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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
|
#ifndef __LAYOUT_H
#define __LAYOUT_H
class Layout;
class Group;
class Container;
class Layer;
#include <bfc/tlist.h>
#include <bfc/depend.h>
#include <tataki/bitmap/bitmap.h>
#include <api/wnd/wndclass/buttwnd.h>
#include <tataki/region/region.h>
#include <api/wndmgr/container.h>
#include <api/skin/group.h>
#include <api/skin/widgets/layer.h>
#include <api/wndmgr/guistatuscb.h>
#include <api/script/script.h>
#include <api/script/scriptobj.h>
#ifdef WASABI_WIDGETS_GUIOBJECT
#include <api/script/objects/guiobj.h>
#endif
#include <api/wnd/accessible.h>
#include <api/wndmgr/alphamgr.h>
#include <api/wnd/resizable.h>
class XmlObject;
class Layout;
extern AlphaMgr *alphaMgr;
class LayoutScriptController : public GroupScriptController {
public:
virtual const wchar_t *getClassName();
virtual const wchar_t *getAncestorClassName();
virtual ScriptObjectController *getAncestorController() { return groupController; }
virtual int getNumFunctions();
virtual const function_descriptor_struct *getExportedFunctions();
virtual GUID getClassGuid();
virtual ScriptObject *instantiate();
virtual int getInstantiable();
virtual void destroy(ScriptObject *o);
virtual void *encapsulate(ScriptObject *o);
virtual void deencapsulate(void *o);
private:
static function_descriptor_struct exportedFunction[];
};
extern LayoutScriptController *layoutController;
#ifndef _NOSTUDIO
class AutoOpacityLinker;
#define LAYOUT_PARENT Group
#define LAYOUT_SCRIPTPARENT Group
class Layout : public LAYOUT_SCRIPTPARENT, public DependentViewerI, public GuiResizable
{
public:
Layout();
virtual ~Layout();
#ifdef _WIN32
virtual LRESULT wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
#else
virtual OSStatus eventHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData);
#endif
// int onPaint(Canvas *canvas);
virtual int onInit();
virtual int init(OSMODULEHANDLE inst, OSWINDOWHANDLE parent, int nochild);
virtual int reinit(OSMODULEHANDLE inst, OSWINDOWHANDLE parent, int nochild);
virtual int childNotify(ifc_window *child, int msg, intptr_t param1=0, intptr_t param2=0);
virtual int onActionNotify(int action, intptr_t param=0);
virtual void resize(int x, int y, int w, int h, int wantcb=1);
virtual void move(int x, int y);
// virtual int onRightButtonDown(int x, int y);
// virtual int onLeftButtonDown(int x, int y);
// virtual int onMouseMove(int x, int y);
// virtual int onLeftButtonUp(int x, int y);
virtual int onResize();
virtual int onPostedMove();
virtual int onPaint(Canvas *canvas);
virtual void onSetDesktopAlpha(int a);
virtual int isLayout();
virtual void setAlphaBackground(const wchar_t *txture);
virtual SkinBitmap *getBaseTexture();
virtual void onGuiObjectSetVisible(GuiObject *o, int status); // called whenever a child shows/hide
virtual ifc_window *getCustomOwner();
virtual void addLockedLayout(Layout *l);
virtual void removeLockedLayout(Layout *l);
virtual int getNumLockedLayouts();
virtual Layout *enumLockedLayout(int n);
virtual int isLocked();
virtual void lockTo(Layout *l);
virtual Layout *getLockedTo();
void updateLockedLayouts();
virtual int onGetFocus();
virtual int onKillFocus();
virtual void snapAdjust(int left, int right, int top, int bottom);
virtual void onShow(void);
virtual void onHide(void);
virtual void center();
virtual int wantDesktopAlpha();
virtual void setWantDesktopAlpha(int want);
virtual int handleDesktopAlpha();
virtual int setXuiParam(int _xuihandle, int attribid, const wchar_t *paramname, const wchar_t *strvalue);
void setWindowRegion(api_region *reg);
virtual int allowResize() {
return !isLocked()
#ifdef USEAPPBAR
&& !appbar_isDocked()
#endif
;
}
// container/component callbacks to get notified that a container
// has been set visible/invisible
void containerToggled(const wchar_t *id,int visible);
void componentToggled(GUID *guid, int visible);
void setParentContainer(Container *c);
virtual Container *getParentContainer();
virtual int isClickThrough();
void onSetVisible(int show);
virtual void cancelCapture();
virtual int onActivate();
virtual int onDeactivate();
virtual int forceTransparencyFlag();
int x, y;
#ifdef _WIN32
void setForwardMsgWnd(HWND wnd) { forwardMsgWnd = wnd; }
LPARAM wndHolder_getParentParam(int i=0);
#endif
void scaleTo(int s);
virtual void setRenderRatio(double s);
virtual void beginMove();
virtual void beginScale();
virtual void beginResize();
virtual void endMove();
virtual void endScale();
virtual void endResize();
virtual void setEndMoveResize(int w, int h) {
m_w = w;
m_h = h;
m_endmovesize = 1;
};
virtual ifc_window *guiresizable_getRootWnd() { return (this); }
virtual void lockScale(int locked);
virtual int isScaleLocked() { return scalelocked; }
virtual void onMove();
virtual int isDesktopAlphaSafe();
void addSubRegionLayer(Layer *l);
void removeSubRegionLayer(Layer *l);
virtual void setInDesktop(int a);
virtual int getInDesktop();
virtual void setAlpha(int a);
virtual int getAlpha();
virtual int getPaintingAlpha();
virtual void timerCallback(int id);
virtual void setLinkWidth(const wchar_t *layoutid);
virtual void setLinkHeight(const wchar_t *layoutid);
virtual void setBaseTexture(const wchar_t *b, int regis=1);
virtual void setPaintingAlpha(int activealpha, int inactivealpha=-1);
static void onGlobalEnableDesktopAlpha(int enabled);
void savePosition();
#ifdef USEAPPBAR
void saveAppBarPosition();
#endif
virtual void setStatusText(const wchar_t *txt, int overlay=0);
virtual void addAppCmds(AppCmds *commands);
virtual void removeAppCmds(AppCmds *commands);
void pushCompleted(int max=100);
void incCompleted(int add=1);
void setCompleted(int pos);
void popCompleted();
virtual void registerStatusCallback(GuiStatusCallback *lcb);
virtual int viewer_onItemDeleted(api_dependent *item);
virtual int wantActivation() { return wantactiv && LAYOUT_PARENT::wantActivation(); }
void loadSavedState();
virtual void updateOnTop();
virtual int runAction(int actionid, const wchar_t *param=NULL);
virtual void getSnapAdjust(RECT *r);
virtual void updateTransparency();
virtual int onDeferredCallback(intptr_t p1, intptr_t p2);
virtual int wantRedrawOnResize() { return wantredrawonresize; }
virtual void setWantRedrawOnResize(int v);
#ifdef USEAPPBAR
virtual int appbar_wantAutoHide() { return getAppBarAutoHide(); }
virtual int appbar_wantAlwaysOnTop() { return getAppBarAlwaysOnTop(); }
virtual int getAppBarAutoHide();
virtual void setAppBarAutoHide(int ah);
virtual int getAppBarAlwaysOnTop();
virtual void setAppBarAlwaysOnTop(int aot);
#endif
virtual void pushForceUnlink() { m_forceunlink++; }
virtual void popForceUnlink() { m_forceunlink--; }
virtual int isUnlinked() {
#ifdef USEAPPBAR
return unlinked || appbar_isDocked() || m_forceunlink;
#else
return unlinked || m_forceunlink;
#endif
}
void setAutoOpacify(int a);
int getAutoOpacify() { return autoopacify; }
void offscreenCheck();
int isOffscreen(ifc_window *w);
int getResizable();
int getScalable();
void setTransparencyOverride(int v);
int getTransparencyOverride() { return transparencyoverride; }
enum {
LAYOUT_SETDESKTOPALPHA=0,
LAYOUT_SETINDESKTOP,
LAYOUT_SETALPHA,
LAYOUT_SETLINKWIDTH,
LAYOUT_SETLINKHEIGHT,
LAYOUT_SETOWNER,
LAYOUT_SETLOCKTO,
LAYOUT_SETOSFRAME,
LAYOUT_SETALPHABACKGROUND,
LAYOUT_SETNOACTIVATION,
LAYOUT_SETONTOP,
LAYOUT_SNAPADJUSTLEFT,
LAYOUT_SNAPADJUSTTOP,
LAYOUT_SNAPADJUSTRIGHT,
LAYOUT_SNAPADJUSTBOTTOM,
LAYOUT_UNLINKED,
LAYOUT_NOPARENT,
LAYOUT_FORCEALPHA,
LAYOUT_NODOCK,
LAYOUT_NOOFFSCREENCHECK,
LAYOUT_RESIZABLE,
LAYOUT_SCALABLE,
};
void onMouseEnterLayout();
void onMouseLeaveLayout();
int getNoParent() { return noparent; }
void setNoParent(int np) { noparent = np; }
int isAlphaForced() { return forcealpha; }
AlphaMgr *getAlphaMgr() { return alphaMgr; }
int getNoDock() { return nodock; }
void setNoDock(int nd) { nodock = nd; }
int isTransparencyForcedOff() { return transparency_autooff; }
void controlMenu();
void setNoOffscreenCheck(int nocheck);
#ifdef USEAPPBAR
void onDock(int side);
void onUnDock();
virtual void appbar_onDock(int side);
virtual void appbar_onUnDock();
virtual void appbar_onSlide();
#endif
protected:
/*static */void CreateXMLParameters(int master_handle);
/* virtual int dragEnter(ifc_window *sourceWnd);
virtual int dragOver(int x, int y, ifc_window *sourceWnd);
virtual int dragDrop(ifc_window *sourceWnd, int x, int y);
virtual int acceptExternalDrops() { return 1; }*/
virtual int wantClickWndAutoInvalidate() { return 0; }
private:
StringW MakePrefix();
static XMLParamPair params[];
void fixPosition();
void saveAllPositions();
void activateChildren(int act);
#ifdef _WIN32
void getExplorerWindows(HWND *parent, HWND *listview, HWND *webserver);
#endif
void desktopAlpha_autoTurnOn();
void desktopAlpha_autoTurnOff();
void transparency_autoTurnOn();
void transparency_autoTurnOff();
void globalEnableDesktopAlpha(int enabled);
#ifdef _WIN32
HWND forwardMsgWnd;
#endif
int resizing;
int wantactiv;
int size_w,size_h;
int cX,cY;
int captured;
POINT mousepos;
#ifdef _WIN32
HWND webserver;
HWND listview;
#endif
int alphagoingon;
int alphagoingoff;
int scalelocked;
int wantredrawonresize;
int xuihandle;
RegionI *reg;
//PtrList<Layer> *subregionlayers;
Container *p_container;
StringW alphabackgroundstr;
ifc_window *wndholders;
int abortSaving();
int transparencyoverride;
int default_x;
int default_y;
int moving;
int scaling;
int mover;
int indesktop;
int alpha;
StringW linkedheight, linkedwidth;
int inlinkwidth, inlinkheight;
AutoSkinBitmap alphabackground;
int wantdesktopalpha;
int galphadisabled;
static PtrList<Layout> alllayouts;
StringW owner;
PtrList<Layout> locked;
StringW lockto;
Layout *lockedto;
int inpostedmove;
int osframe;
PtrList<GuiStatusCallback> statuscbs;
int initontop;
// GarbageCollector gc;
PtrList<AppCmds> appcmds;
int inresize;
int unlinked;
int snap_adjust_left;
int snap_adjust_top;
int snap_adjust_right;
int snap_adjust_bottom;
int disable_auto_alpha;
int autoopacify;
int noparent;
int forcealpha;
redock_struct redock;
static int broadcasting;
int nodock;
uint32_t transparency_reenabled_at;
int transparency_autooff;
int nooffscreencheck;
int resizable;
int scalable;
int m_w, m_h;
int m_endmovesize;
int m_allowsavedock;
int m_forceunlink;
#ifdef USEAPPBAR
int appbar_want_autohide;
int appbar_want_alwaysontop;
#endif
// FG>
// -- SCRIPT -----------------------------------------------------
public:
static scriptVar script_vcpu_onDock(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar side);
static scriptVar script_vcpu_onUndock(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_getScale(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_setScale(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar s);
static scriptVar script_vcpu_onScale(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar s);
static scriptVar script_vcpu_setDesktopAlpha(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar s);
static scriptVar script_vcpu_getDesktopAlpha(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_isTransparencySafe(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_isLayoutAnimationSafe(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_getContainer(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_center(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_onMove(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_onEndMove(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_onUserResize(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar x, scriptVar y, scriptVar w, scriptVar h);
static scriptVar script_vcpu_snapAdjust(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar left, scriptVar top, scriptVar right, scriptVar bottom);
static scriptVar script_vcpu_setRedrawOnResize(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar v);
static scriptVar script_vcpu_beforeRedock(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_redock(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_getSnapAdjustTop(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_getSnapAdjustLeft(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_getSnapAdjustRight(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_getSnapAdjustBottom(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_onMouseEnterLayout(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_onMouseLeaveLayout(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
static scriptVar script_vcpu_onSnapAdjustChanged(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
#else
class Layout : public LAYOUT_SCRIPTPARENT {
public:
#endif
// INSERT_SCRIPT_OBJECT_CONTROL
};
// END SCRIPT
#endif
|