Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

Res.h

00001 
00002 #ifndef __RES_H
00003 #define __RES_H
00004 
00005 // Includes
00006 #include "GXmlTree.h"
00007 #include "GProperties.h"
00008 
00010 // Language stuff
00011 enum ResFileFormat
00012 {
00013     CodepageFile,       // The original format based on different codepages for each translations.
00014     Lr8File,            // The second format using utf-8 throughout instead.
00015     XmlFile,            // Straight XML.
00016 };
00017 
00018 typedef char *GLanguageId;
00019 
00020 struct GLanguage
00021 {
00022     char *Name;
00023     GLanguageId Id;
00024     int Win32Id;
00025     int OldId;
00026     char *CodePage;
00027 
00028     bool IsEnglish()
00029     {
00030         return  Id[0] == 'e' AND
00031                 Id[1] == 'n' AND
00032                 NOT Id[2];
00033     }
00034 
00035     bool operator ==(GLanguageId i)
00036     {
00037         return i AND stricmp(Id, i) == 0;
00038     }
00039 
00040     bool operator !=(GLanguageId i)
00041     {
00042         return NOT (*this == i);
00043     }
00044 };
00045 
00046 /*
00047 class LangInfo
00048 {
00049 public:
00050     int Id;
00051     char *Name;
00052     char *CodePage;
00053     int Win32Id;
00054     char *Win32Define;
00055 };
00056 */
00057 
00058 LgiExtern GLanguage LgiLanguageTable[];
00059 LgiExtern GLanguage *GFindLang(GLanguageId Id, char *Name = 0);
00060 LgiExtern GLanguage *GFindOldLang(int OldId);
00061 
00063 // All the names of the controls as strings
00064 LgiExtern char Res_Dialog[];
00065 LgiExtern char Res_Table[];
00066 LgiExtern char Res_StaticText[];
00067 LgiExtern char Res_EditBox[];
00068 LgiExtern char Res_CheckBox[];
00069 LgiExtern char Res_Button[];
00070 LgiExtern char Res_Group[];
00071 LgiExtern char Res_RadioBox[];
00072 LgiExtern char Res_Tab[];
00073 LgiExtern char Res_TabView[];
00074 LgiExtern char Res_ListView[];
00075 LgiExtern char Res_Column[];
00076 LgiExtern char Res_TreeView[];
00077 LgiExtern char Res_Bitmap[];
00078 LgiExtern char Res_Progress[];
00079 LgiExtern char Res_Slider[];
00080 LgiExtern char Res_ComboBox[];
00081 LgiExtern char Res_ScrollBar[];
00082 LgiExtern char Res_Custom[];
00083 
00084 // Classes
00085 class ResObjectImpl;
00086 class ResFactory;
00087 
00088 class LgiClass ResParent
00089 {
00090 public:
00091     ResParent() {}
00092     virtual ~ResParent() {}
00093 
00094     virtual void *GetRealPtr() { return 0; }
00095 };
00096 
00097 class LgiClass ResObject : public ResParent
00098 {
00099 private:
00100     ResObjectImpl *_ObjImpl;
00101 
00102 protected:
00103     char *_ObjName;
00104 
00105 public:
00106     ResObject(char *Name);
00107     ~ResObject();
00108 
00109     char *GetObjectName() { return _ObjName; }
00110     virtual ResObjectImpl *GetObjectImpl(ResFactory *f);
00111 };
00112 
00113 // Inherit from and implement to create objects for your system
00114 class LgiClass ResFactory
00115 {
00116 public:
00117     // Use to read and write the objects
00118     bool Res_Read(ResObject *Obj, GXmlTag *Tag);
00119     bool Res_Write(ResObject *Obj, GXmlTag *Tag);
00120 
00121     // Overide
00122     virtual char *StringFromRef(int Ref) = 0;
00123     virtual ResObject *CreateObject(GXmlTag *Tag, ResObject *Parent) = 0;
00124 
00125     // Overide these to operate on the objects
00126     virtual void        Res_SetPos      (ResObject *Obj, int x1, int y1, int x2, int y2) = 0;
00127     virtual void        Res_SetPos      (ResObject *Obj, char *s) = 0;
00128     virtual GRect       Res_GetPos      (ResObject *Obj) = 0;
00129     virtual int         Res_GetStrRef   (ResObject *Obj) = 0;
00130     virtual void        Res_SetStrRef   (ResObject *Obj, int Ref) = 0;
00131     virtual void        Res_Attach      (ResObject *Obj, ResObject *Parent) = 0;
00132     virtual bool        Res_GetChildren (ResObject *Obj, List<ResObject> *l, bool Deep) = 0;
00133     virtual void        Res_Append      (ResObject *Obj, ResObject *Parent) = 0;
00134     virtual bool        Res_GetItems    (ResObject *Obj, List<ResObject> *l) = 0;
00135     virtual GDom*       Res_GetDom      (ResObject *Obj) = 0;
00136     
00137     // Property access
00138     virtual bool        Res_GetProperties(ResObject *Obj, ObjProperties *Props) = 0;
00139     virtual bool        Res_SetProperties(ResObject *Obj, ObjProperties *Props) = 0;
00140 };
00141 
00142 #endif

Generated on Wed Oct 26 14:46:51 2005 for Lgi by  doxygen 1.4.1