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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
#ifndef __GUIOBJWND_H
#define __GUIOBJWND_H
#if defined(WIN32) || defined(WIN64)
#define USEAPPBAR
#endif
#ifdef USEAPPBAR
#include <api/wnd/wndclass/appbarwnd.h>
#define GUIOBJECTWND_PARENT AppBarWnd
#else
#include <api/wnd/wndclass/clickwnd.h>
#define GUIOBJECTWND_PARENT ClickWnd
#endif
#include <api/script/scriptobj.h>
#include <api/script/objects/guiobject.h>
#include <api/script/objects/rootobj.h>
#include <api/skin/xmlobject.h>
#include <api/service/svcs/svc_xuiobject.h>
// {E5760861-5489-4ffc-BE02-061D9DA6CD1B}
const GUID guiObjectWndGuid =
{ 0xe5760861, 0x5489, 0x4ffc, { 0xbe, 0x2, 0x6, 0x1d, 0x9d, 0xa6, 0xcd, 0x1b } };
#define XUI_ATTRIBUTE_IMPLIED XML_ATTRIBUTE_IMPLIED
#define XUI_ATTRIBUTE_REQUIRED XML_ATTRIBUTE_REQUIRED
class GuiObjectWnd : public GUIOBJECTWND_PARENT, public RootObjectInstance, public XmlObjectI
{
public:
GuiObjectWnd();
virtual ~GuiObjectWnd();
#ifdef WASABI_COMPILE_CONFIG
virtual int onReloadConfig() { return 1; }
#endif
// XmlObject
virtual int setXmlParamById(int xmlhandle, int attrid, const wchar_t *name, const wchar_t *value);
virtual int onUnknownXmlParam(const wchar_t *param, const wchar_t *value);
virtual int newXuiHandle() { return newXmlHandle(); }
// ClickWnd
virtual int onRightButtonDown(int x, int y);
virtual int onRightButtonUp(int x, int y);
virtual int onLeftButtonDown(int x, int y);
virtual int onLeftButtonUp(int x, int y);
virtual int onMouseMove(int x, int y);
virtual int onLeftButtonDblClk(int x, int y);
virtual int onRightButtonDblClk(int x, int y);
virtual int onMouseWheelUp(int click, int lines);
virtual int onMouseWheelDown(int click, int lines);
virtual int onResize();
virtual int onActivate();
virtual int onDeactivate();
virtual void onEnterArea();
virtual void onLeaveArea();
virtual void onSetVisible(int show);
virtual int onEnable(int en);
virtual void onCancelCapture();
virtual int dragDrop(ifc_window *sourceWnd, int x, int y);
virtual int acceptExternalDrops() { return 1; }
virtual int dragEnter(ifc_window *sourceWnd);
virtual int dragOver(int x, int y, ifc_window *sourceWnd);
virtual int dragLeave(ifc_window *sourceWnd);
virtual void *getInterface(GUID g);
virtual int onAction(const wchar_t *action, const wchar_t *param, int x, int y, intptr_t p1, intptr_t p2, void *data, size_t datalen, ifc_window *source);
virtual const wchar_t *getId();
virtual int onAcceleratorEvent(const wchar_t *name);
virtual void setContent(const wchar_t *groupid_orguid, int autoresizefromcontent = 0);
virtual void setContentBySkinItem(SkinItem *item, int autoresizefromcontent = 0);
virtual void onNewContent() {}
// AbstractWndHolder
virtual void abstract_onNewContent();
virtual int onUnknownXuiParam(const wchar_t *param, const wchar_t *value) { return 0; }
virtual GuiObject *findObject(const wchar_t *object_id);
#ifdef WASABI_COMPILE_SCRIPT
virtual ScriptObject *findScriptObject(const wchar_t *object_id);
#endif
#ifdef WASABI_COMPILE_SKIN
virtual GuiObject *getContent() { return abstract_getContent(); }
virtual ScriptObject *getContentScriptObject() { return abstract_getContentScriptObject(); }
virtual ifc_window *getContentRootWnd() { return abstract_getContentRootWnd(); }
#endif
// BaseWnd
virtual int onInit();
virtual int onPostOnInit();
virtual int onChar(unsigned int c);
virtual int onKeyDown(int vkcode);
virtual int onKeyUp(int vkcode);
virtual int onGetFocus();
virtual int onKillFocus();
virtual int wantFocus();
const wchar_t *getTip();
// GuiObjectWnd
int wantTranslation();
GuiObject *getGuiObject();
RootObject *getRootObject();
int cfg_reentry;
// XuiObject
virtual int setXuiParam(int _xuihandle, int attrid, const wchar_t *name, const wchar_t *value);
protected:
/*static */void CreateXMLParameters(int master_handle);
private:
GuiObject *my_gui_object;
int xuihandle;
static XMLParamPair params[];
public:
enum {
GUIOBJECT_ID = 0,
GUIOBJECT_ALPHA,
GUIOBJECT_ACTIVEALPHA,
GUIOBJECT_INACTIVEALPHA,
GUIOBJECT_SYSREGION,
GUIOBJECT_RECTRGN,
GUIOBJECT_TOOLTIP,
GUIOBJECT_SYSMETRICSX,
GUIOBJECT_SYSMETRICSY,
GUIOBJECT_SYSMETRICSW,
GUIOBJECT_SYSMETRICSH,
GUIOBJECT_MOVE,
GUIOBJECT_RENDERBASETEXTURE,
GUIOBJECT_CFGATTR,
GUIOBJECT_X,
GUIOBJECT_Y,
GUIOBJECT_W,
GUIOBJECT_H,
GUIOBJECT_VISIBLE,
GUIOBJECT_ENABLED,
GUIOBJECT_RELATX,
GUIOBJECT_RELATY,
GUIOBJECT_RELATW,
GUIOBJECT_RELATH,
GUIOBJECT_DROPTARGET,
GUIOBJECT_GHOST,
GUIOBJECT_NOTIFY,
GUIOBJECT_FOCUSONCLICK,
GUIOBJECT_TABORDER,
GUIOBJECT_WANTFOCUS,
GUIOBJECT_SETNODBLCLICK,
GUIOBJECT_SETNOLEFTCLICK,
GUIOBJECT_SETNORIGHTCLICK,
GUIOBJECT_SETNOMOUSEMOVE,
GUIOBJECT_SETNOCONTEXTMENU,
GUIOBJECT_SETX1,
GUIOBJECT_SETY1,
GUIOBJECT_SETX2,
GUIOBJECT_SETY2,
GUIOBJECT_SETANCHOR,
GUIOBJECT_SETCURSOR,
GUIOBJECT_FITTOPARENT,
GUIOBJECT_USERDATA,
#ifdef USEAPPBAR
GUIOBJECT_APPBAR,
#endif
GUIOBJECT_TRANSLATE,
GUIOBJECT_NUMPARAMS
};
};
template <class T, const wchar_t XMLTAG[], char SVCNAME[]>
class XuiObjectSvc : public svc_xuiObjectI
{
public:
static const wchar_t *xuisvc_getXmlTag() { return XMLTAG; }
int testTag(const wchar_t *xmltag)
{
if (!WCSICMP(xmltag, XMLTAG)) return 1;
return 0;
}
GuiObject *instantiate(const wchar_t *xmltag, ifc_xmlreaderparams *params = NULL)
{
if (testTag(xmltag))
{
T * obj = new T;
ASSERT(obj != NULL);
return obj->getGuiObject();
}
return NULL;
}
void destroy(GuiObject *g)
{
T *obj = static_cast<T *>(g->guiobject_getRootWnd());
delete obj;
}
static const char *getServiceName() { return SVCNAME; }
};
template <class T>
class XuiObjectSvc2 : public svc_xuiObjectI
{
public:
static const wchar_t *xuisvc_getXmlTag() { return T::xuiobject_getXmlTag(); }
int testTag(const wchar_t *xmltag)
{
if (!WCSICMP(xmltag, T::xuiobject_getXmlTag())) return 1;
return 0;
}
GuiObject *instantiate(const wchar_t *xmltag, ifc_xmlreaderparams *params = NULL)
{
if (testTag(xmltag))
{
T * obj = new T;
ASSERT(obj != NULL);
return obj->getGuiObject();
}
return NULL;
}
void destroy(GuiObject *g)
{
T *obj = static_cast<T *>(g->guiobject_getRootWnd());
delete obj;
}
static const char *getServiceName() { return T::xuiobject_getServiceName(); }
};
#endif
|