1
|
#include "CtrlCore.h"
|
2
|
|
3
|
#ifdef GUI_WIN
|
4
|
|
5
|
#define LLOG(x)
|
6
|
|
7
|
NAMESPACE_UPP
|
8
|
|
9
|
void Ctrl::GuiPlatformConstruct()
|
10
|
{
|
11
|
activex = false;
|
12
|
isdhctrl = false;
|
13
|
}
|
14
|
|
15
|
void Ctrl::GuiPlatformDestruct()
|
16
|
{
|
17
|
}
|
18
|
|
19
|
void Ctrl::GuiPlatformRemove()
|
20
|
{
|
21
|
}
|
22
|
|
23
|
void Ctrl::GuiPlatformGetTopRect(Rect& r) const
|
24
|
{
|
25
|
if(activex)
|
26
|
r = GetWndScreenRect();
|
27
|
}
|
28
|
|
29
|
bool Ctrl::GuiPlatformRefreshFrameSpecial(const Rect& r)
|
30
|
{
|
31
|
if(isdhctrl) {
|
32
|
InvalidateRect(((DHCtrl *)this)->GetHWND(), r, false);
|
33
|
return true;
|
34
|
}
|
35
|
return false;
|
36
|
}
|
37
|
|
38
|
bool Ctrl::GuiPlatformSetFullRefreshSpecial()
|
39
|
{
|
40
|
return isdhctrl;
|
41
|
}
|
42
|
|
43
|
void Ctrl::GuiPlatformSelection(PasteClip&)
|
44
|
{
|
45
|
}
|
46
|
|
47
|
void GuiPlatformAdjustDragImage(ImageBuffer&)
|
48
|
{
|
49
|
}
|
50
|
|
51
|
bool GuiPlatformHasSizeGrip()
|
52
|
{
|
53
|
return true;
|
54
|
}
|
55
|
|
56
|
void GuiPlatformGripResize(TopWindow *q)
|
57
|
{
|
58
|
LLOG("GuiPlatformGripResize " << Name(q));
|
59
|
HWND hwnd = q->GetHWND();
|
60
|
Point p = GetMousePos() - q->GetRect().TopLeft();
|
61
|
if(hwnd) {
|
62
|
::SendMessage(hwnd, WM_SYSCOMMAND, 0xf008, MAKELONG(p.x, p.y));
|
63
|
::SendMessage(hwnd, WM_LBUTTONUP, 0, MAKELONG(p.x, p.y));
|
64
|
}
|
65
|
}
|
66
|
|
67
|
Color GuiPlatformGetScreenPixel(int x, int y)
|
68
|
{
|
69
|
HDC sdc = GetWindowDC(0);
|
70
|
Color c = Color::FromCR(GetPixel(sdc, x, y));
|
71
|
ReleaseDC(0, sdc);
|
72
|
return c;
|
73
|
}
|
74
|
|
75
|
void GuiPlatformAfterMenuPopUp()
|
76
|
{
|
77
|
}
|
78
|
|
79
|
#if WINCARET
|
80
|
void Ctrl::SetCaret(int x, int y, int cx, int cy)
|
81
|
{
|
82
|
GuiLock __;
|
83
|
caretx = x;
|
84
|
carety = y;
|
85
|
caretcx = cx;
|
86
|
caretcy = cy;
|
87
|
SyncCaret();
|
88
|
}
|
89
|
|
90
|
void Ctrl::SyncCaret() {
|
91
|
GuiLock __;
|
92
|
Rect cr;
|
93
|
cr.Clear();
|
94
|
if(focusCtrl && focusCtrl->IsVisible()) {
|
95
|
bool inframe = focusCtrl->InFrame();
|
96
|
cr = focusCtrl->GetScreenView();
|
97
|
cr = RectC(focusCtrl->caretx + cr.left, focusCtrl->carety + cr.top,
|
98
|
focusCtrl->caretcx, focusCtrl->caretcy) & cr;
|
99
|
for(Ctrl *q = focusCtrl->GetParent(); q; q = q->GetParent()) {
|
100
|
cr &= inframe ? q->GetScreenRect() : q->GetScreenView();
|
101
|
inframe = q->InFrame();
|
102
|
}
|
103
|
}
|
104
|
if(focusCtrl != caretCtrl || cr != caretRect) {
|
105
|
LLOG("Do SyncCaret focusCtrl: " << UPP::Name(focusCtrl)
|
106
|
<< ", caretCtrl: " << UPP::Name(caretCtrl)
|
107
|
<< ", cr: " << cr);
|
108
|
WndDestroyCaret();
|
109
|
if(focusCtrl && !cr.IsEmpty())
|
110
|
focusCtrl->GetTopCtrl()->WndCreateCaret(cr);
|
111
|
caretCtrl = focusCtrl;
|
112
|
caretRect = cr;
|
113
|
}
|
114
|
}
|
115
|
#endif
|
116
|
|
117
|
String Ctrl::Name() const {
|
118
|
GuiLock __;
|
119
|
String s = Name0();
|
120
|
if(!IsChild())
|
121
|
s << Format(" (hwnd 0x%x)", (int)(intptr_t) GetHWND());
|
122
|
return s;
|
123
|
}
|
124
|
|
125
|
END_UPP_NAMESPACE
|
126
|
|
127
|
#endif
|