00001
00002
00003 #ifndef _GFILTER_UI_H_
00004 #define _GFILTER_UI_H_
00005
00006 #include "GTree.h"
00007
00008 class GFilterViewPrivate;
00009
00010 enum GFilterNode
00011 {
00012 LNODE_NULL,
00013 LNODE_AND,
00014 LNODE_OR,
00015 LNODE_COND,
00016 LNODE_NEW
00017 };
00018
00019 enum GFilterMenu
00020 {
00021 FMENU_FIELD,
00022 FMENU_OP,
00023 FMENU_VALUE
00024 };
00025
00026 class GFilterView;
00027 class GFilterItem;
00028
00029 typedef int (*FilterUi_Menu)(GFilterView *View,
00030 GFilterItem *Item,
00031 GFilterMenu Menu,
00032 GRect &r,
00033 GArray<char*> *GetList,
00034 void *UserData);
00035
00036 class GFilterItem : public GTreeItem
00037 {
00038 class GFilterItemPrivate *d;
00039
00040 protected:
00041 void _PourText(GdcPt2 &Size);
00042 void _PaintText(GSurface *pDC, COLOUR Fore, COLOUR Back);
00043 void ShowControls(bool s);
00044
00045 public:
00046 GFilterItem(GFilterViewPrivate *Data, GFilterNode Node = LNODE_NEW);
00047 ~GFilterItem();
00048
00049 bool GetNot();
00050 char *GetField();
00051 int GetOp();
00052 char *GetValue();
00053
00054 void SetNot(bool b);
00055 void SetField(char *s);
00056 void SetOp(int i);
00057 void SetValue(char *s);
00058
00059 GFilterNode GetNode();
00060 void SetNode(GFilterNode n);
00061 bool OnKey(GKey &k);
00062 void OnMouseClick(GMouse &m);
00063 void OnExpand(bool b);
00064
00065 void OptionsMenu();
00066 };
00067
00069 class GFilterView : public GLayout
00070 {
00071 class GFilterViewPrivate *d;
00072
00073 public:
00074 GFilterView(FilterUi_Menu Callback = 0, void *UserData = 0);
00075 ~GFilterView();
00076
00077 void SetDefault();
00078 bool ShowLegend();
00079 void ShowLegend(bool b);
00080 void Empty();
00081 GFilterItem *Create(GFilterNode Node = LNODE_NEW);
00082 GTreeNode *GetRootNode();
00083
00084 void OnPaint(GSurface *pDC);
00085 void OnPosChange();
00086 void OnCreate();
00087 };
00088
00089 #endif