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/fwl_formimp.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" | 10 #include "xfa/fwl/basewidget/fwl_formproxyimp.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 IFWL_Form* pForm = new IFWL_Form; | 42 IFWL_Form* pForm = new IFWL_Form; |
43 CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter); | 43 CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter); |
44 pForm->SetImpl(pFormProxyImpl); | 44 pForm->SetImpl(pFormProxyImpl); |
45 pFormProxyImpl->SetInterface(pForm); | 45 pFormProxyImpl->SetInterface(pForm); |
46 return pForm; | 46 return pForm; |
47 } | 47 } |
48 IFWL_Form::IFWL_Form() {} | 48 IFWL_Form::IFWL_Form() {} |
49 FWL_FORMSIZE IFWL_Form::GetFormSize() { | 49 FWL_FORMSIZE IFWL_Form::GetFormSize() { |
50 return static_cast<CFWL_FormImp*>(GetImpl())->GetFormSize(); | 50 return static_cast<CFWL_FormImp*>(GetImpl())->GetFormSize(); |
51 } | 51 } |
52 FWL_ERR IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { | 52 FWL_Error IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { |
53 return static_cast<CFWL_FormImp*>(GetImpl())->SetFormSize(eFormSize); | 53 return static_cast<CFWL_FormImp*>(GetImpl())->SetFormSize(eFormSize); |
54 } | 54 } |
55 IFWL_Widget* IFWL_Form::DoModal() { | 55 IFWL_Widget* IFWL_Form::DoModal() { |
56 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(); | 56 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(); |
57 } | 57 } |
58 IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { | 58 IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { |
59 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(dwCommandID); | 59 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(dwCommandID); |
60 } | 60 } |
61 FWL_ERR IFWL_Form::EndDoModal() { | 61 FWL_Error IFWL_Form::EndDoModal() { |
62 return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal(); | 62 return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal(); |
63 } | 63 } |
64 FWL_ERR IFWL_Form::SetBorderRegion(CFX_Path* pPath) { | 64 FWL_Error IFWL_Form::SetBorderRegion(CFX_Path* pPath) { |
65 return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); | 65 return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); |
66 } | 66 } |
67 | 67 |
68 CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, | 68 CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, |
69 IFWL_Widget* pOuter) | 69 IFWL_Widget* pOuter) |
70 : CFWL_WidgetImp(properties, pOuter), | 70 : CFWL_WidgetImp(properties, pOuter), |
71 m_pCloseBox(nullptr), | 71 m_pCloseBox(nullptr), |
72 m_pMinBox(nullptr), | 72 m_pMinBox(nullptr), |
73 m_pMaxBox(nullptr), | 73 m_pMaxBox(nullptr), |
74 m_pCaptionBox(nullptr), | 74 m_pCaptionBox(nullptr), |
(...skipping 18 matching lines...) Expand all Loading... |
93 m_rtRestore.Reset(); | 93 m_rtRestore.Reset(); |
94 m_rtCaptionText.Reset(); | 94 m_rtCaptionText.Reset(); |
95 m_rtIcon.Reset(); | 95 m_rtIcon.Reset(); |
96 } | 96 } |
97 | 97 |
98 CFWL_FormImp::~CFWL_FormImp() { | 98 CFWL_FormImp::~CFWL_FormImp() { |
99 RemoveSysButtons(); | 99 RemoveSysButtons(); |
100 delete m_pNoteLoop; | 100 delete m_pNoteLoop; |
101 } | 101 } |
102 | 102 |
103 FWL_ERR CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { | 103 FWL_Error CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { |
104 wsClass = FWL_CLASS_Form; | 104 wsClass = FWL_CLASS_Form; |
105 return FWL_ERR_Succeeded; | 105 return FWL_Error::Succeeded; |
106 } | 106 } |
107 | 107 |
108 uint32_t CFWL_FormImp::GetClassID() const { | 108 uint32_t CFWL_FormImp::GetClassID() const { |
109 return FWL_CLASSHASH_Form; | 109 return FWL_CLASSHASH_Form; |
110 } | 110 } |
111 | 111 |
112 FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { | 112 FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { |
113 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) | 113 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) |
114 return TRUE; | 114 return TRUE; |
115 return CFWL_WidgetImp::IsInstance(wsClass); | 115 return CFWL_WidgetImp::IsInstance(wsClass); |
116 } | 116 } |
117 | 117 |
118 FWL_ERR CFWL_FormImp::Initialize() { | 118 FWL_Error CFWL_FormImp::Initialize() { |
119 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) | 119 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) |
120 return FWL_ERR_Indefinite; | 120 return FWL_Error::Indefinite; |
121 RegisterForm(); | 121 RegisterForm(); |
122 RegisterEventTarget(); | 122 RegisterEventTarget(); |
123 m_pDelegate = new CFWL_FormImpDelegate(this); | 123 m_pDelegate = new CFWL_FormImpDelegate(this); |
124 return FWL_ERR_Succeeded; | 124 return FWL_Error::Succeeded; |
125 } | 125 } |
126 FWL_ERR CFWL_FormImp::Finalize() { | 126 FWL_Error CFWL_FormImp::Finalize() { |
127 delete m_pDelegate; | 127 delete m_pDelegate; |
128 m_pDelegate = nullptr; | 128 m_pDelegate = nullptr; |
129 UnregisterEventTarget(); | 129 UnregisterEventTarget(); |
130 UnRegisterForm(); | 130 UnRegisterForm(); |
131 return CFWL_WidgetImp::Finalize(); | 131 return CFWL_WidgetImp::Finalize(); |
132 } | 132 } |
133 FWL_ERR CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 133 FWL_Error CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
134 if (bAutoSize) { | 134 if (bAutoSize) { |
135 rect.Reset(); | 135 rect.Reset(); |
136 FX_FLOAT fCapHeight = GetCaptionHeight(); | 136 FX_FLOAT fCapHeight = GetCaptionHeight(); |
137 FX_FLOAT fCXBorder = GetBorderSize(TRUE); | 137 FX_FLOAT fCXBorder = GetBorderSize(TRUE); |
138 FX_FLOAT fCYBorder = GetBorderSize(FALSE); | 138 FX_FLOAT fCYBorder = GetBorderSize(FALSE); |
139 FX_FLOAT fEdge = GetEdgeWidth(); | 139 FX_FLOAT fEdge = GetEdgeWidth(); |
140 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; | 140 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; |
141 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; | 141 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; |
142 } else { | 142 } else { |
143 rect = m_pProperties->m_rtWidget; | 143 rect = m_pProperties->m_rtWidget; |
144 } | 144 } |
145 return FWL_ERR_Succeeded; | 145 return FWL_Error::Succeeded; |
146 } | 146 } |
147 FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) { | 147 FWL_Error CFWL_FormImp::GetClientRect(CFX_RectF& rect) { |
148 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { | 148 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { |
149 rect = m_pProperties->m_rtWidget; | 149 rect = m_pProperties->m_rtWidget; |
150 rect.Offset(-rect.left, -rect.top); | 150 rect.Offset(-rect.left, -rect.top); |
151 return FWL_ERR_Succeeded; | 151 return FWL_Error::Succeeded; |
152 } | 152 } |
153 #ifdef FWL_UseMacSystemBorder | 153 #ifdef FWL_UseMacSystemBorder |
154 rect = m_rtRelative; | 154 rect = m_rtRelative; |
155 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 155 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); |
156 if (!pWidgetMgr) | 156 if (!pWidgetMgr) |
157 return FWL_ERR_Indefinite; | 157 return FWL_Error::Indefinite; |
158 IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr(); | 158 IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr(); |
159 FX_FLOAT l, t, r, b; | 159 FX_FLOAT l, t, r, b; |
160 l = t = r = b = 0; | 160 l = t = r = b = 0; |
161 adapterWidgetMgr->GetSystemBorder(l, t, r, b); | 161 adapterWidgetMgr->GetSystemBorder(l, t, r, b); |
162 rect.Deflate(l, t, r, b); | 162 rect.Deflate(l, t, r, b); |
163 rect.left = rect.top = 0; | 163 rect.left = rect.top = 0; |
164 return FWL_ERR_Succeeded; | 164 return FWL_Error::Succeeded; |
165 #else | 165 #else |
166 FX_FLOAT x = 0; | 166 FX_FLOAT x = 0; |
167 FX_FLOAT y = 0; | 167 FX_FLOAT y = 0; |
168 FX_FLOAT t = 0; | 168 FX_FLOAT t = 0; |
169 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 169 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
170 if (pTheme) { | 170 if (pTheme) { |
171 CFWL_ThemePart part; | 171 CFWL_ThemePart part; |
172 part.m_pWidget = m_pInterface; | 172 part.m_pWidget = m_pInterface; |
173 x = *static_cast<FX_FLOAT*>( | 173 x = *static_cast<FX_FLOAT*>( |
174 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder)); | 174 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder)); |
175 y = *static_cast<FX_FLOAT*>( | 175 y = *static_cast<FX_FLOAT*>( |
176 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYBorder)); | 176 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYBorder)); |
177 t = *static_cast<FX_FLOAT*>( | 177 t = *static_cast<FX_FLOAT*>( |
178 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYCaption)); | 178 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYCaption)); |
179 } | 179 } |
180 rect = m_pProperties->m_rtWidget; | 180 rect = m_pProperties->m_rtWidget; |
181 rect.Offset(-rect.left, -rect.top); | 181 rect.Offset(-rect.left, -rect.top); |
182 rect.Deflate(x, t, x, y); | 182 rect.Deflate(x, t, x, y); |
183 return FWL_ERR_Succeeded; | 183 return FWL_Error::Succeeded; |
184 #endif | 184 #endif |
185 } | 185 } |
186 FWL_ERR CFWL_FormImp::Update() { | 186 FWL_Error CFWL_FormImp::Update() { |
187 if (m_iLock > 0) { | 187 if (m_iLock > 0) { |
188 return FWL_ERR_Succeeded; | 188 return FWL_Error::Succeeded; |
189 } | 189 } |
190 if (!m_pProperties->m_pThemeProvider) { | 190 if (!m_pProperties->m_pThemeProvider) { |
191 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 191 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
192 } | 192 } |
193 #ifdef FWL_UseMacSystemBorder | 193 #ifdef FWL_UseMacSystemBorder |
194 #else | 194 #else |
195 SetThemeData(); | 195 SetThemeData(); |
196 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon) { | 196 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon) { |
197 UpdateIcon(); | 197 UpdateIcon(); |
198 } | 198 } |
199 #endif | 199 #endif |
200 UpdateCaption(); | 200 UpdateCaption(); |
201 Layout(); | 201 Layout(); |
202 return FWL_ERR_Succeeded; | 202 return FWL_Error::Succeeded; |
203 } | 203 } |
204 uint32_t CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 204 uint32_t CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
205 (void)GetAvailableTheme(); | 205 (void)GetAvailableTheme(); |
206 if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) { | 206 if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) { |
207 return FWL_WGTHITTEST_CloseBox; | 207 return FWL_WGTHITTEST_CloseBox; |
208 } | 208 } |
209 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) { | 209 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) { |
210 return FWL_WGTHITTEST_MaxBox; | 210 return FWL_WGTHITTEST_MaxBox; |
211 } | 211 } |
212 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) { | 212 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 258 } |
259 rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge, | 259 rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge, |
260 m_rtRelative.height - m_fCXBorder - kCornerEnlarge, | 260 m_rtRelative.height - m_fCXBorder - kCornerEnlarge, |
261 m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge); | 261 m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge); |
262 if (rt.Contains(fx, fy)) { | 262 if (rt.Contains(fx, fy)) { |
263 return FWL_WGTHITTEST_RightBottom; | 263 return FWL_WGTHITTEST_RightBottom; |
264 } | 264 } |
265 } | 265 } |
266 return FWL_WGTHITTEST_Client; | 266 return FWL_WGTHITTEST_Client; |
267 } | 267 } |
268 FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, | 268 FWL_Error CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, |
269 const CFX_Matrix* pMatrix) { | 269 const CFX_Matrix* pMatrix) { |
270 if (!pGraphics) | 270 if (!pGraphics) |
271 return FWL_ERR_Indefinite; | 271 return FWL_Error::Indefinite; |
272 if (!m_pProperties->m_pThemeProvider) | 272 if (!m_pProperties->m_pThemeProvider) |
273 return FWL_ERR_Indefinite; | 273 return FWL_Error::Indefinite; |
274 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 274 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
275 FX_BOOL bInactive = !IsActive(); | 275 FX_BOOL bInactive = !IsActive(); |
276 int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; | 276 int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; |
277 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_NoDrawClient) == 0) { | 277 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_NoDrawClient) == 0) { |
278 DrawBackground(pGraphics, pTheme); | 278 DrawBackground(pGraphics, pTheme); |
279 } | 279 } |
280 #ifdef FWL_UseMacSystemBorder | 280 #ifdef FWL_UseMacSystemBorder |
281 return FWL_ERR_Succeeded; | 281 return FWL_Error::Succeeded; |
282 #endif | 282 #endif |
283 CFWL_ThemeBackground param; | 283 CFWL_ThemeBackground param; |
284 param.m_pWidget = m_pInterface; | 284 param.m_pWidget = m_pInterface; |
285 param.m_dwStates = iState; | 285 param.m_dwStates = iState; |
286 param.m_pGraphics = pGraphics; | 286 param.m_pGraphics = pGraphics; |
287 param.m_rtPart = m_rtRelative; | 287 param.m_rtPart = m_rtRelative; |
288 if (pMatrix) { | 288 if (pMatrix) { |
289 param.m_matrix.Concat(*pMatrix); | 289 param.m_matrix.Concat(*pMatrix); |
290 } | 290 } |
291 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { | 291 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 pTheme->DrawBackground(¶m); | 374 pTheme->DrawBackground(¶m); |
375 } | 375 } |
376 if (m_pMinBox) { | 376 if (m_pMinBox) { |
377 param.m_iPart = CFWL_Part::MinimizeBox; | 377 param.m_iPart = CFWL_Part::MinimizeBox; |
378 param.m_dwStates = m_pMinBox->GetPartState(); | 378 param.m_dwStates = m_pMinBox->GetPartState(); |
379 param.m_rtPart = m_pMinBox->m_rtBtn; | 379 param.m_rtPart = m_pMinBox->m_rtBtn; |
380 pTheme->DrawBackground(¶m); | 380 pTheme->DrawBackground(¶m); |
381 } | 381 } |
382 } | 382 } |
383 #endif | 383 #endif |
384 return FWL_ERR_Succeeded; | 384 return FWL_Error::Succeeded; |
385 } | 385 } |
386 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { | 386 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { |
387 return m_eFormSize; | 387 return m_eFormSize; |
388 } | 388 } |
389 FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { | 389 FWL_Error CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { |
390 m_eFormSize = eFormSize; | 390 m_eFormSize = eFormSize; |
391 return FWL_ERR_Succeeded; | 391 return FWL_Error::Succeeded; |
392 } | 392 } |
393 IFWL_Widget* CFWL_FormImp::DoModal() { | 393 IFWL_Widget* CFWL_FormImp::DoModal() { |
394 IFWL_App* pApp = GetOwnerApp(); | 394 IFWL_App* pApp = GetOwnerApp(); |
395 if (!pApp) | 395 if (!pApp) |
396 return nullptr; | 396 return nullptr; |
397 | 397 |
398 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | 398 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); |
399 if (!pDriver) | 399 if (!pDriver) |
400 return nullptr; | 400 return nullptr; |
401 | 401 |
402 m_pNoteLoop = new CFWL_NoteLoop(this); | 402 m_pNoteLoop = new CFWL_NoteLoop(this); |
403 pDriver->PushNoteLoop(m_pNoteLoop); | 403 pDriver->PushNoteLoop(m_pNoteLoop); |
404 m_bDoModalFlag = TRUE; | 404 m_bDoModalFlag = TRUE; |
405 SetStates(FWL_WGTSTATE_Invisible, FALSE); | 405 SetStates(FWL_WGTSTATE_Invisible, FALSE); |
406 pDriver->Run(); | 406 pDriver->Run(); |
407 #if (_FX_OS_ == _FX_MACOSX_) | 407 #if (_FX_OS_ == _FX_MACOSX_) |
408 #else | 408 #else |
409 pDriver->PopNoteLoop(); | 409 pDriver->PopNoteLoop(); |
410 #endif | 410 #endif |
411 delete m_pNoteLoop; | 411 delete m_pNoteLoop; |
412 m_pNoteLoop = NULL; | 412 m_pNoteLoop = NULL; |
413 return NULL; | 413 return NULL; |
414 } | 414 } |
415 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { | 415 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { |
416 return DoModal(); | 416 return DoModal(); |
417 } | 417 } |
418 FWL_ERR CFWL_FormImp::EndDoModal() { | 418 FWL_Error CFWL_FormImp::EndDoModal() { |
419 if (!m_pNoteLoop) | 419 if (!m_pNoteLoop) |
420 return FWL_ERR_Indefinite; | 420 return FWL_Error::Indefinite; |
421 m_bDoModalFlag = FALSE; | 421 m_bDoModalFlag = FALSE; |
422 #if (_FX_OS_ == _FX_MACOSX_) | 422 #if (_FX_OS_ == _FX_MACOSX_) |
423 m_pNoteLoop->EndModalLoop(); | 423 m_pNoteLoop->EndModalLoop(); |
424 IFWL_App* pApp = GetOwnerApp(); | 424 IFWL_App* pApp = GetOwnerApp(); |
425 if (!pApp) | 425 if (!pApp) |
426 return FWL_ERR_Indefinite; | 426 return FWL_Error::Indefinite; |
427 | 427 |
428 CFWL_NoteDriver* pDriver = | 428 CFWL_NoteDriver* pDriver = |
429 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 429 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
430 if (!pDriver) | 430 if (!pDriver) |
431 return FWL_ERR_Indefinite; | 431 return FWL_Error::Indefinite; |
432 | 432 |
433 pDriver->PopNoteLoop(); | 433 pDriver->PopNoteLoop(); |
434 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 434 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
435 return FWL_ERR_Succeeded; | 435 return FWL_Error::Succeeded; |
436 #else | 436 #else |
437 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 437 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
438 return m_pNoteLoop->EndModalLoop(); | 438 return m_pNoteLoop->EndModalLoop(); |
439 #endif | 439 #endif |
440 } | 440 } |
441 FWL_ERR CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { | 441 FWL_Error CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { |
442 return FWL_ERR_Succeeded; | 442 return FWL_Error::Succeeded; |
443 } | 443 } |
444 void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, | 444 void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, |
445 IFWL_ThemeProvider* pTheme) { | 445 IFWL_ThemeProvider* pTheme) { |
446 CFWL_ThemeBackground param; | 446 CFWL_ThemeBackground param; |
447 param.m_pWidget = m_pInterface; | 447 param.m_pWidget = m_pInterface; |
448 param.m_iPart = CFWL_Part::Background; | 448 param.m_iPart = CFWL_Part::Background; |
449 param.m_pGraphics = pGraphics; | 449 param.m_pGraphics = pGraphics; |
450 param.m_rtPart = m_rtRelative; | 450 param.m_rtPart = m_rtRelative; |
451 param.m_rtPart.Deflate(m_fCYBorder, m_rtCaption.height, m_fCYBorder, | 451 param.m_rtPart.Deflate(m_fCYBorder, m_rtCaption.height, m_fCYBorder, |
452 m_fCXBorder); | 452 m_fCXBorder); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 break; | 875 break; |
876 } | 876 } |
877 case CFWL_MessageType::Deactivate: { | 877 case CFWL_MessageType::Deactivate: { |
878 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; | 878 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; |
879 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 879 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
880 break; | 880 break; |
881 } | 881 } |
882 default: | 882 default: |
883 break; | 883 break; |
884 } | 884 } |
885 return FWL_ERR_Succeeded; | 885 return 0; |
886 } | 886 } |
887 #else | 887 #else |
888 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 888 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
889 if (!pMessage) | 889 if (!pMessage) |
890 return 0; | 890 return 0; |
891 int32_t iRet = 1; | 891 int32_t iRet = 1; |
892 switch (pMessage->GetClassID()) { | 892 switch (pMessage->GetClassID()) { |
893 case CFWL_MessageType::Activate: { | 893 case CFWL_MessageType::Activate: { |
894 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 894 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
895 IFWL_App* pApp = m_pOwner->GetOwnerApp(); | 895 IFWL_App* pApp = m_pOwner->GetOwnerApp(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 } | 988 } |
989 default: { | 989 default: { |
990 iRet = 0; | 990 iRet = 0; |
991 break; | 991 break; |
992 } | 992 } |
993 } | 993 } |
994 return iRet; | 994 return iRet; |
995 } | 995 } |
996 #endif // FWL_UseMacSystemBorder | 996 #endif // FWL_UseMacSystemBorder |
997 | 997 |
998 FWL_ERR CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 998 FWL_Error CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
999 if (!pEvent) | 999 if (!pEvent) |
1000 return FWL_ERR_Indefinite; | 1000 return FWL_Error::Indefinite; |
1001 return FWL_ERR_Succeeded; | 1001 return FWL_Error::Succeeded; |
1002 } | 1002 } |
1003 | 1003 |
1004 FWL_ERR CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1004 FWL_Error CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
1005 const CFX_Matrix* pMatrix) { | 1005 const CFX_Matrix* pMatrix) { |
1006 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 1006 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
1007 } | 1007 } |
1008 void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { | 1008 void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { |
1009 m_pOwner->SetGrab(TRUE); | 1009 m_pOwner->SetGrab(TRUE); |
1010 m_pOwner->m_bLButtonDown = TRUE; | 1010 m_pOwner->m_bLButtonDown = TRUE; |
1011 m_pOwner->m_eResizeType = FORM_RESIZETYPE_None; | 1011 m_pOwner->m_eResizeType = FORM_RESIZETYPE_None; |
1012 CFWL_SysBtn* pPressBtn = m_pOwner->GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); | 1012 CFWL_SysBtn* pPressBtn = m_pOwner->GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); |
1013 m_pOwner->m_iCaptureBtn = m_pOwner->GetSysBtnIndex(pPressBtn); | 1013 m_pOwner->m_iCaptureBtn = m_pOwner->GetSysBtnIndex(pPressBtn); |
1014 CFX_RectF rtCap; | 1014 CFX_RectF rtCap; |
1015 rtCap.Set(m_pOwner->m_rtCaption.left + m_pOwner->m_fCYBorder, | 1015 rtCap.Set(m_pOwner->m_rtCaption.left + m_pOwner->m_fCYBorder, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 } | 1158 } |
1159 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { | 1159 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { |
1160 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; | 1160 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; |
1161 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; | 1161 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; |
1162 } | 1162 } |
1163 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { | 1163 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { |
1164 CFWL_EvtClose eClose; | 1164 CFWL_EvtClose eClose; |
1165 eClose.m_pSrcTarget = m_pOwner->m_pInterface; | 1165 eClose.m_pSrcTarget = m_pOwner->m_pInterface; |
1166 m_pOwner->DispatchEvent(&eClose); | 1166 m_pOwner->DispatchEvent(&eClose); |
1167 } | 1167 } |
OLD | NEW |