OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fwl/core/fwl_formimp.h" | 7 #include "xfa/fwl/core/ifwl_form.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" | |
11 #include "xfa/fwl/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
12 #include "xfa/fwl/core/cfwl_themebackground.h" | 11 #include "xfa/fwl/core/cfwl_themebackground.h" |
13 #include "xfa/fwl/core/cfwl_themepart.h" | 12 #include "xfa/fwl/core/cfwl_themepart.h" |
14 #include "xfa/fwl/core/cfwl_themetext.h" | 13 #include "xfa/fwl/core/cfwl_themetext.h" |
15 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 14 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
16 #include "xfa/fwl/core/fwl_noteimp.h" | 15 #include "xfa/fwl/core/fwl_noteimp.h" |
17 #include "xfa/fwl/core/fwl_widgetimp.h" | |
18 #include "xfa/fwl/core/ifwl_app.h" | 16 #include "xfa/fwl/core/ifwl_app.h" |
| 17 #include "xfa/fwl/core/ifwl_formproxy.h" |
19 #include "xfa/fwl/core/ifwl_themeprovider.h" | 18 #include "xfa/fwl/core/ifwl_themeprovider.h" |
20 #include "xfa/fwl/theme/cfwl_widgettp.h" | 19 #include "xfa/fwl/theme/cfwl_widgettp.h" |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
24 const int kSystemButtonSize = 21; | 23 const int kSystemButtonSize = 21; |
25 const int kSystemButtonMargin = 5; | 24 const int kSystemButtonMargin = 5; |
26 const int kSystemButtonSpan = 2; | 25 const int kSystemButtonSpan = 2; |
27 | 26 |
28 } // namespace | 27 } // namespace |
29 | 28 |
30 namespace { | 29 namespace { |
31 | 30 |
32 const uint8_t kCornerEnlarge = 10; | 31 const uint8_t kCornerEnlarge = 10; |
33 | 32 |
34 } // namespace | 33 } // namespace |
35 | 34 |
36 // static | 35 RestoreInfo::RestoreInfo() {} |
37 IFWL_Form* IFWL_Form::CreateFormProxy(CFWL_WidgetImpProperties& properties, | |
38 CFX_WideString* classname, | |
39 IFWL_Widget* pOuter) { | |
40 IFWL_Form* pForm = new IFWL_Form; | |
41 CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter); | |
42 pForm->SetImpl(pFormProxyImpl); | |
43 pFormProxyImpl->SetInterface(pForm); | |
44 return pForm; | |
45 } | |
46 IFWL_Form::IFWL_Form() {} | |
47 FWL_FORMSIZE IFWL_Form::GetFormSize() { | |
48 return static_cast<CFWL_FormImp*>(GetImpl())->GetFormSize(); | |
49 } | |
50 FWL_Error IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { | |
51 return static_cast<CFWL_FormImp*>(GetImpl())->SetFormSize(eFormSize); | |
52 } | |
53 IFWL_Widget* IFWL_Form::DoModal() { | |
54 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(); | |
55 } | |
56 IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { | |
57 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(dwCommandID); | |
58 } | |
59 FWL_Error IFWL_Form::EndDoModal() { | |
60 return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal(); | |
61 } | |
62 FWL_Error IFWL_Form::SetBorderRegion(CFX_Path* pPath) { | |
63 return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); | |
64 } | |
65 | 36 |
66 RestoreResizeInfo::RestoreResizeInfo() {} | 37 RestoreInfo::~RestoreInfo() {} |
67 | 38 |
68 RestoreResizeInfo::~RestoreResizeInfo() {} | 39 IFWL_Form::IFWL_Form(const CFWL_WidgetImpProperties& properties, |
69 | 40 IFWL_Widget* pOuter) |
70 CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, | 41 : IFWL_Widget(properties, pOuter), |
71 IFWL_Widget* pOuter) | |
72 : CFWL_WidgetImp(properties, pOuter), | |
73 m_pCloseBox(nullptr), | 42 m_pCloseBox(nullptr), |
74 m_pMinBox(nullptr), | 43 m_pMinBox(nullptr), |
75 m_pMaxBox(nullptr), | 44 m_pMaxBox(nullptr), |
76 m_pCaptionBox(nullptr), | 45 m_pCaptionBox(nullptr), |
77 m_pSubFocus(nullptr), | 46 m_pSubFocus(nullptr), |
78 m_fCXBorder(0), | 47 m_fCXBorder(0), |
79 m_fCYBorder(0), | 48 m_fCYBorder(0), |
80 m_iCaptureBtn(-1), | 49 m_iCaptureBtn(-1), |
81 m_iSysBox(0), | 50 m_iSysBox(0), |
82 m_eResizeType(FORM_RESIZETYPE_None), | 51 m_eResizeType(FORM_RESIZETYPE_None), |
83 m_bLButtonDown(FALSE), | 52 m_bLButtonDown(FALSE), |
84 m_bMaximized(false), | 53 m_bMaximized(false), |
85 m_bSetMaximize(FALSE), | 54 m_bSetMaximize(FALSE), |
86 m_bCustomizeLayout(FALSE), | 55 m_bCustomizeLayout(FALSE), |
87 m_eFormSize(FWL_FORMSIZE_Manual), | 56 m_eFormSize(FWL_FORMSIZE_Manual), |
88 m_bDoModalFlag(FALSE), | 57 m_bDoModalFlag(FALSE), |
89 m_pBigIcon(nullptr), | 58 m_pBigIcon(nullptr), |
90 m_pSmallIcon(nullptr), | 59 m_pSmallIcon(nullptr), |
91 m_bMouseIn(FALSE) { | 60 m_bMouseIn(FALSE) { |
92 m_rtRelative.Reset(); | 61 m_rtRelative.Reset(); |
93 m_rtCaption.Reset(); | 62 m_rtCaption.Reset(); |
94 m_rtRestore.Reset(); | 63 m_rtRestore.Reset(); |
95 m_rtCaptionText.Reset(); | 64 m_rtCaptionText.Reset(); |
96 m_rtIcon.Reset(); | 65 m_rtIcon.Reset(); |
97 } | 66 } |
98 | 67 |
99 CFWL_FormImp::~CFWL_FormImp() { | 68 IFWL_Form::~IFWL_Form() { |
100 RemoveSysButtons(); | 69 RemoveSysButtons(); |
101 } | 70 } |
102 | 71 |
103 FWL_Error CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { | 72 FWL_Error IFWL_Form::GetClassName(CFX_WideString& wsClass) const { |
104 wsClass = FWL_CLASS_Form; | 73 wsClass = FWL_CLASS_Form; |
105 return FWL_Error::Succeeded; | 74 return FWL_Error::Succeeded; |
106 } | 75 } |
107 | 76 |
108 FWL_Type CFWL_FormImp::GetClassID() const { | 77 FWL_Type IFWL_Form::GetClassID() const { |
109 return FWL_Type::Form; | 78 return FWL_Type::Form; |
110 } | 79 } |
111 | 80 |
112 FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { | 81 FX_BOOL IFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const { |
113 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) | 82 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) |
114 return TRUE; | 83 return TRUE; |
115 return CFWL_WidgetImp::IsInstance(wsClass); | 84 return IFWL_Widget::IsInstance(wsClass); |
116 } | 85 } |
117 | 86 |
118 FWL_Error CFWL_FormImp::Initialize() { | 87 FWL_Error IFWL_Form::Initialize() { |
119 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) | 88 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) |
120 return FWL_Error::Indefinite; | 89 return FWL_Error::Indefinite; |
121 RegisterForm(); | 90 RegisterForm(); |
122 RegisterEventTarget(); | 91 RegisterEventTarget(); |
123 m_pDelegate = new CFWL_FormImpDelegate(this); | 92 m_pDelegate = new CFWL_FormImpDelegate(this); |
124 return FWL_Error::Succeeded; | 93 return FWL_Error::Succeeded; |
125 } | 94 } |
126 FWL_Error CFWL_FormImp::Finalize() { | 95 FWL_Error IFWL_Form::Finalize() { |
127 delete m_pDelegate; | 96 delete m_pDelegate; |
128 m_pDelegate = nullptr; | 97 m_pDelegate = nullptr; |
129 UnregisterEventTarget(); | 98 UnregisterEventTarget(); |
130 UnRegisterForm(); | 99 UnRegisterForm(); |
131 return CFWL_WidgetImp::Finalize(); | 100 return IFWL_Widget::Finalize(); |
132 } | 101 } |
133 FWL_Error CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 102 FWL_Error IFWL_Form::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
134 if (bAutoSize) { | 103 if (bAutoSize) { |
135 rect.Reset(); | 104 rect.Reset(); |
136 FX_FLOAT fCapHeight = GetCaptionHeight(); | 105 FX_FLOAT fCapHeight = GetCaptionHeight(); |
137 FX_FLOAT fCXBorder = GetBorderSize(TRUE); | 106 FX_FLOAT fCXBorder = GetBorderSize(TRUE); |
138 FX_FLOAT fCYBorder = GetBorderSize(FALSE); | 107 FX_FLOAT fCYBorder = GetBorderSize(FALSE); |
139 FX_FLOAT fEdge = GetEdgeWidth(); | 108 FX_FLOAT fEdge = GetEdgeWidth(); |
140 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; | 109 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; |
141 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; | 110 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; |
142 } else { | 111 } else { |
143 rect = m_pProperties->m_rtWidget; | 112 rect = m_pProperties->m_rtWidget; |
144 } | 113 } |
145 return FWL_Error::Succeeded; | 114 return FWL_Error::Succeeded; |
146 } | 115 } |
147 FWL_Error CFWL_FormImp::GetClientRect(CFX_RectF& rect) { | 116 FWL_Error IFWL_Form::GetClientRect(CFX_RectF& rect) { |
148 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { | 117 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { |
149 rect = m_pProperties->m_rtWidget; | 118 rect = m_pProperties->m_rtWidget; |
150 rect.Offset(-rect.left, -rect.top); | 119 rect.Offset(-rect.left, -rect.top); |
151 return FWL_Error::Succeeded; | 120 return FWL_Error::Succeeded; |
152 } | 121 } |
153 #ifdef FWL_UseMacSystemBorder | 122 #ifdef FWL_UseMacSystemBorder |
154 rect = m_rtRelative; | 123 rect = m_rtRelative; |
155 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 124 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
156 if (!pWidgetMgr) | 125 if (!pWidgetMgr) |
157 return FWL_Error::Indefinite; | 126 return FWL_Error::Indefinite; |
158 | 127 |
159 rect.left = 0; | 128 rect.left = 0; |
160 rect.top = 0; | 129 rect.top = 0; |
161 return FWL_Error::Succeeded; | 130 return FWL_Error::Succeeded; |
162 #else | 131 #else |
163 FX_FLOAT x = 0; | 132 FX_FLOAT x = 0; |
164 FX_FLOAT y = 0; | 133 FX_FLOAT y = 0; |
165 FX_FLOAT t = 0; | 134 FX_FLOAT t = 0; |
166 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 135 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
167 if (pTheme) { | 136 if (pTheme) { |
168 CFWL_ThemePart part; | 137 CFWL_ThemePart part; |
169 part.m_pWidget = m_pInterface; | 138 part.m_pWidget = this; |
170 x = *static_cast<FX_FLOAT*>( | 139 x = *static_cast<FX_FLOAT*>( |
171 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder)); | 140 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder)); |
172 y = *static_cast<FX_FLOAT*>( | 141 y = *static_cast<FX_FLOAT*>( |
173 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYBorder)); | 142 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYBorder)); |
174 t = *static_cast<FX_FLOAT*>( | 143 t = *static_cast<FX_FLOAT*>( |
175 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYCaption)); | 144 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYCaption)); |
176 } | 145 } |
177 rect = m_pProperties->m_rtWidget; | 146 rect = m_pProperties->m_rtWidget; |
178 rect.Offset(-rect.left, -rect.top); | 147 rect.Offset(-rect.left, -rect.top); |
179 rect.Deflate(x, t, x, y); | 148 rect.Deflate(x, t, x, y); |
180 return FWL_Error::Succeeded; | 149 return FWL_Error::Succeeded; |
181 #endif | 150 #endif |
182 } | 151 } |
183 FWL_Error CFWL_FormImp::Update() { | 152 FWL_Error IFWL_Form::Update() { |
184 if (m_iLock > 0) { | 153 if (m_iLock > 0) { |
185 return FWL_Error::Succeeded; | 154 return FWL_Error::Succeeded; |
186 } | 155 } |
187 if (!m_pProperties->m_pThemeProvider) { | 156 if (!m_pProperties->m_pThemeProvider) { |
188 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 157 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
189 } | 158 } |
190 #ifdef FWL_UseMacSystemBorder | 159 #ifdef FWL_UseMacSystemBorder |
191 #else | 160 #else |
192 SetThemeData(); | 161 SetThemeData(); |
193 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon) { | 162 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon) { |
194 UpdateIcon(); | 163 UpdateIcon(); |
195 } | 164 } |
196 #endif | 165 #endif |
197 UpdateCaption(); | 166 UpdateCaption(); |
198 Layout(); | 167 Layout(); |
199 return FWL_Error::Succeeded; | 168 return FWL_Error::Succeeded; |
200 } | 169 } |
201 FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 170 FWL_WidgetHit IFWL_Form::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
202 GetAvailableTheme(); | 171 GetAvailableTheme(); |
203 if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) | 172 if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) |
204 return FWL_WidgetHit::CloseBox; | 173 return FWL_WidgetHit::CloseBox; |
205 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) | 174 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) |
206 return FWL_WidgetHit::MaxBox; | 175 return FWL_WidgetHit::MaxBox; |
207 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) | 176 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) |
208 return FWL_WidgetHit::MinBox; | 177 return FWL_WidgetHit::MinBox; |
209 CFX_RectF rtCap; | 178 CFX_RectF rtCap; |
210 rtCap.Set(m_rtCaption.left + m_fCYBorder, m_rtCaption.top + m_fCXBorder, | 179 rtCap.Set(m_rtCaption.left + m_fCYBorder, m_rtCaption.top + m_fCXBorder, |
211 m_rtCaption.width - kSystemButtonSize * m_iSysBox - 2 * m_fCYBorder, | 180 m_rtCaption.width - kSystemButtonSize * m_iSysBox - 2 * m_fCYBorder, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 if (rt.Contains(fx, fy)) | 212 if (rt.Contains(fx, fy)) |
244 return FWL_WidgetHit::RightTop; | 213 return FWL_WidgetHit::RightTop; |
245 rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge, | 214 rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge, |
246 m_rtRelative.height - m_fCXBorder - kCornerEnlarge, | 215 m_rtRelative.height - m_fCXBorder - kCornerEnlarge, |
247 m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge); | 216 m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge); |
248 if (rt.Contains(fx, fy)) | 217 if (rt.Contains(fx, fy)) |
249 return FWL_WidgetHit::RightBottom; | 218 return FWL_WidgetHit::RightBottom; |
250 } | 219 } |
251 return FWL_WidgetHit::Client; | 220 return FWL_WidgetHit::Client; |
252 } | 221 } |
253 FWL_Error CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, | 222 FWL_Error IFWL_Form::DrawWidget(CFX_Graphics* pGraphics, |
254 const CFX_Matrix* pMatrix) { | 223 const CFX_Matrix* pMatrix) { |
255 if (!pGraphics) | 224 if (!pGraphics) |
256 return FWL_Error::Indefinite; | 225 return FWL_Error::Indefinite; |
257 if (!m_pProperties->m_pThemeProvider) | 226 if (!m_pProperties->m_pThemeProvider) |
258 return FWL_Error::Indefinite; | 227 return FWL_Error::Indefinite; |
259 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 228 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
260 FX_BOOL bInactive = !IsActive(); | 229 FX_BOOL bInactive = !IsActive(); |
261 int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; | 230 int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; |
262 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_NoDrawClient) == 0) { | 231 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_NoDrawClient) == 0) { |
263 DrawBackground(pGraphics, pTheme); | 232 DrawBackground(pGraphics, pTheme); |
264 } | 233 } |
265 #ifdef FWL_UseMacSystemBorder | 234 #ifdef FWL_UseMacSystemBorder |
266 return FWL_Error::Succeeded; | 235 return FWL_Error::Succeeded; |
267 #endif | 236 #endif |
268 CFWL_ThemeBackground param; | 237 CFWL_ThemeBackground param; |
269 param.m_pWidget = m_pInterface; | 238 param.m_pWidget = this; |
270 param.m_dwStates = iState; | 239 param.m_dwStates = iState; |
271 param.m_pGraphics = pGraphics; | 240 param.m_pGraphics = pGraphics; |
272 param.m_rtPart = m_rtRelative; | 241 param.m_rtPart = m_rtRelative; |
273 if (pMatrix) { | 242 if (pMatrix) { |
274 param.m_matrix.Concat(*pMatrix); | 243 param.m_matrix.Concat(*pMatrix); |
275 } | 244 } |
276 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { | 245 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { |
277 param.m_iPart = CFWL_Part::Border; | 246 param.m_iPart = CFWL_Part::Border; |
278 pTheme->DrawBackground(¶m); | 247 pTheme->DrawBackground(¶m); |
279 } | 248 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 param.m_iPart = CFWL_Part::MinimizeBox; | 331 param.m_iPart = CFWL_Part::MinimizeBox; |
363 param.m_dwStates = m_pMinBox->GetPartState(); | 332 param.m_dwStates = m_pMinBox->GetPartState(); |
364 param.m_rtPart = m_pMinBox->m_rtBtn; | 333 param.m_rtPart = m_pMinBox->m_rtBtn; |
365 pTheme->DrawBackground(¶m); | 334 pTheme->DrawBackground(¶m); |
366 } | 335 } |
367 } | 336 } |
368 #endif | 337 #endif |
369 return FWL_Error::Succeeded; | 338 return FWL_Error::Succeeded; |
370 } | 339 } |
371 | 340 |
372 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { | 341 FWL_FORMSIZE IFWL_Form::GetFormSize() { |
373 return m_eFormSize; | 342 return m_eFormSize; |
374 } | 343 } |
375 | 344 |
376 FWL_Error CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { | 345 FWL_Error IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { |
377 m_eFormSize = eFormSize; | 346 m_eFormSize = eFormSize; |
378 return FWL_Error::Succeeded; | 347 return FWL_Error::Succeeded; |
379 } | 348 } |
380 | 349 |
381 IFWL_Widget* CFWL_FormImp::DoModal() { | 350 IFWL_Widget* IFWL_Form::DoModal() { |
382 IFWL_App* pApp = GetOwnerApp(); | 351 IFWL_App* pApp = GetOwnerApp(); |
383 if (!pApp) | 352 if (!pApp) |
384 return nullptr; | 353 return nullptr; |
385 | 354 |
386 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | 355 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); |
387 if (!pDriver) | 356 if (!pDriver) |
388 return nullptr; | 357 return nullptr; |
389 | 358 |
390 m_pNoteLoop.reset(new CFWL_NoteLoop(this)); | 359 m_pNoteLoop.reset(new CFWL_NoteLoop(this)); |
391 pDriver->PushNoteLoop(m_pNoteLoop.get()); | 360 pDriver->PushNoteLoop(m_pNoteLoop.get()); |
392 m_bDoModalFlag = TRUE; | 361 m_bDoModalFlag = TRUE; |
393 SetStates(FWL_WGTSTATE_Invisible, FALSE); | 362 SetStates(FWL_WGTSTATE_Invisible, FALSE); |
394 pDriver->Run(); | 363 pDriver->Run(); |
395 #if (_FX_OS_ == _FX_MACOSX_) | 364 #if (_FX_OS_ == _FX_MACOSX_) |
396 #else | 365 #else |
397 pDriver->PopNoteLoop(); | 366 pDriver->PopNoteLoop(); |
398 #endif | 367 #endif |
399 m_pNoteLoop.reset(); | 368 m_pNoteLoop.reset(); |
400 return nullptr; | 369 return nullptr; |
401 } | 370 } |
402 | 371 |
403 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { | 372 IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { |
404 return DoModal(); | 373 return DoModal(); |
405 } | 374 } |
406 | 375 |
407 FWL_Error CFWL_FormImp::EndDoModal() { | 376 FWL_Error IFWL_Form::EndDoModal() { |
408 if (!m_pNoteLoop) | 377 if (!m_pNoteLoop) |
409 return FWL_Error::Indefinite; | 378 return FWL_Error::Indefinite; |
410 m_bDoModalFlag = FALSE; | 379 m_bDoModalFlag = FALSE; |
411 #if (_FX_OS_ == _FX_MACOSX_) | 380 #if (_FX_OS_ == _FX_MACOSX_) |
412 m_pNoteLoop->EndModalLoop(); | 381 m_pNoteLoop->EndModalLoop(); |
413 IFWL_App* pApp = GetOwnerApp(); | 382 IFWL_App* pApp = GetOwnerApp(); |
414 if (!pApp) | 383 if (!pApp) |
415 return FWL_Error::Indefinite; | 384 return FWL_Error::Indefinite; |
416 | 385 |
417 CFWL_NoteDriver* pDriver = | 386 CFWL_NoteDriver* pDriver = |
418 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 387 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
419 if (!pDriver) | 388 if (!pDriver) |
420 return FWL_Error::Indefinite; | 389 return FWL_Error::Indefinite; |
421 | 390 |
422 pDriver->PopNoteLoop(); | 391 pDriver->PopNoteLoop(); |
423 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 392 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
424 return FWL_Error::Succeeded; | 393 return FWL_Error::Succeeded; |
425 #else | 394 #else |
426 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 395 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
427 return m_pNoteLoop->EndModalLoop(); | 396 return m_pNoteLoop->EndModalLoop(); |
428 #endif | 397 #endif |
429 } | 398 } |
430 | 399 |
431 FWL_Error CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { | 400 FWL_Error IFWL_Form::SetBorderRegion(CFX_Path* pPath) { |
432 return FWL_Error::Succeeded; | 401 return FWL_Error::Succeeded; |
433 } | 402 } |
434 void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, | 403 void IFWL_Form::DrawBackground(CFX_Graphics* pGraphics, |
435 IFWL_ThemeProvider* pTheme) { | 404 IFWL_ThemeProvider* pTheme) { |
436 CFWL_ThemeBackground param; | 405 CFWL_ThemeBackground param; |
437 param.m_pWidget = m_pInterface; | 406 param.m_pWidget = this; |
438 param.m_iPart = CFWL_Part::Background; | 407 param.m_iPart = CFWL_Part::Background; |
439 param.m_pGraphics = pGraphics; | 408 param.m_pGraphics = pGraphics; |
440 param.m_rtPart = m_rtRelative; | 409 param.m_rtPart = m_rtRelative; |
441 param.m_rtPart.Deflate(m_fCYBorder, m_rtCaption.height, m_fCYBorder, | 410 param.m_rtPart.Deflate(m_fCYBorder, m_rtCaption.height, m_fCYBorder, |
442 m_fCXBorder); | 411 m_fCXBorder); |
443 pTheme->DrawBackground(¶m); | 412 pTheme->DrawBackground(¶m); |
444 } | 413 } |
445 CFWL_WidgetImp* CFWL_FormImp::GetSubFocus() { | 414 IFWL_Widget* IFWL_Form::GetSubFocus() { |
446 return m_pSubFocus; | 415 return m_pSubFocus; |
447 } | 416 } |
448 void CFWL_FormImp::SetSubFocus(CFWL_WidgetImp* pWidget) { | 417 void IFWL_Form::SetSubFocus(IFWL_Widget* pWidget) { |
449 m_pSubFocus = pWidget; | 418 m_pSubFocus = pWidget; |
450 } | 419 } |
451 | 420 |
452 void CFWL_FormImp::ShowChildWidget(IFWL_Widget* pParent) { | 421 void IFWL_Form::ShowChildWidget(IFWL_Widget* pParent) { |
453 IFWL_App* pApp = FWL_GetApp(); | 422 IFWL_App* pApp = FWL_GetApp(); |
454 if (!pApp) | 423 if (!pApp) |
455 return; | 424 return; |
456 | 425 |
457 CFWL_WidgetMgr* pWidgetMgr = pApp->GetWidgetMgr(); | 426 CFWL_WidgetMgr* pWidgetMgr = pApp->GetWidgetMgr(); |
458 if (!pWidgetMgr) | 427 if (!pWidgetMgr) |
459 return; | 428 return; |
460 | 429 |
461 IFWL_Widget* pChild = pWidgetMgr->GetFirstChildWidget(pParent); | 430 IFWL_Widget* pChild = pWidgetMgr->GetFirstChildWidget(pParent); |
462 while (pChild) { | 431 while (pChild) { |
463 ShowChildWidget(pChild); | 432 ShowChildWidget(pChild); |
464 pChild = pWidgetMgr->GetNextSiblingWidget(pChild); | 433 pChild = pWidgetMgr->GetNextSiblingWidget(pChild); |
465 } | 434 } |
466 } | 435 } |
467 | 436 |
468 void CFWL_FormImp::RemoveSysButtons() { | 437 void IFWL_Form::RemoveSysButtons() { |
469 m_rtCaption.Reset(); | 438 m_rtCaption.Reset(); |
470 delete m_pCloseBox; | 439 delete m_pCloseBox; |
471 m_pCloseBox = nullptr; | 440 m_pCloseBox = nullptr; |
472 delete m_pMinBox; | 441 delete m_pMinBox; |
473 m_pMinBox = nullptr; | 442 m_pMinBox = nullptr; |
474 delete m_pMaxBox; | 443 delete m_pMaxBox; |
475 m_pMaxBox = nullptr; | 444 m_pMaxBox = nullptr; |
476 delete m_pCaptionBox; | 445 delete m_pCaptionBox; |
477 m_pCaptionBox = nullptr; | 446 m_pCaptionBox = nullptr; |
478 } | 447 } |
479 | 448 |
480 void CFWL_FormImp::CalcContentRect(CFX_RectF& rtContent) { | 449 void IFWL_Form::CalcContentRect(CFX_RectF& rtContent) { |
481 #ifdef FWL_UseMacSystemBorder | 450 #ifdef FWL_UseMacSystemBorder |
482 rtContent = m_rtRelative; | 451 rtContent = m_rtRelative; |
483 #else | 452 #else |
484 GetEdgeRect(rtContent); | 453 GetEdgeRect(rtContent); |
485 if (HasEdge()) { | 454 if (HasEdge()) { |
486 FX_FLOAT fEdge = GetEdgeWidth(); | 455 FX_FLOAT fEdge = GetEdgeWidth(); |
487 rtContent.Deflate(fEdge, fEdge); | 456 rtContent.Deflate(fEdge, fEdge); |
488 } | 457 } |
489 #endif | 458 #endif |
490 } | 459 } |
491 CFWL_SysBtn* CFWL_FormImp::GetSysBtnAtPoint(FX_FLOAT fx, FX_FLOAT fy) { | 460 CFWL_SysBtn* IFWL_Form::GetSysBtnAtPoint(FX_FLOAT fx, FX_FLOAT fy) { |
492 if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) { | 461 if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) { |
493 return m_pCloseBox; | 462 return m_pCloseBox; |
494 } | 463 } |
495 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) { | 464 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) { |
496 return m_pMaxBox; | 465 return m_pMaxBox; |
497 } | 466 } |
498 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) { | 467 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) { |
499 return m_pMinBox; | 468 return m_pMinBox; |
500 } | 469 } |
501 if (m_pCaptionBox && m_pCaptionBox->m_rtBtn.Contains(fx, fy)) { | 470 if (m_pCaptionBox && m_pCaptionBox->m_rtBtn.Contains(fx, fy)) { |
502 return m_pCaptionBox; | 471 return m_pCaptionBox; |
503 } | 472 } |
504 return nullptr; | 473 return nullptr; |
505 } | 474 } |
506 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) { | 475 CFWL_SysBtn* IFWL_Form::GetSysBtnByState(uint32_t dwState) { |
507 if (m_pCloseBox && (m_pCloseBox->m_dwState & dwState)) { | 476 if (m_pCloseBox && (m_pCloseBox->m_dwState & dwState)) { |
508 return m_pCloseBox; | 477 return m_pCloseBox; |
509 } | 478 } |
510 if (m_pMaxBox && (m_pMaxBox->m_dwState & dwState)) { | 479 if (m_pMaxBox && (m_pMaxBox->m_dwState & dwState)) { |
511 return m_pMaxBox; | 480 return m_pMaxBox; |
512 } | 481 } |
513 if (m_pMinBox && (m_pMinBox->m_dwState & dwState)) { | 482 if (m_pMinBox && (m_pMinBox->m_dwState & dwState)) { |
514 return m_pMinBox; | 483 return m_pMinBox; |
515 } | 484 } |
516 if (m_pCaptionBox && (m_pCaptionBox->m_dwState & dwState)) { | 485 if (m_pCaptionBox && (m_pCaptionBox->m_dwState & dwState)) { |
517 return m_pCaptionBox; | 486 return m_pCaptionBox; |
518 } | 487 } |
519 return nullptr; | 488 return nullptr; |
520 } | 489 } |
521 CFWL_SysBtn* CFWL_FormImp::GetSysBtnByIndex(int32_t nIndex) { | 490 CFWL_SysBtn* IFWL_Form::GetSysBtnByIndex(int32_t nIndex) { |
522 if (nIndex < 0) | 491 if (nIndex < 0) |
523 return nullptr; | 492 return nullptr; |
524 | 493 |
525 CFX_ArrayTemplate<CFWL_SysBtn*> arrBtn; | 494 CFX_ArrayTemplate<CFWL_SysBtn*> arrBtn; |
526 if (m_pMinBox) | 495 if (m_pMinBox) |
527 arrBtn.Add(m_pMinBox); | 496 arrBtn.Add(m_pMinBox); |
528 | 497 |
529 if (m_pMaxBox) | 498 if (m_pMaxBox) |
530 arrBtn.Add(m_pMaxBox); | 499 arrBtn.Add(m_pMaxBox); |
531 | 500 |
532 if (m_pCloseBox) | 501 if (m_pCloseBox) |
533 arrBtn.Add(m_pCloseBox); | 502 arrBtn.Add(m_pCloseBox); |
534 | 503 |
535 return arrBtn[nIndex]; | 504 return arrBtn[nIndex]; |
536 } | 505 } |
537 int32_t CFWL_FormImp::GetSysBtnIndex(CFWL_SysBtn* pBtn) { | 506 int32_t IFWL_Form::GetSysBtnIndex(CFWL_SysBtn* pBtn) { |
538 CFX_ArrayTemplate<CFWL_SysBtn*> arrBtn; | 507 CFX_ArrayTemplate<CFWL_SysBtn*> arrBtn; |
539 if (m_pMinBox) | 508 if (m_pMinBox) |
540 arrBtn.Add(m_pMinBox); | 509 arrBtn.Add(m_pMinBox); |
541 | 510 |
542 if (m_pMaxBox) | 511 if (m_pMaxBox) |
543 arrBtn.Add(m_pMaxBox); | 512 arrBtn.Add(m_pMaxBox); |
544 | 513 |
545 if (m_pCloseBox) | 514 if (m_pCloseBox) |
546 arrBtn.Add(m_pCloseBox); | 515 arrBtn.Add(m_pCloseBox); |
547 | 516 |
548 return arrBtn.Find(pBtn); | 517 return arrBtn.Find(pBtn); |
549 } | 518 } |
550 FX_FLOAT CFWL_FormImp::GetCaptionHeight() { | 519 FX_FLOAT IFWL_Form::GetCaptionHeight() { |
551 CFWL_WidgetCapacity dwCapacity = CFWL_WidgetCapacity::None; | 520 CFWL_WidgetCapacity dwCapacity = CFWL_WidgetCapacity::None; |
552 | 521 |
553 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) { | 522 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) { |
554 dwCapacity = CFWL_WidgetCapacity::CYCaption; | 523 dwCapacity = CFWL_WidgetCapacity::CYCaption; |
555 } else if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_NarrowCaption) { | 524 } else if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_NarrowCaption) { |
556 dwCapacity = CFWL_WidgetCapacity::CYNarrowCaption; | 525 dwCapacity = CFWL_WidgetCapacity::CYNarrowCaption; |
557 } | 526 } |
558 if (dwCapacity != CFWL_WidgetCapacity::None) { | 527 if (dwCapacity != CFWL_WidgetCapacity::None) { |
559 FX_FLOAT* pfCapHeight = | 528 FX_FLOAT* pfCapHeight = |
560 static_cast<FX_FLOAT*>(GetThemeCapacity(dwCapacity)); | 529 static_cast<FX_FLOAT*>(GetThemeCapacity(dwCapacity)); |
561 return pfCapHeight ? *pfCapHeight : 0; | 530 return pfCapHeight ? *pfCapHeight : 0; |
562 } | 531 } |
563 return 0; | 532 return 0; |
564 } | 533 } |
565 void CFWL_FormImp::DrawCaptionText(CFX_Graphics* pGs, | 534 void IFWL_Form::DrawCaptionText(CFX_Graphics* pGs, |
566 IFWL_ThemeProvider* pTheme, | 535 IFWL_ThemeProvider* pTheme, |
567 const CFX_Matrix* pMatrix) { | 536 const CFX_Matrix* pMatrix) { |
568 CFX_WideString wsText; | 537 CFX_WideString wsText; |
569 IFWL_DataProvider* pData = m_pProperties->m_pDataProvider; | 538 IFWL_DataProvider* pData = m_pProperties->m_pDataProvider; |
570 pData->GetCaption(m_pInterface, wsText); | 539 pData->GetCaption(this, wsText); |
571 if (wsText.IsEmpty()) { | 540 if (wsText.IsEmpty()) { |
572 return; | 541 return; |
573 } | 542 } |
574 CFWL_ThemeText textParam; | 543 CFWL_ThemeText textParam; |
575 textParam.m_pWidget = m_pInterface; | 544 textParam.m_pWidget = this; |
576 textParam.m_iPart = CFWL_Part::Caption; | 545 textParam.m_iPart = CFWL_Part::Caption; |
577 textParam.m_dwStates = CFWL_PartState_Normal; | 546 textParam.m_dwStates = CFWL_PartState_Normal; |
578 textParam.m_pGraphics = pGs; | 547 textParam.m_pGraphics = pGs; |
579 if (pMatrix) { | 548 if (pMatrix) { |
580 textParam.m_matrix.Concat(*pMatrix); | 549 textParam.m_matrix.Concat(*pMatrix); |
581 } | 550 } |
582 CFX_RectF rtText; | 551 CFX_RectF rtText; |
583 if (m_bCustomizeLayout) { | 552 if (m_bCustomizeLayout) { |
584 rtText = m_rtCaptionText; | 553 rtText = m_rtCaptionText; |
585 rtText.top -= 5; | 554 rtText.top -= 5; |
586 } else { | 555 } else { |
587 rtText = m_rtCaption; | 556 rtText = m_rtCaption; |
588 FX_FLOAT fpos; | 557 FX_FLOAT fpos; |
589 fpos = HasIcon() ? 29.0f : 13.0f; | 558 fpos = HasIcon() ? 29.0f : 13.0f; |
590 rtText.left += fpos; | 559 rtText.left += fpos; |
591 } | 560 } |
592 textParam.m_rtPart = rtText; | 561 textParam.m_rtPart = rtText; |
593 textParam.m_wsText = wsText; | 562 textParam.m_wsText = wsText; |
594 textParam.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine | FDE_TTOSTYLE_Ellipsis; | 563 textParam.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine | FDE_TTOSTYLE_Ellipsis; |
595 textParam.m_iTTOAlign = m_bCustomizeLayout ? FDE_TTOALIGNMENT_Center | 564 textParam.m_iTTOAlign = m_bCustomizeLayout ? FDE_TTOALIGNMENT_Center |
596 : FDE_TTOALIGNMENT_CenterLeft; | 565 : FDE_TTOALIGNMENT_CenterLeft; |
597 pTheme->DrawText(&textParam); | 566 pTheme->DrawText(&textParam); |
598 } | 567 } |
599 void CFWL_FormImp::DrawIconImage(CFX_Graphics* pGs, | 568 void IFWL_Form::DrawIconImage(CFX_Graphics* pGs, |
600 IFWL_ThemeProvider* pTheme, | 569 IFWL_ThemeProvider* pTheme, |
601 const CFX_Matrix* pMatrix) { | 570 const CFX_Matrix* pMatrix) { |
602 IFWL_FormDP* pData = | 571 IFWL_FormDP* pData = |
603 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); | 572 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); |
604 CFWL_ThemeBackground param; | 573 CFWL_ThemeBackground param; |
605 param.m_pWidget = m_pInterface; | 574 param.m_pWidget = this; |
606 param.m_iPart = CFWL_Part::Icon; | 575 param.m_iPart = CFWL_Part::Icon; |
607 param.m_pGraphics = pGs; | 576 param.m_pGraphics = pGs; |
608 param.m_pImage = pData->GetIcon(m_pInterface, FALSE); | 577 param.m_pImage = pData->GetIcon(this, FALSE); |
609 param.m_rtPart = m_rtIcon; | 578 param.m_rtPart = m_rtIcon; |
610 if (pMatrix) { | 579 if (pMatrix) { |
611 param.m_matrix.Concat(*pMatrix); | 580 param.m_matrix.Concat(*pMatrix); |
612 } | 581 } |
613 pTheme->DrawBackground(¶m); | 582 pTheme->DrawBackground(¶m); |
614 } | 583 } |
615 void CFWL_FormImp::GetEdgeRect(CFX_RectF& rtEdge) { | 584 void IFWL_Form::GetEdgeRect(CFX_RectF& rtEdge) { |
616 rtEdge = m_rtRelative; | 585 rtEdge = m_rtRelative; |
617 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { | 586 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { |
618 FX_FLOAT fCX = GetBorderSize(); | 587 FX_FLOAT fCX = GetBorderSize(); |
619 FX_FLOAT fCY = GetBorderSize(FALSE); | 588 FX_FLOAT fCY = GetBorderSize(FALSE); |
620 rtEdge.Deflate(fCX, m_rtCaption.Height(), fCX, fCY); | 589 rtEdge.Deflate(fCX, m_rtCaption.Height(), fCX, fCY); |
621 } | 590 } |
622 } | 591 } |
623 void CFWL_FormImp::SetWorkAreaRect() { | 592 void IFWL_Form::SetWorkAreaRect() { |
624 m_rtRestore = m_pProperties->m_rtWidget; | 593 m_rtRestore = m_pProperties->m_rtWidget; |
625 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 594 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
626 if (!pWidgetMgr) | 595 if (!pWidgetMgr) |
627 return; | 596 return; |
628 m_bSetMaximize = TRUE; | 597 m_bSetMaximize = TRUE; |
629 Repaint(&m_rtRelative); | 598 Repaint(&m_rtRelative); |
630 } | 599 } |
631 void CFWL_FormImp::SetCursor(FX_FLOAT fx, FX_FLOAT fy) {} | 600 void IFWL_Form::SetCursor(FX_FLOAT fx, FX_FLOAT fy) {} |
632 void CFWL_FormImp::Layout() { | 601 void IFWL_Form::Layout() { |
633 GetRelativeRect(m_rtRelative); | 602 GetRelativeRect(m_rtRelative); |
634 #ifndef FWL_UseMacSystemBorder | 603 #ifndef FWL_UseMacSystemBorder |
635 ReSetSysBtn(); | 604 ReSetSysBtn(); |
636 #endif | 605 #endif |
637 } | 606 } |
638 void CFWL_FormImp::ReSetSysBtn() { | 607 void IFWL_Form::ReSetSysBtn() { |
639 m_fCXBorder = | 608 m_fCXBorder = |
640 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::CXBorder)); | 609 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::CXBorder)); |
641 m_fCYBorder = | 610 m_fCYBorder = |
642 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::CYBorder)); | 611 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::CYBorder)); |
643 RemoveSysButtons(); | 612 RemoveSysButtons(); |
644 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 613 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
645 m_bCustomizeLayout = pTheme->IsCustomizedLayout(m_pInterface); | 614 m_bCustomizeLayout = pTheme->IsCustomizedLayout(this); |
646 FX_FLOAT fCapHeight = GetCaptionHeight(); | 615 FX_FLOAT fCapHeight = GetCaptionHeight(); |
647 if (fCapHeight > 0) { | 616 if (fCapHeight > 0) { |
648 m_rtCaption = m_rtRelative; | 617 m_rtCaption = m_rtRelative; |
649 m_rtCaption.height = fCapHeight; | 618 m_rtCaption.height = fCapHeight; |
650 } | 619 } |
651 m_iSysBox = 0; | 620 m_iSysBox = 0; |
652 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_CloseBox) { | 621 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_CloseBox) { |
653 m_pCloseBox = new CFWL_SysBtn; | 622 m_pCloseBox = new CFWL_SysBtn; |
654 if (!m_bCustomizeLayout) { | 623 if (!m_bCustomizeLayout) { |
655 m_pCloseBox->m_rtBtn.Set( | 624 m_pCloseBox->m_rtBtn.Set( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 m_pMinBox->m_rtBtn.Set( | 657 m_pMinBox->m_rtBtn.Set( |
689 m_rtRelative.right() - kSystemButtonMargin - kSystemButtonSize, | 658 m_rtRelative.right() - kSystemButtonMargin - kSystemButtonSize, |
690 kSystemButtonMargin, kSystemButtonSize, kSystemButtonSize); | 659 kSystemButtonMargin, kSystemButtonSize, kSystemButtonSize); |
691 } | 660 } |
692 } | 661 } |
693 m_iSysBox++; | 662 m_iSysBox++; |
694 } | 663 } |
695 IFWL_FormDP* pData = | 664 IFWL_FormDP* pData = |
696 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); | 665 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); |
697 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon && | 666 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon && |
698 pData->GetIcon(m_pInterface, FALSE)) { | 667 pData->GetIcon(this, FALSE)) { |
699 if (!m_bCustomizeLayout) { | 668 if (!m_bCustomizeLayout) { |
700 m_rtIcon.Set(5, (m_rtCaption.height - m_fSmallIconSz) / 2, m_fSmallIconSz, | 669 m_rtIcon.Set(5, (m_rtCaption.height - m_fSmallIconSz) / 2, m_fSmallIconSz, |
701 m_fSmallIconSz); | 670 m_fSmallIconSz); |
702 } | 671 } |
703 } | 672 } |
704 } | 673 } |
705 void CFWL_FormImp::RegisterForm() { | 674 void IFWL_Form::RegisterForm() { |
706 IFWL_App* pApp = GetOwnerApp(); | 675 IFWL_App* pApp = GetOwnerApp(); |
707 if (!pApp) | 676 if (!pApp) |
708 return; | 677 return; |
709 | 678 |
710 CFWL_NoteDriver* pDriver = | 679 CFWL_NoteDriver* pDriver = |
711 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 680 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
712 if (!pDriver) | 681 if (!pDriver) |
713 return; | 682 return; |
714 | 683 |
715 pDriver->RegisterForm(this); | 684 pDriver->RegisterForm(this); |
716 } | 685 } |
717 void CFWL_FormImp::UnRegisterForm() { | 686 void IFWL_Form::UnRegisterForm() { |
718 IFWL_App* pApp = GetOwnerApp(); | 687 IFWL_App* pApp = GetOwnerApp(); |
719 if (!pApp) | 688 if (!pApp) |
720 return; | 689 return; |
721 | 690 |
722 CFWL_NoteDriver* pDriver = | 691 CFWL_NoteDriver* pDriver = |
723 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 692 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
724 if (!pDriver) | 693 if (!pDriver) |
725 return; | 694 return; |
726 | 695 |
727 pDriver->UnRegisterForm(this); | 696 pDriver->UnRegisterForm(this); |
728 } | 697 } |
729 FX_BOOL CFWL_FormImp::IsDoModal() { | 698 FX_BOOL IFWL_Form::IsDoModal() { |
730 return m_bDoModalFlag; | 699 return m_bDoModalFlag; |
731 } | 700 } |
732 void CFWL_FormImp::SetThemeData() { | 701 void IFWL_Form::SetThemeData() { |
733 m_fSmallIconSz = | 702 m_fSmallIconSz = |
734 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::SmallIcon)); | 703 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::SmallIcon)); |
735 m_fBigIconSz = | 704 m_fBigIconSz = |
736 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::BigIcon)); | 705 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::BigIcon)); |
737 } | 706 } |
738 FX_BOOL CFWL_FormImp::HasIcon() { | 707 FX_BOOL IFWL_Form::HasIcon() { |
739 IFWL_FormDP* pData = | 708 IFWL_FormDP* pData = |
740 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); | 709 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); |
741 return !!pData->GetIcon(m_pInterface, FALSE); | 710 return !!pData->GetIcon(this, FALSE); |
742 } | 711 } |
743 void CFWL_FormImp::UpdateIcon() { | 712 void IFWL_Form::UpdateIcon() { |
744 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 713 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
745 if (!pWidgetMgr) | 714 if (!pWidgetMgr) |
746 return; | 715 return; |
747 IFWL_FormDP* pData = | 716 IFWL_FormDP* pData = |
748 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); | 717 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); |
749 CFX_DIBitmap* pBigIcon = pData->GetIcon(m_pInterface, TRUE); | 718 CFX_DIBitmap* pBigIcon = pData->GetIcon(this, TRUE); |
750 CFX_DIBitmap* pSmallIcon = pData->GetIcon(m_pInterface, FALSE); | 719 CFX_DIBitmap* pSmallIcon = pData->GetIcon(this, FALSE); |
751 if (pBigIcon) | 720 if (pBigIcon) |
752 m_pBigIcon = pBigIcon; | 721 m_pBigIcon = pBigIcon; |
753 if (pSmallIcon) | 722 if (pSmallIcon) |
754 m_pSmallIcon = pSmallIcon; | 723 m_pSmallIcon = pSmallIcon; |
755 } | 724 } |
756 void CFWL_FormImp::UpdateCaption() { | 725 void IFWL_Form::UpdateCaption() { |
757 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 726 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
758 if (!pWidgetMgr) | 727 if (!pWidgetMgr) |
759 return; | 728 return; |
760 IFWL_DataProvider* pData = m_pProperties->m_pDataProvider; | 729 IFWL_DataProvider* pData = m_pProperties->m_pDataProvider; |
761 if (!pData) | 730 if (!pData) |
762 return; | 731 return; |
763 CFX_WideString text; | 732 CFX_WideString text; |
764 pData->GetCaption(m_pInterface, text); | 733 pData->GetCaption(this, text); |
765 } | 734 } |
766 void CFWL_FormImp::DoWidthLimit(FX_FLOAT& fLeft, | 735 void IFWL_Form::DoWidthLimit(FX_FLOAT& fLeft, |
767 FX_FLOAT& fWidth, | 736 FX_FLOAT& fWidth, |
768 FX_FLOAT fCurX, | 737 FX_FLOAT fCurX, |
769 FX_FLOAT fSpace, | 738 FX_FLOAT fSpace, |
770 FX_FLOAT fLimitMin, | 739 FX_FLOAT fLimitMin, |
771 FX_FLOAT fLimitMax, | 740 FX_FLOAT fLimitMax, |
772 FX_BOOL bLeft) { | 741 FX_BOOL bLeft) { |
773 FX_FLOAT fx = fCurX; | 742 FX_FLOAT fx = fCurX; |
774 FX_FLOAT fy = 0; | 743 FX_FLOAT fy = 0; |
775 TransformTo(nullptr, fx, fy); | 744 TransformTo(nullptr, fx, fy); |
776 FX_FLOAT fTemp = | 745 FX_FLOAT fTemp = |
777 bLeft ? (fWidth - fx + fLeft + fSpace) : (fx - fLeft + fSpace); | 746 bLeft ? (fWidth - fx + fLeft + fSpace) : (fx - fLeft + fSpace); |
778 if (fTemp >= fLimitMin && fTemp <= fLimitMax) { | 747 if (fTemp >= fLimitMin && fTemp <= fLimitMax) { |
779 fWidth = fTemp; | 748 fWidth = fTemp; |
780 fLeft += bLeft ? (fx - fLeft - fSpace) : 0; | 749 fLeft += bLeft ? (fx - fLeft - fSpace) : 0; |
781 } else { | 750 } else { |
782 if (fTemp < fLimitMin && fWidth > fLimitMin) { | 751 if (fTemp < fLimitMin && fWidth > fLimitMin) { |
783 fLeft += bLeft ? (fWidth - fLimitMin) : 0; | 752 fLeft += bLeft ? (fWidth - fLimitMin) : 0; |
784 fWidth = fLimitMin; | 753 fWidth = fLimitMin; |
785 } else if (fTemp > fLimitMax && fWidth < fLimitMax) { | 754 } else if (fTemp > fLimitMax && fWidth < fLimitMax) { |
786 fLeft -= bLeft ? (fLimitMax - fWidth) : 0; | 755 fLeft -= bLeft ? (fLimitMax - fWidth) : 0; |
787 fWidth = fLimitMax; | 756 fWidth = fLimitMax; |
788 } | 757 } |
789 } | 758 } |
790 } | 759 } |
791 void CFWL_FormImp::DoHeightLimit(FX_FLOAT& fTop, | 760 void IFWL_Form::DoHeightLimit(FX_FLOAT& fTop, |
792 FX_FLOAT& fHeight, | 761 FX_FLOAT& fHeight, |
793 FX_FLOAT fCurY, | 762 FX_FLOAT fCurY, |
794 FX_FLOAT fSpace, | 763 FX_FLOAT fSpace, |
795 FX_FLOAT fLimitMin, | 764 FX_FLOAT fLimitMin, |
796 FX_FLOAT fLimitMax, | 765 FX_FLOAT fLimitMax, |
797 FX_BOOL bTop) { | 766 FX_BOOL bTop) { |
798 FX_FLOAT fx = 0; | 767 FX_FLOAT fx = 0; |
799 FX_FLOAT fy = fCurY; | 768 FX_FLOAT fy = fCurY; |
800 TransformTo(nullptr, fx, fy); | 769 TransformTo(nullptr, fx, fy); |
801 FX_FLOAT fTemp = bTop ? (fHeight - fy + fTop + fSpace) : (fy - fTop + fSpace); | 770 FX_FLOAT fTemp = bTop ? (fHeight - fy + fTop + fSpace) : (fy - fTop + fSpace); |
802 if (fTemp >= fLimitMin && fTemp <= fLimitMax) { | 771 if (fTemp >= fLimitMin && fTemp <= fLimitMax) { |
803 fHeight = fTemp; | 772 fHeight = fTemp; |
804 fTop += bTop ? (fy - fTop - fSpace) : 0; | 773 fTop += bTop ? (fy - fTop - fSpace) : 0; |
805 } else { | 774 } else { |
806 if (fTemp < fLimitMin && fHeight > fLimitMin) { | 775 if (fTemp < fLimitMin && fHeight > fLimitMin) { |
807 fTop += bTop ? (fHeight - fLimitMin) : 0; | 776 fTop += bTop ? (fHeight - fLimitMin) : 0; |
808 fHeight = fLimitMin; | 777 fHeight = fLimitMin; |
809 } else if (fTemp > fLimitMax && fHeight < fLimitMax) { | 778 } else if (fTemp > fLimitMax && fHeight < fLimitMax) { |
810 fTop -= bTop ? (fLimitMax - fHeight) : 0; | 779 fTop -= bTop ? (fLimitMax - fHeight) : 0; |
811 fHeight = fLimitMax; | 780 fHeight = fLimitMax; |
812 } | 781 } |
813 } | 782 } |
814 } | 783 } |
815 | 784 |
816 CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner) | 785 CFWL_FormImpDelegate::CFWL_FormImpDelegate(IFWL_Form* pOwner) |
817 : m_pOwner(pOwner) {} | 786 : m_pOwner(pOwner) {} |
818 | 787 |
819 #ifdef FWL_UseMacSystemBorder | 788 #ifdef FWL_UseMacSystemBorder |
820 void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 789 void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
821 if (!pMessage) | 790 if (!pMessage) |
822 return; | 791 return; |
823 | 792 |
824 switch (pMessage->GetClassID()) { | 793 switch (pMessage->GetClassID()) { |
825 case CFWL_MessageType::Activate: { | 794 case CFWL_MessageType::Activate: { |
826 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 795 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
(...skipping 13 matching lines...) Expand all Loading... |
840 void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 809 void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
841 if (!pMessage) | 810 if (!pMessage) |
842 return; | 811 return; |
843 | 812 |
844 switch (pMessage->GetClassID()) { | 813 switch (pMessage->GetClassID()) { |
845 case CFWL_MessageType::Activate: { | 814 case CFWL_MessageType::Activate: { |
846 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 815 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
847 IFWL_App* pApp = m_pOwner->GetOwnerApp(); | 816 IFWL_App* pApp = m_pOwner->GetOwnerApp(); |
848 CFWL_NoteDriver* pDriver = | 817 CFWL_NoteDriver* pDriver = |
849 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 818 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
850 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); | 819 IFWL_Widget* pSubFocus = m_pOwner->GetSubFocus(); |
851 IFWL_Widget* pSubFocus = | |
852 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; | |
853 if (pSubFocus && pSubFocus != pDriver->GetFocus()) | 820 if (pSubFocus && pSubFocus != pDriver->GetFocus()) |
854 pDriver->SetFocus(pSubFocus); | 821 pDriver->SetFocus(pSubFocus); |
855 | 822 |
856 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 823 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
857 break; | 824 break; |
858 } | 825 } |
859 case CFWL_MessageType::Deactivate: { | 826 case CFWL_MessageType::Deactivate: { |
860 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; | 827 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; |
861 IFWL_App* pApp = m_pOwner->GetOwnerApp(); | 828 IFWL_App* pApp = m_pOwner->GetOwnerApp(); |
862 CFWL_NoteDriver* pDriver = | 829 CFWL_NoteDriver* pDriver = |
863 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 830 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
864 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); | 831 IFWL_Widget* pSubFocus = m_pOwner->GetSubFocus(); |
865 IFWL_Widget* pSubFocus = | |
866 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; | |
867 if (pSubFocus) { | 832 if (pSubFocus) { |
868 if (pSubFocus == pDriver->GetFocus()) { | 833 if (pSubFocus == pDriver->GetFocus()) { |
869 pDriver->SetFocus(nullptr); | 834 pDriver->SetFocus(nullptr); |
870 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { | 835 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { |
871 CFWL_MsgKillFocus ms; | 836 CFWL_MsgKillFocus ms; |
872 IFWL_WidgetDelegate* pDelegate = pSubFocus->SetDelegate(nullptr); | 837 IFWL_WidgetDelegate* pDelegate = pSubFocus->SetDelegate(nullptr); |
873 if (pDelegate) | 838 if (pDelegate) |
874 pDelegate->OnProcessMessage(&ms); | 839 pDelegate->OnProcessMessage(&ms); |
875 } | 840 } |
876 } | 841 } |
(...skipping 30 matching lines...) Expand all Loading... |
907 default: | 872 default: |
908 break; | 873 break; |
909 } | 874 } |
910 break; | 875 break; |
911 } | 876 } |
912 case CFWL_MessageType::Size: { | 877 case CFWL_MessageType::Size: { |
913 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 878 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); |
914 if (!pWidgetMgr) | 879 if (!pWidgetMgr) |
915 return; | 880 return; |
916 | 881 |
917 pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface); | 882 pWidgetMgr->AddRedrawCounts(m_pOwner); |
918 if (!m_pOwner->m_bSetMaximize) | 883 if (!m_pOwner->m_bSetMaximize) |
919 break; | 884 break; |
920 | 885 |
921 m_pOwner->m_bSetMaximize = FALSE; | 886 m_pOwner->m_bSetMaximize = FALSE; |
922 CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage); | 887 CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage); |
923 m_pOwner->m_pProperties->m_rtWidget.left = 0; | 888 m_pOwner->m_pProperties->m_rtWidget.left = 0; |
924 m_pOwner->m_pProperties->m_rtWidget.top = 0; | 889 m_pOwner->m_pProperties->m_rtWidget.top = 0; |
925 m_pOwner->m_pProperties->m_rtWidget.width = (FX_FLOAT)pMsg->m_iWidth; | 890 m_pOwner->m_pProperties->m_rtWidget.width = (FX_FLOAT)pMsg->m_iWidth; |
926 m_pOwner->m_pProperties->m_rtWidget.height = (FX_FLOAT)pMsg->m_iHeight; | 891 m_pOwner->m_pProperties->m_rtWidget.height = (FX_FLOAT)pMsg->m_iHeight; |
927 m_pOwner->Update(); | 892 m_pOwner->Update(); |
928 break; | 893 break; |
929 } | 894 } |
930 case CFWL_MessageType::WindowMove: { | 895 case CFWL_MessageType::WindowMove: { |
931 OnWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage)); | 896 OnWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage)); |
932 break; | 897 break; |
933 } | 898 } |
934 case CFWL_MessageType::Close: { | 899 case CFWL_MessageType::Close: { |
935 OnClose(static_cast<CFWL_MsgClose*>(pMessage)); | 900 OnClose(static_cast<CFWL_MsgClose*>(pMessage)); |
936 break; | 901 break; |
937 } | 902 } |
938 default: { | 903 default: { break; } |
939 break; | |
940 } | |
941 } | 904 } |
942 } | 905 } |
943 #endif // FWL_UseMacSystemBorder | 906 #endif // FWL_UseMacSystemBorder |
944 | 907 |
945 void CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} | 908 void CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} |
946 | 909 |
947 void CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 910 void CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
948 const CFX_Matrix* pMatrix) { | 911 const CFX_Matrix* pMatrix) { |
949 m_pOwner->DrawWidget(pGraphics, pMatrix); | 912 m_pOwner->DrawWidget(pGraphics, pMatrix); |
950 } | 913 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 m_pOwner->SetWidgetRect(m_pOwner->m_rtRestore); | 958 m_pOwner->SetWidgetRect(m_pOwner->m_rtRestore); |
996 m_pOwner->Update(); | 959 m_pOwner->Update(); |
997 m_pOwner->Repaint(); | 960 m_pOwner->Repaint(); |
998 } else { | 961 } else { |
999 m_pOwner->SetWorkAreaRect(); | 962 m_pOwner->SetWorkAreaRect(); |
1000 m_pOwner->Update(); | 963 m_pOwner->Update(); |
1001 } | 964 } |
1002 m_pOwner->m_bMaximized = !m_pOwner->m_bMaximized; | 965 m_pOwner->m_bMaximized = !m_pOwner->m_bMaximized; |
1003 } else if (pPressedBtn != m_pOwner->m_pMinBox) { | 966 } else if (pPressedBtn != m_pOwner->m_pMinBox) { |
1004 CFWL_EvtClose eClose; | 967 CFWL_EvtClose eClose; |
1005 eClose.m_pSrcTarget = m_pOwner->m_pInterface; | 968 eClose.m_pSrcTarget = m_pOwner; |
1006 m_pOwner->DispatchEvent(&eClose); | 969 m_pOwner->DispatchEvent(&eClose); |
1007 } | 970 } |
1008 } | 971 } |
1009 void CFWL_FormImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { | 972 void CFWL_FormImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { |
1010 if (m_pOwner->m_bLButtonDown) { | 973 if (m_pOwner->m_bLButtonDown) { |
1011 return; | 974 return; |
1012 } | 975 } |
1013 if ((m_pOwner->m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) && | 976 if ((m_pOwner->m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) && |
1014 (m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_Resize) && | 977 (m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_Resize) && |
1015 !m_pOwner->m_bMaximized) { | 978 !m_pOwner->m_bMaximized) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 m_pOwner->Update(); | 1056 m_pOwner->Update(); |
1094 m_pOwner->m_bMaximized = !m_pOwner->m_bMaximized; | 1057 m_pOwner->m_bMaximized = !m_pOwner->m_bMaximized; |
1095 } | 1058 } |
1096 } | 1059 } |
1097 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { | 1060 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { |
1098 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; | 1061 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; |
1099 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; | 1062 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; |
1100 } | 1063 } |
1101 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { | 1064 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { |
1102 CFWL_EvtClose eClose; | 1065 CFWL_EvtClose eClose; |
1103 eClose.m_pSrcTarget = m_pOwner->m_pInterface; | 1066 eClose.m_pSrcTarget = m_pOwner; |
1104 m_pOwner->DispatchEvent(&eClose); | 1067 m_pOwner->DispatchEvent(&eClose); |
1105 } | 1068 } |
1106 | 1069 |
1107 CFWL_SysBtn::CFWL_SysBtn() { | 1070 CFWL_SysBtn::CFWL_SysBtn() { |
1108 m_rtBtn.Set(0, 0, 0, 0); | 1071 m_rtBtn.Set(0, 0, 0, 0); |
1109 m_dwState = 0; | 1072 m_dwState = 0; |
1110 } | 1073 } |
1111 | 1074 |
1112 bool CFWL_SysBtn::IsDisabled() const { | 1075 bool CFWL_SysBtn::IsDisabled() const { |
1113 return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled); | 1076 return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled); |
(...skipping 20 matching lines...) Expand all Loading... |
1134 | 1097 |
1135 uint32_t CFWL_SysBtn::GetPartState() const { | 1098 uint32_t CFWL_SysBtn::GetPartState() const { |
1136 if (IsDisabled()) | 1099 if (IsDisabled()) |
1137 return CFWL_PartState_Disabled; | 1100 return CFWL_PartState_Disabled; |
1138 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) | 1101 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) |
1139 return CFWL_PartState_Pressed; | 1102 return CFWL_PartState_Pressed; |
1140 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) | 1103 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) |
1141 return CFWL_PartState_Hovered; | 1104 return CFWL_PartState_Hovered; |
1142 return CFWL_PartState_Normal; | 1105 return CFWL_PartState_Normal; |
1143 } | 1106 } |
OLD | NEW |