| 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_widgetimp.h" | 7 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "xfa/fde/tto/fde_textout.h" | 11 #include "xfa/fde/tto/fde_textout.h" |
| 12 #include "xfa/fwl/basewidget/ifwl_combobox.h" | 12 #include "xfa/fwl/basewidget/ifwl_combobox.h" |
| 13 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h" | 13 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h" |
| 14 #include "xfa/fwl/core/cfwl_message.h" | 14 #include "xfa/fwl/core/cfwl_message.h" |
| 15 #include "xfa/fwl/core/cfwl_themebackground.h" | 15 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 16 #include "xfa/fwl/core/cfwl_themepart.h" | 16 #include "xfa/fwl/core/cfwl_themepart.h" |
| 17 #include "xfa/fwl/core/cfwl_themetext.h" | 17 #include "xfa/fwl/core/cfwl_themetext.h" |
| 18 #include "xfa/fwl/core/fwl_appimp.h" | 18 #include "xfa/fwl/core/fwl_appimp.h" |
| 19 #include "xfa/fwl/core/fwl_noteimp.h" | 19 #include "xfa/fwl/core/fwl_noteimp.h" |
| 20 #include "xfa/fwl/core/fwl_widgetmgrimp.h" | 20 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
| 21 #include "xfa/fwl/core/ifwl_app.h" | 21 #include "xfa/fwl/core/ifwl_app.h" |
| 22 #include "xfa/fwl/core/ifwl_form.h" | 22 #include "xfa/fwl/core/ifwl_form.h" |
| 23 #include "xfa/fwl/core/ifwl_themeprovider.h" | 23 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 24 #include "xfa/fxfa/include/xfa_ffapp.h" | 24 #include "xfa/fxfa/include/xfa_ffapp.h" |
| 25 | 25 |
| 26 #define FWL_CLASSHASH_Menu 3957949655 | |
| 27 #define FWL_STYLEEXT_MNU_Vert (1L << 0) | 26 #define FWL_STYLEEXT_MNU_Vert (1L << 0) |
| 28 | 27 |
| 29 IFWL_Widget::~IFWL_Widget() {} | 28 IFWL_Widget::~IFWL_Widget() {} |
| 30 | 29 |
| 31 FWL_Error IFWL_Widget::GetClassName(CFX_WideString& wsClass) const { | 30 FWL_Error IFWL_Widget::GetClassName(CFX_WideString& wsClass) const { |
| 32 return m_pImpl->GetClassName(wsClass); | 31 return m_pImpl->GetClassName(wsClass); |
| 33 } | 32 } |
| 34 | 33 |
| 35 uint32_t IFWL_Widget::GetClassID() const { | 34 FWL_Type IFWL_Widget::GetClassID() const { |
| 36 return m_pImpl->GetClassID(); | 35 return m_pImpl->GetClassID(); |
| 37 } | 36 } |
| 38 | 37 |
| 39 FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { | 38 FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { |
| 40 return m_pImpl->IsInstance(wsClass); | 39 return m_pImpl->IsInstance(wsClass); |
| 41 } | 40 } |
| 42 | 41 |
| 43 FWL_Error IFWL_Widget::Initialize() { | 42 FWL_Error IFWL_Widget::Initialize() { |
| 44 return m_pImpl->Initialize(); | 43 return m_pImpl->Initialize(); |
| 45 } | 44 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 NotifyDriver(); | 183 NotifyDriver(); |
| 185 m_pWidgetMgr->RemoveWidget(m_pInterface); | 184 m_pWidgetMgr->RemoveWidget(m_pInterface); |
| 186 return FWL_Error::Succeeded; | 185 return FWL_Error::Succeeded; |
| 187 } | 186 } |
| 188 | 187 |
| 189 FWL_Error CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const { | 188 FWL_Error CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const { |
| 190 wsClass.clear(); | 189 wsClass.clear(); |
| 191 return FWL_Error::Succeeded; | 190 return FWL_Error::Succeeded; |
| 192 } | 191 } |
| 193 | 192 |
| 194 uint32_t CFWL_WidgetImp::GetClassID() const { | |
| 195 return 0; | |
| 196 } | |
| 197 | |
| 198 FX_BOOL CFWL_WidgetImp::IsInstance(const CFX_WideStringC& wsClass) const { | 193 FX_BOOL CFWL_WidgetImp::IsInstance(const CFX_WideStringC& wsClass) const { |
| 199 return FALSE; | 194 return FALSE; |
| 200 } | 195 } |
| 201 | 196 |
| 202 FWL_Error CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 197 FWL_Error CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
| 203 if (bAutoSize) { | 198 if (bAutoSize) { |
| 204 if (HasEdge()) { | 199 if (HasEdge()) { |
| 205 FX_FLOAT fEdge = GetEdgeWidth(); | 200 FX_FLOAT fEdge = GetEdgeWidth(); |
| 206 rect.Inflate(fEdge, fEdge); | 201 rect.Inflate(fEdge, fEdge); |
| 207 } | 202 } |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 } | 697 } |
| 703 } | 698 } |
| 704 void CFWL_WidgetImp::SetGrab(FX_BOOL bSet) { | 699 void CFWL_WidgetImp::SetGrab(FX_BOOL bSet) { |
| 705 IFWL_App* pApp = GetOwnerApp(); | 700 IFWL_App* pApp = GetOwnerApp(); |
| 706 if (!pApp) | 701 if (!pApp) |
| 707 return; | 702 return; |
| 708 CFWL_NoteDriver* pDriver = | 703 CFWL_NoteDriver* pDriver = |
| 709 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 704 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
| 710 pDriver->SetGrab(m_pInterface, bSet); | 705 pDriver->SetGrab(m_pInterface, bSet); |
| 711 } | 706 } |
| 707 |
| 712 FX_BOOL CFWL_WidgetImp::GetPopupPos(FX_FLOAT fMinHeight, | 708 FX_BOOL CFWL_WidgetImp::GetPopupPos(FX_FLOAT fMinHeight, |
| 713 FX_FLOAT fMaxHeight, | 709 FX_FLOAT fMaxHeight, |
| 714 const CFX_RectF& rtAnchor, | 710 const CFX_RectF& rtAnchor, |
| 715 CFX_RectF& rtPopup) { | 711 CFX_RectF& rtPopup) { |
| 716 if (GetClassID() == FWL_CLASSHASH_Menu) { | 712 if (GetClassID() == FWL_Type::ComboBox) { |
| 717 return GetPopupPosMenu(fMinHeight, fMaxHeight, rtAnchor, rtPopup); | 713 if (m_pWidgetMgr->IsFormDisabled()) { |
| 718 } else { | |
| 719 if (GetClassID() == FWL_CLASSHASH_ComboBox) { | |
| 720 if (m_pWidgetMgr->IsFormDisabled()) { | |
| 721 return m_pWidgetMgr->GetAdapterPopupPos(m_pInterface, fMinHeight, | |
| 722 fMaxHeight, rtAnchor, rtPopup); | |
| 723 } else { | |
| 724 return GetPopupPosComboBox(fMinHeight, fMaxHeight, rtAnchor, rtPopup); | |
| 725 } | |
| 726 } else if (GetClassID() == FWL_CLASSHASH_DateTimePicker && | |
| 727 m_pWidgetMgr->IsFormDisabled()) { | |
| 728 return m_pWidgetMgr->GetAdapterPopupPos(m_pInterface, fMinHeight, | 714 return m_pWidgetMgr->GetAdapterPopupPos(m_pInterface, fMinHeight, |
| 729 fMaxHeight, rtAnchor, rtPopup); | 715 fMaxHeight, rtAnchor, rtPopup); |
| 730 } else { | |
| 731 return GetPopupPosGeneral(fMinHeight, fMaxHeight, rtAnchor, rtPopup); | |
| 732 } | 716 } |
| 717 return GetPopupPosComboBox(fMinHeight, fMaxHeight, rtAnchor, rtPopup); |
| 733 } | 718 } |
| 734 return FALSE; | 719 if (GetClassID() == FWL_Type::DateTimePicker && |
| 720 m_pWidgetMgr->IsFormDisabled()) { |
| 721 return m_pWidgetMgr->GetAdapterPopupPos(m_pInterface, fMinHeight, |
| 722 fMaxHeight, rtAnchor, rtPopup); |
| 723 } |
| 724 return GetPopupPosGeneral(fMinHeight, fMaxHeight, rtAnchor, rtPopup); |
| 735 } | 725 } |
| 726 |
| 736 FX_BOOL CFWL_WidgetImp::GetPopupPosMenu(FX_FLOAT fMinHeight, | 727 FX_BOOL CFWL_WidgetImp::GetPopupPosMenu(FX_FLOAT fMinHeight, |
| 737 FX_FLOAT fMaxHeight, | 728 FX_FLOAT fMaxHeight, |
| 738 const CFX_RectF& rtAnchor, | 729 const CFX_RectF& rtAnchor, |
| 739 CFX_RectF& rtPopup) { | 730 CFX_RectF& rtPopup) { |
| 740 FX_FLOAT fx = 0; | 731 FX_FLOAT fx = 0; |
| 741 FX_FLOAT fy = 0; | 732 FX_FLOAT fy = 0; |
| 742 FX_FLOAT fScreenWidth = 0; | 733 FX_FLOAT fScreenWidth = 0; |
| 743 FX_FLOAT fScreenHeight = 0; | 734 FX_FLOAT fScreenHeight = 0; |
| 744 GetScreenSize(fScreenWidth, fScreenHeight); | 735 GetScreenSize(fScreenWidth, fScreenHeight); |
| 745 if (GetStylesEx() & FWL_STYLEEXT_MNU_Vert) { | 736 if (GetStylesEx() & FWL_STYLEEXT_MNU_Vert) { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 } | 1026 } |
| 1036 } | 1027 } |
| 1037 | 1028 |
| 1038 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} | 1029 void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} |
| 1039 | 1030 |
| 1040 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1031 void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 1041 const CFX_Matrix* pMatrix) { | 1032 const CFX_Matrix* pMatrix) { |
| 1042 CFWL_EvtDraw evt; | 1033 CFWL_EvtDraw evt; |
| 1043 evt.m_pGraphics = pGraphics; | 1034 evt.m_pGraphics = pGraphics; |
| 1044 } | 1035 } |
| OLD | NEW |