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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 RestoreResizeInfo::~RestoreResizeInfo() {} | 69 RestoreResizeInfo::~RestoreResizeInfo() {} |
70 | 70 |
71 CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, | 71 CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties, |
72 IFWL_Widget* pOuter) | 72 IFWL_Widget* pOuter) |
73 : CFWL_WidgetImp(properties, pOuter), | 73 : CFWL_WidgetImp(properties, pOuter), |
74 m_pCloseBox(nullptr), | 74 m_pCloseBox(nullptr), |
75 m_pMinBox(nullptr), | 75 m_pMinBox(nullptr), |
76 m_pMaxBox(nullptr), | 76 m_pMaxBox(nullptr), |
77 m_pCaptionBox(nullptr), | 77 m_pCaptionBox(nullptr), |
78 m_pNoteLoop(nullptr), | |
79 m_pSubFocus(nullptr), | 78 m_pSubFocus(nullptr), |
80 m_fCXBorder(0), | 79 m_fCXBorder(0), |
81 m_fCYBorder(0), | 80 m_fCYBorder(0), |
82 m_iCaptureBtn(-1), | 81 m_iCaptureBtn(-1), |
83 m_iSysBox(0), | 82 m_iSysBox(0), |
84 m_eResizeType(FORM_RESIZETYPE_None), | 83 m_eResizeType(FORM_RESIZETYPE_None), |
85 m_bLButtonDown(FALSE), | 84 m_bLButtonDown(FALSE), |
86 m_bMaximized(false), | 85 m_bMaximized(false), |
87 m_bSetMaximize(FALSE), | 86 m_bSetMaximize(FALSE), |
88 m_bCustomizeLayout(FALSE), | 87 m_bCustomizeLayout(FALSE), |
89 m_eFormSize(FWL_FORMSIZE_Manual), | 88 m_eFormSize(FWL_FORMSIZE_Manual), |
90 m_bDoModalFlag(FALSE), | 89 m_bDoModalFlag(FALSE), |
91 m_pBigIcon(nullptr), | 90 m_pBigIcon(nullptr), |
92 m_pSmallIcon(nullptr), | 91 m_pSmallIcon(nullptr), |
93 m_bMouseIn(FALSE) { | 92 m_bMouseIn(FALSE) { |
94 m_rtRelative.Reset(); | 93 m_rtRelative.Reset(); |
95 m_rtCaption.Reset(); | 94 m_rtCaption.Reset(); |
96 m_rtRestore.Reset(); | 95 m_rtRestore.Reset(); |
97 m_rtCaptionText.Reset(); | 96 m_rtCaptionText.Reset(); |
98 m_rtIcon.Reset(); | 97 m_rtIcon.Reset(); |
99 } | 98 } |
100 | 99 |
101 CFWL_FormImp::~CFWL_FormImp() { | 100 CFWL_FormImp::~CFWL_FormImp() { |
102 RemoveSysButtons(); | 101 RemoveSysButtons(); |
103 delete m_pNoteLoop; | |
104 } | 102 } |
105 | 103 |
106 FWL_Error CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { | 104 FWL_Error CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { |
107 wsClass = FWL_CLASS_Form; | 105 wsClass = FWL_CLASS_Form; |
108 return FWL_Error::Succeeded; | 106 return FWL_Error::Succeeded; |
109 } | 107 } |
110 | 108 |
111 FWL_Type CFWL_FormImp::GetClassID() const { | 109 FWL_Type CFWL_FormImp::GetClassID() const { |
112 return FWL_Type::Form; | 110 return FWL_Type::Form; |
113 } | 111 } |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 if (m_pMinBox) { | 362 if (m_pMinBox) { |
365 param.m_iPart = CFWL_Part::MinimizeBox; | 363 param.m_iPart = CFWL_Part::MinimizeBox; |
366 param.m_dwStates = m_pMinBox->GetPartState(); | 364 param.m_dwStates = m_pMinBox->GetPartState(); |
367 param.m_rtPart = m_pMinBox->m_rtBtn; | 365 param.m_rtPart = m_pMinBox->m_rtBtn; |
368 pTheme->DrawBackground(¶m); | 366 pTheme->DrawBackground(¶m); |
369 } | 367 } |
370 } | 368 } |
371 #endif | 369 #endif |
372 return FWL_Error::Succeeded; | 370 return FWL_Error::Succeeded; |
373 } | 371 } |
| 372 |
374 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { | 373 FWL_FORMSIZE CFWL_FormImp::GetFormSize() { |
375 return m_eFormSize; | 374 return m_eFormSize; |
376 } | 375 } |
| 376 |
377 FWL_Error 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_Error::Succeeded; | 379 return FWL_Error::Succeeded; |
380 } | 380 } |
| 381 |
381 IFWL_Widget* CFWL_FormImp::DoModal() { | 382 IFWL_Widget* CFWL_FormImp::DoModal() { |
382 IFWL_App* pApp = GetOwnerApp(); | 383 IFWL_App* pApp = GetOwnerApp(); |
383 if (!pApp) | 384 if (!pApp) |
384 return nullptr; | 385 return nullptr; |
385 | 386 |
386 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | 387 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); |
387 if (!pDriver) | 388 if (!pDriver) |
388 return nullptr; | 389 return nullptr; |
389 | 390 |
390 m_pNoteLoop = new CFWL_NoteLoop(this); | 391 m_pNoteLoop.reset(new CFWL_NoteLoop(this)); |
391 pDriver->PushNoteLoop(m_pNoteLoop); | 392 pDriver->PushNoteLoop(m_pNoteLoop.get()); |
392 m_bDoModalFlag = TRUE; | 393 m_bDoModalFlag = TRUE; |
393 SetStates(FWL_WGTSTATE_Invisible, FALSE); | 394 SetStates(FWL_WGTSTATE_Invisible, FALSE); |
394 pDriver->Run(); | 395 pDriver->Run(); |
395 #if (_FX_OS_ == _FX_MACOSX_) | 396 #if (_FX_OS_ == _FX_MACOSX_) |
396 #else | 397 #else |
397 pDriver->PopNoteLoop(); | 398 pDriver->PopNoteLoop(); |
398 #endif | 399 #endif |
399 delete m_pNoteLoop; | 400 m_pNoteLoop.reset(); |
400 m_pNoteLoop = nullptr; | |
401 return nullptr; | 401 return nullptr; |
402 } | 402 } |
| 403 |
403 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { | 404 IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { |
404 return DoModal(); | 405 return DoModal(); |
405 } | 406 } |
| 407 |
406 FWL_Error CFWL_FormImp::EndDoModal() { | 408 FWL_Error CFWL_FormImp::EndDoModal() { |
407 if (!m_pNoteLoop) | 409 if (!m_pNoteLoop) |
408 return FWL_Error::Indefinite; | 410 return FWL_Error::Indefinite; |
409 m_bDoModalFlag = FALSE; | 411 m_bDoModalFlag = FALSE; |
410 #if (_FX_OS_ == _FX_MACOSX_) | 412 #if (_FX_OS_ == _FX_MACOSX_) |
411 m_pNoteLoop->EndModalLoop(); | 413 m_pNoteLoop->EndModalLoop(); |
412 IFWL_App* pApp = GetOwnerApp(); | 414 IFWL_App* pApp = GetOwnerApp(); |
413 if (!pApp) | 415 if (!pApp) |
414 return FWL_Error::Indefinite; | 416 return FWL_Error::Indefinite; |
415 | 417 |
416 CFWL_NoteDriver* pDriver = | 418 CFWL_NoteDriver* pDriver = |
417 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 419 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
418 if (!pDriver) | 420 if (!pDriver) |
419 return FWL_Error::Indefinite; | 421 return FWL_Error::Indefinite; |
420 | 422 |
421 pDriver->PopNoteLoop(); | 423 pDriver->PopNoteLoop(); |
422 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 424 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
423 return FWL_Error::Succeeded; | 425 return FWL_Error::Succeeded; |
424 #else | 426 #else |
425 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 427 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
426 return m_pNoteLoop->EndModalLoop(); | 428 return m_pNoteLoop->EndModalLoop(); |
427 #endif | 429 #endif |
428 } | 430 } |
| 431 |
429 FWL_Error CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { | 432 FWL_Error CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { |
430 return FWL_Error::Succeeded; | 433 return FWL_Error::Succeeded; |
431 } | 434 } |
432 void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, | 435 void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, |
433 IFWL_ThemeProvider* pTheme) { | 436 IFWL_ThemeProvider* pTheme) { |
434 CFWL_ThemeBackground param; | 437 CFWL_ThemeBackground param; |
435 param.m_pWidget = m_pInterface; | 438 param.m_pWidget = m_pInterface; |
436 param.m_iPart = CFWL_Part::Background; | 439 param.m_iPart = CFWL_Part::Background; |
437 param.m_pGraphics = pGraphics; | 440 param.m_pGraphics = pGraphics; |
438 param.m_rtPart = m_rtRelative; | 441 param.m_rtPart = m_rtRelative; |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 | 1166 |
1164 uint32_t CFWL_SysBtn::GetPartState() const { | 1167 uint32_t CFWL_SysBtn::GetPartState() const { |
1165 if (IsDisabled()) | 1168 if (IsDisabled()) |
1166 return CFWL_PartState_Disabled; | 1169 return CFWL_PartState_Disabled; |
1167 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) | 1170 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) |
1168 return CFWL_PartState_Pressed; | 1171 return CFWL_PartState_Pressed; |
1169 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) | 1172 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) |
1170 return CFWL_PartState_Hovered; | 1173 return CFWL_PartState_Hovered; |
1171 return CFWL_PartState_Normal; | 1174 return CFWL_PartState_Normal; |
1172 } | 1175 } |
OLD | NEW |