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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
#ifndef _TABSHEET_H
#define _TABSHEET_H
#include <api/skin/widgets/grouptgbutton.h>
#include <api/wnd/wndclass/buttwnd.h>
#include <bfc/common.h>
#include <api/wnd/wndclass/guiobjwnd.h>
#include <bfc/ptrlist.h>
class ButtonWnd;
class SkinBitmap;
class TabButtonBase;
class ButtBar;
class TabSheetBar;
#define TABSHEET_GROUPS -2
#define TABSHEET_NOTABS -3
#define TABSHEET_PARENT GuiObjectWnd
/**
class TabSheet
@short A TabSheet Control.
@author Nullsoft
@ver 1.0
@see
@cat SDK
*/
class TabSheet : public TABSHEET_PARENT
{
public:
/**
TabSheet constructor
@see ~TabSheet()
@param bbtype The type of button bar to use in the tabsheet.
*/
TabSheet(int bbtype=-1);
/**
TabSheet destructor
@see TabSheet()
*/
virtual ~TabSheet();
/**
TabSheet method onInit
@ret 1
*/
virtual int onInit();
/**
TabSheet method getClientRect
@param r A pointer to the RECT that will be filled.
*/
virtual void getClientRect(RECT *);
/**
TabSheet method onPaint
@ret 1
@param canvas The canvas upon which we'll paint ourself.
*/
virtual int onPaint(Canvas *canvas);
/**
TabSheet method onResize
@ret 1
*/
virtual int onResize();
/**
TabSheet method setButtonType .
@param type The button type.
*/
void setButtonType(int type);
/**
TabSheet method setTabRowMargin
@assert newmargin is non-negative
@param newmargin The new margin width in pixels.
*/
void setTabRowMargin(int pixels);
/**
TabSheet method addChild
@ret One less than the number of tabs
@param newchild A pointer to the new child window to add.
@param tip The tooltip for the button associated with this child.
*/
int addChild(BaseWnd *newchild, const wchar_t *tooltip=NULL);
/**
TabSheet method activateChild
@see addChild()
@see killChildren()
@ret None
@param newactive A pointer to the child window to render active.
*/
virtual void activateChild(BaseWnd *activechild);
/**
TabSheet method killChildren .
*/
virtual void killChildren();
/**
TabSheet method childNotify .
@ret Returns 1 when complete.
@param child The child that's being notified.
@param msg The message.
@param param1 Custom parameter 1.
@param param2 Custom parameter 2.
*/
virtual int childNotify(ifc_window *child, int msg,
intptr_t param1=0, intptr_t param2=0);
void setContentMarginLeft(int cm);
void setContentMarginTop(int cm);
void setContentMarginRight(int cm);
void setContentMarginBottom(int cm);
/**
TabSheet method enumChild
@ret The base window of the specified tab button, or NULL if there is none.
*/
BaseWnd *enumChild(int child);
/**
TabSheet method getNumChild
@ret The number of tabs
*/
int getNumChild();
BaseWnd *getActiveChild() { return active; }
virtual void onSetPage(int n) { lastpage = n; }
int getCurPage() { return lastpage; }
void setCurPage(int page);
int getNumPages() { return tabs.getNumItems(); }
void nextPage() { int n = getCurPage()+1; if (n >= getNumPages()) n = 0; setCurPage(n); }
void previousPage() { int n = getCurPage()-1; if (n < 0) n = getNumPages()-1; setCurPage(n); }
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);
protected:
/** TabSheet method enumButton
@ret The specified tab, or NULL if there is none. */
TabButtonBase *enumButton(int button);
public:
/**
TabSheet method setBackgroundBmp
@param name The name of the bitmap to use.
*/
#ifdef WASABI_COMPILE_IMGLDR
void setBackgroundBmp(const wchar_t *name); //FG
#endif
SkinBitmap *getBackgroundBitmap(); //FG
protected:
// you can set these in your constructor, they will be deleted for you
ButtonWnd *leftscroll, *rightscroll;
SkinBitmap *background;
private:
int tabrowheight, tabrowwidth, tabrowmargin;
PtrList<TabButtonBase> tabs;
ButtBar *bb;
TabSheetBar *tsb;
GuiObjectWnd *contentwnd;
int tilex, tilew;
BaseWnd *active;
int type;
int content_margin_left, content_margin_top, content_margin_right, content_margin_bottom;
int lastpage;
};
class TabButtonBase
{
public:
TabButtonBase(BaseWnd *linkWnd, TabSheet *par, const wchar_t *tip=NULL);
virtual ~TabButtonBase();
BaseWnd *getBaseWnd() const { return linked; }
void setNoDeleteLinked(int i) { nodeletelinked = i; }
virtual void btn_setHilite(int tf)=0;
virtual void btn_setText(const wchar_t *txt)=0;
protected:
BaseWnd *linked;
TabSheet *parent;
int nodeletelinked;
};
#define TABBUTTON_PARENT ButtonWnd
/**
Class TabButton
@short
@author Nullsoft
@ver 1.0
@see TabButtonBase
@cat SDK
*/
class TabButton : public TABBUTTON_PARENT, public TabButtonBase {
public:
/**
TabButton constructor
@assert The BaseWnd passed to this method must previously be linked.
@param linkwnd The window to associate with this button.
@param par A pointer to the parent tabsheet.
@param tip The tooltip for the window associated with this button.
*/
TabButton(BaseWnd *linkWnd, TabSheet *par, const wchar_t *tip=NULL) : TabButtonBase(linkWnd, par, tip)
{
if (tip != NULL)
setTip(tip);
}
/**
TabButton method onInit
@ret 1
*/
virtual int onInit();
/**
TabButton method onLeftPush .
@assert parent and linked both exist.
@param x The X position, of the mouse pointer, in the client screen.
@param y The Y position, of the mouse pointer, in the client screen.
*/
virtual void onLeftPush(int x, int y);
virtual void btn_setHilite(int tf);
virtual void btn_setText(const wchar_t *text);
};
#define GROUPTABBUTTON_PARENT GroupToggleButton
class GroupTabButton : public GROUPTABBUTTON_PARENT, public TabButtonBase {
public:
GroupTabButton(BaseWnd *linkWnd, TabSheet *par, const wchar_t *tip=NULL) : TabButtonBase(linkWnd, par, tip)
{
setGroups(L"wasabi.tabsheet.button.selected.group", L"wasabi.tabsheet.button.unselected.group");
}
virtual int wantFullClick() { return 0; }
virtual int wantAutoToggle() { return 0; }
virtual int onInit();
virtual void grouptoggle_onLeftPush();
virtual void btn_setHilite(int tf);
virtual void btn_setText(const wchar_t *text);
};
#endif
|