00001
00025 #ifndef _PANE_H_
00026 #define _PANE_H_
00027
00028 #ifdef __BORLANDC__
00029 #pragma option push -b
00030 #pragma option push -a4
00031 #endif
00032
00033 #ifdef FG_NAMESPACE
00034 namespace fgl {
00035 #endif
00036
00037 class CfgStore;
00038 class StoreVectorStr;
00039
00045 class FGBlockStyle
00046 {
00047 friend class FGBlock;
00051 virtual void frame(FGWindow *wnd, int x, int y, int w, int h, char* name)
00052 {
00053 wnd->WindowBox(x+4,y+4,w-8,h-8,CGRAYED);
00054 wnd->AddPanel(x+8,y+8,w-16,h-16,name,CWHITE,CWHITED,CDARK);
00055 }
00056 public:
00057 FGBlockStyle() { }
00058 virtual ~FGBlockStyle() { }
00059 };
00060
00061 static FGBlockStyle default_style;
00062
00063
00064
00069 class FGBlock
00070 {
00071 protected:
00072 int width;
00073 int height;
00074 char name[64];
00075 FGBlockStyle& style;
00076 void* container;
00077 bool fixed;
00078
00079 void FGAPI Add(FGControl *);
00080 public:
00084 FGBlock(int w, int h, const char *n="", FGBlockStyle& s=default_style);
00085 virtual ~FGBlock();
00089 virtual void build(FGWindow *parent, int x, int y) = 0;
00093 void FGAPI show(FGWindow *parent, int x, int y)
00094 {
00095 style.frame(parent,x,y,width,height,name);
00096 build(parent,x,y);
00097 }
00098
00099 void FGAPI Disable(void);
00100 void FGAPI Enable(void);
00101
00105 int FGAPI GetHeight(void) { return height; }
00109 int FGAPI GetWidth(void) { return width; }
00113 char* FGAPI GetName(void) { return name; }
00117 void FGAPI SetFixed(bool value) { fixed = value; }
00118 };
00119
00120
00121
00125 class FGPaneContainer
00126 {
00127 protected:
00128 void *container;
00129 bool destroy;
00130 public:
00131 FGPaneContainer();
00132 virtual ~FGPaneContainer();
00133 };
00134
00135
00136
00140 class FGPane : public FGPaneContainer
00141 {
00142 protected:
00143 FGWindow *parent;
00144 public:
00145 FGPane(FGWindow *w);
00146 virtual ~FGPane();
00147
00148 void FGAPI Add(FGBlock* val, bool fixed=false);
00149 void FGAPI AddFrom(char * name);
00150 void FGAPI ShowHorizontal(int xx=0, int yy=0);
00151 void FGAPI ShowVertical(int xx=0, int yy=0);
00152 };
00153
00154
00155
00156 #if 0
00157
00163 class FGPaneProvider : public FGPaneContainer
00164 {
00165 friend class FGBlock;
00166 friend class FGPane;
00167
00168 static FGPaneProvider *self;
00169 static void FGBlock_Provider_DialogProc(FGEvent *p);
00170 static FGListBox *listboxPtr0;
00171 static FGListBox *listboxPtr1;
00172 FGWindow *FGBlock_Provider_DialogPtr;
00173
00174 CfgStore* cfg;
00175
00176 static void AddToCfg(CallBack);
00177 static void RemoveFromCfg(CallBack);
00178 static void Up(CallBack);
00179 static void Down(CallBack cb);
00180 static void Ok(CallBack cb);
00181 static void Cancel(CallBack cb);
00182 static void FGAPI Register(FGBlock* block);
00183
00184 StoreVectorStr* FGAPI GetStore(char *);
00185 FGBlock* FGAPI FindBlockByName(const char s[]);
00186
00187 protected:
00188 FGPaneProvider();
00189 public:
00190 ~FGPaneProvider();
00194 inline static FGPaneProvider* Self(void)
00195 {
00196 if (self == 0)
00197 {
00198 self = new FGPaneProvider;
00199 }
00200 return self;
00201 }
00202 void FGAPI ShowDialog(char *store_name);
00203 };
00204 #endif
00205
00206 #ifdef __BORLANDC__
00207 #pragma option pop
00208 #pragma option pop
00209 #endif
00210
00211 #ifdef FG_NAMESPACE
00212 }
00213 #endif
00214
00215 #endif