| 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 FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 204 FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
| 205 GetAvailableTheme(); | 205 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_WidgetHit::CloseBox; | 207 return FWL_WidgetHit::CloseBox; |
| 208 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) | 208 if (m_pMaxBox && m_pMaxBox->m_rtBtn.Contains(fx, fy)) |
| 209 return FWL_WidgetHit::MaxBox; | 209 return FWL_WidgetHit::MaxBox; |
| 210 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) | 210 if (m_pMinBox && m_pMinBox->m_rtBtn.Contains(fx, fy)) |
| 211 return FWL_WidgetHit::MinBox; | 211 return FWL_WidgetHit::MinBox; |
| 212 CFX_RectF rtCap; | 212 CFX_RectF rtCap; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 if (rt.Contains(fx, fy)) | 246 if (rt.Contains(fx, fy)) |
| 247 return FWL_WidgetHit::RightTop; | 247 return FWL_WidgetHit::RightTop; |
| 248 rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge, | 248 rt.Set(m_rtRelative.width - m_fCYBorder - kCornerEnlarge, |
| 249 m_rtRelative.height - m_fCXBorder - kCornerEnlarge, | 249 m_rtRelative.height - m_fCXBorder - kCornerEnlarge, |
| 250 m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge); | 250 m_fCYBorder + kCornerEnlarge, m_fCXBorder + kCornerEnlarge); |
| 251 if (rt.Contains(fx, fy)) | 251 if (rt.Contains(fx, fy)) |
| 252 return FWL_WidgetHit::RightBottom; | 252 return FWL_WidgetHit::RightBottom; |
| 253 } | 253 } |
| 254 return FWL_WidgetHit::Client; | 254 return FWL_WidgetHit::Client; |
| 255 } | 255 } |
| 256 FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, | 256 FWL_Error CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, |
| 257 const CFX_Matrix* pMatrix) { | 257 const CFX_Matrix* pMatrix) { |
| 258 if (!pGraphics) | 258 if (!pGraphics) |
| 259 return FWL_ERR_Indefinite; | 259 return FWL_Error::Indefinite; |
| 260 if (!m_pProperties->m_pThemeProvider) | 260 if (!m_pProperties->m_pThemeProvider) |
| 261 return FWL_ERR_Indefinite; | 261 return FWL_Error::Indefinite; |
| 262 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 262 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
| 263 FX_BOOL bInactive = !IsActive(); | 263 FX_BOOL bInactive = !IsActive(); |
| 264 int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; | 264 int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; |
| 265 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_NoDrawClient) == 0) { | 265 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_FRM_NoDrawClient) == 0) { |
| 266 DrawBackground(pGraphics, pTheme); | 266 DrawBackground(pGraphics, pTheme); |
| 267 } | 267 } |
| 268 #ifdef FWL_UseMacSystemBorder | 268 #ifdef FWL_UseMacSystemBorder |
| 269 return FWL_ERR_Succeeded; | 269 return FWL_Error::Succeeded; |
| 270 #endif | 270 #endif |
| 271 CFWL_ThemeBackground param; | 271 CFWL_ThemeBackground param; |
| 272 param.m_pWidget = m_pInterface; | 272 param.m_pWidget = m_pInterface; |
| 273 param.m_dwStates = iState; | 273 param.m_dwStates = iState; |
| 274 param.m_pGraphics = pGraphics; | 274 param.m_pGraphics = pGraphics; |
| 275 param.m_rtPart = m_rtRelative; | 275 param.m_rtPart = m_rtRelative; |
| 276 if (pMatrix) { | 276 if (pMatrix) { |
| 277 param.m_matrix.Concat(*pMatrix); | 277 param.m_matrix.Concat(*pMatrix); |
| 278 } | 278 } |
| 279 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { | 279 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 pTheme->DrawBackground(¶m); | 362 pTheme->DrawBackground(¶m); |
| 363 } | 363 } |
| 364 if (m_pMinBox) { | 364 if (m_pMinBox) { |
| 365 param.m_iPart = CFWL_Part::MinimizeBox; | 365 param.m_iPart = CFWL_Part::MinimizeBox; |
| 366 param.m_dwStates = m_pMinBox->GetPartState(); | 366 param.m_dwStates = m_pMinBox->GetPartState(); |
| 367 param.m_rtPart = m_pMinBox->m_rtBtn; | 367 param.m_rtPart = m_pMinBox->m_rtBtn; |
| 368 pTheme->DrawBackground(¶m); | 368 pTheme->DrawBackground(¶m); |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 #endif | 371 #endif |
| 372 return FWL_ERR_Succeeded; | 372 return FWL_Error::Succeeded; |
| 373 } | 373 } |
| 374 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { | 374 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { |
| 375 return m_eFormSize; | 375 return m_eFormSize; |
| 376 } | 376 } |
| 377 FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { | 377 FWL_Error CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { |
| 378 m_eFormSize = eFormSize; | 378 m_eFormSize = eFormSize; |
| 379 return FWL_ERR_Succeeded; | 379 return FWL_Error::Succeeded; |
| 380 } | 380 } |
| 381 IFWL_Widget* CFWL_FormImp::DoModal() { | 381 IFWL_Widget* CFWL_FormImp::DoModal() { |
| 382 IFWL_App* pApp = GetOwnerApp(); | 382 IFWL_App* pApp = GetOwnerApp(); |
| 383 if (!pApp) | 383 if (!pApp) |
| 384 return nullptr; | 384 return nullptr; |
| 385 | 385 |
| 386 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | 386 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); |
| 387 if (!pDriver) | 387 if (!pDriver) |
| 388 return nullptr; | 388 return nullptr; |
| 389 | 389 |
| 390 m_pNoteLoop = new CFWL_NoteLoop(this); | 390 m_pNoteLoop = new CFWL_NoteLoop(this); |
| 391 pDriver->PushNoteLoop(m_pNoteLoop); | 391 pDriver->PushNoteLoop(m_pNoteLoop); |
| 392 m_bDoModalFlag = TRUE; | 392 m_bDoModalFlag = TRUE; |
| 393 SetStates(FWL_WGTSTATE_Invisible, FALSE); | 393 SetStates(FWL_WGTSTATE_Invisible, FALSE); |
| 394 pDriver->Run(); | 394 pDriver->Run(); |
| 395 #if (_FX_OS_ == _FX_MACOSX_) | 395 #if (_FX_OS_ == _FX_MACOSX_) |
| 396 #else | 396 #else |
| 397 pDriver->PopNoteLoop(); | 397 pDriver->PopNoteLoop(); |
| 398 #endif | 398 #endif |
| 399 delete m_pNoteLoop; | 399 delete m_pNoteLoop; |
| 400 m_pNoteLoop = NULL; | 400 m_pNoteLoop = NULL; |
| 401 return NULL; | 401 return NULL; |
| 402 } | 402 } |
| 403 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { | 403 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { |
| 404 return DoModal(); | 404 return DoModal(); |
| 405 } | 405 } |
| 406 FWL_ERR CFWL_FormImp::EndDoModal() { | 406 FWL_Error CFWL_FormImp::EndDoModal() { |
| 407 if (!m_pNoteLoop) | 407 if (!m_pNoteLoop) |
| 408 return FWL_ERR_Indefinite; | 408 return FWL_Error::Indefinite; |
| 409 m_bDoModalFlag = FALSE; | 409 m_bDoModalFlag = FALSE; |
| 410 #if (_FX_OS_ == _FX_MACOSX_) | 410 #if (_FX_OS_ == _FX_MACOSX_) |
| 411 m_pNoteLoop->EndModalLoop(); | 411 m_pNoteLoop->EndModalLoop(); |
| 412 IFWL_App* pApp = GetOwnerApp(); | 412 IFWL_App* pApp = GetOwnerApp(); |
| 413 if (!pApp) | 413 if (!pApp) |
| 414 return FWL_ERR_Indefinite; | 414 return FWL_Error::Indefinite; |
| 415 | 415 |
| 416 CFWL_NoteDriver* pDriver = | 416 CFWL_NoteDriver* pDriver = |
| 417 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 417 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 418 if (!pDriver) | 418 if (!pDriver) |
| 419 return FWL_ERR_Indefinite; | 419 return FWL_Error::Indefinite; |
| 420 | 420 |
| 421 pDriver->PopNoteLoop(); | 421 pDriver->PopNoteLoop(); |
| 422 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 422 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
| 423 return FWL_ERR_Succeeded; | 423 return FWL_Error::Succeeded; |
| 424 #else | 424 #else |
| 425 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 425 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
| 426 return m_pNoteLoop->EndModalLoop(); | 426 return m_pNoteLoop->EndModalLoop(); |
| 427 #endif | 427 #endif |
| 428 } | 428 } |
| 429 FWL_ERR CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { | 429 FWL_Error CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { |
| 430 return FWL_ERR_Succeeded; | 430 return FWL_Error::Succeeded; |
| 431 } | 431 } |
| 432 void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, | 432 void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, |
| 433 IFWL_ThemeProvider* pTheme) { | 433 IFWL_ThemeProvider* pTheme) { |
| 434 CFWL_ThemeBackground param; | 434 CFWL_ThemeBackground param; |
| 435 param.m_pWidget = m_pInterface; | 435 param.m_pWidget = m_pInterface; |
| 436 param.m_iPart = CFWL_Part::Background; | 436 param.m_iPart = CFWL_Part::Background; |
| 437 param.m_pGraphics = pGraphics; | 437 param.m_pGraphics = pGraphics; |
| 438 param.m_rtPart = m_rtRelative; | 438 param.m_rtPart = m_rtRelative; |
| 439 param.m_rtPart.Deflate(m_fCYBorder, m_rtCaption.height, m_fCYBorder, | 439 param.m_rtPart.Deflate(m_fCYBorder, m_rtCaption.height, m_fCYBorder, |
| 440 m_fCXBorder); | 440 m_fCXBorder); |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 fTop -= bTop ? (fLimitMax - fHeight) : 0; | 846 fTop -= bTop ? (fLimitMax - fHeight) : 0; |
| 847 fHeight = fLimitMax; | 847 fHeight = fLimitMax; |
| 848 } | 848 } |
| 849 } | 849 } |
| 850 } | 850 } |
| 851 | 851 |
| 852 CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner) | 852 CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner) |
| 853 : m_pOwner(pOwner) {} | 853 : m_pOwner(pOwner) {} |
| 854 | 854 |
| 855 #ifdef FWL_UseMacSystemBorder | 855 #ifdef FWL_UseMacSystemBorder |
| 856 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 856 void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 857 if (!pMessage) | 857 if (!pMessage) |
| 858 return 0; | 858 return; |
| 859 |
| 859 switch (pMessage->GetClassID()) { | 860 switch (pMessage->GetClassID()) { |
| 860 case CFWL_MessageType::Activate: { | 861 case CFWL_MessageType::Activate: { |
| 861 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 862 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
| 862 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 863 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
| 863 break; | 864 break; |
| 864 } | 865 } |
| 865 case CFWL_MessageType::Deactivate: { | 866 case CFWL_MessageType::Deactivate: { |
| 866 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; | 867 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; |
| 867 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 868 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
| 868 break; | 869 break; |
| 869 } | 870 } |
| 870 default: | 871 default: |
| 871 break; | 872 break; |
| 872 } | 873 } |
| 873 return FWL_ERR_Succeeded; | |
| 874 } | 874 } |
| 875 #else | 875 #else |
| 876 int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 876 void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 877 if (!pMessage) | 877 if (!pMessage) |
| 878 return 0; | 878 return; |
| 879 int32_t iRet = 1; | 879 |
| 880 switch (pMessage->GetClassID()) { | 880 switch (pMessage->GetClassID()) { |
| 881 case CFWL_MessageType::Activate: { | 881 case CFWL_MessageType::Activate: { |
| 882 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 882 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
| 883 IFWL_App* pApp = m_pOwner->GetOwnerApp(); | 883 IFWL_App* pApp = m_pOwner->GetOwnerApp(); |
| 884 CFWL_NoteDriver* pDriver = | 884 CFWL_NoteDriver* pDriver = |
| 885 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 885 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 886 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); | 886 CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus(); |
| 887 IFWL_Widget* pSubFocus = | 887 IFWL_Widget* pSubFocus = |
| 888 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; | 888 pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr; |
| 889 if (pSubFocus && pSubFocus != pDriver->GetFocus()) | 889 if (pSubFocus && pSubFocus != pDriver->GetFocus()) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 } | 942 } |
| 943 default: | 943 default: |
| 944 break; | 944 break; |
| 945 } | 945 } |
| 946 break; | 946 break; |
| 947 } | 947 } |
| 948 case CFWL_MessageType::Size: { | 948 case CFWL_MessageType::Size: { |
| 949 CFWL_WidgetMgr* pWidgetMgr = | 949 CFWL_WidgetMgr* pWidgetMgr = |
| 950 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); | 950 static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); |
| 951 if (!pWidgetMgr) | 951 if (!pWidgetMgr) |
| 952 return 0; | 952 return; |
| 953 | 953 |
| 954 pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface); | 954 pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface); |
| 955 if (!m_pOwner->m_bSetMaximize) | 955 if (!m_pOwner->m_bSetMaximize) |
| 956 break; | 956 break; |
| 957 | 957 |
| 958 m_pOwner->m_bSetMaximize = FALSE; | 958 m_pOwner->m_bSetMaximize = FALSE; |
| 959 CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage); | 959 CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage); |
| 960 CFX_RectF rt; | 960 CFX_RectF rt; |
| 961 pWidgetMgr->GetWidgetRect_Native(m_pOwner->m_pInterface, rt); | 961 pWidgetMgr->GetWidgetRect_Native(m_pOwner->m_pInterface, rt); |
| 962 m_pOwner->m_pProperties->m_rtWidget.left = rt.left; | 962 m_pOwner->m_pProperties->m_rtWidget.left = rt.left; |
| 963 m_pOwner->m_pProperties->m_rtWidget.top = rt.top; | 963 m_pOwner->m_pProperties->m_rtWidget.top = rt.top; |
| 964 m_pOwner->m_pProperties->m_rtWidget.width = (FX_FLOAT)pMsg->m_iWidth; | 964 m_pOwner->m_pProperties->m_rtWidget.width = (FX_FLOAT)pMsg->m_iWidth; |
| 965 m_pOwner->m_pProperties->m_rtWidget.height = (FX_FLOAT)pMsg->m_iHeight; | 965 m_pOwner->m_pProperties->m_rtWidget.height = (FX_FLOAT)pMsg->m_iHeight; |
| 966 m_pOwner->Update(); | 966 m_pOwner->Update(); |
| 967 break; | 967 break; |
| 968 } | 968 } |
| 969 case CFWL_MessageType::WindowMove: { | 969 case CFWL_MessageType::WindowMove: { |
| 970 OnWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage)); | 970 OnWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage)); |
| 971 break; | 971 break; |
| 972 } | 972 } |
| 973 case CFWL_MessageType::Close: { | 973 case CFWL_MessageType::Close: { |
| 974 OnClose(static_cast<CFWL_MsgClose*>(pMessage)); | 974 OnClose(static_cast<CFWL_MsgClose*>(pMessage)); |
| 975 break; | 975 break; |
| 976 } | 976 } |
| 977 default: { | 977 default: { |
| 978 iRet = 0; | |
| 979 break; | 978 break; |
| 980 } | 979 } |
| 981 } | 980 } |
| 982 return iRet; | |
| 983 } | 981 } |
| 984 #endif // FWL_UseMacSystemBorder | 982 #endif // FWL_UseMacSystemBorder |
| 985 | 983 |
| 986 FWL_ERR CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 984 void CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} |
| 987 if (!pEvent) | 985 |
| 988 return FWL_ERR_Indefinite; | 986 void CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 989 return FWL_ERR_Succeeded; | 987 const CFX_Matrix* pMatrix) { |
| 988 m_pOwner->DrawWidget(pGraphics, pMatrix); |
| 990 } | 989 } |
| 991 | 990 |
| 992 FWL_ERR CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | |
| 993 const CFX_Matrix* pMatrix) { | |
| 994 return m_pOwner->DrawWidget(pGraphics, pMatrix); | |
| 995 } | |
| 996 void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { | 991 void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { |
| 997 m_pOwner->SetGrab(TRUE); | 992 m_pOwner->SetGrab(TRUE); |
| 998 m_pOwner->m_bLButtonDown = TRUE; | 993 m_pOwner->m_bLButtonDown = TRUE; |
| 999 m_pOwner->m_eResizeType = FORM_RESIZETYPE_None; | 994 m_pOwner->m_eResizeType = FORM_RESIZETYPE_None; |
| 1000 CFWL_SysBtn* pPressBtn = m_pOwner->GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); | 995 CFWL_SysBtn* pPressBtn = m_pOwner->GetSysBtnAtPoint(pMsg->m_fx, pMsg->m_fy); |
| 1001 m_pOwner->m_iCaptureBtn = m_pOwner->GetSysBtnIndex(pPressBtn); | 996 m_pOwner->m_iCaptureBtn = m_pOwner->GetSysBtnIndex(pPressBtn); |
| 1002 CFX_RectF rtCap; | 997 CFX_RectF rtCap; |
| 1003 rtCap.Set(m_pOwner->m_rtCaption.left + m_pOwner->m_fCYBorder, | 998 rtCap.Set(m_pOwner->m_rtCaption.left + m_pOwner->m_fCYBorder, |
| 1004 m_pOwner->m_rtCaption.top + m_pOwner->m_fCXBorder, | 999 m_pOwner->m_rtCaption.top + m_pOwner->m_fCXBorder, |
| 1005 m_pOwner->m_rtCaption.width - | 1000 m_pOwner->m_rtCaption.width - |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 } | 1141 } |
| 1147 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { | 1142 void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) { |
| 1148 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; | 1143 m_pOwner->m_pProperties->m_rtWidget.left = pMsg->m_fx; |
| 1149 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; | 1144 m_pOwner->m_pProperties->m_rtWidget.top = pMsg->m_fy; |
| 1150 } | 1145 } |
| 1151 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { | 1146 void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { |
| 1152 CFWL_EvtClose eClose; | 1147 CFWL_EvtClose eClose; |
| 1153 eClose.m_pSrcTarget = m_pOwner->m_pInterface; | 1148 eClose.m_pSrcTarget = m_pOwner->m_pInterface; |
| 1154 m_pOwner->DispatchEvent(&eClose); | 1149 m_pOwner->DispatchEvent(&eClose); |
| 1155 } | 1150 } |
| OLD | NEW |