1
|
#ifndef CTRLCORE_H
|
2
|
#define CTRLCORE_H
|
3
|
|
4
|
#include <RichText/RichText.h>
|
5
|
|
6
|
#ifdef flagNOGTK
|
7
|
#undef flagGTK
|
8
|
#define flagX11
|
9
|
#endif
|
10
|
|
11
|
#include <guiplatform.h>
|
12
|
|
13
|
#ifndef GUIPLATFORM_INCLUDE
|
14
|
|
15
|
#ifdef flagTURTLE
|
16
|
#define GUIPLATFORM_KEYCODES_INCLUDE <Turtle/Keys.h>
|
17
|
|
18
|
#define GUIPLATFORM_INCLUDE <Turtle/Turtle.h>
|
19
|
#define GUIPLATFORM_NOSCROLL
|
20
|
#define PLATFORM_TURTLE
|
21
|
#define TURTLE
|
22
|
#elif PLATFORM_WIN32
|
23
|
#define GUIPLATFORM_INCLUDE "Win32Gui.h"
|
24
|
#else
|
25
|
#ifdef flagX11
|
26
|
#define GUIPLATFORM_INCLUDE "X11Gui.h"
|
27
|
#else
|
28
|
#ifndef flagGTK
|
29
|
#define flagGTK
|
30
|
#endif
|
31
|
#define GUIPLATFORM_INCLUDE "Gtk.h"
|
32
|
#endif
|
33
|
#endif
|
34
|
|
35
|
#endif
|
36
|
|
37
|
#include GUIPLATFORM_INCLUDE
|
38
|
|
39
|
NAMESPACE_UPP
|
40
|
|
41
|
#ifdef _MULTITHREADED
|
42
|
void EnterGuiMutex();
|
43
|
void LeaveGuiMutex();
|
44
|
|
45
|
int LeaveGuiMutexAll();
|
46
|
void EnterGuiMutex(int n);
|
47
|
|
48
|
bool ThreadHasGuiLock();
|
49
|
#else
|
50
|
inline void EnterGuiMutex() {}
|
51
|
inline void LeaveGuiMutex() {}
|
52
|
|
53
|
inline int LeaveGuiMutexAll() { return 0; }
|
54
|
inline void EnterGuiMutex(int) {}
|
55
|
inline bool ThreadHasGuiLock() { return true; }
|
56
|
#endif
|
57
|
|
58
|
struct GuiLock {
|
59
|
GuiLock() { EnterGuiMutex(); }
|
60
|
~GuiLock() { LeaveGuiMutex(); }
|
61
|
};
|
62
|
|
63
|
bool ScreenInPaletteMode();
|
64
|
|
65
|
typedef ImageDraw SystemImageDraw;
|
66
|
|
67
|
void SetSurface(Draw& w, const Rect& dest, const RGBA *pixels, Size srcsz, Point poff);
|
68
|
void SetSurface(Draw& w, int x, int y, int cx, int cy, const RGBA *pixels);
|
69
|
|
70
|
enum {
|
71
|
K_DELTA = 0x010000,
|
72
|
|
73
|
K_ALT = 0x080000,
|
74
|
K_SHIFT = 0x040000,
|
75
|
K_CTRL = 0x020000,
|
76
|
|
77
|
K_KEYUP = 0x100000,
|
78
|
|
79
|
K_MOUSEMIDDLE = 0x200000,
|
80
|
K_MOUSERIGHT = 0x400000,
|
81
|
K_MOUSELEFT = 0x800000,
|
82
|
K_MOUSEDOUBLE = 0x1000000,
|
83
|
K_MOUSETRIPLE = 0x2000000,
|
84
|
|
85
|
K_SHIFT_CTRL = K_SHIFT|K_CTRL,
|
86
|
};
|
87
|
|
88
|
#include "MKeys.h"
|
89
|
|
90
|
bool GetShift();
|
91
|
bool GetCtrl();
|
92
|
bool GetAlt();
|
93
|
bool GetCapsLock();
|
94
|
bool GetMouseLeft();
|
95
|
bool GetMouseRight();
|
96
|
bool GetMouseMiddle();
|
97
|
|
98
|
enum {
|
99
|
DELAY_MINIMAL = 0
|
100
|
};
|
101
|
|
102
|
void SetTimeCallback(int delay_ms, Callback cb, void *id = NULL);
|
103
|
void KillTimeCallback(void *id);
|
104
|
bool ExistsTimeCallback(void *id);
|
105
|
dword GetTimeClick();
|
106
|
|
107
|
inline
|
108
|
void PostCallback(Callback cb, void *id = NULL) { SetTimeCallback(1, cb, id); }
|
109
|
|
110
|
class TimeCallback
|
111
|
{
|
112
|
public:
|
113
|
~TimeCallback() { Kill(); (void)dummy; }
|
114
|
|
115
|
void Set(int delay, Callback cb) { UPP::SetTimeCallback(delay, cb, this); }
|
116
|
void Post(Callback cb) { UPP::PostCallback(cb, this); }
|
117
|
void Kill() { UPP::KillTimeCallback(this); }
|
118
|
void KillSet(int delay, Callback cb) { Kill(); Set(delay, cb); }
|
119
|
void KillPost(Callback cb) { Kill(); Post(cb); }
|
120
|
|
121
|
private:
|
122
|
byte dummy;
|
123
|
};
|
124
|
|
125
|
class Ctrl;
|
126
|
|
127
|
class CtrlFrame {
|
128
|
public:
|
129
|
virtual void FrameLayout(Rect& r) = 0;
|
130
|
virtual void FrameAddSize(Size& sz) = 0;
|
131
|
virtual void FramePaint(Draw& w, const Rect& r);
|
132
|
virtual void FrameAdd(Ctrl& parent);
|
133
|
virtual void FrameRemove();
|
134
|
virtual int OverPaint() const;
|
135
|
|
136
|
#ifdef flagSO
|
137
|
CtrlFrame();
|
138
|
virtual ~CtrlFrame();
|
139
|
#else
|
140
|
CtrlFrame() {}
|
141
|
virtual ~CtrlFrame() {}
|
142
|
#endif
|
143
|
|
144
|
private:
|
145
|
CtrlFrame(const CtrlFrame&);
|
146
|
void operator=(const CtrlFrame&);
|
147
|
};
|
148
|
|
149
|
struct NullFrameClass : public CtrlFrame {
|
150
|
virtual void FrameLayout(Rect& r);
|
151
|
virtual void FramePaint(Draw& w, const Rect& r);
|
152
|
virtual void FrameAddSize(Size& sz);
|
153
|
};
|
154
|
|
155
|
CtrlFrame& NullFrame();
|
156
|
|
157
|
class BorderFrame : public CtrlFrame {
|
158
|
public:
|
159
|
virtual void FrameLayout(Rect& r);
|
160
|
virtual void FramePaint(Draw& w, const Rect& r);
|
161
|
virtual void FrameAddSize(Size& sz);
|
162
|
|
163
|
protected:
|
164
|
const ColorF *border;
|
165
|
|
166
|
public:
|
167
|
#ifdef flagSO
|
168
|
BorderFrame(const ColorF *border);
|
169
|
virtual ~BorderFrame();
|
170
|
#else
|
171
|
BorderFrame(const ColorF *border) : border(border) {}
|
172
|
#endif
|
173
|
};
|
174
|
|
175
|
CtrlFrame& InsetFrame();
|
176
|
CtrlFrame& OutsetFrame();
|
177
|
CtrlFrame& ButtonFrame();
|
178
|
CtrlFrame& ThinInsetFrame();
|
179
|
CtrlFrame& ThinOutsetFrame();
|
180
|
CtrlFrame& BlackFrame();
|
181
|
CtrlFrame& WhiteFrame();
|
182
|
|
183
|
CtrlFrame& XPFieldFrame();
|
184
|
|
185
|
CtrlFrame& FieldFrame();
|
186
|
|
187
|
|
188
|
CtrlFrame& TopSeparatorFrame();
|
189
|
CtrlFrame& BottomSeparatorFrame();
|
190
|
CtrlFrame& LeftSeparatorFrame();
|
191
|
CtrlFrame& RightSeparatorFrame();
|
192
|
|
193
|
void LayoutFrameLeft(Rect& r, Ctrl *ctrl, int cx);
|
194
|
void LayoutFrameRight(Rect& r, Ctrl *ctrl, int cx);
|
195
|
void LayoutFrameTop(Rect& r, Ctrl *ctrl, int cy);
|
196
|
void LayoutFrameBottom(Rect& r, Ctrl *ctrl, int cy);
|
197
|
|
198
|
dword GetMouseFlags();
|
199
|
|
200
|
Point GetMousePos();
|
201
|
dword GetMouseFlags();
|
202
|
|
203
|
#define IMAGECLASS CtrlCoreImg
|
204
|
#define IMAGEFILE <CtrlCore/CtrlCore.iml>
|
205
|
#include <Draw/iml_header.h>
|
206
|
|
207
|
class TopWindow;
|
208
|
class TrayIcon;
|
209
|
class GLCtrl;
|
210
|
|
211
|
enum {
|
212
|
DND_NONE = 0,
|
213
|
DND_COPY = 1,
|
214
|
DND_MOVE = 2,
|
215
|
|
216
|
DND_ALL = 3,
|
217
|
|
218
|
DND_EXACTIMAGE = 0x80000000,
|
219
|
};
|
220
|
|
221
|
struct UDropTarget;
|
222
|
|
223
|
struct ClipData : Moveable<ClipData> {
|
224
|
Value data;
|
225
|
String (*render)(const Value& data);
|
226
|
|
227
|
String Render() const { return (*render)(data); }
|
228
|
|
229
|
ClipData(const Value& data, String (*render)(const Value& data));
|
230
|
ClipData(const String& data);
|
231
|
ClipData();
|
232
|
};
|
233
|
|
234
|
class PasteClip {
|
235
|
friend struct UDropTarget;
|
236
|
friend class Ctrl;
|
237
|
friend PasteClip sMakeDropClip(bool paste);
|
238
|
|
239
|
GUIPLATFORM_PASTECLIP_DECLS
|
240
|
|
241
|
byte action;
|
242
|
byte allowed;
|
243
|
bool paste;
|
244
|
bool accepted;
|
245
|
String fmt;
|
246
|
String data;
|
247
|
|
248
|
void GuiPlatformConstruct();
|
249
|
|
250
|
public:
|
251
|
bool IsAvailable(const char *fmt) const;
|
252
|
String Get(const char *fmt) const;
|
253
|
|
254
|
bool Accept();
|
255
|
|
256
|
bool Accept(const char *fmt);
|
257
|
String GetFormat() { return fmt; }
|
258
|
String Get() const { return data; }
|
259
|
operator String() const { return Get(); }
|
260
|
String operator ~() const { return Get(); }
|
261
|
|
262
|
void Reject() { accepted = false; }
|
263
|
|
264
|
int GetAction() const { return action; }
|
265
|
int GetAllowedActions() const { return allowed; }
|
266
|
void SetAction(int x) { action = x; }
|
267
|
|
268
|
bool IsAccepted() const { return accepted; }
|
269
|
|
270
|
bool IsQuery() const { return !paste; }
|
271
|
bool IsPaste() const { return paste; }
|
272
|
|
273
|
PasteClip();
|
274
|
};
|
275
|
|
276
|
String Unicode__(const WString& w);
|
277
|
WString Unicode__(const String& s);
|
278
|
|
279
|
void GuiPlatformAdjustDragImage(ImageBuffer& b);
|
280
|
|
281
|
Image MakeDragImage(const Image& arrow, Image sample);
|
282
|
|
283
|
const char *ClipFmtsText();
|
284
|
bool AcceptText(PasteClip& clip);
|
285
|
String GetString(PasteClip& clip);
|
286
|
WString GetWString(PasteClip& clip);
|
287
|
String GetTextClip(const String& text, const String& fmt);
|
288
|
String GetTextClip(const WString& text, const String& fmt);
|
289
|
void Append(VectorMap<String, ClipData>& data, const String& text);
|
290
|
void Append(VectorMap<String, ClipData>& data, const WString& text);
|
291
|
|
292
|
const char *ClipFmtsImage();
|
293
|
bool AcceptImage(PasteClip& clip);
|
294
|
Image GetImage(PasteClip& clip);
|
295
|
String GetImageClip(const Image& m, const String& fmt);
|
296
|
void Append(VectorMap<String, ClipData>& data, const Image& img);
|
297
|
|
298
|
bool IsAvailableFiles(PasteClip& clip);
|
299
|
bool AcceptFiles(PasteClip& clip);
|
300
|
Vector<String> GetClipFiles(const String& data);
|
301
|
Vector<String> GetFiles(PasteClip& clip);
|
302
|
void AppendFiles(VectorMap<String, ClipData>& data, const Vector<String>& files);
|
303
|
|
304
|
template <class T>
|
305
|
String ClipFmt()
|
306
|
{
|
307
|
return String("U++ type: ") + typeid(T).name();
|
308
|
}
|
309
|
|
310
|
template <class T>
|
311
|
bool Accept(PasteClip& clip)
|
312
|
{
|
313
|
return clip.Accept(ClipFmt<T>());
|
314
|
}
|
315
|
|
316
|
|
317
|
String GetInternalDropId__(const char *type, const char *id);
|
318
|
void NewInternalDrop__(const void *ptr);
|
319
|
const void *GetInternalDropPtr__();
|
320
|
|
321
|
template <class T>
|
322
|
VectorMap<String, ClipData> InternalClip(const T& x, const char *id = "")
|
323
|
{
|
324
|
NewInternalDrop__(&x);
|
325
|
VectorMap<String, ClipData> d;
|
326
|
d.Add(GetInternalDropId__(typeid(T).name(), id));
|
327
|
return d;
|
328
|
}
|
329
|
|
330
|
template <class T>
|
331
|
bool IsAvailableInternal(PasteClip& d, const char *id = "")
|
332
|
{
|
333
|
return d.IsAvailable(GetInternalDropId__(typeid(T).name(), id));
|
334
|
}
|
335
|
|
336
|
template <class T>
|
337
|
bool AcceptInternal(PasteClip& d, const char *id = "")
|
338
|
{
|
339
|
return d.Accept(GetInternalDropId__(typeid(T).name(), id));
|
340
|
}
|
341
|
|
342
|
template <class T>
|
343
|
const T& GetInternal(PasteClip& d)
|
344
|
{
|
345
|
return *(T *)GetInternalDropPtr__();
|
346
|
}
|
347
|
|
348
|
class Ctrl : public Pte<Ctrl> {
|
349
|
public:
|
350
|
enum PlacementConstants {
|
351
|
CENTER = 0,
|
352
|
MIDDLE = 0,
|
353
|
LEFT = 1,
|
354
|
RIGHT = 2,
|
355
|
TOP = 1,
|
356
|
BOTTOM = 2,
|
357
|
SIZE = 3,
|
358
|
|
359
|
MINSIZE = -16380,
|
360
|
MAXSIZE = -16381,
|
361
|
STDSIZE = -16382,
|
362
|
};
|
363
|
|
364
|
class Logc {
|
365
|
dword data;
|
366
|
|
367
|
static int LSGN(dword d) { return int16((d & 0x7fff) | ((d & 0x4000) << 1)); }
|
368
|
|
369
|
public:
|
370
|
bool operator==(Logc q) const { return data == q.data; }
|
371
|
bool operator!=(Logc q) const { return data != q.data; }
|
372
|
int GetAlign() const { return (data >> 30) & 3; }
|
373
|
int GetA() const { return LSGN(data >> 15); }
|
374
|
int GetB() const { return LSGN(data); }
|
375
|
void SetAlign(int align) { data = (data & ~(3 << 30)) | (align << 30); }
|
376
|
void SetA(int a) { data = (data & ~(0x7fff << 15)) | ((a & 0x7fff) << 15); }
|
377
|
void SetB(int b) { data = (data & ~0x7fff) | (b & 0x7fff); }
|
378
|
bool IsEmpty() const;
|
379
|
|
380
|
Logc(int al, int a, int b) { data = (al << 30) | ((a & 0x7fff) << 15) | (b & 0x7fff); }
|
381
|
Logc() { data = 0xffffffff; }
|
382
|
};
|
383
|
|
384
|
struct LogPos : Moveable<LogPos> {
|
385
|
Logc x, y;
|
386
|
|
387
|
bool operator==(LogPos b) const { return x == b.x && y == b.y; }
|
388
|
bool operator!=(LogPos b) const { return !(*this == b); }
|
389
|
|
390
|
LogPos(Logc x, Logc y) : x(x), y(y) {}
|
391
|
LogPos() {}
|
392
|
};
|
393
|
|
394
|
static Logc PosLeft(int pos, int size) { return Logc(LEFT, pos, size); }
|
395
|
static Logc PosRight(int pos, int size) { return Logc(RIGHT, pos, size); }
|
396
|
static Logc PosTop(int pos, int size) { return Logc(TOP, pos, size); }
|
397
|
static Logc PosBottom(int pos, int size) { return Logc(BOTTOM, pos, size); }
|
398
|
static Logc PosSize(int lpos, int rpos) { return Logc(SIZE, lpos, rpos); }
|
399
|
static Logc PosCenter(int size, int offset) { return Logc(CENTER, offset, size); }
|
400
|
static Logc PosCenter(int size) { return Logc(CENTER, 0, size); }
|
401
|
|
402
|
typedef bool (*MouseHook)(Ctrl *ctrl, bool inframe, int event, Point p,
|
403
|
int zdelta, dword keyflags);
|
404
|
typedef bool (*KeyHook)(Ctrl *ctrl, dword key, int count);
|
405
|
typedef bool (*StateHook)(Ctrl *ctrl, int reason);
|
406
|
|
407
|
static dword KEYtoK(dword);
|
408
|
|
409
|
private:
|
410
|
Ctrl(Ctrl&);
|
411
|
void operator=(Ctrl&);
|
412
|
|
413
|
private:
|
414
|
struct Frame : Moveable<Frame> {
|
415
|
CtrlFrame *frame;
|
416
|
Rect16 view;
|
417
|
|
418
|
Frame() { view.Clear(); }
|
419
|
};
|
420
|
Ctrl *parent;
|
421
|
|
422
|
struct Scroll : Moveable<Scroll> {
|
423
|
Rect rect;
|
424
|
int dx;
|
425
|
int dy;
|
426
|
};
|
427
|
|
428
|
struct MoveCtrl : Moveable<MoveCtrl> {
|
429
|
Ptr<Ctrl> ctrl;
|
430
|
Rect from;
|
431
|
Rect to;
|
432
|
};
|
433
|
|
434
|
friend struct UDropTarget;
|
435
|
|
436
|
struct Top {
|
437
|
GUIPLATFORM_CTRL_TOP_DECLS
|
438
|
Vector<Scroll> scroll;
|
439
|
VectorMap<Ctrl *, MoveCtrl> move;
|
440
|
VectorMap<Ctrl *, MoveCtrl> scroll_move;
|
441
|
Ptr<Ctrl> owner;
|
442
|
};
|
443
|
|
444
|
Top *top;
|
445
|
int exitcode;
|
446
|
|
447
|
Ctrl *prev, *next;
|
448
|
Ctrl *firstchild, *lastchild;
|
449
|
LogPos pos;
|
450
|
Rect16 rect;
|
451
|
Mitor<Frame> frame;
|
452
|
String info;
|
453
|
int16 caretx, carety, caretcx, caretcy;
|
454
|
|
455
|
byte overpaint;
|
456
|
|
457
|
bool unicode:1;
|
458
|
|
459
|
bool fullrefresh:1;
|
460
|
|
461
|
bool transparent:1;
|
462
|
bool visible:1;
|
463
|
bool enabled:1;
|
464
|
bool wantfocus:1;
|
465
|
bool initfocus:1;
|
466
|
bool activepopup:1;
|
467
|
bool editable:1;
|
468
|
bool modify:1;
|
469
|
bool ignoremouse:1;
|
470
|
bool inframe:1;
|
471
|
bool inloop:1;
|
472
|
bool isopen:1;
|
473
|
bool popup:1;
|
474
|
bool popupgrab:1;
|
475
|
byte backpaint:2;
|
476
|
bool hasdhctrl:1;
|
477
|
|
478
|
bool akv:1;
|
479
|
bool destroying:1;
|
480
|
|
481
|
static Ptr<Ctrl> eventCtrl;
|
482
|
static Ptr<Ctrl> mouseCtrl;
|
483
|
static Point mousepos;
|
484
|
static Point leftmousepos, rightmousepos, middlemousepos;
|
485
|
static Ptr<Ctrl> focusCtrl;
|
486
|
static Ptr<Ctrl> focusCtrlWnd;
|
487
|
static Ptr<Ctrl> lastActiveWnd;
|
488
|
static Ptr<Ctrl> caretCtrl;
|
489
|
static Rect caretRect;
|
490
|
static Ptr<Ctrl> captureCtrl;
|
491
|
static bool ignoreclick;
|
492
|
static bool ignoremouseup;
|
493
|
static bool ignorekeyup;
|
494
|
static bool mouseinview;
|
495
|
static bool mouseinframe;
|
496
|
static bool globalbackpaint;
|
497
|
static bool globalbackbuffer;
|
498
|
static bool painting;
|
499
|
static int LoopLevel;
|
500
|
static Ctrl *LoopCtrl;
|
501
|
static int64 EventLoopNo;
|
502
|
static int64 EndSessionLoopNo;
|
503
|
static int64 eventid;
|
504
|
|
505
|
static Ptr<Ctrl> defferedSetFocus;
|
506
|
static Vector< Ptr<Ctrl> > defferedChildLostFocus;
|
507
|
|
508
|
static Ptr<Ctrl> repeatTopCtrl;
|
509
|
static Point repeatMousePos;
|
510
|
|
511
|
static Vector<MouseHook>& mousehook();
|
512
|
static Vector<KeyHook>& keyhook();
|
513
|
static Vector<StateHook>& statehook();
|
514
|
|
515
|
#ifdef flagSO
|
516
|
static Ptr<Ctrl> FocusCtrl();
|
517
|
static void FocusCtrl(Ptr<Ctrl> fc);
|
518
|
#else
|
519
|
static Ptr<Ctrl> FocusCtrl() { return focusCtrl; }
|
520
|
static void FocusCtrl(Ptr<Ctrl> fc) { focusCtrl = fc; }
|
521
|
#endif
|
522
|
|
523
|
void StateDeep(int state);
|
524
|
|
525
|
void RemoveChild0(Ctrl *q);
|
526
|
|
527
|
static int FindMoveCtrl(const VectorMap<Ctrl *, MoveCtrl>& m, Ctrl *x);
|
528
|
static MoveCtrl *FindMoveCtrlPtr(VectorMap<Ctrl *, MoveCtrl>& m, Ctrl *x);
|
529
|
|
530
|
Size PosVal(int v) const;
|
531
|
void Lay1(int& pos, int& r, int align, int a, int b, int sz) const;
|
532
|
Rect CalcRect(LogPos pos, const Rect& prect, const Rect& pview) const;
|
533
|
Rect CalcRect(const Rect& prect, const Rect& pview) const;
|
534
|
void UpdateRect0(bool sync = true);
|
535
|
void UpdateRect(bool sync = true);
|
536
|
void SetPos0(LogPos p, bool inframe);
|
537
|
void SetWndRect(const Rect& r);
|
538
|
void SyncMoves();
|
539
|
|
540
|
static void EndIgnore();
|
541
|
static void LRep();
|
542
|
static void LHold();
|
543
|
static void LRepeat();
|
544
|
static void RRep();
|
545
|
static void RHold();
|
546
|
static void RRepeat();
|
547
|
static void MRep();
|
548
|
static void MHold();
|
549
|
static void MRepeat();
|
550
|
static void KillRepeat();
|
551
|
static void CheckMouseCtrl();
|
552
|
static void DoCursorShape();
|
553
|
static Image& CursorOverride();
|
554
|
bool IsMouseActive() const;
|
555
|
Image MouseEvent0(int event, Point p, int zdelta, dword keyflags);
|
556
|
Image MouseEventH(int event, Point p, int zdelta, dword keyflags);
|
557
|
Image FrameMouseEventH(int event, Point p, int zdelta, dword keyflags);
|
558
|
Image MEvent0(int e, Point p, int zd);
|
559
|
Image DispatchMouse(int e, Point p, int zd = 0);
|
560
|
Image DispatchMouseEvent(int e, Point p, int zd = 0);
|
561
|
void LogMouseEvent(const char *f, const Ctrl *ctrl, int event, Point p, int zdelta, dword keyflags);
|
562
|
|
563
|
struct CallBox;
|
564
|
static void PerformCall(CallBox *cbox);
|
565
|
|
566
|
void StateH(int reason);
|
567
|
|
568
|
void RefreshAccessKeys();
|
569
|
void RefreshAccessKeysDo(bool vis);
|
570
|
static void DefferedFocusSync();
|
571
|
static void SyncCaret();
|
572
|
static void RefreshCaret();
|
573
|
static bool DispatchKey(dword keycode, int count);
|
574
|
void SetFocusWnd();
|
575
|
void KillFocusWnd();
|
576
|
|
577
|
static Ptr<Ctrl> dndctrl;
|
578
|
static Point dndpos;
|
579
|
static bool dndframe;
|
580
|
static PasteClip dndclip;
|
581
|
|
582
|
void DnD(Point p, PasteClip& clip);
|
583
|
static void DnDRepeat();
|
584
|
static void DnDLeave();
|
585
|
|
586
|
void SyncLayout(int force = 0);
|
587
|
bool AddScroll(const Rect& sr, int dx, int dy);
|
588
|
Rect GetClippedView();
|
589
|
void ScrollRefresh(const Rect& r, int dx, int dy);
|
590
|
void ScrollCtrl(Top *top, Ctrl *q, const Rect& r, Rect cr, int dx, int dy);
|
591
|
void SyncScroll();
|
592
|
void Refresh0(const Rect& area);
|
593
|
void PaintCaret(SystemDraw& w);
|
594
|
void CtrlPaint(SystemDraw& w, const Rect& clip);
|
595
|
void RemoveFullRefresh();
|
596
|
bool PaintOpaqueAreas(SystemDraw& w, const Rect& r, const Rect& clip, bool nochild = false);
|
597
|
void GatherTransparentAreas(Vector<Rect>& area, SystemDraw& w, Rect r, const Rect& clip);
|
598
|
Ctrl *FindBestOpaque(const Rect& clip);
|
599
|
void UpdateArea0(SystemDraw& draw, const Rect& clip, int backpaint);
|
600
|
void UpdateArea(SystemDraw& draw, const Rect& clip);
|
601
|
Ctrl *GetTopRect(Rect& r, bool inframe, bool clip = true);
|
602
|
void DoSync(Ctrl *q, Rect r, bool inframe);
|
603
|
bool HasDHCtrl() const;
|
604
|
void SyncDHCtrl();
|
605
|
void SetInfoPart(int i, const char *txt);
|
606
|
String GetInfoPart(int i) const;
|
607
|
|
608
|
|
609
|
void WndShow(bool b);
|
610
|
void WndSetPos(const Rect& rect);
|
611
|
|
612
|
bool IsWndOpen() const;
|
613
|
|
614
|
bool SetWndCapture();
|
615
|
bool HasWndCapture() const;
|
616
|
bool ReleaseWndCapture();
|
617
|
|
618
|
static void SetMouseCursor(const Image& m);
|
619
|
|
620
|
static void DoDeactivate(Ptr<Ctrl> pfocusCtrl, Ptr<Ctrl> nfocusCtrl);
|
621
|
static void DoKillFocus(Ptr<Ctrl> pfocusCtrl, Ptr<Ctrl> nfocusCtrl);
|
622
|
static void DoSetFocus(Ptr<Ctrl> pfocusCtrl, Ptr<Ctrl> nfocusCtrl, bool activate);
|
623
|
|
624
|
bool SetFocus0(bool activate);
|
625
|
void ActivateWnd();
|
626
|
void ClickActivateWnd();
|
627
|
bool SetWndFocus();
|
628
|
bool HasWndFocus() const;
|
629
|
|
630
|
void WndInvalidateRect(const Rect& r);
|
631
|
|
632
|
void WndScrollView(const Rect& r, int dx, int dy);
|
633
|
|
634
|
void SetWndForeground();
|
635
|
bool IsWndForeground() const;
|
636
|
|
637
|
void WndEnable(bool b);
|
638
|
|
639
|
Rect GetWndScreenRect() const;
|
640
|
|
641
|
void WndUpdate();
|
642
|
void WndUpdate(const Rect& r);
|
643
|
|
644
|
void WndFree();
|
645
|
void WndDestroy();
|
646
|
|
647
|
void SysEndLoop();
|
648
|
|
649
|
String Name0() const;
|
650
|
|
651
|
static void InitTimer();
|
652
|
|
653
|
static String appname;
|
654
|
|
655
|
static Size Bsize;
|
656
|
static Size Dsize;
|
657
|
static Size Csize;
|
658
|
static bool IsNoLayoutZoom;
|
659
|
static void Csizeinit();
|
660
|
static void (*skin)();
|
661
|
|
662
|
friend void InitRichTextZoom();
|
663
|
friend void AvoidPaintingCheck__();
|
664
|
friend void CtrlSetDefaultSkin(void (*fn1)(), void (*fn2)());
|
665
|
friend class DHCtrl;
|
666
|
friend class ViewDraw;
|
667
|
friend class TopWindow;
|
668
|
friend class TrayIcon;
|
669
|
friend class GLCtrl;
|
670
|
friend class WaitCursor;
|
671
|
friend struct UDropSource;
|
672
|
friend class DnDAction;
|
673
|
friend class PasteClip;
|
674
|
|
675
|
typedef Ctrl CLASSNAME;
|
676
|
|
677
|
void GuiPlatformConstruct();
|
678
|
void GuiPlatformDestruct();
|
679
|
void GuiPlatformRemove();
|
680
|
void GuiPlatformGetTopRect(Rect& r) const;
|
681
|
bool GuiPlatformRefreshFrameSpecial(const Rect& r);
|
682
|
bool GuiPlatformSetFullRefreshSpecial();
|
683
|
static void GuiPlatformSelection(PasteClip& d);
|
684
|
|
685
|
#ifdef GUIPLATFORM_CTRL_DECLS_INCLUDE
|
686
|
#include GUIPLATFORM_CTRL_DECLS_INCLUDE
|
687
|
#else
|
688
|
GUIPLATFORM_CTRL_DECLS
|
689
|
#endif
|
690
|
|
691
|
static void InstallPanicBox();
|
692
|
|
693
|
private:
|
694
|
void DoRemove();
|
695
|
|
696
|
protected:
|
697
|
static void TimerProc(dword time);
|
698
|
|
699
|
Ctrl& Unicode() { unicode = true; return *this; }
|
700
|
|
701
|
public:
|
702
|
enum StateReason {
|
703
|
FOCUS = 10,
|
704
|
ACTIVATE = 11,
|
705
|
DEACTIVATE = 12,
|
706
|
SHOW = 13,
|
707
|
ENABLE = 14,
|
708
|
EDITABLE = 15,
|
709
|
OPEN = 16,
|
710
|
CLOSE = 17,
|
711
|
POSITION = 100,
|
712
|
LAYOUTPOS = 101,
|
713
|
};
|
714
|
|
715
|
enum MouseEvents {
|
716
|
BUTTON = 0x0F,
|
717
|
ACTION = 0xF0,
|
718
|
|
719
|
MOUSEENTER = 0x10,
|
720
|
MOUSEMOVE = 0x20,
|
721
|
MOUSELEAVE = 0x30,
|
722
|
CURSORIMAGE = 0x40,
|
723
|
MOUSEWHEEL = 0x50,
|
724
|
|
725
|
DOWN = 0x80,
|
726
|
UP = 0x90,
|
727
|
DOUBLE = 0xa0,
|
728
|
REPEAT = 0xb0,
|
729
|
DRAG = 0xc0,
|
730
|
HOLD = 0xd0,
|
731
|
TRIPLE = 0xe0,
|
732
|
|
733
|
LEFTDOWN = LEFT|DOWN,
|
734
|
LEFTDOUBLE = LEFT|DOUBLE,
|
735
|
LEFTREPEAT = LEFT|REPEAT,
|
736
|
LEFTUP = LEFT|UP,
|
737
|
LEFTDRAG = LEFT|DRAG,
|
738
|
LEFTHOLD = LEFT|HOLD,
|
739
|
LEFTTRIPLE = LEFT|TRIPLE,
|
740
|
|
741
|
RIGHTDOWN = RIGHT|DOWN,
|
742
|
RIGHTDOUBLE = RIGHT|DOUBLE,
|
743
|
RIGHTREPEAT = RIGHT|REPEAT,
|
744
|
RIGHTUP = RIGHT|UP,
|
745
|
RIGHTDRAG = RIGHT|DRAG,
|
746
|
RIGHTHOLD = RIGHT|HOLD,
|
747
|
RIGHTTRIPLE = RIGHT|TRIPLE,
|
748
|
|
749
|
MIDDLEDOWN = MIDDLE|DOWN,
|
750
|
MIDDLEDOUBLE = MIDDLE|DOUBLE,
|
751
|
MIDDLEREPEAT = MIDDLE|REPEAT,
|
752
|
MIDDLEUP = MIDDLE|UP,
|
753
|
MIDDLEDRAG = MIDDLE|DRAG,
|
754
|
MIDDLEHOLD = MIDDLE|HOLD,
|
755
|
MIDDLETRIPLE = MIDDLE|TRIPLE
|
756
|
};
|
757
|
|
758
|
enum {
|
759
|
NOBACKPAINT,
|
760
|
FULLBACKPAINT,
|
761
|
TRANSPARENTBACKPAINT,
|
762
|
EXCLUDEPAINT,
|
763
|
};
|
764
|
|
765
|
static Vector<Ctrl *> GetTopCtrls();
|
766
|
static Vector<Ctrl *> GetTopWindows();
|
767
|
static void CloseTopCtrls();
|
768
|
|
769
|
static void InstallMouseHook(MouseHook hook);
|
770
|
static void DeinstallMouseHook(MouseHook hook);
|
771
|
|
772
|
static void InstallKeyHook(KeyHook hook);
|
773
|
static void DeinstallKeyHook(KeyHook hook);
|
774
|
|
775
|
static void InstallStateHook(StateHook hook);
|
776
|
static void DeinstallStateHook(StateHook hook);
|
777
|
|
778
|
static int RegisterSystemHotKey(dword key, Callback cb);
|
779
|
static void UnregisterSystemHotKey(int id);
|
780
|
|
781
|
virtual bool Accept();
|
782
|
virtual void Reject();
|
783
|
virtual void SetData(const Value& data);
|
784
|
virtual Value GetData() const;
|
785
|
virtual void Serialize(Stream& s);
|
786
|
virtual void Jsonize(JsonIO& jio);
|
787
|
virtual void Xmlize(XmlIO& xio);
|
788
|
virtual void SetModify();
|
789
|
virtual void ClearModify();
|
790
|
virtual bool IsModified() const;
|
791
|
|
792
|
virtual void Paint(Draw& w);
|
793
|
virtual int OverPaint() const;
|
794
|
|
795
|
virtual void CancelMode();
|
796
|
|
797
|
virtual void Activate();
|
798
|
virtual void Deactivate();
|
799
|
|
800
|
virtual Image FrameMouseEvent(int event, Point p, int zdelta, dword keyflags);
|
801
|
virtual Image MouseEvent(int event, Point p, int zdelta, dword keyflags);
|
802
|
virtual void MouseEnter(Point p, dword keyflags);
|
803
|
virtual void MouseMove(Point p, dword keyflags);
|
804
|
virtual void LeftDown(Point p, dword keyflags);
|
805
|
virtual void LeftDouble(Point p, dword keyflags);
|
806
|
virtual void LeftTriple(Point p, dword keyflags);
|
807
|
virtual void LeftRepeat(Point p, dword keyflags);
|
808
|
virtual void LeftDrag(Point p, dword keyflags);
|
809
|
virtual void LeftHold(Point p, dword keyflags);
|
810
|
virtual void LeftUp(Point p, dword keyflags);
|
811
|
virtual void RightDown(Point p, dword keyflags);
|
812
|
virtual void RightDouble(Point p, dword keyflags);
|
813
|
virtual void RightTriple(Point p, dword keyflags);
|
814
|
virtual void RightRepeat(Point p, dword keyflags);
|
815
|
virtual void RightDrag(Point p, dword keyflags);
|
816
|
virtual void RightHold(Point p, dword keyflags);
|
817
|
virtual void RightUp(Point p, dword keyflags);
|
818
|
virtual void MiddleDown(Point p, dword keyflags);
|
819
|
virtual void MiddleDouble(Point p, dword keyflags);
|
820
|
virtual void MiddleTriple(Point p, dword keyflags);
|
821
|
virtual void MiddleRepeat(Point p, dword keyflags);
|
822
|
virtual void MiddleDrag(Point p, dword keyflags);
|
823
|
virtual void MiddleHold(Point p, dword keyflags);
|
824
|
virtual void MiddleUp(Point p, dword keyflags);
|
825
|
virtual void MouseWheel(Point p, int zdelta, dword keyflags);
|
826
|
virtual void MouseLeave();
|
827
|
|
828
|
virtual void DragAndDrop(Point p, PasteClip& d);
|
829
|
virtual void FrameDragAndDrop(Point p, PasteClip& d);
|
830
|
virtual void DragRepeat(Point p);
|
831
|
virtual void DragEnter();
|
832
|
virtual void DragLeave();
|
833
|
virtual String GetDropData(const String& fmt) const;
|
834
|
virtual String GetSelectionData(const String& fmt) const;
|
835
|
|
836
|
virtual Image CursorImage(Point p, dword keyflags);
|
837
|
|
838
|
virtual bool Key(dword key, int count);
|
839
|
virtual void GotFocus();
|
840
|
virtual void LostFocus();
|
841
|
virtual bool HotKey(dword key);
|
842
|
|
843
|
virtual dword GetAccessKeys() const;
|
844
|
virtual void AssignAccessKeys(dword used);
|
845
|
|
846
|
virtual void PostInput();
|
847
|
|
848
|
virtual void ChildFrameMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword keyflags);
|
849
|
virtual void ChildMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword keyflags);
|
850
|
virtual void ChildGotFocus();
|
851
|
virtual void ChildLostFocus();
|
852
|
virtual void ChildAdded(Ctrl *child);
|
853
|
virtual void ChildRemoved(Ctrl *child);
|
854
|
virtual void ParentChange();
|
855
|
|
856
|
virtual void State(int reason);
|
857
|
|
858
|
virtual void Layout();
|
859
|
|
860
|
virtual Size GetMinSize() const;
|
861
|
virtual Size GetStdSize() const;
|
862
|
virtual Size GetMaxSize() const;
|
863
|
|
864
|
virtual bool IsShowEnabled() const;
|
865
|
|
866
|
virtual Rect GetOpaqueRect() const;
|
867
|
virtual Rect GetVoidRect() const ;
|
868
|
|
869
|
virtual void Updated();
|
870
|
|
871
|
virtual void Close();
|
872
|
|
873
|
virtual bool IsOcxChild();
|
874
|
|
875
|
virtual String GetDesc() const;
|
876
|
|
877
|
Callback WhenAction;
|
878
|
|
879
|
void AddChild(Ctrl *child);
|
880
|
void AddChild(Ctrl *child, Ctrl *insafter);
|
881
|
void AddChildBefore(Ctrl *child, Ctrl *insbefore);
|
882
|
void RemoveChild(Ctrl *child);
|
883
|
Ctrl *GetParent() const { return parent; }
|
884
|
Ctrl *GetLastChild() const { return lastchild; }
|
885
|
Ctrl *GetFirstChild() const { return firstchild; }
|
886
|
Ctrl *GetPrev() const { return parent ? prev : NULL; }
|
887
|
Ctrl *GetNext() const { return parent ? next : NULL; }
|
888
|
int GetChildIndex(const Ctrl *child) const;
|
889
|
Ctrl *GetIndexChild(int i) const;
|
890
|
int GetChildCount() const;
|
891
|
|
892
|
bool IsChild() const { return parent; }
|
893
|
|
894
|
Ctrl *ChildFromPoint(Point& pt) const;
|
895
|
|
896
|
bool IsForeground() const;
|
897
|
void SetForeground();
|
898
|
|
899
|
const Ctrl *GetTopCtrl() const;
|
900
|
Ctrl *GetTopCtrl();
|
901
|
const Ctrl *GetOwner() const;
|
902
|
Ctrl *GetOwner();
|
903
|
const Ctrl *GetTopCtrlOwner() const;
|
904
|
Ctrl *GetTopCtrlOwner();
|
905
|
|
906
|
Ctrl *GetOwnerCtrl();
|
907
|
const Ctrl *GetOwnerCtrl() const;
|
908
|
|
909
|
const TopWindow *GetTopWindow() const;
|
910
|
TopWindow *GetTopWindow();
|
911
|
|
912
|
const TopWindow *GetMainWindow() const;
|
913
|
TopWindow *GetMainWindow();
|
914
|
|
915
|
Ctrl& SetFrame(int i, CtrlFrame& frm);
|
916
|
Ctrl& SetFrame(CtrlFrame& frm) { return SetFrame(0, frm); }
|
917
|
Ctrl& AddFrame(CtrlFrame& frm);
|
918
|
const CtrlFrame& GetFrame(int i = 0) const { return *frame[i].frame; }
|
919
|
CtrlFrame& GetFrame(int i = 0) { return *frame[i].frame; }
|
920
|
void RemoveFrame(int i);
|
921
|
void RemoveFrame(CtrlFrame& frm);
|
922
|
void InsertFrame(int i, CtrlFrame& frm);
|
923
|
int FindFrame(CtrlFrame& frm);
|
924
|
int GetFrameCount() const { return frame.GetCount(); }
|
925
|
void ClearFrames();
|
926
|
|
927
|
bool IsOpen() const;
|
928
|
|
929
|
void Shutdown() { destroying = true; }
|
930
|
bool IsShutdown() const { return destroying; }
|
931
|
|
932
|
Ctrl& SetPos(LogPos p, bool inframe);
|
933
|
|
934
|
Ctrl& SetPos(LogPos p);
|
935
|
Ctrl& SetPos(Logc x, Logc y) { return SetPos(LogPos(x, y)); }
|
936
|
Ctrl& SetPosX(Logc x);
|
937
|
Ctrl& SetPosY(Logc y);
|
938
|
|
939
|
void SetRect(const Rect& r);
|
940
|
void SetRect(int x, int y, int cx, int cy);
|
941
|
void SetRectX(int x, int cx);
|
942
|
void SetRectY(int y, int cy);
|
943
|
|
944
|
Ctrl& SetFramePos(LogPos p);
|
945
|
Ctrl& SetFramePos(Logc x, Logc y) { return SetFramePos(LogPos(x, y)); }
|
946
|
Ctrl& SetFramePosX(Logc x);
|
947
|
Ctrl& SetFramePosY(Logc y);
|
948
|
|
949
|
void SetFrameRect(const Rect& r);
|
950
|
void SetFrameRect(int x, int y, int cx, int cy);
|
951
|
void SetFrameRectX(int x, int cx);
|
952
|
void SetFrameRectY(int y, int cy);
|
953
|
|
954
|
bool InFrame() const { return inframe; }
|
955
|
bool InView() const { return !inframe; }
|
956
|
LogPos GetPos() const { return pos; }
|
957
|
|
958
|
void RefreshLayout() { SyncLayout(1); }
|
959
|
void RefreshLayoutDeep() { SyncLayout(2); }
|
960
|
void RefreshParentLayout() { if(parent) parent->RefreshLayout(); }
|
961
|
|
962
|
void UpdateLayout() { SyncLayout(); }
|
963
|
void UpdateParentLayout() { if(parent) parent->UpdateLayout(); }
|
964
|
|
965
|
Ctrl& LeftPos(int a, int size = STDSIZE);
|
966
|
Ctrl& RightPos(int a, int size = STDSIZE);
|
967
|
Ctrl& TopPos(int a, int size = STDSIZE);
|
968
|
Ctrl& BottomPos(int a, int size = STDSIZE);
|
969
|
Ctrl& HSizePos(int a = 0, int b = 0);
|
970
|
Ctrl& VSizePos(int a = 0, int b = 0);
|
971
|
Ctrl& SizePos();
|
972
|
Ctrl& HCenterPos(int size = STDSIZE, int delta = 0);
|
973
|
Ctrl& VCenterPos(int size = STDSIZE, int delta = 0);
|
974
|
|
975
|
Ctrl& LeftPosZ(int a, int size = STDSIZE);
|
976
|
Ctrl& RightPosZ(int a, int size = STDSIZE);
|
977
|
Ctrl& TopPosZ(int a, int size = STDSIZE);
|
978
|
Ctrl& BottomPosZ(int a, int size = STDSIZE);
|
979
|
Ctrl& HSizePosZ(int a = 0, int b = 0);
|
980
|
Ctrl& VSizePosZ(int a = 0, int b = 0);
|
981
|
Ctrl& HCenterPosZ(int size = STDSIZE, int delta = 0);
|
982
|
Ctrl& VCenterPosZ(int size = STDSIZE, int delta = 0);
|
983
|
|
984
|
Rect GetRect() const;
|
985
|
Rect GetScreenRect() const;
|
986
|
|
987
|
Rect GetView() const;
|
988
|
Rect GetScreenView() const;
|
989
|
Size GetSize() const;
|
990
|
|
991
|
Rect GetVisibleScreenRect() const;
|
992
|
Rect GetVisibleScreenView() const;
|
993
|
|
994
|
Rect GetWorkArea() const;
|
995
|
|
996
|
Size AddFrameSize(int cx, int cy) const;
|
997
|
Size AddFrameSize(Size sz) const { return AddFrameSize(sz.cx, sz.cy); }
|
998
|
|
999
|
void Refresh(const Rect& r);
|
1000
|
void Refresh(int x, int y, int cx, int cy);
|
1001
|
void Refresh();
|
1002
|
bool IsFullRefresh() const { return fullrefresh; }
|
1003
|
|
1004
|
void RefreshFrame(const Rect& r);
|
1005
|
void RefreshFrame(int x, int y, int cx, int cy);
|
1006
|
void RefreshFrame();
|
1007
|
|
1008
|
static bool IsPainting() { return painting; }
|
1009
|
|
1010
|
void ScrollView(const Rect& r, int dx, int dy);
|
1011
|
void ScrollView(int x, int y, int cx, int cy, int dx, int dy);
|
1012
|
void ScrollView(int dx, int dy);
|
1013
|
void ScrollView(const Rect& r, Size delta) { ScrollView(r, delta.cx, delta.cy); }
|
1014
|
void ScrollView(Size delta) { ScrollView(delta.cx, delta.cy); }
|
1015
|
|
1016
|
void Sync();
|
1017
|
void Sync(const Rect& r);
|
1018
|
|
1019
|
static Image OverrideCursor(const Image& m);
|
1020
|
|
1021
|
void DrawCtrl(Draw& w, int x = 0, int y = 0);
|
1022
|
void DrawCtrlWithParent(Draw& w, int x = 0, int y = 0);
|
1023
|
|
1024
|
bool HasChild(Ctrl *ctrl) const;
|
1025
|
bool HasChildDeep(Ctrl *ctrl) const;
|
1026
|
|
1027
|
Ctrl& IgnoreMouse(bool b = true) { ignoremouse = b; return *this; }
|
1028
|
Ctrl& NoIgnoreMouse() { return IgnoreMouse(false); }
|
1029
|
bool IsIgnoreMouse() const { return ignoremouse; }
|
1030
|
bool HasMouse() const;
|
1031
|
bool HasMouseDeep() const;
|
1032
|
bool HasMouseInFrame(const Rect& r) const;
|
1033
|
bool HasMouseIn(const Rect& r) const;
|
1034
|
Point GetMouseViewPos() const;
|
1035
|
static Ctrl *GetMouseCtrl();
|
1036
|
|
1037
|
static void IgnoreMouseClick();
|
1038
|
static void IgnoreMouseUp();
|
1039
|
static void UnIgnoreMouse();
|
1040
|
|
1041
|
bool SetCapture();
|
1042
|
bool ReleaseCapture();
|
1043
|
bool HasCapture() const;
|
1044
|
static bool ReleaseCtrlCapture();
|
1045
|
static Ctrl *GetCaptureCtrl();
|
1046
|
|
1047
|
bool SetFocus();
|
1048
|
bool HasFocus() const { return FocusCtrl() == this; }
|
1049
|
bool HasFocusDeep() const;
|
1050
|
Ctrl& WantFocus(bool ft = true) { wantfocus = ft; return *this; }
|
1051
|
Ctrl& NoWantFocus() { return WantFocus(false); }
|
1052
|
bool IsWantFocus() const { return wantfocus; }
|
1053
|
bool SetWantFocus();
|
1054
|
Ctrl& InitFocus(bool ft = true) { initfocus = ft; return *this; }
|
1055
|
Ctrl& NoInitFocus() { return InitFocus(false); }
|
1056
|
bool IsInitFocus() const { return initfocus; }
|
1057
|
Ctrl *GetFocusChild() const { return HasChild(FocusCtrl()) ? ~FocusCtrl() : NULL; }
|
1058
|
Ctrl *GetFocusChildDeep() const { return HasChildDeep(FocusCtrl()) ? ~FocusCtrl() : NULL; }
|
1059
|
|
1060
|
void CancelModeDeep();
|
1061
|
|
1062
|
void SetCaret(int x, int y, int cx, int cy);
|
1063
|
void SetCaret(const Rect& r);
|
1064
|
Rect GetCaret() const;
|
1065
|
void KillCaret();
|
1066
|
|
1067
|
static Ctrl *GetFocusCtrl() { return FocusCtrl(); }
|
1068
|
|
1069
|
static Ctrl *GetEventTopCtrl() { return eventCtrl; }
|
1070
|
|
1071
|
static bool IterateFocusForward(Ctrl *ctrl, Ctrl *top, bool noframe = false, bool init = false, bool all = false);
|
1072
|
static bool IterateFocusBackward(Ctrl *ctrl, Ctrl *top, bool noframe = false, bool all = false);
|
1073
|
|
1074
|
static dword AccessKeyBit(int accesskey);
|
1075
|
dword GetAccessKeysDeep() const;
|
1076
|
void DistributeAccessKeys();
|
1077
|
bool VisibleAccessKeys();
|
1078
|
|
1079
|
void Show(bool show = true);
|
1080
|
void Hide() { Show(false); }
|
1081
|
bool IsShown() const { return visible; }
|
1082
|
bool IsVisible() const;
|
1083
|
|
1084
|
void Enable(bool enable = true);
|
1085
|
void Disable() { Enable(false); }
|
1086
|
bool IsEnabled() const { return enabled; }
|
1087
|
|
1088
|
Ctrl& SetEditable(bool editable = true);
|
1089
|
Ctrl& SetReadOnly() { return SetEditable(false); }
|
1090
|
bool IsEditable() const { return editable; }
|
1091
|
bool IsReadOnly() const { return !editable; }
|
1092
|
|
1093
|
void ResetModify() { modify = false; }
|
1094
|
bool IsModifySet() const { return modify; }
|
1095
|
|
1096
|
void UpdateRefresh();
|
1097
|
void Update();
|
1098
|
void Action();
|
1099
|
void UpdateAction();
|
1100
|
void UpdateActionRefresh();
|
1101
|
|
1102
|
Ctrl& BackPaint(int bp = FULLBACKPAINT) { backpaint = bp; return *this; }
|
1103
|
Ctrl& TransparentBackPaint() { backpaint = TRANSPARENTBACKPAINT; return *this; }
|
1104
|
Ctrl& NoBackPaint() { return BackPaint(NOBACKPAINT); }
|
1105
|
Ctrl& BackPaintHint();
|
1106
|
int GetBackPaint() const { return backpaint; }
|
1107
|
Ctrl& Transparent(bool bp = true) { transparent = bp; return *this; }
|
1108
|
Ctrl& NoTransparent() { return Transparent(false); }
|
1109
|
bool IsTransparent() const { return transparent; }
|
1110
|
|
1111
|
Ctrl& Info(const char *txt) { info = txt; return *this; }
|
1112
|
String GetInfo() const { return info; }
|
1113
|
|
1114
|
Ctrl& Tip(const char *txt);
|
1115
|
Ctrl& HelpLine(const char *txt);
|
1116
|
Ctrl& Description(const char *txt);
|
1117
|
Ctrl& HelpTopic(const char *txt);
|
1118
|
Ctrl& LayoutId(const char *txt);
|
1119
|
|
1120
|
String GetTip() const;
|
1121
|
String GetHelpLine() const;
|
1122
|
String GetDescription() const;
|
1123
|
String GetHelpTopic() const;
|
1124
|
String GetLayoutId() const;
|
1125
|
|
1126
|
void Add(Ctrl& ctrl) { AddChild(&ctrl); }
|
1127
|
Ctrl& operator<<(Ctrl& ctrl) { Add(ctrl); return *this; }
|
1128
|
|
1129
|
void Remove();
|
1130
|
|
1131
|
Value operator~() const { return GetData(); }
|
1132
|
const Value& operator<<=(const Value& v) { SetData(v); return v; }
|
1133
|
bool IsNullInstance() const { return GetData().IsNull(); }
|
1134
|
|
1135
|
Callback operator<<=(Callback action) { WhenAction = action; return action; }
|
1136
|
Callback& operator<<(Callback action) { return WhenAction << action; }
|
1137
|
|
1138
|
void SetTimeCallback(int delay_ms, Callback cb, int id = 0);
|
1139
|
void KillTimeCallback(int id = 0);
|
1140
|
void KillSetTimeCallback(int delay_ms, Callback cb, int id);
|
1141
|
bool ExistsTimeCallback(int id = 0) const;
|
1142
|
void PostCallback(Callback cb, int id = 0);
|
1143
|
void KillPostCallback(Callback cb, int id);
|
1144
|
|
1145
|
enum { TIMEID_COUNT = 1 };
|
1146
|
|
1147
|
static Ctrl *GetActiveCtrl();
|
1148
|
static Ctrl *GetActiveWindow();
|
1149
|
|
1150
|
static Ctrl *GetVisibleChild(Ctrl *ctrl, Point p, bool pointinframe);
|
1151
|
|
1152
|
void PopUp(Ctrl *owner = NULL, bool savebits = true, bool activate = true, bool dropshadow = false,
|
1153
|
bool topmost = false);
|
1154
|
|
1155
|
void SetAlpha(byte alpha);
|
1156
|
|
1157
|
static bool IsWaitingEvent();
|
1158
|
static bool ProcessEvent(bool *quit = NULL);
|
1159
|
static bool ProcessEvents(bool *quit = NULL);
|
1160
|
|
1161
|
bool IsPopUp() const { return popup; }
|
1162
|
|
1163
|
static void EventLoop(Ctrl *loopctrl = NULL);
|
1164
|
static int GetLoopLevel() { return LoopLevel; }
|
1165
|
static Ctrl *GetLoopCtrl() { return LoopCtrl; }
|
1166
|
|
1167
|
void EndLoop();
|
1168
|
void EndLoop(int code);
|
1169
|
bool InLoop() const;
|
1170
|
bool InCurrentLoop() const;
|
1171
|
int GetExitCode() const;
|
1172
|
|
1173
|
static PasteClip& Clipboard();
|
1174
|
static PasteClip& Selection();
|
1175
|
|
1176
|
void SetSelectionSource(const char *fmts);
|
1177
|
|
1178
|
int DoDragAndDrop(const char *fmts, const Image& sample, dword actions,
|
1179
|
const VectorMap<String, ClipData>& data);
|
1180
|
int DoDragAndDrop(const char *fmts, const Image& sample = Null, dword actions = DND_ALL);
|
1181
|
int DoDragAndDrop(const VectorMap<String, ClipData>& data, const Image& sample = Null,
|
1182
|
dword actions = DND_ALL);
|
1183
|
static Ctrl *GetDragAndDropSource();
|
1184
|
static Ctrl *GetDragAndDropTarget();
|
1185
|
bool IsDragAndDropSource() { return this == GetDragAndDropSource(); }
|
1186
|
bool IsDragAndDropTarget() { return this == GetDragAndDropTarget(); }
|
1187
|
static Size StdSampleSize() { return Size(126, 106); }
|
1188
|
|
1189
|
void SetMinSize(Size sz) {}
|
1190
|
|
1191
|
public:
|
1192
|
static void SetSkin(void (*skin)());
|
1193
|
|
1194
|
static const char *GetZoomText();
|
1195
|
static void SetZoomSize(Size sz, Size bsz = Size(0, 0));
|
1196
|
static int HorzLayoutZoom(int cx);
|
1197
|
static int VertLayoutZoom(int cy);
|
1198
|
static Size LayoutZoom(int cx, int cy);
|
1199
|
static Size LayoutZoom(Size sz);
|
1200
|
static void NoLayoutZoom();
|
1201
|
static void GetZoomRatio(Size& m, Size& d);
|
1202
|
|
1203
|
static int HZoom(int cx) { return HorzLayoutZoom(cx); }
|
1204
|
|
1205
|
static bool ClickFocus();
|
1206
|
static void ClickFocus(bool cf);
|
1207
|
|
1208
|
static Rect GetVirtualWorkArea();
|
1209
|
static Rect GetVirtualScreenArea();
|
1210
|
static Rect GetPrimaryWorkArea();
|
1211
|
static Rect GetPrimaryScreenArea();
|
1212
|
static void GetWorkArea(Array<Rect>& rc);
|
1213
|
static Rect GetWorkArea(Point pt);
|
1214
|
static Rect GetMouseWorkArea() { return GetWorkArea(GetMousePos()); }
|
1215
|
static int GetKbdDelay();
|
1216
|
static int GetKbdSpeed();
|
1217
|
static bool IsAlphaSupported();
|
1218
|
static Rect GetDefaultWindowRect();
|
1219
|
static String GetAppName();
|
1220
|
static void SetAppName(const String& appname);
|
1221
|
static bool IsCompositedGui();
|
1222
|
|
1223
|
static void GlobalBackPaint(bool b = true);
|
1224
|
static void GlobalBackPaintHint();
|
1225
|
static void GlobalBackBuffer(bool b = true);
|
1226
|
|
1227
|
static void ReSkin();
|
1228
|
|
1229
|
String Name() const;
|
1230
|
static String Name(Ctrl *ctrl);
|
1231
|
|
1232
|
#ifdef _DEBUG
|
1233
|
virtual void Dump() const;
|
1234
|
virtual void Dump(Stream& s) const;
|
1235
|
|
1236
|
static bool LogMessages;
|
1237
|
#endif
|
1238
|
|
1239
|
static void ShowRepaint(int ms);
|
1240
|
|
1241
|
static bool MemoryCheck;
|
1242
|
|
1243
|
static void GuiSleep(int ms);
|
1244
|
|
1245
|
static void SetTimerGranularity(int ms);
|
1246
|
|
1247
|
static void Call(Callback cb);
|
1248
|
|
1249
|
#ifdef _MULTITHREADED
|
1250
|
static bool IsShutdownThreads() { return Thread::IsShutdownThreads(); }
|
1251
|
static void ShutdownThreads();
|
1252
|
#endif
|
1253
|
|
1254
|
static int64 GetEventId() { return eventid; }
|
1255
|
|
1256
|
Ctrl();
|
1257
|
virtual ~Ctrl();
|
1258
|
};
|
1259
|
|
1260
|
inline Size GetScreenSize() { return Ctrl::GetVirtualScreenArea().GetSize(); }
|
1261
|
|
1262
|
bool GuiPlatformHasSizeGrip();
|
1263
|
void GuiPlatformGripResize(TopWindow *q);
|
1264
|
Color GuiPlatformGetScreenPixel(int x, int y);
|
1265
|
void GuiPlatformAfterMenuPopUp();
|
1266
|
|
1267
|
Font FontZ(int face, int height = 0);
|
1268
|
|
1269
|
Font StdFontZ(int height = 0);
|
1270
|
Font SansSerifZ(int height = 0);
|
1271
|
Font SerifZ(int height = 0);
|
1272
|
Font MonospaceZ(int height = 0);
|
1273
|
|
1274
|
Font ScreenSansZ(int height = 0);
|
1275
|
Font ScreenSerifZ(int height = 0);
|
1276
|
Font ScreenFixedZ(int height = 0);
|
1277
|
Font RomanZ(int height = 0);
|
1278
|
Font ArialZ(int height = 0);
|
1279
|
Font CourierZ(int height = 0);
|
1280
|
|
1281
|
int EditFieldIsThin();
|
1282
|
Value TopSeparator1();
|
1283
|
Value TopSeparator2();
|
1284
|
int FrameButtonWidth();
|
1285
|
int ScrollBarArrowSize();
|
1286
|
Color FieldFrameColor();
|
1287
|
|
1288
|
enum { GUISTYLE_FLAT, GUISTYLE_CLASSIC, GUISTYLE_XP, GUISTYLE_X };
|
1289
|
int GUI_GlobalStyle();
|
1290
|
|
1291
|
int GUI_DragFullWindow();
|
1292
|
|
1293
|
enum { GUIEFFECT_NONE, GUIEFFECT_SLIDE, GUIEFFECT_FADE };
|
1294
|
int GUI_PopUpEffect();
|
1295
|
|
1296
|
int GUI_ToolTipDelay();
|
1297
|
|
1298
|
int GUI_DropShadows();
|
1299
|
int GUI_AltAccessKeys();
|
1300
|
int GUI_AKD_Conservative();
|
1301
|
int GUI_DragDistance();
|
1302
|
int GUI_DblClickTime();
|
1303
|
|
1304
|
void GUI_GlobalStyle_Write(int);
|
1305
|
void GUI_DragFullWindow_Write(int);
|
1306
|
void GUI_PopUpEffect_Write(int);
|
1307
|
void GUI_ToolTipDelay_Write(int);
|
1308
|
void GUI_DropShadows_Write(int);
|
1309
|
void GUI_AltAccessKeys_Write(int);
|
1310
|
void GUI_AKD_Conservative_Write(int);
|
1311
|
void GUI_DragDistance_Write(int);
|
1312
|
void GUI_DblClickTime_Write(int);
|
1313
|
|
1314
|
void EditFieldIsThin_Write(int);
|
1315
|
void TopSeparator1_Write(Value);
|
1316
|
void TopSeparator2_Write(Value);
|
1317
|
void FrameButtonWidth_Write(int);
|
1318
|
void ScrollBarArrowSize_Write(int);
|
1319
|
void FieldFrameColor_Write(Color);
|
1320
|
|
1321
|
String Name(const Ctrl *ctrl);
|
1322
|
String Desc(const Ctrl *ctrl);
|
1323
|
void Dump(const Ctrl *ctrl);
|
1324
|
|
1325
|
inline Ctrl *operator<<(Ctrl *parent, Ctrl& child)
|
1326
|
{
|
1327
|
parent->Add(child);
|
1328
|
return parent;
|
1329
|
}
|
1330
|
|
1331
|
inline unsigned GetHashValue(Ctrl *x)
|
1332
|
{
|
1333
|
return (unsigned)(intptr_t)x;
|
1334
|
}
|
1335
|
|
1336
|
String GetKeyDesc(dword key);
|
1337
|
|
1338
|
Vector< Ptr<Ctrl> > DisableCtrls(const Vector<Ctrl *>& ctrl, Ctrl *exclude = NULL);
|
1339
|
void EnableCtrls(const Vector< Ptr<Ctrl> >& ctrl);
|
1340
|
|
1341
|
template <class T>
|
1342
|
class FrameCtrl : public T, public CtrlFrame {
|
1343
|
public:
|
1344
|
virtual void FrameAdd(Ctrl& parent) { parent.Add(*this); }
|
1345
|
virtual void FrameRemove() { this->Ctrl::Remove(); }
|
1346
|
|
1347
|
FrameCtrl() { this->NoWantFocus(); }
|
1348
|
};
|
1349
|
|
1350
|
template <class T>
|
1351
|
class FrameLR : public FrameCtrl<T> {
|
1352
|
public:
|
1353
|
virtual void FrameAddSize(Size& sz) { sz.cx += (cx ? cx : sz.cy) * this->IsShown(); }
|
1354
|
|
1355
|
protected:
|
1356
|
int cx;
|
1357
|
|
1358
|
public:
|
1359
|
FrameLR& Width(int _cx) { cx = _cx; this->RefreshParentLayout(); return *this; }
|
1360
|
int GetWidth() const { return cx; }
|
1361
|
FrameLR() { cx = 0; }
|
1362
|
};
|
1363
|
|
1364
|
template <class T>
|
1365
|
class FrameLeft : public FrameLR<T> {
|
1366
|
public:
|
1367
|
virtual void FrameLayout(Rect& r) {
|
1368
|
LayoutFrameLeft(r, this, this->cx ? this->cx : FrameButtonWidth());
|
1369
|
}
|
1370
|
};
|
1371
|
|
1372
|
template <class T>
|
1373
|
class FrameRight : public FrameLR<T> {
|
1374
|
public:
|
1375
|
virtual void FrameLayout(Rect& r) {
|
1376
|
LayoutFrameRight(r, this, this->cx ? this->cx : FrameButtonWidth());
|
1377
|
}
|
1378
|
};
|
1379
|
|
1380
|
template <class T>
|
1381
|
class FrameTB : public FrameCtrl<T> {
|
1382
|
public:
|
1383
|
virtual void FrameAddSize(Size& sz) { sz.cy += (cy ? cy : sz.cx) * this->IsShown(); }
|
1384
|
|
1385
|
protected:
|
1386
|
int cy;
|
1387
|
|
1388
|
public:
|
1389
|
FrameTB& Height(int _cy) { cy = _cy; this->RefreshParentLayout(); return *this; }
|
1390
|
int GetHeight() const { return cy; }
|
1391
|
FrameTB() { cy = 0; }
|
1392
|
};
|
1393
|
|
1394
|
template <class T>
|
1395
|
class FrameTop : public FrameTB<T> {
|
1396
|
public:
|
1397
|
virtual void FrameLayout(Rect& r) {
|
1398
|
LayoutFrameTop(r, this, this->cy ? this->cy : r.Width());
|
1399
|
}
|
1400
|
};
|
1401
|
|
1402
|
template <class T>
|
1403
|
class FrameBottom : public FrameTB<T> {
|
1404
|
public:
|
1405
|
virtual void FrameLayout(Rect& r) {
|
1406
|
LayoutFrameBottom(r, this, this->cy ? this->cy : r.Width());
|
1407
|
}
|
1408
|
};
|
1409
|
|
1410
|
class Modality {
|
1411
|
Ptr<Ctrl> active;
|
1412
|
bool fore_only;
|
1413
|
Vector< Ptr<Ctrl> > enable;
|
1414
|
|
1415
|
public:
|
1416
|
void Begin(Ctrl *modal, bool fore_only = false);
|
1417
|
void End();
|
1418
|
|
1419
|
~Modality() { End(); }
|
1420
|
};
|
1421
|
|
1422
|
class LocalLoop : public Ctrl {
|
1423
|
public:
|
1424
|
virtual void CancelMode();
|
1425
|
|
1426
|
private:
|
1427
|
Ctrl *master;
|
1428
|
|
1429
|
public:
|
1430
|
void Run();
|
1431
|
void SetMaster(Ctrl& m) { master = &m; }
|
1432
|
Ctrl& GetMaster() const { return *master; }
|
1433
|
|
1434
|
LocalLoop() { master = NULL; }
|
1435
|
};
|
1436
|
|
1437
|
enum {
|
1438
|
DRAWDRAGRECT_SOLID, DRAWDRAGRECT_NORMAL, DRAWDRAGRECT_DASHED
|
1439
|
};
|
1440
|
|
1441
|
void DrawDragRect(Ctrl& q, const Rect& rect1, const Rect& rect2, const Rect& clip, int n,
|
1442
|
Color color, int type, int animation);
|
1443
|
void FinishDragRect(Ctrl& q);
|
1444
|
|
1445
|
bool PointLoop(Ctrl& ctrl, const Vector<Image>& ani, int ani_ms);
|
1446
|
bool PointLoop(Ctrl& ctrl, const Image& img);
|
1447
|
|
1448
|
class RectTracker : public LocalLoop {
|
1449
|
public:
|
1450
|
virtual void LeftUp(Point, dword);
|
1451
|
virtual void RightUp(Point, dword);
|
1452
|
virtual void MouseMove(Point p, dword);
|
1453
|
virtual Image CursorImage(Point, dword);
|
1454
|
|
1455
|
public:
|
1456
|
struct Rounder {
|
1457
|
virtual Rect Round(const Rect& r) = 0;
|
1458
|
virtual ~Rounder() {}
|
1459
|
};
|
1460
|
|
1461
|
protected:
|
1462
|
Rect rect;
|
1463
|
int tx, ty;
|
1464
|
Rect maxrect;
|
1465
|
Size minsize, maxsize;
|
1466
|
bool keepratio;
|
1467
|
Rect clip;
|
1468
|
Color color;
|
1469
|
Image cursorimage;
|
1470
|
int width;
|
1471
|
int pattern;
|
1472
|
int animation;
|
1473
|
int panim;
|
1474
|
Rounder *rounder;
|
1475
|
|
1476
|
Rect org;
|
1477
|
Rect o;
|
1478
|
Point op;
|
1479
|
|
1480
|
Rect Round(const Rect& r);
|
1481
|
|
1482
|
virtual void DrawRect(Rect r1, Rect r2);
|
1483
|
|
1484
|
public:
|
1485
|
Callback1<Rect> sync;
|
1486
|
Callback1<Rect&> round;
|
1487
|
|
1488
|
RectTracker& SetCursorImage(const Image& m) { cursorimage = m; return *this; }
|
1489
|
RectTracker& MinSize(Size sz) { minsize = sz; return *this; }
|
1490
|
RectTracker& MaxSize(Size sz) { maxsize = sz; return *this; }
|
1491
|
RectTracker& MaxRect(const Rect& mr) { maxrect = mr; return *this; }
|
1492
|
RectTracker& Clip(const Rect& c) { clip = c; return *this; }
|
1493
|
RectTracker& Width(int n) { width = n; return *this; }
|
1494
|
RectTracker& SetColor(Color c) { color = c; return *this; }
|
1495
|
RectTracker& Pattern(int p) { pattern = p; return *this; }
|
1496
|
RectTracker& Dashed() { return Pattern(DRAWDRAGRECT_DASHED); }
|
1497
|
RectTracker& Solid() { return Pattern(DRAWDRAGRECT_SOLID); }
|
1498
|
RectTracker& Normal() { return Pattern(DRAWDRAGRECT_NORMAL); }
|
1499
|
RectTracker& Animation(int step_ms = 40) { animation = step_ms; return *this; }
|
1500
|
RectTracker& KeepRatio(bool b) { keepratio = b; return *this; }
|
1501
|
RectTracker& Round(Rounder& r) { rounder = &r; return *this; }
|
1502
|
|
1503
|
Rect Get() { return rect; }
|
1504
|
|
1505
|
Rect Track(const Rect& r, int tx = ALIGN_RIGHT, int ty = ALIGN_BOTTOM);
|
1506
|
int TrackHorzLine(int x0, int y0, int cx, int line);
|
1507
|
int TrackVertLine(int x0, int y0, int cy, int line);
|
1508
|
|
1509
|
RectTracker(Ctrl& master);
|
1510
|
virtual ~RectTracker();
|
1511
|
};
|
1512
|
|
1513
|
class WaitCursor {
|
1514
|
Image prev;
|
1515
|
bool flag;
|
1516
|
|
1517
|
public:
|
1518
|
void Show();
|
1519
|
|
1520
|
WaitCursor(bool show = true);
|
1521
|
~WaitCursor();
|
1522
|
};
|
1523
|
|
1524
|
class AutoWaitCursor : public WaitCursor {
|
1525
|
protected:
|
1526
|
int& avg;
|
1527
|
int time0;
|
1528
|
|
1529
|
public:
|
1530
|
void Cancel() { time0 = 0; }
|
1531
|
|
1532
|
AutoWaitCursor(int& avg);
|
1533
|
~AutoWaitCursor();
|
1534
|
};
|
1535
|
|
1536
|
void ClearClipboard();
|
1537
|
void AppendClipboard(const char *format, const byte *data, int length);
|
1538
|
void AppendClipboard(const char *format, const String& data);
|
1539
|
void AppendClipboard(const char *format, const Value& data, String (*render)(const Value& data));
|
1540
|
String ReadClipboard(const char *format);
|
1541
|
bool IsClipboardAvailable(const char *format);
|
1542
|
|
1543
|
inline void WriteClipboard(const char *format, const String& data)
|
1544
|
{ ClearClipboard(); AppendClipboard(format, data); }
|
1545
|
|
1546
|
void AppendClipboardText(const String& s);
|
1547
|
String ReadClipboardText();
|
1548
|
void AppendClipboardUnicodeText(const WString& s);
|
1549
|
WString ReadClipboardUnicodeText();
|
1550
|
bool IsClipboardAvailableText();
|
1551
|
|
1552
|
inline void WriteClipboardText(const String& s)
|
1553
|
{ ClearClipboard(); AppendClipboardText(s); }
|
1554
|
inline void WriteClipboardUnicodeText(const WString& s)
|
1555
|
{ ClearClipboard(); AppendClipboardUnicodeText(s); }
|
1556
|
|
1557
|
template <class T>
|
1558
|
inline void AppendClipboardFormat(const T& object) {
|
1559
|
AppendClipboard(typeid(T).name(), StoreAsString(const_cast<T&>(object)));
|
1560
|
}
|
1561
|
|
1562
|
template <class T>
|
1563
|
inline void WriteClipboardFormat(const T& object) {
|
1564
|
ClearClipboard();
|
1565
|
AppendClipboardFormat(object);
|
1566
|
}
|
1567
|
|
1568
|
template <class T>
|
1569
|
inline bool ReadClipboardFormat(T& object)
|
1570
|
{
|
1571
|
String s = ReadClipboard(typeid(T).name());
|
1572
|
return !IsNull(s) && LoadFromString(object, s);
|
1573
|
}
|
1574
|
|
1575
|
template <class T>
|
1576
|
bool IsClipboardFormatAvailable()
|
1577
|
{
|
1578
|
return IsClipboardAvailable(typeid(T).name());
|
1579
|
}
|
1580
|
|
1581
|
template <class T>
|
1582
|
inline T ReadClipboardFormat() {
|
1583
|
T object;
|
1584
|
ReadClipboardFormat(object);
|
1585
|
return object;
|
1586
|
}
|
1587
|
|
1588
|
Image ReadClipboardImage();
|
1589
|
void AppendClipboardImage(const Image& img);
|
1590
|
|
1591
|
inline void WriteClipboardImage(const Image& img)
|
1592
|
{ ClearClipboard(); AppendClipboardImage(img); }
|
1593
|
|
1594
|
bool (*&DisplayErrorFn())(const Value& v);
|
1595
|
inline bool DisplayError(const Value& v) { return DisplayErrorFn()(v); }
|
1596
|
|
1597
|
void EncodeRTF(Stream& stream, const RichText& richtext, byte charset,
|
1598
|
Size dot_page_size = Size(4960, 7015), const Rect& dot_margin = Rect(472, 472, 472, 472),
|
1599
|
void *context = NULL);
|
1600
|
String EncodeRTF(const RichText& richtext, byte charset,
|
1601
|
Size dot_page_size = Size(4960, 7015), const Rect& dot_margin = Rect(472, 472, 472, 472),
|
1602
|
void *context = NULL);
|
1603
|
String EncodeRTF(const RichText& richtext, byte charset, int dot_page_width);
|
1604
|
String EncodeRTF(const RichText& richtext);
|
1605
|
RichText ParseRTF(const char *rtf);
|
1606
|
|
1607
|
#include <CtrlCore/TopWindow.h>
|
1608
|
|
1609
|
#include GUIPLATFORM_INCLUDE_AFTER
|
1610
|
|
1611
|
END_UPP_NAMESPACE
|
1612
|
|
1613
|
#endif
|