1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
#ifndef __GUITREE_H
#define __GUITREE_H
#include <bfc/string/bfcstring.h>
#include <bfc/ptrlist.h>
#include <bfc/nsguid.h>
#include <api/timer/timerclient.h>
#include <api/xml/xmlreader.h>
#include <api/xml/xmlparamsi.h>
#include <api/skin/skinitem.h>
#include <bfc/string/StringW.h>
#define CB_GUITREE 0x987
#define INVALIDATEGRP 1
#define INVALIDATETYPE 2
class GuiTreeCB {
public:
int cmd;
StringW *ptr;
};
class GuiTreeItem : public SkinItemI
{
public:
GuiTreeItem(int type, const wchar_t *name, ifc_xmlreaderparams *p, int scriptid, const wchar_t *rootpath, GUID g, const wchar_t *windowtype, const wchar_t *xuitag);
virtual ~GuiTreeItem();
virtual int getType();
virtual const wchar_t *getName();
virtual int getSkinPartId() { return getScriptId(); }
virtual int getScriptId();
virtual ifc_xmlreaderparams *getParams();
virtual const wchar_t *getXmlRootPath();
virtual void setIdx(int i) { idx = i; }
virtual int getIdx() { return idx; }
virtual int getSecCount() { return seccount; }
virtual void setGuid(GUID g) { guid = g; }
virtual GUID getGuid() { return guid; }
virtual const wchar_t *getWindowType() { return wndtype; }
virtual const wchar_t *getXuiTag() { return tag; }
virtual void setXuiTag(const wchar_t *xuitag) { tag = xuitag; }
virtual SkinItem *getAncestor();
private:
XmlReaderParamsI params;
int object_type;
StringW object_name;
int scriptId;
StringW rootpath;
int idx;
int seccount;
GUID guid;
StringW wndtype;
StringW tag;
static int incrementor;
};
class SortGuiTreeItem
{
public:
static int compareItem(GuiTreeItem *p1, GuiTreeItem *p2) {
int r = WCSICMP(p1->getParams()->getItemValue(L"id"), p2->getParams()->getItemValue(L"id"));
if (!r) {
if (p1->getScriptId() < p2->getScriptId()) return -1;
if (p1->getScriptId() > p2->getScriptId()) return 1;
if (p1->getSecCount() < p2->getSecCount()) return -1;
if (p1->getSecCount() > p2->getSecCount()) return 1;
return 0;
}
return r;
}
static int compareAttrib(const wchar_t *attrib, GuiTreeItem *item) {
return WCSICMP(attrib, item->getParams()->getItemValue(L"id"));
}
};
class SortGuiTreeItemByXuiTag {
public:
static int compareItem(GuiTreeItem *p1, GuiTreeItem *p2) {
int r = WCSICMP(p1->getParams()->getItemValue(L"xuitag"), p2->getParams()->getItemValue(L"xuitag"));
if (!r) {
if (p1->getScriptId() < p2->getScriptId()) return -1;
if (p1->getScriptId() > p2->getScriptId()) return 1;
if (p1->getSecCount() < p2->getSecCount()) return -1;
if (p1->getSecCount() > p2->getSecCount()) return 1;
return 0;
}
return r;
}
static int compareAttrib(const wchar_t *attrib, GuiTreeItem *item) {
return WCSICMP(attrib, item->getParams()->getItemValue(L"xuitag"));
}
};
class SortGuiTreeItemByGuid
{
public:
static int compareItem(GuiTreeItem *p1, GuiTreeItem *p2) {
GUID g1 = p1->getGuid();
GUID g2 = p2->getGuid();
if (g1 == g2) {
if (p1->getScriptId() < p2->getScriptId()) return -1;
if (p1->getScriptId() > p2->getScriptId()) return 1;
if (p1->getSecCount() < p2->getSecCount()) return -1;
if (p1->getSecCount() > p2->getSecCount()) return 1;
return 0;
}
return nsGUID::compare(g1, g2) < 0 ? -1 : 1;
}
static int compareAttrib(const wchar_t *attrib, GuiTreeItem *item) {
const GUID *g = reinterpret_cast<const GUID *>(attrib);
ASSERT(g);
GUID g1 = *g;
GUID g2 = item->getGuid();
if (g1 == g2) return 0;
return nsGUID::compare(g1, g2) < 0 ? -1 : 1;
}
};
#define GUITREE_PARENT TimerClientDI
class GuiTree : public GUITREE_PARENT {
public:
GuiTree();
virtual ~GuiTree();
void addItem(int object_type, const wchar_t *object_name, ifc_xmlreaderparams *params, int scriptId, const wchar_t *rootpath);
SkinItem *getGroupDef(const wchar_t *id);
SkinItem *enumGroupDefOfType(const wchar_t *type, int n);
SkinItem *getGroupDefAncestor(SkinItem *item);
SkinItem *getContainerAncestor(SkinItem *item);
//int getGroupDef(GUID g);
SkinItem *getXuiGroupDef(const wchar_t *xuitag);
int getObjectType(SkinItem *item);
int getNumObject(); // total number of objects
int getNumObject(int object_type); // return the number of objects of this type
SkinItem *getObject(int object_type, int nth); // get nth object_type, return its index
SkinItem *getContainerById(const wchar_t *id);
int getObjectIdx(SkinItem *item);
void reset(void);
PtrList<GuiTreeItem> *getList();;
PtrList<GuiTreeItem> *getGroupList();;
void removeSkinPart(int scriptid);
void deferredInvalidateGroup(const wchar_t *id);
void deferredInvalidateType(const wchar_t *type);
int timerclient_onDeferredCallback(intptr_t param1, intptr_t param2);
SkinItem *getLastDefinedGroup() { return lastdefinedgroupdef; }
SkinItem *enumGroupDef(int n) { return groupdefs.enumItem(n); }
int getNumGroupDefs() { return groupdefs.getNumItems(); }
private:
int cached;
int cachedtype;
PtrList<GuiTreeItem> list;
PtrListInsertMultiSorted<GuiTreeItem, SortGuiTreeItem> groupdefs;
// PtrListQuickMultiSorted<GuiTreeItem, SortGuiTreeItemByGuid> groupdefsbyguid;
PtrListQuickMultiSorted<GuiTreeItem, SortGuiTreeItemByXuiTag> xuigroupdefs;
PtrListQuickMultiSorted<GuiTreeItem, SortGuiTreeItem> containers_by_id;
PtrList<GuiTreeItem> wndtypes;
int cached_guid_idx;
GUID cached_guid;
SkinItem *lastdefinedgroupdef;
};
extern GuiTree *guiTree;
#endif
|