00001 #ifndef _GCTRLTREE_H_
00002 #define _GCTRLTREE_H_
00003
00004 #include "GTree.h"
00005 #include "GVariant.h"
00006
00007 class GControlTree : public GTree, public GDom
00008 {
00009 public:
00010 struct EnumValue
00011 {
00012 char *Name;
00013 GVariant Value;
00014 };
00015
00016 class Item : public GTreeItem
00017 {
00018 public:
00019 typedef GArray<EnumValue> EnumArr;
00020
00021 private:
00022 GAutoString Opt;
00023 GVariantType Type;
00024 GVariant Value;
00025 GViewI *Ctrl;
00026 GButton *Browse;
00027 GAutoPtr<EnumArr> Enum;
00028
00029 void Save();
00030
00031 public:
00032 enum ItemFlags
00033 {
00034 TYPE_FILE = 0x1,
00035 };
00036 int Flags;
00037
00038 Item(char *Txt, char *opt, GVariantType type, GArray<EnumValue> *pEnum);
00039 ~Item();
00040
00041 Item *Find(char *opt);
00042 bool Serialize(GDom *Store, bool Write);
00043 void SetValue(GVariant &v);
00044 GRect &GetRect();
00045 void Select(bool b);
00046 void OnPaint(ItemPaintCtx &Ctx);
00047 void SetEnum(GAutoPtr<EnumArr> e) { Enum = e; }
00048 void OnVisible(bool v);
00049 void PositionControls();
00050 };
00051
00052 protected:
00053 class GControlTreePriv *d;
00054
00055 class Item *Resolve(bool Create, char *Path, GVariantType Type = GV_NULL, GArray<EnumValue> *Enum = 0);
00056
00057 public:
00058 GControlTree();
00059 ~GControlTree();
00060
00061 Item *Find(char *opt);
00062 GTreeItem *Insert(char *DomPath, GVariantType Type, GVariant *Value = 0, GArray<EnumValue> *Enum = 0);
00063 bool SetVariant(char *Name, GVariant &Value, char *Array = 0);
00064 bool Serialize(GDom *Store, bool Write);
00065 int OnNotify(GViewI *c, int f);
00066 };
00067
00068 #endif