| 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/ifwl_form.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/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 const uint8_t kCornerEnlarge = 10; | 31 const uint8_t kCornerEnlarge = 10; |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 RestoreInfo::RestoreInfo() {} | 35 RestoreInfo::RestoreInfo() {} |
| 36 | 36 |
| 37 RestoreInfo::~RestoreInfo() {} | 37 RestoreInfo::~RestoreInfo() {} |
| 38 | 38 |
| 39 IFWL_Form::IFWL_Form(const CFWL_WidgetImpProperties& properties, | 39 IFWL_Form::IFWL_Form(const IFWL_App* app, |
| 40 const CFWL_WidgetImpProperties& properties, |
| 40 IFWL_Widget* pOuter) | 41 IFWL_Widget* pOuter) |
| 41 : IFWL_Widget(properties, pOuter), | 42 : IFWL_Widget(app, properties, pOuter), |
| 42 m_pCloseBox(nullptr), | 43 m_pCloseBox(nullptr), |
| 43 m_pMinBox(nullptr), | 44 m_pMinBox(nullptr), |
| 44 m_pMaxBox(nullptr), | 45 m_pMaxBox(nullptr), |
| 45 m_pCaptionBox(nullptr), | 46 m_pCaptionBox(nullptr), |
| 46 m_pSubFocus(nullptr), | 47 m_pSubFocus(nullptr), |
| 47 m_fCXBorder(0), | 48 m_fCXBorder(0), |
| 48 m_fCYBorder(0), | 49 m_fCYBorder(0), |
| 49 m_iCaptureBtn(-1), | 50 m_iCaptureBtn(-1), |
| 50 m_iSysBox(0), | 51 m_iSysBox(0), |
| 51 m_eResizeType(FORM_RESIZETYPE_None), | 52 m_eResizeType(FORM_RESIZETYPE_None), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 62 m_rtCaption.Reset(); | 63 m_rtCaption.Reset(); |
| 63 m_rtRestore.Reset(); | 64 m_rtRestore.Reset(); |
| 64 m_rtCaptionText.Reset(); | 65 m_rtCaptionText.Reset(); |
| 65 m_rtIcon.Reset(); | 66 m_rtIcon.Reset(); |
| 66 } | 67 } |
| 67 | 68 |
| 68 IFWL_Form::~IFWL_Form() { | 69 IFWL_Form::~IFWL_Form() { |
| 69 RemoveSysButtons(); | 70 RemoveSysButtons(); |
| 70 } | 71 } |
| 71 | 72 |
| 72 FWL_Type IFWL_Form::GetClassID() const { | 73 void IFWL_Form::Initialize() { |
| 73 return FWL_Type::Form; | 74 IFWL_Widget::Initialize(); |
| 74 } | |
| 75 | 75 |
| 76 FX_BOOL IFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const { | |
| 77 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) | |
| 78 return TRUE; | |
| 79 return IFWL_Widget::IsInstance(wsClass); | |
| 80 } | |
| 81 | |
| 82 FWL_Error IFWL_Form::Initialize() { | |
| 83 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) | |
| 84 return FWL_Error::Indefinite; | |
| 85 RegisterForm(); | 76 RegisterForm(); |
| 86 RegisterEventTarget(); | 77 RegisterEventTarget(); |
| 87 m_pDelegate = new CFWL_FormImpDelegate(this); | 78 m_pDelegate = new CFWL_FormImpDelegate(this); |
| 88 return FWL_Error::Succeeded; | |
| 89 } | 79 } |
| 90 | 80 |
| 91 void IFWL_Form::Finalize() { | 81 void IFWL_Form::Finalize() { |
| 92 delete m_pDelegate; | 82 delete m_pDelegate; |
| 93 m_pDelegate = nullptr; | 83 m_pDelegate = nullptr; |
| 94 UnregisterEventTarget(); | 84 UnregisterEventTarget(); |
| 95 UnRegisterForm(); | 85 UnRegisterForm(); |
| 96 IFWL_Widget::Finalize(); | 86 IFWL_Widget::Finalize(); |
| 97 } | 87 } |
| 98 | 88 |
| 89 FWL_Type IFWL_Form::GetClassID() const { |
| 90 return FWL_Type::Form; |
| 91 } |
| 92 |
| 93 FX_BOOL IFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const { |
| 94 if (wsClass == CFX_WideStringC(FWL_CLASS_Form)) |
| 95 return TRUE; |
| 96 return IFWL_Widget::IsInstance(wsClass); |
| 97 } |
| 98 |
| 99 FWL_Error IFWL_Form::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 99 FWL_Error IFWL_Form::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
| 100 if (bAutoSize) { | 100 if (bAutoSize) { |
| 101 rect.Reset(); | 101 rect.Reset(); |
| 102 FX_FLOAT fCapHeight = GetCaptionHeight(); | 102 FX_FLOAT fCapHeight = GetCaptionHeight(); |
| 103 FX_FLOAT fCXBorder = GetBorderSize(TRUE); | 103 FX_FLOAT fCXBorder = GetBorderSize(TRUE); |
| 104 FX_FLOAT fCYBorder = GetBorderSize(FALSE); | 104 FX_FLOAT fCYBorder = GetBorderSize(FALSE); |
| 105 FX_FLOAT fEdge = GetEdgeWidth(); | 105 FX_FLOAT fEdge = GetEdgeWidth(); |
| 106 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; | 106 rect.height += fCapHeight + fCYBorder + fEdge + fEdge; |
| 107 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; | 107 rect.width += fCXBorder + fCXBorder + fEdge + fEdge; |
| 108 } else { | 108 } else { |
| 109 rect = m_pProperties->m_rtWidget; | 109 rect = m_pProperties->m_rtWidget; |
| 110 } | 110 } |
| 111 return FWL_Error::Succeeded; | 111 return FWL_Error::Succeeded; |
| 112 } | 112 } |
| 113 FWL_Error IFWL_Form::GetClientRect(CFX_RectF& rect) { | 113 FWL_Error IFWL_Form::GetClientRect(CFX_RectF& rect) { |
| 114 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { | 114 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { |
| 115 rect = m_pProperties->m_rtWidget; | 115 rect = m_pProperties->m_rtWidget; |
| 116 rect.Offset(-rect.left, -rect.top); | 116 rect.Offset(-rect.left, -rect.top); |
| 117 return FWL_Error::Succeeded; | 117 return FWL_Error::Succeeded; |
| 118 } | 118 } |
| 119 #ifdef FWL_UseMacSystemBorder | 119 #ifdef FWL_UseMacSystemBorder |
| 120 rect = m_rtRelative; | 120 rect = m_rtRelative; |
| 121 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 121 CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr(); |
| 122 if (!pWidgetMgr) | 122 if (!pWidgetMgr) |
| 123 return FWL_Error::Indefinite; | 123 return FWL_Error::Indefinite; |
| 124 | 124 |
| 125 rect.left = 0; | 125 rect.left = 0; |
| 126 rect.top = 0; | 126 rect.top = 0; |
| 127 return FWL_Error::Succeeded; | 127 return FWL_Error::Succeeded; |
| 128 #else | 128 #else |
| 129 FX_FLOAT x = 0; | 129 FX_FLOAT x = 0; |
| 130 FX_FLOAT y = 0; | 130 FX_FLOAT y = 0; |
| 131 FX_FLOAT t = 0; | 131 FX_FLOAT t = 0; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 FWL_FORMSIZE IFWL_Form::GetFormSize() { | 338 FWL_FORMSIZE IFWL_Form::GetFormSize() { |
| 339 return m_eFormSize; | 339 return m_eFormSize; |
| 340 } | 340 } |
| 341 | 341 |
| 342 FWL_Error IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { | 342 FWL_Error IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { |
| 343 m_eFormSize = eFormSize; | 343 m_eFormSize = eFormSize; |
| 344 return FWL_Error::Succeeded; | 344 return FWL_Error::Succeeded; |
| 345 } | 345 } |
| 346 | 346 |
| 347 IFWL_Widget* IFWL_Form::DoModal() { | 347 IFWL_Widget* IFWL_Form::DoModal() { |
| 348 IFWL_App* pApp = GetOwnerApp(); | 348 const IFWL_App* pApp = GetOwnerApp(); |
| 349 if (!pApp) | 349 if (!pApp) |
| 350 return nullptr; | 350 return nullptr; |
| 351 | 351 |
| 352 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); | 352 CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); |
| 353 if (!pDriver) | 353 if (!pDriver) |
| 354 return nullptr; | 354 return nullptr; |
| 355 | 355 |
| 356 m_pNoteLoop.reset(new CFWL_NoteLoop(this)); | 356 m_pNoteLoop.reset(new CFWL_NoteLoop(this)); |
| 357 pDriver->PushNoteLoop(m_pNoteLoop.get()); | 357 pDriver->PushNoteLoop(m_pNoteLoop.get()); |
| 358 m_bDoModalFlag = TRUE; | 358 m_bDoModalFlag = TRUE; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 369 IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { | 369 IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { |
| 370 return DoModal(); | 370 return DoModal(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 FWL_Error IFWL_Form::EndDoModal() { | 373 FWL_Error IFWL_Form::EndDoModal() { |
| 374 if (!m_pNoteLoop) | 374 if (!m_pNoteLoop) |
| 375 return FWL_Error::Indefinite; | 375 return FWL_Error::Indefinite; |
| 376 m_bDoModalFlag = FALSE; | 376 m_bDoModalFlag = FALSE; |
| 377 #if (_FX_OS_ == _FX_MACOSX_) | 377 #if (_FX_OS_ == _FX_MACOSX_) |
| 378 m_pNoteLoop->EndModalLoop(); | 378 m_pNoteLoop->EndModalLoop(); |
| 379 IFWL_App* pApp = GetOwnerApp(); | 379 const IFWL_App* pApp = GetOwnerApp(); |
| 380 if (!pApp) | 380 if (!pApp) |
| 381 return FWL_Error::Indefinite; | 381 return FWL_Error::Indefinite; |
| 382 | 382 |
| 383 CFWL_NoteDriver* pDriver = | 383 CFWL_NoteDriver* pDriver = |
| 384 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 384 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 385 if (!pDriver) | 385 if (!pDriver) |
| 386 return FWL_Error::Indefinite; | 386 return FWL_Error::Indefinite; |
| 387 | 387 |
| 388 pDriver->PopNoteLoop(); | 388 pDriver->PopNoteLoop(); |
| 389 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 389 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 409 pTheme->DrawBackground(¶m); | 409 pTheme->DrawBackground(¶m); |
| 410 } | 410 } |
| 411 IFWL_Widget* IFWL_Form::GetSubFocus() { | 411 IFWL_Widget* IFWL_Form::GetSubFocus() { |
| 412 return m_pSubFocus; | 412 return m_pSubFocus; |
| 413 } | 413 } |
| 414 void IFWL_Form::SetSubFocus(IFWL_Widget* pWidget) { | 414 void IFWL_Form::SetSubFocus(IFWL_Widget* pWidget) { |
| 415 m_pSubFocus = pWidget; | 415 m_pSubFocus = pWidget; |
| 416 } | 416 } |
| 417 | 417 |
| 418 void IFWL_Form::ShowChildWidget(IFWL_Widget* pParent) { | 418 void IFWL_Form::ShowChildWidget(IFWL_Widget* pParent) { |
| 419 IFWL_App* pApp = FWL_GetApp(); | 419 const IFWL_App* pApp = pParent->GetOwnerApp(); |
| 420 if (!pApp) | 420 if (!pApp) |
| 421 return; | 421 return; |
| 422 | 422 |
| 423 CFWL_WidgetMgr* pWidgetMgr = pApp->GetWidgetMgr(); | 423 CFWL_WidgetMgr* pWidgetMgr = pApp->GetWidgetMgr(); |
| 424 if (!pWidgetMgr) | 424 if (!pWidgetMgr) |
| 425 return; | 425 return; |
| 426 | 426 |
| 427 IFWL_Widget* pChild = pWidgetMgr->GetFirstChildWidget(pParent); | 427 IFWL_Widget* pChild = pWidgetMgr->GetFirstChildWidget(pParent); |
| 428 while (pChild) { | 428 while (pChild) { |
| 429 ShowChildWidget(pChild); | 429 ShowChildWidget(pChild); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 void IFWL_Form::GetEdgeRect(CFX_RectF& rtEdge) { | 581 void IFWL_Form::GetEdgeRect(CFX_RectF& rtEdge) { |
| 582 rtEdge = m_rtRelative; | 582 rtEdge = m_rtRelative; |
| 583 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { | 583 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) { |
| 584 FX_FLOAT fCX = GetBorderSize(); | 584 FX_FLOAT fCX = GetBorderSize(); |
| 585 FX_FLOAT fCY = GetBorderSize(FALSE); | 585 FX_FLOAT fCY = GetBorderSize(FALSE); |
| 586 rtEdge.Deflate(fCX, m_rtCaption.Height(), fCX, fCY); | 586 rtEdge.Deflate(fCX, m_rtCaption.Height(), fCX, fCY); |
| 587 } | 587 } |
| 588 } | 588 } |
| 589 void IFWL_Form::SetWorkAreaRect() { | 589 void IFWL_Form::SetWorkAreaRect() { |
| 590 m_rtRestore = m_pProperties->m_rtWidget; | 590 m_rtRestore = m_pProperties->m_rtWidget; |
| 591 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 591 CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr(); |
| 592 if (!pWidgetMgr) | 592 if (!pWidgetMgr) |
| 593 return; | 593 return; |
| 594 m_bSetMaximize = TRUE; | 594 m_bSetMaximize = TRUE; |
| 595 Repaint(&m_rtRelative); | 595 Repaint(&m_rtRelative); |
| 596 } | 596 } |
| 597 void IFWL_Form::SetCursor(FX_FLOAT fx, FX_FLOAT fy) {} | 597 void IFWL_Form::SetCursor(FX_FLOAT fx, FX_FLOAT fy) {} |
| 598 void IFWL_Form::Layout() { | 598 void IFWL_Form::Layout() { |
| 599 GetRelativeRect(m_rtRelative); | 599 GetRelativeRect(m_rtRelative); |
| 600 #ifndef FWL_UseMacSystemBorder | 600 #ifndef FWL_UseMacSystemBorder |
| 601 ReSetSysBtn(); | 601 ReSetSysBtn(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); | 662 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); |
| 663 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon && | 663 if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon && |
| 664 pData->GetIcon(this, FALSE)) { | 664 pData->GetIcon(this, FALSE)) { |
| 665 if (!m_bCustomizeLayout) { | 665 if (!m_bCustomizeLayout) { |
| 666 m_rtIcon.Set(5, (m_rtCaption.height - m_fSmallIconSz) / 2, m_fSmallIconSz, | 666 m_rtIcon.Set(5, (m_rtCaption.height - m_fSmallIconSz) / 2, m_fSmallIconSz, |
| 667 m_fSmallIconSz); | 667 m_fSmallIconSz); |
| 668 } | 668 } |
| 669 } | 669 } |
| 670 } | 670 } |
| 671 void IFWL_Form::RegisterForm() { | 671 void IFWL_Form::RegisterForm() { |
| 672 IFWL_App* pApp = GetOwnerApp(); | 672 const IFWL_App* pApp = GetOwnerApp(); |
| 673 if (!pApp) | 673 if (!pApp) |
| 674 return; | 674 return; |
| 675 | 675 |
| 676 CFWL_NoteDriver* pDriver = | 676 CFWL_NoteDriver* pDriver = |
| 677 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 677 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 678 if (!pDriver) | 678 if (!pDriver) |
| 679 return; | 679 return; |
| 680 | 680 |
| 681 pDriver->RegisterForm(this); | 681 pDriver->RegisterForm(this); |
| 682 } | 682 } |
| 683 void IFWL_Form::UnRegisterForm() { | 683 void IFWL_Form::UnRegisterForm() { |
| 684 IFWL_App* pApp = GetOwnerApp(); | 684 const IFWL_App* pApp = GetOwnerApp(); |
| 685 if (!pApp) | 685 if (!pApp) |
| 686 return; | 686 return; |
| 687 | 687 |
| 688 CFWL_NoteDriver* pDriver = | 688 CFWL_NoteDriver* pDriver = |
| 689 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 689 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 690 if (!pDriver) | 690 if (!pDriver) |
| 691 return; | 691 return; |
| 692 | 692 |
| 693 pDriver->UnRegisterForm(this); | 693 pDriver->UnRegisterForm(this); |
| 694 } | 694 } |
| 695 FX_BOOL IFWL_Form::IsDoModal() { | 695 FX_BOOL IFWL_Form::IsDoModal() { |
| 696 return m_bDoModalFlag; | 696 return m_bDoModalFlag; |
| 697 } | 697 } |
| 698 void IFWL_Form::SetThemeData() { | 698 void IFWL_Form::SetThemeData() { |
| 699 m_fSmallIconSz = | 699 m_fSmallIconSz = |
| 700 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::SmallIcon)); | 700 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::SmallIcon)); |
| 701 m_fBigIconSz = | 701 m_fBigIconSz = |
| 702 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::BigIcon)); | 702 *static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::BigIcon)); |
| 703 } | 703 } |
| 704 FX_BOOL IFWL_Form::HasIcon() { | 704 FX_BOOL IFWL_Form::HasIcon() { |
| 705 IFWL_FormDP* pData = | 705 IFWL_FormDP* pData = |
| 706 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); | 706 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); |
| 707 return !!pData->GetIcon(this, FALSE); | 707 return !!pData->GetIcon(this, FALSE); |
| 708 } | 708 } |
| 709 void IFWL_Form::UpdateIcon() { | 709 void IFWL_Form::UpdateIcon() { |
| 710 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 710 CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr(); |
| 711 if (!pWidgetMgr) | 711 if (!pWidgetMgr) |
| 712 return; | 712 return; |
| 713 IFWL_FormDP* pData = | 713 IFWL_FormDP* pData = |
| 714 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); | 714 static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider); |
| 715 CFX_DIBitmap* pBigIcon = pData->GetIcon(this, TRUE); | 715 CFX_DIBitmap* pBigIcon = pData->GetIcon(this, TRUE); |
| 716 CFX_DIBitmap* pSmallIcon = pData->GetIcon(this, FALSE); | 716 CFX_DIBitmap* pSmallIcon = pData->GetIcon(this, FALSE); |
| 717 if (pBigIcon) | 717 if (pBigIcon) |
| 718 m_pBigIcon = pBigIcon; | 718 m_pBigIcon = pBigIcon; |
| 719 if (pSmallIcon) | 719 if (pSmallIcon) |
| 720 m_pSmallIcon = pSmallIcon; | 720 m_pSmallIcon = pSmallIcon; |
| 721 } | 721 } |
| 722 void IFWL_Form::UpdateCaption() { | 722 void IFWL_Form::UpdateCaption() { |
| 723 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 723 CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr(); |
| 724 if (!pWidgetMgr) | 724 if (!pWidgetMgr) |
| 725 return; | 725 return; |
| 726 IFWL_DataProvider* pData = m_pProperties->m_pDataProvider; | 726 IFWL_DataProvider* pData = m_pProperties->m_pDataProvider; |
| 727 if (!pData) | 727 if (!pData) |
| 728 return; | 728 return; |
| 729 CFX_WideString text; | 729 CFX_WideString text; |
| 730 pData->GetCaption(this, text); | 730 pData->GetCaption(this, text); |
| 731 } | 731 } |
| 732 void IFWL_Form::DoWidthLimit(FX_FLOAT& fLeft, | 732 void IFWL_Form::DoWidthLimit(FX_FLOAT& fLeft, |
| 733 FX_FLOAT& fWidth, | 733 FX_FLOAT& fWidth, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 } | 803 } |
| 804 } | 804 } |
| 805 #else | 805 #else |
| 806 void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 806 void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 807 if (!pMessage) | 807 if (!pMessage) |
| 808 return; | 808 return; |
| 809 | 809 |
| 810 switch (pMessage->GetClassID()) { | 810 switch (pMessage->GetClassID()) { |
| 811 case CFWL_MessageType::Activate: { | 811 case CFWL_MessageType::Activate: { |
| 812 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | 812 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; |
| 813 IFWL_App* pApp = m_pOwner->GetOwnerApp(); | 813 const IFWL_App* pApp = m_pOwner->GetOwnerApp(); |
| 814 CFWL_NoteDriver* pDriver = | 814 CFWL_NoteDriver* pDriver = |
| 815 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 815 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 816 IFWL_Widget* pSubFocus = m_pOwner->GetSubFocus(); | 816 IFWL_Widget* pSubFocus = m_pOwner->GetSubFocus(); |
| 817 if (pSubFocus && pSubFocus != pDriver->GetFocus()) | 817 if (pSubFocus && pSubFocus != pDriver->GetFocus()) |
| 818 pDriver->SetFocus(pSubFocus); | 818 pDriver->SetFocus(pSubFocus); |
| 819 | 819 |
| 820 m_pOwner->Repaint(&m_pOwner->m_rtRelative); | 820 m_pOwner->Repaint(&m_pOwner->m_rtRelative); |
| 821 break; | 821 break; |
| 822 } | 822 } |
| 823 case CFWL_MessageType::Deactivate: { | 823 case CFWL_MessageType::Deactivate: { |
| 824 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; | 824 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; |
| 825 IFWL_App* pApp = m_pOwner->GetOwnerApp(); | 825 const IFWL_App* pApp = m_pOwner->GetOwnerApp(); |
| 826 CFWL_NoteDriver* pDriver = | 826 CFWL_NoteDriver* pDriver = |
| 827 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 827 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 828 IFWL_Widget* pSubFocus = m_pOwner->GetSubFocus(); | 828 IFWL_Widget* pSubFocus = m_pOwner->GetSubFocus(); |
| 829 if (pSubFocus) { | 829 if (pSubFocus) { |
| 830 if (pSubFocus == pDriver->GetFocus()) { | 830 if (pSubFocus == pDriver->GetFocus()) { |
| 831 pDriver->SetFocus(nullptr); | 831 pDriver->SetFocus(nullptr); |
| 832 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { | 832 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { |
| 833 CFWL_MsgKillFocus ms; | 833 CFWL_MsgKillFocus ms; |
| 834 IFWL_WidgetDelegate* pDelegate = pSubFocus->SetDelegate(nullptr); | 834 IFWL_WidgetDelegate* pDelegate = pSubFocus->SetDelegate(nullptr); |
| 835 if (pDelegate) | 835 if (pDelegate) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 865 case FWL_MouseCommand::LeftButtonDblClk: { | 865 case FWL_MouseCommand::LeftButtonDblClk: { |
| 866 OnLButtonDblClk(pMsg); | 866 OnLButtonDblClk(pMsg); |
| 867 break; | 867 break; |
| 868 } | 868 } |
| 869 default: | 869 default: |
| 870 break; | 870 break; |
| 871 } | 871 } |
| 872 break; | 872 break; |
| 873 } | 873 } |
| 874 case CFWL_MessageType::Size: { | 874 case CFWL_MessageType::Size: { |
| 875 CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance(); | 875 CFWL_WidgetMgr* pWidgetMgr = m_pOwner->GetOwnerApp()->GetWidgetMgr(); |
| 876 if (!pWidgetMgr) | 876 if (!pWidgetMgr) |
| 877 return; | 877 return; |
| 878 | 878 |
| 879 pWidgetMgr->AddRedrawCounts(m_pOwner); | 879 pWidgetMgr->AddRedrawCounts(m_pOwner); |
| 880 if (!m_pOwner->m_bSetMaximize) | 880 if (!m_pOwner->m_bSetMaximize) |
| 881 break; | 881 break; |
| 882 | 882 |
| 883 m_pOwner->m_bSetMaximize = FALSE; | 883 m_pOwner->m_bSetMaximize = FALSE; |
| 884 CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage); | 884 CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage); |
| 885 m_pOwner->m_pProperties->m_rtWidget.left = 0; | 885 m_pOwner->m_pProperties->m_rtWidget.left = 0; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 | 1094 |
| 1095 uint32_t CFWL_SysBtn::GetPartState() const { | 1095 uint32_t CFWL_SysBtn::GetPartState() const { |
| 1096 if (IsDisabled()) | 1096 if (IsDisabled()) |
| 1097 return CFWL_PartState_Disabled; | 1097 return CFWL_PartState_Disabled; |
| 1098 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) | 1098 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) |
| 1099 return CFWL_PartState_Pressed; | 1099 return CFWL_PartState_Pressed; |
| 1100 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) | 1100 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) |
| 1101 return CFWL_PartState_Hovered; | 1101 return CFWL_PartState_Hovered; |
| 1102 return CFWL_PartState_Normal; | 1102 return CFWL_PartState_Normal; |
| 1103 } | 1103 } |
| OLD | NEW |