| 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 30 matching lines...) Expand all Loading... |
| 41 IFWL_Form* pForm = new IFWL_Form; | 41 IFWL_Form* pForm = new IFWL_Form; |
| 42 CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter); | 42 CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter); |
| 43 pForm->SetImpl(pFormProxyImpl); | 43 pForm->SetImpl(pFormProxyImpl); |
| 44 pFormProxyImpl->SetInterface(pForm); | 44 pFormProxyImpl->SetInterface(pForm); |
| 45 return pForm; | 45 return pForm; |
| 46 } | 46 } |
| 47 IFWL_Form::IFWL_Form() {} | 47 IFWL_Form::IFWL_Form() {} |
| 48 FWL_FORMSIZE IFWL_Form::GetFormSize() { | 48 FWL_FORMSIZE IFWL_Form::GetFormSize() { |
| 49 return static_cast<CFWL_FormImp*>(GetImpl())->GetFormSize(); | 49 return static_cast<CFWL_FormImp*>(GetImpl())->GetFormSize(); |
| 50 } | 50 } |
| 51 FWL_ERR IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { | 51 FWL_Error IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { |
| 52 return static_cast<CFWL_FormImp*>(GetImpl())->SetFormSize(eFormSize); | 52 return static_cast<CFWL_FormImp*>(GetImpl())->SetFormSize(eFormSize); |
| 53 } | 53 } |
| 54 IFWL_Widget* IFWL_Form::DoModal() { | 54 IFWL_Widget* IFWL_Form::DoModal() { |
| 55 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(); | 55 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(); |
| 56 } | 56 } |
| 57 IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { | 57 IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { |
| 58 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(dwCommandID); | 58 return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(dwCommandID); |
| 59 } | 59 } |
| 60 FWL_ERR IFWL_Form::EndDoModal() { | 60 FWL_Error IFWL_Form::EndDoModal() { |
| 61 return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal(); | 61 return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal(); |
| 62 } | 62 } |
| 63 FWL_ERR IFWL_Form::SetBorderRegion(CFX_Path* pPath) { | 63 FWL_Error IFWL_Form::SetBorderRegion(CFX_Path* pPath) { |
| 64 return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); | 64 return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); |
| 65 } | 65 } |
| 66 | 66 |
| 67 CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, | 67 CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, |
| 68 IFWL_Widget* pOuter) | 68 IFWL_Widget* pOuter) |
| 69 : CFWL_WidgetImp(properties, pOuter), | 69 : CFWL_WidgetImp(properties, pOuter), |
| 70 m_pCloseBox(nullptr), | 70 m_pCloseBox(nullptr), |
| 71 m_pMinBox(nullptr), | 71 m_pMinBox(nullptr), |
| 72 m_pMaxBox(nullptr), | 72 m_pMaxBox(nullptr), |
| 73 m_pCaptionBox(nullptr), | 73 m_pCaptionBox(nullptr), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 92 m_rtRestore.Reset(); | 92 m_rtRestore.Reset(); |
| 93 m_rtCaptionText.Reset(); | 93 m_rtCaptionText.Reset(); |
| 94 m_rtIcon.Reset(); | 94 m_rtIcon.Reset(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 CFWL_FormImp::~CFWL_FormImp() { | 97 CFWL_FormImp::~CFWL_FormImp() { |
| 98 RemoveSysButtons(); | 98 RemoveSysButtons(); |
| 99 delete m_pNoteLoop; | 99 delete m_pNoteLoop; |
| 100 } | 100 } |
| 101 | 101 |
| 102 FWL_ERR CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { | 102 FWL_Error CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { |
| 103 wsClass = FWL_CLASS_Form; | 103 wsClass = FWL_CLASS_Form; |
| 104 return FWL_ERR_Succeeded; | 104 return FWL_Error::Succeeded; |
| 105 } | 105 } |
| 106 | 106 |
| 107 uint32_t CFWL_FormImp::GetClassID() const { | 107 uint32_t CFWL_FormImp::GetClassID() const { |
| 108 return FWL_CLASSHASH_Form; | 108 return FWL_CLASSHASH_Form; |
| 109 } | 109 } |
| 110 | 110 |
| 111 FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { | 111 FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { |
| 112 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) | 112 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) |
| 113 return TRUE; | 113 return TRUE; |
| 114 return CFWL_WidgetImp::IsInstance(wsClass); | 114 return CFWL_WidgetImp::IsInstance(wsClass); |
| 115 } | 115 } |
| 116 | 116 |
| 117 FWL_ERR CFWL_FormImp::Initialize() { | 117 FWL_Error CFWL_FormImp::Initialize() { |
| 118 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) | 118 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) |
| 119 return FWL_ERR_Indefinite; | 119 return FWL_Error::Indefinite; |
| 120 RegisterForm(); | 120 RegisterForm(); |
| 121 RegisterEventTarget(); | 121 RegisterEventTarget(); |
| 122 m_pDelegate = new CFWL_FormImpDelegate(this); | 122 m_pDelegate = new CFWL_FormImpDelegate(this); |
| 123 return FWL_ERR_Succeeded; | 123 return FWL_Error::Succeeded; |
| 124 } | 124 } |
| 125 FWL_ERR CFWL_FormImp::Finalize() { | 125 FWL_Error CFWL_FormImp::Finalize() { |
| 126 delete m_pDelegate; | 126 delete m_pDelegate; |
| 127 m_pDelegate = nullptr; | 127 m_pDelegate = nullptr; |
| 128 UnregisterEventTarget(); | 128 UnregisterEventTarget(); |
| 129 UnRegisterForm(); | 129 UnRegisterForm(); |
| 130 return CFWL_WidgetImp::Finalize(); | 130 return CFWL_WidgetImp::Finalize(); |
| 131 } | 131 } |
| 132 FWL_ERR CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 132 FWL_Error CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
| 133 if (bAutoSize) { | 133 if (bAutoSize) { |
| 134 rect.Reset(); | 134 rect.Reset(); |
| 135 FX_FLOAT fCapHeight = GetCaptionHeight(); | 135 FX_FLOAT fCapHeight = GetCaptionHeight(); |
| 136 FX_FLOAT fCXBorder = GetBorderSize(TRUE); | 136 FX_FLOAT fCXBorder = GetBorderSize(TRUE); |
| 137 FX_FLOAT fCYBorder = GetBorderSize(FALSE); | 137 FX_FLOAT fCYBorder = GetBorderSize(FALSE); |
| 138 FX_FLOAT fEdge = GetEdgeWidth(); | 138 FX_FLOAT fEdge = GetEdgeWidth(); |
| 139 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; | 139 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; |
| 140 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; | 140 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; |
| 141 } else { | 141 } else { |
| 142 rect = m_pProperties->m_rtWidget; | 142 rect = m_pProperties->m_rtWidget; |
| 143 } | 143 } |
| 144 return FWL_ERR_Succeeded; | 144 return FWL_Error::Succeeded; |
| 145 } | 145 } |
| 146 FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) { | 146 FWL_Error CFWL_FormImp::GetClientRect(CFX_RectF& rect) { |
| 147 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { | 147 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { |
| 148 rect = m_pProperties->m_rtWidget; | 148 rect = m_pProperties->m_rtWidget; |
| 149 rect.Offset(-rect.left, -rect.top); | 149 rect.Offset(-rect.left, -rect.top); |
| 150 return FWL_ERR_Succeeded; | 150 return FWL_Error::Succeeded; |
| 151 } | 151 } |
| 152 #ifdef FWL_UseMacSystemBorder | 152 #ifdef FWL_UseMacSystemBorder |
| 153 rect = m_rtRelative; | 153 rect = m_rtRelative; |
| 154 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 154 CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); |
| 155 if (!pWidgetMgr) | 155 if (!pWidgetMgr) |
| 156 return FWL_ERR_Indefinite; | 156 return FWL_Error::Indefinite; |
| 157 | 157 |
| 158 rect.left = 0; | 158 rect.left = 0; |
| 159 rect.top = 0; | 159 rect.top = 0; |
| 160 return FWL_ERR_Succeeded; | 160 return FWL_Error::Succeeded; |
| 161 #else | 161 #else |
| 162 FX_FLOAT x = 0; | 162 FX_FLOAT x = 0; |
| 163 FX_FLOAT y = 0; | 163 FX_FLOAT y = 0; |
| 164 FX_FLOAT t = 0; | 164 FX_FLOAT t = 0; |
| 165 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 165 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
| 166 if (pTheme) { | 166 if (pTheme) { |
| 167 CFWL_ThemePart part; | 167 CFWL_ThemePart part; |
| 168 part.m_pWidget = m_pInterface; | 168 part.m_pWidget = m_pInterface; |
| 169 x = *static_cast<FX_FLOAT*>( | 169 x = *static_cast<FX_FLOAT*>( |
| 170 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder)); | 170 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder)); |
| 171 y = *static_cast<FX_FLOAT*>( | 171 y = *static_cast<FX_FLOAT*>( |
| 172 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYBorder)); | 172 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYBorder)); |
| 173 t = *static_cast<FX_FLOAT*>( | 173 t = *static_cast<FX_FLOAT*>( |
| 174 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYCaption)); | 174 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYCaption)); |
| 175 } | 175 } |
| 176 rect = m_pProperties->m_rtWidget; | 176 rect = m_pProperties->m_rtWidget; |
| 177 rect.Offset(-rect.left, -rect.top); | 177 rect.Offset(-rect.left, -rect.top); |
| 178 rect.Deflate(x, t, x, y); | 178 rect.Deflate(x, t, x, y); |
| 179 return FWL_ERR_Succeeded; | 179 return FWL_Error::Succeeded; |
| 180 #endif | 180 #endif |
| 181 } | 181 } |
| 182 FWL_ERR CFWL_FormImp::Update() { | 182 FWL_Error CFWL_FormImp::Update() { |
| 183 if (m_iLock > 0) { | 183 if (m_iLock > 0) { |
| 184 return FWL_ERR_Succeeded; | 184 return FWL_Error::Succeeded; |
| 185 } | 185 } |
| 186 if (!m_pProperties->m_pThemeProvider) { | 186 if (!m_pProperties->m_pThemeProvider) { |
| 187 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 187 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
| 188 } | 188 } |
| 189 #ifdef FWL_UseMacSystemBorder | 189 #ifdef FWL_UseMacSystemBorder |
| 190 #else | 190 #else |
| 191 SetThemeData(); | 191 SetThemeData(); |
| 192 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon) { | 192 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon) { |
| 193 UpdateIcon(); | 193 UpdateIcon(); |
| 194 } | 194 } |
| 195 #endif | 195 #endif |
| 196 UpdateCaption(); | 196 UpdateCaption(); |
| 197 Layout(); | 197 Layout(); |
| 198 return FWL_ERR_Succeeded; | 198 return FWL_Error::Succeeded; |
| 199 } | 199 } |
| 200 FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 200 FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
| 201 GetAvailableTheme(); | 201 GetAvailableTheme(); |
| 202 if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) | 202 if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) |
| 203 return FWL_WidgetHit::CloseBox; | 203 return FWL_WidgetHit::CloseBox; |
| 204 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) | 204 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) |
| 205 return FWL_WidgetHit::MaxBox; | 205 return FWL_WidgetHit::MaxBox; |
| 206 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) | 206 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) |
| 207 return FWL_WidgetHit::MinBox; | 207 return FWL_WidgetHit::MinBox; |
| 208 CFX_RectF rtCap; | 208 CFX_RectF rtCap; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 if (rt.Contains(fx, fy)) | 242 if (rt.Contains(fx, fy)) |
| 243 return FWL_WidgetHit::RightTop; | 243 return FWL_WidgetHit::RightTop; |
| 244 rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge, | 244 rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge, |
| 245 m_rtRelative.height - m_fCXBorder - kCornerEnlarge, | 245 m_rtRelative.height - m_fCXBorder - kCornerEnlarge, |
| 246 m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge); | 246 m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge); |
| 247 if (rt.Contains(fx, fy)) | 247 if (rt.Contains(fx, fy)) |
| 248 return FWL_WidgetHit::RightBottom; | 248 return FWL_WidgetHit::RightBottom; |
| 249 } | 249 } |
| 250 return FWL_WidgetHit::Client; | 250 return FWL_WidgetHit::Client; |
| 251 } | 251 } |
| 252 FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, | 252 FWL_Error CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, |
| 253 const CFX_Matrix* pMatrix) { | 253 const CFX_Matrix* pMatrix) { |
| 254 if (!pGraphics) | 254 if (!pGraphics) |
| 255 return FWL_ERR_Indefinite; | 255 return FWL_Error::Indefinite; |
| 256 if (!m_pProperties->m_pThemeProvider) | 256 if (!m_pProperties->m_pThemeProvider) |
| 257 return FWL_ERR_Indefinite; | 257 return FWL_Error::Indefinite; |
| 258 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 258 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
| 259 FX_BOOL bInactive = !IsActive(); | 259 FX_BOOL bInactive = !IsActive(); |
| 260 int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; | 260 int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; |
| 261 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_NoDrawClient) == 0) { | 261 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_NoDrawClient) == 0) { |
| 262 DrawBackground(pGraphics, pTheme); | 262 DrawBackground(pGraphics, pTheme); |
| 263 } | 263 } |
| 264 #ifdef FWL_UseMacSystemBorder | 264 #ifdef FWL_UseMacSystemBorder |
| 265 return FWL_ERR_Succeeded; | 265 return FWL_Error::Succeeded; |
| 266 #endif | 266 #endif |
| 267 CFWL_ThemeBackground param; | 267 CFWL_ThemeBackground param; |
| 268 param.m_pWidget = m_pInterface; | 268 param.m_pWidget = m_pInterface; |
| 269 param.m_dwStates = iState; | 269 param.m_dwStates = iState; |
| 270 param.m_pGraphics = pGraphics; | 270 param.m_pGraphics = pGraphics; |
| 271 param.m_rtPart = m_rtRelative; | 271 param.m_rtPart = m_rtRelative; |
| 272 if (pMatrix) { | 272 if (pMatrix) { |
| 273 param.m_matrix.Concat(*pMatrix); | 273 param.m_matrix.Concat(*pMatrix); |
| 274 } | 274 } |
| 275 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { | 275 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 pTheme->DrawBackground(¶m); | 358 pTheme->DrawBackground(¶m); |
| 359 } | 359 } |
| 360 if (m_pMinBox) { | 360 if (m_pMinBox) { |
| 361 param.m_iPart = CFWL_Part::MinimizeBox; | 361 param.m_iPart = CFWL_Part::MinimizeBox; |
| 362 param.m_dwStates = m_pMinBox->GetPartState(); | 362 param.m_dwStates = m_pMinBox->GetPartState(); |
| 363 param.m_rtPart = m_pMinBox->m_rtBtn; | 363 param.m_rtPart = m_pMinBox->m_rtBtn; |
| 364 pTheme->DrawBackground(¶m); | 364 pTheme->DrawBackground(¶m); |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 #endif | 367 #endif |
| 368 return FWL_ERR_Succeeded; | 368 return FWL_Error::Succeeded; |
| 369 } | 369 } |
| 370 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { | 370 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { |
| 371 return m_eFormSize; | 371 return m_eFormSize; |
| 372 } | 372 } |
| 373 FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { | 373 FWL_Error CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { |
| 374 m_eFormSize = eFormSize; | 374 m_eFormSize = eFormSize; |
| 375 return FWL_ERR_Succeeded; | 375 return FWL_Error::Succeeded; |
| 376 } | 376 } |
| 377 IFWL_Widget* CFWL_FormImp::DoModal() { | 377 IFWL_Widget* CFWL_FormImp::DoModal() { |
| 378 IFWL_App* pApp = GetOwnerApp(); | 378 IFWL_App* pApp = GetOwnerApp(); |
| 379 if (!pApp) | 379 if (!pApp) |
| 380 return nullptr; | 380 return nullptr; |
| 381 | 381 |
| 382 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | 382 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); |
| 383 if (!pDriver) | 383 if (!pDriver) |
| 384 return nullptr; | 384 return nullptr; |
| 385 | 385 |
| 386 m_pNoteLoop = new CFWL_NoteLoop(this); | 386 m_pNoteLoop = new CFWL_NoteLoop(this); |
| 387 pDriver->PushNoteLoop(m_pNoteLoop); | 387 pDriver->PushNoteLoop(m_pNoteLoop); |
| 388 m_bDoModalFlag = TRUE; | 388 m_bDoModalFlag = TRUE; |
| 389 SetStates(FWL_WGTSTATE_Invisible, FALSE); | 389 SetStates(FWL_WGTSTATE_Invisible, FALSE); |
| 390 pDriver->Run(); | 390 pDriver->Run(); |
| 391 #if (_FX_OS_ == _FX_MACOSX_) | 391 #if (_FX_OS_ == _FX_MACOSX_) |
| 392 #else | 392 #else |
| 393 pDriver->PopNoteLoop(); | 393 pDriver->PopNoteLoop(); |
| 394 #endif | 394 #endif |
| 395 delete m_pNoteLoop; | 395 delete m_pNoteLoop; |
| 396 m_pNoteLoop = NULL; | 396 m_pNoteLoop = NULL; |
| 397 return NULL; | 397 return NULL; |
| 398 } | 398 } |
| 399 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { | 399 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { |
| 400 return DoModal(); | 400 return DoModal(); |
| 401 } | 401 } |
| 402 FWL_ERR CFWL_FormImp::EndDoModal() { | 402 FWL_Error CFWL_FormImp::EndDoModal() { |
| 403 if (!m_pNoteLoop) | 403 if (!m_pNoteLoop) |
| 404 return FWL_ERR_Indefinite; | 404 return FWL_Error::Indefinite; |
| 405 m_bDoModalFlag = FALSE; | 405 m_bDoModalFlag = FALSE; |
| 406 #if (_FX_OS_ == _FX_MACOSX_) | 406 #if (_FX_OS_ == _FX_MACOSX_) |
| 407 m_pNoteLoop->EndModalLoop(); | 407 m_pNoteLoop->EndModalLoop(); |
| 408 IFWL_App* pApp = GetOwnerApp(); | 408 IFWL_App* pApp = GetOwnerApp(); |
| 409 if (!pApp) | 409 if (!pApp) |
| 410 return FWL_ERR_Indefinite; | 410 return FWL_Error::Indefinite; |
| 411 | 411 |
| 412 CFWL_NoteDriver* pDriver = | 412 CFWL_NoteDriver* pDriver = |
| 413 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 413 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 414 if (!pDriver) | 414 if (!pDriver) |
| 415 return FWL_ERR_Indefinite; | 415 return FWL_Error::Indefinite; |
| 416 | 416 |
| 417 pDriver->PopNoteLoop(); | 417 pDriver->PopNoteLoop(); |
| 418 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 418 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
| 419 return FWL_ERR_Succeeded; | 419 return FWL_Error::Succeeded; |
| 420 #else | 420 #else |
| 421 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 421 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
| 422 return m_pNoteLoop->EndModalLoop(); | 422 return m_pNoteLoop->EndModalLoop(); |
| 423 #endif | 423 #endif |
| 424 } | 424 } |
| 425 FWL_ERR CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { | 425 FWL_Error CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { |
| 426 return FWL_ERR_Succeeded; | 426 return FWL_Error::Succeeded; |
| 427 } | 427 } |
| 428 void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, | 428 void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, |
| 429 IFWL_ThemeProvider* pTheme) { | 429 IFWL_ThemeProvider* pTheme) { |
| 430 CFWL_ThemeBackground param; | 430 CFWL_ThemeBackground param; |
| 431 param.m_pWidget = m_pInterface; | 431 param.m_pWidget = m_pInterface; |
| 432 param.m_iPart = CFWL_Part::Background; | 432 param.m_iPart = CFWL_Part::Background; |
| 433 param.m_pGraphics = pGraphics; | 433 param.m_pGraphics = pGraphics; |
| 434 param.m_rtPart = m_rtRelative; | 434 param.m_rtPart = m_rtRelative; |
| 435 param.m_rtPart.Deflate(m_fCYBorder, m_rtCaption.height, m_fCYBorder, | 435 param.m_rtPart.Deflate(m_fCYBorder, m_rtCaption.height, m_fCYBorder, |
| 436 m_fCXBorder); | 436 m_fCXBorder); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 fTop -= bTop ? (fLimitMax - fHeight) : 0; | 835 fTop -= bTop ? (fLimitMax - fHeight) : 0; |
| 836 fHeight = fLimitMax; | 836 fHeight = fLimitMax; |
| 837 } | 837 } |
| 838 } | 838 } |
| 839 } | 839 } |
| 840 | 840 |
| 841 CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner) | 841 CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner) |
| 842 : m_pOwner(pOwner) {} | 842 : m_pOwner(pOwner) {} |
| 843 | 843 |
| 844 #ifdef FWL_UseMacSystemBorder | 844 #ifdef FWL_UseMacSystemBorder |
| 845 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 845 void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 846 if (!pMessage) | 846 if (!pMessage) |
| 847 return 0; | 847 return; |
| 848 |
| 848 switch (pMessage->GetClassID()) { | 849 switch (pMessage->GetClassID()) { |
| 849 case CFWL_MessageType::Activate: { | 850 case CFWL_MessageType::Activate: { |
| 850 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 851 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
| 851 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 852 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
| 852 break; | 853 break; |
| 853 } | 854 } |
| 854 case CFWL_MessageType::Deactivate: { | 855 case CFWL_MessageType::Deactivate: { |
| 855 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; | 856 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; |
| 856 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 857 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
| 857 break; | 858 break; |
| 858 } | 859 } |
| 859 default: | 860 default: |
| 860 break; | 861 break; |
| 861 } | 862 } |
| 862 return FWL_ERR_Succeeded; | |
| 863 } | 863 } |
| 864 #else | 864 #else |
| 865 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 865 void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 866 if (!pMessage) | 866 if (!pMessage) |
| 867 return 0; | 867 return; |
| 868 int32_t iRet = 1; | 868 |
| 869 switch (pMessage->GetClassID()) { | 869 switch (pMessage->GetClassID()) { |
| 870 case CFWL_MessageType::Activate: { | 870 case CFWL_MessageType::Activate: { |
| 871 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 871 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
| 872 IFWL_App* pApp = m_pOwner->GetOwnerApp(); | 872 IFWL_App* pApp = m_pOwner->GetOwnerApp(); |
| 873 CFWL_NoteDriver* pDriver = | 873 CFWL_NoteDriver* pDriver = |
| 874 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 874 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 875 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); | 875 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); |
| 876 IFWL_Widget* pSubFocus = | 876 IFWL_Widget* pSubFocus = |
| 877 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; | 877 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; |
| 878 if (pSubFocus && pSubFocus != pDriver->GetFocus()) | 878 if (pSubFocus && pSubFocus != pDriver->GetFocus()) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 } | 931 } |
| 932 default: | 932 default: |
| 933 break; | 933 break; |
| 934 } | 934 } |
| 935 break; | 935 break; |
| 936 } | 936 } |
| 937 case CFWL_MessageType::Size: { | 937 case CFWL_MessageType::Size: { |
| 938 CFWL_WidgetMgr* pWidgetMgr = | 938 CFWL_WidgetMgr* pWidgetMgr = |
| 939 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 939 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); |
| 940 if (!pWidgetMgr) | 940 if (!pWidgetMgr) |
| 941 return 0; | 941 return; |
| 942 | 942 |
| 943 pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface); | 943 pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface); |
| 944 if (!m_pOwner->m_bSetMaximize) | 944 if (!m_pOwner->m_bSetMaximize) |
| 945 break; | 945 break; |
| 946 | 946 |
| 947 m_pOwner->m_bSetMaximize = FALSE; | 947 m_pOwner->m_bSetMaximize = FALSE; |
| 948 CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage); | 948 CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage); |
| 949 m_pOwner->m_pProperties->m_rtWidget.left = 0; | 949 m_pOwner->m_pProperties->m_rtWidget.left = 0; |
| 950 m_pOwner->m_pProperties->m_rtWidget.top = 0; | 950 m_pOwner->m_pProperties->m_rtWidget.top = 0; |
| 951 m_pOwner->m_pProperties->m_rtWidget.width = (FX_FLOAT)pMsg->m_iWidth; | 951 m_pOwner->m_pProperties->m_rtWidget.width = (FX_FLOAT)pMsg->m_iWidth; |
| 952 m_pOwner->m_pProperties->m_rtWidget.height = (FX_FLOAT)pMsg->m_iHeight; | 952 m_pOwner->m_pProperties->m_rtWidget.height = (FX_FLOAT)pMsg->m_iHeight; |
| 953 m_pOwner->Update(); | 953 m_pOwner->Update(); |
| 954 break; | 954 break; |
| 955 } | 955 } |
| 956 case CFWL_MessageType::WindowMove: { | 956 case CFWL_MessageType::WindowMove: { |
| 957 OnWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage)); | 957 OnWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage)); |
| 958 break; | 958 break; |
| 959 } | 959 } |
| 960 case CFWL_MessageType::Close: { | 960 case CFWL_MessageType::Close: { |
| 961 OnClose(static_cast<CFWL_MsgClose*>(pMessage)); | 961 OnClose(static_cast<CFWL_MsgClose*>(pMessage)); |
| 962 break; | 962 break; |
| 963 } | 963 } |
| 964 default: { | 964 default: { |
| 965 iRet = 0; | |
| 966 break; | 965 break; |
| 967 } | 966 } |
| 968 } | 967 } |
| 969 return iRet; | |
| 970 } | 968 } |
| 971 #endif // FWL_UseMacSystemBorder | 969 #endif // FWL_UseMacSystemBorder |
| 972 | 970 |
| 973 FWL_ERR CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 971 void CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} |
| 974 if (!pEvent) | 972 |
| 975 return FWL_ERR_Indefinite; | 973 void CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 976 return FWL_ERR_Succeeded; | 974 const CFX_Matrix* pMatrix) { |
| 975 m_pOwner->DrawWidget(pGraphics, pMatrix); |
| 977 } | 976 } |
| 978 | 977 |
| 979 FWL_ERR CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | |
| 980 const CFX_Matrix* pMatrix) { | |
| 981 return m_pOwner->DrawWidget(pGraphics, pMatrix); | |
| 982 } | |
| 983 void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { | 978 void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { |
| 984 m_pOwner->SetGrab(TRUE); | 979 m_pOwner->SetGrab(TRUE); |
| 985 m_pOwner->m_bLButtonDown = TRUE; | 980 m_pOwner->m_bLButtonDown = TRUE; |
| 986 m_pOwner->m_eResizeType = FORM_RESIZETYPE_None; | 981 m_pOwner->m_eResizeType = FORM_RESIZETYPE_None; |
| 987 CFWL_SysBtn* pPressBtn = m_pOwner->GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); | 982 CFWL_SysBtn* pPressBtn = m_pOwner->GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); |
| 988 m_pOwner->m_iCaptureBtn = m_pOwner->GetSysBtnIndex(pPressBtn); | 983 m_pOwner->m_iCaptureBtn = m_pOwner->GetSysBtnIndex(pPressBtn); |
| 989 CFX_RectF rtCap; | 984 CFX_RectF rtCap; |
| 990 rtCap.Set(m_pOwner->m_rtCaption.left + m_pOwner->m_fCYBorder, | 985 rtCap.Set(m_pOwner->m_rtCaption.left + m_pOwner->m_fCYBorder, |
| 991 m_pOwner->m_rtCaption.top + m_pOwner->m_fCXBorder, | 986 m_pOwner->m_rtCaption.top + m_pOwner->m_fCXBorder, |
| 992 m_pOwner->m_rtCaption.width - | 987 m_pOwner->m_rtCaption.width - |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 } | 1122 } |
| 1128 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { | 1123 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { |
| 1129 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; | 1124 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; |
| 1130 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; | 1125 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; |
| 1131 } | 1126 } |
| 1132 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { | 1127 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { |
| 1133 CFWL_EvtClose eClose; | 1128 CFWL_EvtClose eClose; |
| 1134 eClose.m_pSrcTarget = m_pOwner->m_pInterface; | 1129 eClose.m_pSrcTarget = m_pOwner->m_pInterface; |
| 1135 m_pOwner->DispatchEvent(&eClose); | 1130 m_pOwner->DispatchEvent(&eClose); |
| 1136 } | 1131 } |
| OLD | NEW |