Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXTranslator.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * M e s s a g e T r a n s l a t o r *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2005,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXTranslator.h,v 1.6 2006/01/22 17:58:11 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXTRANSLATOR_H
25 #define FXTRANSLATOR_H
26 
27 #ifndef FXOBJECT_H
28 #include "FXObject.h"
29 #endif
30 
31 
32 //////////////////////////// UNDER DEVELOPMENT ////////////////////////////////
33 
34 
35 namespace FX {
36 
37 class FXApp;
38 class FXTextCodec;
39 
40 
41 /**
42 * The translator class translates a message to another language.
43 */
44 class FXAPI FXTranslator : public FXObject {
46 private:
47  FXApp *app; // Back link to application object
48  FXTextCodec *codec; // Text codec used for source text
49 private:
50  FXTranslator(const FXTranslator&);
51  FXTranslator &operator=(const FXTranslator&);
52 protected:
53  FXTranslator():app((FXApp*)-1L){}
54 public:
55 
56  /// Construct translator
57  FXTranslator(FXApp* a);
58 
59  /// Get application
60  FXApp* getApp() const { return app; }
61 
62  /// Translate a string
63  virtual const FXchar* tr(const FXchar* context,const FXchar* message,const FXchar* hint=NULL) const;
64 
65  /// Change text codec used to decode the messages embedded in the source
66  void setTextCodec(FXTextCodec *cdc){ codec=cdc; }
67 
68  /// Return text codec
69  FXTextCodec *getTextCodec() const { return codec; }
70 
71  /// Save translator to a stream
72  virtual void save(FXStream& store) const;
73 
74  /// Load translator from a stream
75  virtual void load(FXStream& store);
76 
77  /// Destructor
78  virtual ~FXTranslator();
79  };
80 
81 
82 }
83 
84 #endif
Abstract base class for a stateless coder/decoder.
Definition: FXTextCodec.h:38
char FXchar
Definition: fxdefs.h:387
The translator class translates a message to another language.
Definition: FXTranslator.h:44
#define FXAPI
Definition: fxdefs.h:122
Application Object.
Definition: FXApp.h:158
#define NULL
Definition: fxdefs.h:41
Definition: FX4Splitter.h:31
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp