diff options
Diffstat (limited to 'xfa')
41 files changed, 393 insertions, 324 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h index b309780f37..95b4cd29eb 100644 --- a/xfa/fwl/core/cfwl_barcode.h +++ b/xfa/fwl/core/cfwl_barcode.h @@ -18,7 +18,7 @@ class CFWL_Barcode : public CFWL_Edit, public IFWL_BarcodeDP { void Initialize(); - // IFWL_DataProvider + // IFWL_Widget::DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; // IFWL_BarcodeDP diff --git a/xfa/fwl/core/cfwl_checkbox.h b/xfa/fwl/core/cfwl_checkbox.h index 306d6d0814..d395aa058d 100644 --- a/xfa/fwl/core/cfwl_checkbox.h +++ b/xfa/fwl/core/cfwl_checkbox.h @@ -17,7 +17,7 @@ class CFWL_CheckBox : public CFWL_Widget, public IFWL_CheckBoxDP { void Initialize(); - // IFWL_DataProvider + // IFWL_Widget::DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; // IFWL_CheckBoxDP diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index 569ad6dad0..f38140821b 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -10,6 +10,7 @@ #include "third_party/base/ptr_util.h" #include "xfa/fwl/core/fwl_error.h" +#include "xfa/fwl/core/ifwl_combobox.h" #include "xfa/fwl/core/ifwl_widget.h" namespace { diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h index 2e904af5fe..67d723718d 100644 --- a/xfa/fwl/core/cfwl_combobox.h +++ b/xfa/fwl/core/cfwl_combobox.h @@ -13,17 +13,17 @@ #include "xfa/fwl/core/cfwl_widget.h" #include "xfa/fwl/core/ifwl_combobox.h" -class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { +class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBox::DataProvider { public: explicit CFWL_ComboBox(const IFWL_App* pApp); ~CFWL_ComboBox() override; void Initialize(); - // IFWL_DataProvider + // IFWL_Widget::DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; - // IFWL_ListBoxDP + // IFWL_ListBox::DataProvider int32_t CountItems(const IFWL_Widget* pWidget) const override; CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) const override; @@ -56,7 +56,7 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { CFWL_ListItem* pItem, uint32_t dwCheckState) override; - // IFWL_ComboBoxDP + // IFWL_ComboBox::DataProvider FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override; int32_t AddString(const CFX_WideStringC& wsText); diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h index a43f69cf4c..8d983c9cdd 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.h +++ b/xfa/fwl/core/cfwl_datetimepicker.h @@ -17,7 +17,7 @@ class CFWL_DateTimePicker : public CFWL_Widget, public IFWL_DateTimePickerDP { void Initialize(); - // IFWL_DataProvider + // IFWL_Widget::DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; // IFWL_DateTimePickerDP diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp index 5b2ad5efbd..0f931d9905 100644 --- a/xfa/fwl/core/cfwl_listbox.cpp +++ b/xfa/fwl/core/cfwl_listbox.cpp @@ -10,6 +10,7 @@ #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" +#include "xfa/fwl/core/ifwl_listbox.h" namespace { diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h index 35ba060ca2..44b580ced2 100644 --- a/xfa/fwl/core/cfwl_listbox.h +++ b/xfa/fwl/core/cfwl_listbox.h @@ -15,17 +15,17 @@ #include "xfa/fwl/core/ifwl_listbox.h" #include "xfa/fwl/core/ifwl_widget.h" -class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP { +class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBox::DataProvider { public: explicit CFWL_ListBox(const IFWL_App* pApp); ~CFWL_ListBox() override; void Initialize(); - // IFWL_DataProvider: + // IFWL_Widget::DataProvider: void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; - // IFWL_ListBoxDP: + // IFWL_ListBox::DataProvider: int32_t CountItems(const IFWL_Widget* pWidget) const override; CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) const override; diff --git a/xfa/fwl/core/cfwl_picturebox.h b/xfa/fwl/core/cfwl_picturebox.h index 12a8b632ff..d1be78bda4 100644 --- a/xfa/fwl/core/cfwl_picturebox.h +++ b/xfa/fwl/core/cfwl_picturebox.h @@ -9,15 +9,16 @@ #include "xfa/fwl/core/cfwl_widget.h" #include "xfa/fwl/core/ifwl_picturebox.h" +#include "xfa/fwl/core/ifwl_widget.h" -class CFWL_PictureBox : public CFWL_Widget, public IFWL_PictureBoxDP { +class CFWL_PictureBox : public CFWL_Widget, public IFWL_Widget::DataProvider { public: explicit CFWL_PictureBox(const IFWL_App* pApp); ~CFWL_PictureBox() override; void Initialize(); - // IFWL_DataProvider + // IFWL_Widget::DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; }; diff --git a/xfa/fwl/core/cfwl_pushbutton.h b/xfa/fwl/core/cfwl_pushbutton.h index ad17406d12..b35ed65474 100644 --- a/xfa/fwl/core/cfwl_pushbutton.h +++ b/xfa/fwl/core/cfwl_pushbutton.h @@ -9,15 +9,16 @@ #include "xfa/fwl/core/cfwl_widget.h" #include "xfa/fwl/core/ifwl_pushbutton.h" +#include "xfa/fwl/core/ifwl_widget.h" -class CFWL_PushButton : public CFWL_Widget, public IFWL_PushButtonDP { +class CFWL_PushButton : public CFWL_Widget, public IFWL_Widget::DataProvider { public: explicit CFWL_PushButton(const IFWL_App*); ~CFWL_PushButton() override; void Initialize(); - // IFWL_DataProvider + // IFWL_Widget::DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; }; diff --git a/xfa/fwl/core/cfwl_sysbtn.cpp b/xfa/fwl/core/cfwl_sysbtn.cpp new file mode 100644 index 0000000000..0ccc4c4b1d --- /dev/null +++ b/xfa/fwl/core/cfwl_sysbtn.cpp @@ -0,0 +1,49 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "xfa/fwl/core/cfwl_sysbtn.h" + +#include "xfa/fwl/core/cfwl_themepart.h" + +CFWL_SysBtn::CFWL_SysBtn() { + m_rtBtn.Set(0, 0, 0, 0); + m_dwState = 0; +} + +CFWL_SysBtn::~CFWL_SysBtn() {} + +bool CFWL_SysBtn::IsDisabled() const { + return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled); +} + +void CFWL_SysBtn::SetNormal() { + m_dwState &= 0xFFF0; +} + +void CFWL_SysBtn::SetPressed() { + SetNormal(); + m_dwState |= FWL_SYSBUTTONSTATE_Pressed; +} + +void CFWL_SysBtn::SetHover() { + SetNormal(); + m_dwState |= FWL_SYSBUTTONSTATE_Hover; +} + +void CFWL_SysBtn::SetDisabled(bool bDisabled) { + bDisabled ? m_dwState |= FWL_SYSBUTTONSTATE_Disabled + : m_dwState &= ~FWL_SYSBUTTONSTATE_Disabled; +} + +uint32_t CFWL_SysBtn::GetPartState() const { + if (IsDisabled()) + return CFWL_PartState_Disabled; + if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) + return CFWL_PartState_Pressed; + if (m_dwState & FWL_SYSBUTTONSTATE_Hover) + return CFWL_PartState_Hovered; + return CFWL_PartState_Normal; +} diff --git a/xfa/fwl/core/cfwl_sysbtn.h b/xfa/fwl/core/cfwl_sysbtn.h new file mode 100644 index 0000000000..b973b92ff8 --- /dev/null +++ b/xfa/fwl/core/cfwl_sysbtn.h @@ -0,0 +1,33 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_FWL_CORE_CFWL_SYSBTN_H_ +#define XFA_FWL_CORE_CFWL_SYSBTN_H_ + +#include "core/fxcrt/fx_coordinates.h" + +#define FWL_SYSBUTTONSTATE_Hover 0x0001 +#define FWL_SYSBUTTONSTATE_Pressed 0x0002 +#define FWL_SYSBUTTONSTATE_Disabled 0x0010 + +class CFWL_SysBtn { + public: + CFWL_SysBtn(); + ~CFWL_SysBtn(); + + bool IsDisabled() const; + uint32_t GetPartState() const; + + void SetNormal(); + void SetPressed(); + void SetHover(); + void SetDisabled(bool bDisabled); + + CFX_RectF m_rtBtn; + uint32_t m_dwState; +}; + +#endif // XFA_FWL_CORE_CFWL_SYSBTN_H_ diff --git a/xfa/fwl/core/cfwl_widgetproperties.h b/xfa/fwl/core/cfwl_widgetproperties.h index 9963b5f357..cadba3f8c7 100644 --- a/xfa/fwl/core/cfwl_widgetproperties.h +++ b/xfa/fwl/core/cfwl_widgetproperties.h @@ -10,15 +10,15 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" #include "xfa/fwl/core/fwl_widgetdef.h" +#include "xfa/fwl/core/ifwl_widget.h" -class IFWL_DataProvider; class IFWL_ThemeProvider; class IFWL_Widget; class CFWL_WidgetProperties { public: CFWL_WidgetProperties(); - CFWL_WidgetProperties(IFWL_DataProvider* dataProvider); + CFWL_WidgetProperties(IFWL_Widget::DataProvider* dataProvider); ~CFWL_WidgetProperties(); CFX_RectF m_rtWidget; @@ -26,7 +26,7 @@ class CFWL_WidgetProperties { uint32_t m_dwStyleExes; uint32_t m_dwStates; IFWL_ThemeProvider* m_pThemeProvider; - IFWL_DataProvider* m_pDataProvider; + IFWL_Widget::DataProvider* m_pDataProvider; IFWL_Widget* m_pParent; IFWL_Widget* m_pOwner; }; @@ -35,7 +35,7 @@ inline CFWL_WidgetProperties::CFWL_WidgetProperties() : CFWL_WidgetProperties(nullptr) {} inline CFWL_WidgetProperties::CFWL_WidgetProperties( - IFWL_DataProvider* dataProvider) + IFWL_Widget::DataProvider* dataProvider) : m_dwStyles(FWL_WGTSTYLE_Child), m_dwStyleExes(0), m_dwStates(0), diff --git a/xfa/fwl/core/ifwl_barcode.h b/xfa/fwl/core/ifwl_barcode.h index 09ec1f3e7d..417b1b77cc 100644 --- a/xfa/fwl/core/ifwl_barcode.h +++ b/xfa/fwl/core/ifwl_barcode.h @@ -9,9 +9,9 @@ #include <memory> -#include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_edit.h" #include "xfa/fwl/core/ifwl_scrollbar.h" +#include "xfa/fwl/core/ifwl_widget.h" #include "xfa/fxbarcode/BC_Library.h" class CFWL_WidgetProperties; @@ -38,7 +38,7 @@ enum FWL_BCDAttribute { FWL_BCDATTRIBUTE_TRUNCATED = 1 << 12 }; -class IFWL_BarcodeDP : public IFWL_DataProvider { +class IFWL_BarcodeDP : public IFWL_Widget::DataProvider { public: virtual BC_CHAR_ENCODING GetCharEncoding() const = 0; virtual int32_t GetModuleHeight() const = 0; diff --git a/xfa/fwl/core/ifwl_caret.cpp b/xfa/fwl/core/ifwl_caret.cpp index 0b84cdf53b..cba6c44aa3 100644 --- a/xfa/fwl/core/ifwl_caret.cpp +++ b/xfa/fwl/core/ifwl_caret.cpp @@ -12,6 +12,7 @@ #include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_caret.h" #include "xfa/fwl/core/ifwl_themeprovider.h" +#include "xfa/fwl/core/ifwl_timerinfo.h" namespace { diff --git a/xfa/fwl/core/ifwl_checkbox.h b/xfa/fwl/core/ifwl_checkbox.h index 65a36a39ab..b947e954ae 100644 --- a/xfa/fwl/core/ifwl_checkbox.h +++ b/xfa/fwl/core/ifwl_checkbox.h @@ -9,7 +9,6 @@ #include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_widgetproperties.h" -#include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_widget.h" #define FWL_STYLEEXT_CKB_Left (0L << 0) @@ -47,7 +46,7 @@ class CFWL_MsgMouse; class CFWL_WidgetProperties; class IFWL_Widget; -class IFWL_CheckBoxDP : public IFWL_DataProvider { +class IFWL_CheckBoxDP : public IFWL_Widget::DataProvider { public: virtual FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) = 0; }; diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp index e186d4fa39..12e009f91a 100644 --- a/xfa/fwl/core/ifwl_combobox.cpp +++ b/xfa/fwl/core/ifwl_combobox.cpp @@ -24,7 +24,9 @@ #include "xfa/fwl/core/cfwl_widgetmgr.h" #include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_app.h" +#include "xfa/fwl/core/ifwl_combobox.h" #include "xfa/fwl/core/ifwl_formproxy.h" +#include "xfa/fwl/core/ifwl_listbox.h" #include "xfa/fwl/core/ifwl_themeprovider.h" IFWL_ComboBox::IFWL_ComboBox(const IFWL_App* app, @@ -174,8 +176,9 @@ void IFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics, param.m_rtPart = rtTextBk; if (m_iCurSel >= 0) { - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pListBox->GetDataProvider()); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>( + m_pListBox->GetDataProvider()); void* p = pData->GetItemData(m_pListBox.get(), pData->GetItem(m_pListBox.get(), m_iCurSel)); if (p) @@ -197,8 +200,9 @@ void IFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics, return; CFX_WideString wsText; - IFWL_ComboBoxDP* pData = - static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ComboBox::DataProvider* pData = + static_cast<IFWL_ComboBox::DataProvider*>( + m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); m_pListBox->GetItemText(hItem, wsText); @@ -250,8 +254,9 @@ void IFWL_ComboBox::SetCurSel(int32_t iSel) { m_pEdit->SetText(CFX_WideString()); } else { CFX_WideString wsText; - IFWL_ComboBoxDP* pData = - static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ComboBox::DataProvider* pData = + static_cast<IFWL_ComboBox::DataProvider*>( + m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, iSel); m_pListBox->GetItemText(hItem, wsText); m_pEdit->SetText(wsText); @@ -287,8 +292,8 @@ void IFWL_ComboBox::GetEditText(CFX_WideString& wsText, if (!m_pListBox) return; - IFWL_ComboBoxDP* pData = - static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ComboBox::DataProvider* pData = + static_cast<IFWL_ComboBox::DataProvider*>(m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); m_pListBox->GetItemText(hItem, wsText); } @@ -320,7 +325,8 @@ void IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, } FX_FLOAT IFWL_ComboBox::GetListHeight() { - return static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider) + return static_cast<IFWL_ComboBox::DataProvider*>( + m_pProperties->m_pDataProvider) ->GetListHeight(this); } @@ -423,8 +429,8 @@ void IFWL_ComboBox::MatchEditText() { void IFWL_ComboBox::SyncEditText(int32_t iListItem) { CFX_WideString wsText; - IFWL_ComboBoxDP* pData = - static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ComboBox::DataProvider* pData = + static_cast<IFWL_ComboBox::DataProvider*>(m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, iListItem); m_pListBox->GetItemText(hItem, wsText); m_pEdit->SetText(wsText); @@ -455,8 +461,9 @@ void IFWL_ComboBox::Layout() { if (m_iCurSel >= 0) { CFX_WideString wsText; - IFWL_ComboBoxDP* pData = - static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ComboBox::DataProvider* pData = + static_cast<IFWL_ComboBox::DataProvider*>( + m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); m_pListBox->GetItemText(hItem, wsText); m_pEdit->LockUpdate(); @@ -541,16 +548,16 @@ void IFWL_ComboBox::ResetListItemAlignment() { } void IFWL_ComboBox::ProcessSelChanged(bool bLButtonUp) { - IFWL_ComboBoxDP* pDatas = - static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ComboBox::DataProvider* pDatas = + static_cast<IFWL_ComboBox::DataProvider*>(m_pProperties->m_pDataProvider); m_iCurSel = pDatas->GetItemIndex(this, m_pListBox->GetSelItem(0)); if (!IsDropDownStyle()) { Repaint(&m_rtClient); return; } - IFWL_ComboBoxDP* pData = - static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ComboBox::DataProvider* pData = + static_cast<IFWL_ComboBox::DataProvider*>(m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); if (!hItem) return; @@ -790,8 +797,9 @@ void IFWL_ComboBox::DisForm_Layout() { if (m_iCurSel >= 0) { CFX_WideString wsText; - IFWL_ComboBoxDP* pData = - static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ComboBox::DataProvider* pData = + static_cast<IFWL_ComboBox::DataProvider*>( + m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); m_pListBox->GetItemText(hItem, wsText); m_pEdit->LockUpdate(); @@ -975,8 +983,9 @@ void IFWL_ComboBox::DoSubCtrlKey(CFWL_MsgKey* pMsg) { iCurSel = m_pListBox->MatchItem(wsText); if (iCurSel >= 0) { CFX_WideString wsTemp; - IFWL_ComboBoxDP* pData = - static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ComboBox::DataProvider* pData = + static_cast<IFWL_ComboBox::DataProvider*>( + m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, iCurSel); m_pListBox->GetItemText(hItem, wsTemp); bMatchEqual = wsText == wsTemp; diff --git a/xfa/fwl/core/ifwl_combobox.h b/xfa/fwl/core/ifwl_combobox.h index 8e23d24de0..7cf17e2881 100644 --- a/xfa/fwl/core/ifwl_combobox.h +++ b/xfa/fwl/core/ifwl_combobox.h @@ -45,13 +45,13 @@ class IFWL_Widget; #define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12) #define FWL_STYLEEXT_CMB_ReadOnly (1L << 13) -class IFWL_ComboBoxDP : public IFWL_ListBoxDP { - public: - virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget) = 0; -}; - class IFWL_ComboBox : public IFWL_Widget { public: + class DataProvider : public IFWL_ListBox::DataProvider { + public: + virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget) = 0; + }; + explicit IFWL_ComboBox(const IFWL_App* app, std::unique_ptr<CFWL_WidgetProperties> properties); ~IFWL_ComboBox() override; diff --git a/xfa/fwl/core/ifwl_combolist.cpp b/xfa/fwl/core/ifwl_combolist.cpp index 7f178fd1b7..deaab7860b 100644 --- a/xfa/fwl/core/ifwl_combolist.cpp +++ b/xfa/fwl/core/ifwl_combolist.cpp @@ -12,6 +12,7 @@ #include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/ifwl_combobox.h" #include "xfa/fwl/core/ifwl_comboedit.h" +#include "xfa/fwl/core/ifwl_listbox.h" IFWL_ComboList::IFWL_ComboList( const IFWL_App* app, @@ -27,8 +28,8 @@ int32_t IFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) { if (!m_pProperties->m_pDataProvider) return -1; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); int32_t iCount = pData->CountItems(this); for (int32_t i = 0; i < iCount; i++) { CFWL_ListItem* hItem = pData->GetItem(this, i); @@ -45,8 +46,8 @@ void IFWL_ComboList::ChangeSelected(int32_t iSel) { if (!m_pProperties->m_pDataProvider) return; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, iSel); CFX_RectF rtInvalidate; rtInvalidate.Reset(); @@ -70,14 +71,14 @@ void IFWL_ComboList::ChangeSelected(int32_t iSel) { } int32_t IFWL_ComboList::CountItems() { - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); return pData ? pData->CountItems(this) : 0; } void IFWL_ComboList::GetItemRect(int32_t nIndex, CFX_RectF& rtItem) { - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, nIndex); pData->GetItemRect(this, hItem, rtItem); } @@ -169,8 +170,9 @@ void IFWL_ComboList::OnDropListMouseMove(CFWL_MsgMouse* pMsg) { if (!m_pProperties->m_pDataProvider) return; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>( + m_pProperties->m_pDataProvider); ChangeSelected(pData->GetItemIndex(this, hItem)); } else if (m_bNotifyOwner) { ClientToOuter(pMsg->m_fx, pMsg->m_fy); @@ -250,8 +252,9 @@ void IFWL_ComboList::OnDropListKeyDown(CFWL_MsgKey* pKey) { case FWL_VKEY_Home: case FWL_VKEY_End: { IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOuter); - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>( + m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, pOuter->GetCurrentSelection()); hItem = GetItem(hItem, dwKeyCode); diff --git a/xfa/fwl/core/ifwl_dataprovider.h b/xfa/fwl/core/ifwl_dataprovider.h deleted file mode 100644 index c4e1a4ea76..0000000000 --- a/xfa/fwl/core/ifwl_dataprovider.h +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FWL_CORE_IFWL_DATAPROVIDER_H_ -#define XFA_FWL_CORE_IFWL_DATAPROVIDER_H_ - -#include "core/fxcrt/fx_string.h" - -class IFWL_Widget; - -class IFWL_DataProvider { - public: - virtual ~IFWL_DataProvider() {} - - virtual void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) = 0; -}; - -#endif // XFA_FWL_CORE_IFWL_DATAPROVIDER_H_ diff --git a/xfa/fwl/core/ifwl_datetimepicker.h b/xfa/fwl/core/ifwl_datetimepicker.h index e9aeb08be2..c8d70f5575 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.h +++ b/xfa/fwl/core/ifwl_datetimepicker.h @@ -9,7 +9,6 @@ #include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_widgetproperties.h" -#include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_datetimeedit.h" #include "xfa/fwl/core/ifwl_monthcalendar.h" #include "xfa/fwl/core/ifwl_widget.h" @@ -34,7 +33,7 @@ class IFWL_DateTimeEdit; class IFWL_FormProxy; -class IFWL_DateTimePickerDP : public IFWL_DataProvider { +class IFWL_DateTimePickerDP : public IFWL_Widget::DataProvider { public: virtual void GetToday(IFWL_Widget* pWidget, int32_t& iYear, @@ -42,7 +41,8 @@ class IFWL_DateTimePickerDP : public IFWL_DataProvider { int32_t& iDay) = 0; }; -class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP { +class IFWL_DateTimePicker : public IFWL_Widget, + public IFWL_MonthCalendar::DataProvider { public: explicit IFWL_DateTimePicker( const IFWL_App* app, @@ -61,10 +61,10 @@ class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; - // IFWL_DataProvider + // IFWL_Widget::DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; - // IFWL_MonthCalendarDP + // IFWL_MonthCalendar::DataProvider int32_t GetCurDay(IFWL_Widget* pWidget) override; int32_t GetCurMonth(IFWL_Widget* pWidget) override; int32_t GetCurYear(IFWL_Widget* pWidget) override; diff --git a/xfa/fwl/core/ifwl_edit.h b/xfa/fwl/core/ifwl_edit.h index e02ae31d7f..a46245e122 100644 --- a/xfa/fwl/core/ifwl_edit.h +++ b/xfa/fwl/core/ifwl_edit.h @@ -14,8 +14,8 @@ #include "xfa/fde/ifde_txtedtdorecord.h" #include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_widget.h" -#include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_scrollbar.h" +#include "xfa/fwl/core/ifwl_widget.h" #include "xfa/fxgraphics/cfx_path.h" #define FWL_STYLEEXT_EDT_ReadOnly (1L << 0) diff --git a/xfa/fwl/core/ifwl_form.cpp b/xfa/fwl/core/ifwl_form.cpp index bd8f8bb7e1..57e2507257 100644 --- a/xfa/fwl/core/ifwl_form.cpp +++ b/xfa/fwl/core/ifwl_form.cpp @@ -10,6 +10,7 @@ #include "xfa/fde/tto/fde_textout.h" #include "xfa/fwl/core/cfwl_evtclose.h" #include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_sysbtn.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_themetext.h" @@ -643,41 +644,3 @@ void IFWL_Form::OnLButtonDblClk(CFWL_MsgMouse* pMsg) { m_bMaximized = !m_bMaximized; } } - -CFWL_SysBtn::CFWL_SysBtn() { - m_rtBtn.Set(0, 0, 0, 0); - m_dwState = 0; -} - -bool CFWL_SysBtn::IsDisabled() const { - return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled); -} - -void CFWL_SysBtn::SetNormal() { - m_dwState &= 0xFFF0; -} - -void CFWL_SysBtn::SetPressed() { - SetNormal(); - m_dwState |= FWL_SYSBUTTONSTATE_Pressed; -} - -void CFWL_SysBtn::SetHover() { - SetNormal(); - m_dwState |= FWL_SYSBUTTONSTATE_Hover; -} - -void CFWL_SysBtn::SetDisabled(bool bDisabled) { - bDisabled ? m_dwState |= FWL_SYSBUTTONSTATE_Disabled - : m_dwState &= ~FWL_SYSBUTTONSTATE_Disabled; -} - -uint32_t CFWL_SysBtn::GetPartState() const { - if (IsDisabled()) - return CFWL_PartState_Disabled; - if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) - return CFWL_PartState_Pressed; - if (m_dwState & FWL_SYSBUTTONSTATE_Hover) - return CFWL_PartState_Hovered; - return CFWL_PartState_Normal; -} diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index 672f1d2530..dfd9930236 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -11,7 +11,6 @@ #include "core/fxcrt/fx_system.h" #include "xfa/fwl/core/cfwl_widgetproperties.h" -#include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_widget.h" #define FWL_CLASS_Form L"FWL_FORM" @@ -28,40 +27,13 @@ #define FWL_UseMacSystemBorder #endif -#define FWL_SYSBUTTONSTATE_Hover 0x0001 -#define FWL_SYSBUTTONSTATE_Pressed 0x0002 -#define FWL_SYSBUTTONSTATE_Disabled 0x0010 - -enum FWL_FORMSIZE { - FWL_FORMSIZE_Manual = 0, - FWL_FORMSIZE_Width, - FWL_FORMSIZE_Height, - FWL_FORMSIZE_All, -}; - -class CFWL_SysBtn { - public: - CFWL_SysBtn(); - - bool IsDisabled() const; - uint32_t GetPartState() const; - - void SetNormal(); - void SetPressed(); - void SetHover(); - void SetDisabled(bool bDisabled); - - CFX_RectF m_rtBtn; - uint32_t m_dwState; -}; - class CFWL_MsgMouse; class CFWL_NoteLoop; class IFWL_Widget; class IFWL_ThemeProvider; class CFWL_SysBtn; -class IFWL_FormDP : public IFWL_DataProvider {}; +class IFWL_FormDP : public IFWL_Widget::DataProvider {}; class IFWL_Form : public IFWL_Widget { public: diff --git a/xfa/fwl/core/ifwl_listbox.cpp b/xfa/fwl/core/ifwl_listbox.cpp index f1ee2f5245..785f5a3f80 100644 --- a/xfa/fwl/core/ifwl_listbox.cpp +++ b/xfa/fwl/core/ifwl_listbox.cpp @@ -15,6 +15,7 @@ #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_themetext.h" #include "xfa/fwl/core/ifwl_app.h" +#include "xfa/fwl/core/ifwl_listbox.h" #include "xfa/fwl/core/ifwl_themeprovider.h" namespace { @@ -146,8 +147,8 @@ int32_t IFWL_ListBox::CountSelItems() { return 0; int32_t iRet = 0; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); int32_t iCount = pData->CountItems(this); for (int32_t i = 0; i < iCount; i++) { CFWL_ListItem* pItem = pData->GetItem(this, i); @@ -165,8 +166,8 @@ CFWL_ListItem* IFWL_ListBox::GetSelItem(int32_t nIndexSel) { int32_t idx = GetSelIndex(nIndexSel); if (idx < 0) return nullptr; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); return pData->GetItem(this, idx); } @@ -175,8 +176,8 @@ int32_t IFWL_ListBox::GetSelIndex(int32_t nIndex) { return -1; int32_t index = 0; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); int32_t iCount = pData->CountItems(this); for (int32_t i = 0; i < iCount; i++) { CFWL_ListItem* pItem = pData->GetItem(this, i); @@ -215,8 +216,8 @@ void IFWL_ListBox::GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText) { if (!m_pProperties->m_pDataProvider) return; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); if (!pItem) return; @@ -233,8 +234,9 @@ CFWL_ListItem* IFWL_ListBox::GetItem(CFWL_ListItem* pItem, uint32_t dwKeyCode) { const bool bUp = dwKeyCode == FWL_VKEY_Up; const bool bDown = dwKeyCode == FWL_VKEY_Down; const bool bHome = dwKeyCode == FWL_VKEY_Home; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>( + m_pProperties->m_pDataProvider); int32_t iDstItem = -1; if (bUp || bDown) { int32_t index = pData->GetItemIndex(this, pItem); @@ -257,8 +259,8 @@ CFWL_ListItem* IFWL_ListBox::GetItem(CFWL_ListItem* pItem, uint32_t dwKeyCode) { void IFWL_ListBox::SetSelection(CFWL_ListItem* hStart, CFWL_ListItem* hEnd, bool bSelected) { - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); int32_t iStart = pData->GetItemIndex(this, hStart); int32_t iEnd = pData->GetItemIndex(this, hEnd); if (iStart > iEnd) { @@ -280,8 +282,8 @@ void IFWL_ListBox::SetSelection(CFWL_ListItem* hStart, } void IFWL_ListBox::SetSelectionDirect(CFWL_ListItem* pItem, bool bSelect) { - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); uint32_t dwOldStyle = pData->GetItemStyles(this, pItem); bSelect ? dwOldStyle |= FWL_ITEMSTATE_LTB_Selected : dwOldStyle &= ~FWL_ITEMSTATE_LTB_Selected; @@ -289,16 +291,16 @@ void IFWL_ListBox::SetSelectionDirect(CFWL_ListItem* pItem, bool bSelect) { } bool IFWL_ListBox::IsItemSelected(CFWL_ListItem* pItem) { - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); uint32_t dwState = pData->GetItemStyles(this, pItem); return (dwState & FWL_ITEMSTATE_LTB_Selected) != 0; } void IFWL_ListBox::ClearSelection() { bool bMulti = m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); int32_t iCount = pData->CountItems(this); for (int32_t i = 0; i < iCount; i++) { CFWL_ListItem* pItem = pData->GetItem(this, i); @@ -315,8 +317,8 @@ void IFWL_ListBox::SelectAll() { if (!m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) return; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); int32_t iCount = pData->CountItems(this); if (iCount <= 0) return; @@ -327,8 +329,8 @@ void IFWL_ListBox::SelectAll() { } CFWL_ListItem* IFWL_ListBox::GetFocusedItem() { - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); int32_t iCount = pData->CountItems(this); for (int32_t i = 0; i < iCount; i++) { CFWL_ListItem* pItem = pData->GetItem(this, i); @@ -341,8 +343,8 @@ CFWL_ListItem* IFWL_ListBox::GetFocusedItem() { } void IFWL_ListBox::SetFocusItem(CFWL_ListItem* pItem) { - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); CFWL_ListItem* hFocus = GetFocusedItem(); if (pItem == hFocus) return; @@ -369,8 +371,8 @@ CFWL_ListItem* IFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { if (m_pVertScrollBar) fPosY = m_pVertScrollBar->GetPos(); - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); int32_t nCount = pData->CountItems(this); for (int32_t i = 0; i < nCount; i++) { CFWL_ListItem* pItem = pData->GetItem(this, i); @@ -392,8 +394,8 @@ bool IFWL_ListBox::GetItemCheckRect(CFWL_ListItem* pItem, CFX_RectF& rtCheck) { if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) return false; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); pData->GetItemCheckRect(this, pItem, rtCheck); return true; } @@ -404,8 +406,8 @@ bool IFWL_ListBox::GetItemChecked(CFWL_ListItem* pItem) { if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) return false; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); return !!(pData->GetItemCheckState(this, pItem) & FWL_ITEMSTATE_LTB_Checked); } @@ -415,8 +417,8 @@ bool IFWL_ListBox::SetItemChecked(CFWL_ListItem* pItem, bool bChecked) { if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) return false; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); pData->SetItemCheckState(this, pItem, bChecked ? FWL_ITEMSTATE_LTB_Checked : 0); return true; @@ -427,8 +429,8 @@ bool IFWL_ListBox::ScrollToVisible(CFWL_ListItem* pItem) { return false; CFX_RectF rtItem; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); pData->GetItemRect(this, pItem, rtItem); bool bScroll = false; @@ -492,8 +494,8 @@ void IFWL_ListBox::DrawItems(CFX_Graphics* pGraphics, bool bMultiCol = !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiColumn); - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); int32_t iCount = pData->CountItems(this); for (int32_t i = 0; i < iCount; i++) { CFWL_ListItem* pItem = pData->GetItem(this, i); @@ -521,8 +523,8 @@ void IFWL_ListBox::DrawItem(CFX_Graphics* pGraphics, int32_t Index, const CFX_RectF& rtItem, const CFX_Matrix* pMatrix) { - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); uint32_t dwItemStyles = pData->GetItemStyles(this, pItem); uint32_t dwPartStates = CFWL_PartState_Normal; if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) @@ -635,16 +637,18 @@ CFX_SizeF IFWL_ListBox::CalcSize(bool bAutoSize) { FX_FLOAT fWidth = 0; if (m_pProperties->m_pThemeProvider->IsCustomizedLayout(this)) { - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>( + m_pProperties->m_pDataProvider); int32_t iCount = pData->CountItems(this); for (int32_t i = 0; i < iCount; i++) { CFWL_ListItem* pItem = pData->GetItem(this, i); if (!bAutoSize) { CFX_RectF rtItem; rtItem.Set(m_rtClient.left, m_rtClient.top + fs.y, 0, 0); - IFWL_ListBoxDP* pBox = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pBox = + static_cast<IFWL_ListBox::DataProvider*>( + m_pProperties->m_pDataProvider); pBox->SetItemRect(this, pItem, rtItem); } if (fs.x < 0) { @@ -661,8 +665,9 @@ CFX_SizeF IFWL_ListBox::CalcSize(bool bAutoSize) { fWidth = std::max(fWidth, fActualWidth); } - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>( + m_pProperties->m_pDataProvider); m_fItemHeight = CalcItemHeight(); if ((GetStylesEx() & FWL_STYLEEXT_LTB_Icon)) fWidth += m_fItemHeight; @@ -775,8 +780,9 @@ void IFWL_ListBox::GetItemSize(CFX_SizeF& size, if (!bAutoSize) { CFX_RectF rtItem; rtItem.Set(0, size.y, fWidth, fItemHeight); - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>( + m_pProperties->m_pDataProvider); pData->SetItemRect(this, pItem, rtItem); } size.x = fWidth; @@ -785,8 +791,8 @@ void IFWL_ListBox::GetItemSize(CFX_SizeF& size, FX_FLOAT IFWL_ListBox::GetMaxTextWidth() { FX_FLOAT fRet = 0.0f; - IFWL_ListBoxDP* pData = - static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_ListBox::DataProvider* pData = + static_cast<IFWL_ListBox::DataProvider*>(m_pProperties->m_pDataProvider); int32_t iCount = pData->CountItems(this); for (int32_t i = 0; i < iCount; i++) { CFWL_ListItem* pItem = pData->GetItem(this, i); diff --git a/xfa/fwl/core/ifwl_listbox.h b/xfa/fwl/core/ifwl_listbox.h index 5912656ac5..ec6587460b 100644 --- a/xfa/fwl/core/ifwl_listbox.h +++ b/xfa/fwl/core/ifwl_listbox.h @@ -12,7 +12,6 @@ #include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_listitem.h" #include "xfa/fwl/core/cfwl_widgetproperties.h" -#include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_edit.h" #include "xfa/fwl/core/ifwl_listbox.h" #include "xfa/fwl/core/ifwl_widget.h" @@ -38,44 +37,45 @@ class CFWL_MsgMouse; class CFWL_MsgMouseWheel; class CFX_DIBitmap; -class IFWL_ListBoxDP : public IFWL_DataProvider { +class IFWL_ListBox : public IFWL_Widget { public: - virtual int32_t CountItems(const IFWL_Widget* pWidget) const = 0; - virtual CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, - int32_t nIndex) const = 0; - virtual int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0; - virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, + class DataProvider : public IFWL_Widget::DataProvider { + public: + virtual int32_t CountItems(const IFWL_Widget* pWidget) const = 0; + virtual CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, + int32_t nIndex) const = 0; + virtual int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0; - virtual void GetItemText(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - CFX_WideString& wsText) = 0; - virtual void GetItemRect(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - CFX_RectF& rtItem) = 0; - virtual void* GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0; - virtual void SetItemStyles(IFWL_Widget* pWidget, + virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, + CFWL_ListItem* pItem) = 0; + virtual void GetItemText(IFWL_Widget* pWidget, CFWL_ListItem* pItem, - uint32_t dwStyle) = 0; - virtual void SetItemRect(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - const CFX_RectF& rtItem) = 0; - virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, - CFWL_ListItem* pItem) = 0; - virtual void GetItemCheckRect(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - CFX_RectF& rtCheck) = 0; - virtual void SetItemCheckRect(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - const CFX_RectF& rtCheck) = 0; - virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, - CFWL_ListItem* pItem) = 0; - virtual void SetItemCheckState(IFWL_Widget* pWidget, - CFWL_ListItem* pItem, - uint32_t dwCheckState) = 0; -}; + CFX_WideString& wsText) = 0; + virtual void GetItemRect(IFWL_Widget* pWidget, + CFWL_ListItem* pItem, + CFX_RectF& rtItem) = 0; + virtual void* GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0; + virtual void SetItemStyles(IFWL_Widget* pWidget, + CFWL_ListItem* pItem, + uint32_t dwStyle) = 0; + virtual void SetItemRect(IFWL_Widget* pWidget, + CFWL_ListItem* pItem, + const CFX_RectF& rtItem) = 0; + virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, + CFWL_ListItem* pItem) = 0; + virtual void GetItemCheckRect(IFWL_Widget* pWidget, + CFWL_ListItem* pItem, + CFX_RectF& rtCheck) = 0; + virtual void SetItemCheckRect(IFWL_Widget* pWidget, + CFWL_ListItem* pItem, + const CFX_RectF& rtCheck) = 0; + virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, + CFWL_ListItem* pItem) = 0; + virtual void SetItemCheckState(IFWL_Widget* pWidget, + CFWL_ListItem* pItem, + uint32_t dwCheckState) = 0; + }; -class IFWL_ListBox : public IFWL_Widget { - public: IFWL_ListBox(const IFWL_App* app, std::unique_ptr<CFWL_WidgetProperties> properties, IFWL_Widget* pOuter); diff --git a/xfa/fwl/core/ifwl_monthcalendar.cpp b/xfa/fwl/core/ifwl_monthcalendar.cpp index 8be738399c..ab9cbc411e 100644 --- a/xfa/fwl/core/ifwl_monthcalendar.cpp +++ b/xfa/fwl/core/ifwl_monthcalendar.cpp @@ -724,8 +724,9 @@ void IFWL_MonthCalendar::GetCapValue() { void IFWL_MonthCalendar::InitDate() { if (m_pProperties->m_pDataProvider) { - IFWL_MonthCalendarDP* pDateProv = - static_cast<IFWL_MonthCalendarDP*>(m_pProperties->m_pDataProvider); + IFWL_MonthCalendar::DataProvider* pDateProv = + static_cast<IFWL_MonthCalendar::DataProvider*>( + m_pProperties->m_pDataProvider); m_iYear = pDateProv->GetCurYear(this); m_iMonth = pDateProv->GetCurMonth(this); m_iDay = pDateProv->GetCurDay(this); diff --git a/xfa/fwl/core/ifwl_monthcalendar.h b/xfa/fwl/core/ifwl_monthcalendar.h index 096b3a04d7..7a8b3125a6 100644 --- a/xfa/fwl/core/ifwl_monthcalendar.h +++ b/xfa/fwl/core/ifwl_monthcalendar.h @@ -10,7 +10,6 @@ #include "xfa/fgas/localization/fgas_datetime.h" #include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_widgetproperties.h" -#include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_widget.h" #define FWL_STYLEEXT_MCD_MultiSelect (1L << 0) @@ -25,15 +24,15 @@ class CFWL_MsgMouse; class IFWL_Widget; -class IFWL_MonthCalendarDP : public IFWL_DataProvider { - public: - virtual int32_t GetCurDay(IFWL_Widget* pWidget) = 0; - virtual int32_t GetCurMonth(IFWL_Widget* pWidget) = 0; - virtual int32_t GetCurYear(IFWL_Widget* pWidget) = 0; -}; - class IFWL_MonthCalendar : public IFWL_Widget { public: + class DataProvider : public IFWL_Widget::DataProvider { + public: + virtual int32_t GetCurDay(IFWL_Widget* pWidget) = 0; + virtual int32_t GetCurMonth(IFWL_Widget* pWidget) = 0; + virtual int32_t GetCurYear(IFWL_Widget* pWidget) = 0; + }; + IFWL_MonthCalendar(const IFWL_App* app, std::unique_ptr<CFWL_WidgetProperties> properties, IFWL_Widget* pOuter); diff --git a/xfa/fwl/core/ifwl_picturebox.h b/xfa/fwl/core/ifwl_picturebox.h index 52ea6ff6b2..5036cf9eef 100644 --- a/xfa/fwl/core/ifwl_picturebox.h +++ b/xfa/fwl/core/ifwl_picturebox.h @@ -8,7 +8,6 @@ #define XFA_FWL_CORE_IFWL_PICTUREBOX_H_ #include "xfa/fwl/core/cfwl_widgetproperties.h" -#include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_widget.h" #define FWL_STYLEEXT_PTB_Left 0L << 0 @@ -29,8 +28,6 @@ class CFX_DIBitmap; class IFWL_Widget; -class IFWL_PictureBoxDP : public IFWL_DataProvider {}; - class IFWL_PictureBox : public IFWL_Widget { public: explicit IFWL_PictureBox(const IFWL_App* app, diff --git a/xfa/fwl/core/ifwl_pushbutton.cpp b/xfa/fwl/core/ifwl_pushbutton.cpp index 63169fe97e..23f141b1dc 100644 --- a/xfa/fwl/core/ifwl_pushbutton.cpp +++ b/xfa/fwl/core/ifwl_pushbutton.cpp @@ -46,10 +46,8 @@ void IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); CFX_WideString wsCaption; - IFWL_PushButtonDP* pData = - static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider); - if (pData) - pData->GetCaption(this, wsCaption); + if (m_pProperties->m_pDataProvider) + m_pProperties->m_pDataProvider->GetCaption(this, wsCaption); int32_t iLen = wsCaption.GetLength(); if (iLen > 0) { @@ -92,8 +90,6 @@ void IFWL_PushButton::DrawWidget(CFX_Graphics* pGraphics, if (!m_pProperties->m_pThemeProvider) return; - IFWL_PushButtonDP* pData = - static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider); IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, @@ -108,8 +104,8 @@ void IFWL_PushButton::DrawWidget(CFX_Graphics* pGraphics, matrix.Concat(*pMatrix); CFX_WideString wsCaption; - if (pData) - pData->GetCaption(this, wsCaption); + if (m_pProperties->m_pDataProvider) + m_pProperties->m_pDataProvider->GetCaption(this, wsCaption); CFX_RectF rtText; rtText.Set(0, 0, 0, 0); diff --git a/xfa/fwl/core/ifwl_pushbutton.h b/xfa/fwl/core/ifwl_pushbutton.h index 0c63592f11..8651aa019d 100644 --- a/xfa/fwl/core/ifwl_pushbutton.h +++ b/xfa/fwl/core/ifwl_pushbutton.h @@ -8,7 +8,6 @@ #define XFA_FWL_CORE_IFWL_PUSHBUTTON_H_ #include "xfa/fwl/core/cfwl_widgetproperties.h" -#include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_widget.h" #define FWL_STYLEEXT_PSB_Left (0L << 0) @@ -31,8 +30,6 @@ class CFWL_MsgMouse; class CFX_DIBitmap; class IFWL_Widget; -class IFWL_PushButtonDP : public IFWL_DataProvider {}; - class IFWL_PushButton : public IFWL_Widget { public: IFWL_PushButton(const IFWL_App* app, diff --git a/xfa/fwl/core/ifwl_scrollbar.cpp b/xfa/fwl/core/ifwl_scrollbar.cpp index 78360d005d..54b3f217da 100644 --- a/xfa/fwl/core/ifwl_scrollbar.cpp +++ b/xfa/fwl/core/ifwl_scrollbar.cpp @@ -14,6 +14,7 @@ #include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_scrollbar.h" #include "xfa/fwl/core/ifwl_themeprovider.h" +#include "xfa/fwl/core/ifwl_timerinfo.h" #define FWL_SCROLLBAR_Elapse 500 #define FWL_SCROLLBAR_MinThumb 5 diff --git a/xfa/fwl/core/ifwl_scrollbar.h b/xfa/fwl/core/ifwl_scrollbar.h index 19e5c88d96..ac19a30fed 100644 --- a/xfa/fwl/core/ifwl_scrollbar.h +++ b/xfa/fwl/core/ifwl_scrollbar.h @@ -10,7 +10,6 @@ #include "core/fxcrt/fx_system.h" #include "xfa/fwl/core/cfwl_evtscroll.h" #include "xfa/fwl/core/cfwl_widgetproperties.h" -#include "xfa/fwl/core/ifwl_dataprovider.h" #include "xfa/fwl/core/ifwl_timer.h" #include "xfa/fwl/core/ifwl_widget.h" @@ -19,8 +18,6 @@ class IFWL_Widget; #define FWL_STYLEEXT_SCB_Horz (0L << 0) #define FWL_STYLEEXT_SCB_Vert (1L << 0) -class IFWL_ScrollBarDP : public IFWL_DataProvider {}; - class IFWL_ScrollBar : public IFWL_Widget { public: IFWL_ScrollBar(const IFWL_App* app, diff --git a/xfa/fwl/core/ifwl_spinbutton.cpp b/xfa/fwl/core/ifwl_spinbutton.cpp index 7ca3ce9135..a12c7bbeae 100644 --- a/xfa/fwl/core/ifwl_spinbutton.cpp +++ b/xfa/fwl/core/ifwl_spinbutton.cpp @@ -16,7 +16,7 @@ #include "xfa/fwl/core/ifwl_spinbutton.h" #include "xfa/fwl/core/ifwl_themeprovider.h" #include "xfa/fwl/core/ifwl_themeprovider.h" -#include "xfa/fwl/core/ifwl_timer.h" +#include "xfa/fwl/core/ifwl_timerinfo.h" namespace { diff --git a/xfa/fwl/core/ifwl_timer.cpp b/xfa/fwl/core/ifwl_timer.cpp index c6f431c3be..e2436dcc34 100644 --- a/xfa/fwl/core/ifwl_timer.cpp +++ b/xfa/fwl/core/ifwl_timer.cpp @@ -4,9 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "xfa/fwl/core/ifwl_timer.h" + #include "xfa/fwl/core/ifwl_adaptertimermgr.h" #include "xfa/fwl/core/ifwl_app.h" -#include "xfa/fwl/core/ifwl_timer.h" +#include "xfa/fwl/core/ifwl_timerinfo.h" #include "xfa/fwl/core/ifwl_widget.h" #include "xfa/fxfa/xfa_ffapp.h" @@ -27,7 +29,3 @@ IFWL_TimerInfo* IFWL_Timer::StartTimer(uint32_t dwElapse, bool bImmediately) { pAdapterTimerMgr->Start(this, dwElapse, bImmediately, &pTimerInfo); return pTimerInfo; } - -void IFWL_TimerInfo::StopTimer() { - m_pMgr->Stop(this); -} diff --git a/xfa/fwl/core/ifwl_timer.h b/xfa/fwl/core/ifwl_timer.h index 71fe6bf188..848c16a717 100644 --- a/xfa/fwl/core/ifwl_timer.h +++ b/xfa/fwl/core/ifwl_timer.h @@ -9,7 +9,6 @@ #include "core/fxcrt/fx_system.h" -class IFWL_AdapterTimerMgr; class IFWL_TimerInfo; class IFWL_Widget; @@ -25,17 +24,4 @@ class IFWL_Timer { IFWL_Widget* m_pWidget; // Not owned. }; -class IFWL_TimerInfo { - public: - explicit IFWL_TimerInfo(IFWL_AdapterTimerMgr* mgr) : m_pMgr(mgr) { - ASSERT(mgr); - } - virtual ~IFWL_TimerInfo() {} - - void StopTimer(); - - private: - IFWL_AdapterTimerMgr* m_pMgr; // Not owned. -}; - #endif // XFA_FWL_CORE_IFWL_TIMER_H_ diff --git a/xfa/fwl/core/ifwl_timerinfo.cpp b/xfa/fwl/core/ifwl_timerinfo.cpp new file mode 100644 index 0000000000..a130eea453 --- /dev/null +++ b/xfa/fwl/core/ifwl_timerinfo.cpp @@ -0,0 +1,13 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "xfa/fwl/core/ifwl_timerinfo.h" + +#include "xfa/fwl/core/ifwl_adaptertimermgr.h" + +void IFWL_TimerInfo::StopTimer() { + m_pMgr->Stop(this); +} diff --git a/xfa/fwl/core/ifwl_timerinfo.h b/xfa/fwl/core/ifwl_timerinfo.h new file mode 100644 index 0000000000..9a18ddd567 --- /dev/null +++ b/xfa/fwl/core/ifwl_timerinfo.h @@ -0,0 +1,27 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_FWL_CORE_IFWL_TIMERINFO_H_ +#define XFA_FWL_CORE_IFWL_TIMERINFO_H_ + +#include "core/fxcrt/fx_system.h" + +class IFWL_AdapterTimerMgr; + +class IFWL_TimerInfo { + public: + explicit IFWL_TimerInfo(IFWL_AdapterTimerMgr* mgr) : m_pMgr(mgr) { + ASSERT(mgr); + } + virtual ~IFWL_TimerInfo() {} + + void StopTimer(); + + private: + IFWL_AdapterTimerMgr* m_pMgr; // Not owned. +}; + +#endif // XFA_FWL_CORE_IFWL_TIMERINFO_H_ diff --git a/xfa/fwl/core/ifwl_tooltip.cpp b/xfa/fwl/core/ifwl_tooltip.cpp index 034ac56e05..82b0fd723b 100644 --- a/xfa/fwl/core/ifwl_tooltip.cpp +++ b/xfa/fwl/core/ifwl_tooltip.cpp @@ -13,6 +13,7 @@ #include "xfa/fwl/core/cfwl_themetext.h" #include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" +#include "xfa/fwl/core/ifwl_timerinfo.h" #include "xfa/fwl/core/ifwl_tooltip.h" #include "xfa/fwl/theme/cfwl_widgettp.h" diff --git a/xfa/fwl/core/ifwl_widget.cpp b/xfa/fwl/core/ifwl_widget.cpp index 8bb148247e..01f9a4d5d4 100644 --- a/xfa/fwl/core/ifwl_widget.cpp +++ b/xfa/fwl/core/ifwl_widget.cpp @@ -118,12 +118,23 @@ void IFWL_Widget::SetParent(IFWL_Widget* pParent) { m_pWidgetMgr->SetParent(pParent, this); } +uint32_t IFWL_Widget::GetStyles() const { + return m_pProperties->m_dwStyles; +} + void IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved) { m_pProperties->m_dwStyles = (m_pProperties->m_dwStyles & ~dwStylesRemoved) | dwStylesAdded; } +uint32_t IFWL_Widget::GetStylesEx() const { + return m_pProperties->m_dwStyleExes; +} +uint32_t IFWL_Widget::GetStates() const { + return m_pProperties->m_dwStates; +} + void IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved) { m_pProperties->m_dwStyleExes = @@ -272,6 +283,14 @@ void IFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) { parents.RemoveAll(); } +IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() const { + return m_pProperties->m_pThemeProvider; +} + +IFWL_Widget::DataProvider* IFWL_Widget::GetDataProvider() const { + return m_pProperties->m_pDataProvider; +} + void IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) {} @@ -279,6 +298,43 @@ void IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pProperties->m_pThemeProvider = pThemeProvider; } +bool IFWL_Widget::IsEnabled() const { + return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; +} + +bool IFWL_Widget::IsActive() const { + return (m_pProperties->m_dwStates & FWL_WGTSTATE_Deactivated) == 0; +} + +bool IFWL_Widget::HasBorder() const { + return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border); +} + +bool IFWL_Widget::HasEdge() const { + return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_EdgeMask); +} + +bool IFWL_Widget::IsVisible() const { + return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0; +} + +bool IFWL_Widget::IsOverLapper() const { + return (m_pProperties->m_dwStyles & FWL_WGTSTYLE_WindowTypeMask) == + FWL_WGTSTYLE_OverLapper; +} + +bool IFWL_Widget::IsPopup() const { + return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Popup); +} + +bool IFWL_Widget::IsChild() const { + return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child); +} + +bool IFWL_Widget::IsOffscreen() const { + return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen); +} + void IFWL_Widget::GetEdgeRect(CFX_RectF& rtEdge) { rtEdge = m_pProperties->m_rtWidget; rtEdge.left = rtEdge.top = 0; diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h index 221c29d51a..ebd430356b 100644 --- a/xfa/fwl/core/ifwl_widget.h +++ b/xfa/fwl/core/ifwl_widget.h @@ -14,7 +14,6 @@ #include "xfa/fwl/core/cfwl_event.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" -#include "xfa/fwl/core/cfwl_widgetproperties.h" #include "xfa/fwl/core/fwl_widgethit.h" #include "xfa/fwl/core/ifwl_widgetdelegate.h" #include "xfa/fwl/theme/cfwl_widgettp.h" @@ -59,13 +58,18 @@ class CFWL_Widget; class CFWL_WidgetProperties; class CFWL_WidgetMgr; class IFWL_App; -class IFWL_DataProvider; class IFWL_ThemeProvider; class IFWL_Widget; enum class FWL_Type; class IFWL_Widget : public IFWL_WidgetDelegate { public: + class DataProvider { + public: + virtual void GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) = 0; + }; + ~IFWL_Widget() override; virtual FWL_Type GetClassID() const = 0; @@ -94,10 +98,10 @@ class IFWL_Widget : public IFWL_WidgetDelegate { IFWL_Widget* GetOwner() { return m_pWidgetMgr->GetOwnerWidget(this); } IFWL_Widget* GetOuter() const { return m_pOuter; } - uint32_t GetStyles() const { return m_pProperties->m_dwStyles; } + uint32_t GetStyles() const; void ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); - uint32_t GetStylesEx() const { return m_pProperties->m_dwStyleExes; } - uint32_t GetStates() const { return m_pProperties->m_dwStates; } + uint32_t GetStylesEx() const; + uint32_t GetStates() const; void LockUpdate() { m_iLock++; } void UnlockUpdate() { @@ -107,13 +111,8 @@ class IFWL_Widget : public IFWL_WidgetDelegate { void TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); void GetMatrix(CFX_Matrix& matrix, bool bGlobal = false); - IFWL_ThemeProvider* GetThemeProvider() const { - return m_pProperties->m_pThemeProvider; - } - - IFWL_DataProvider* GetDataProvider() const { - return m_pProperties->m_pDataProvider; - } + IFWL_ThemeProvider* GetThemeProvider() const; + IFWL_Widget::DataProvider* GetDataProvider() const; void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; } IFWL_WidgetDelegate* GetDelegate() { @@ -142,19 +141,11 @@ class IFWL_Widget : public IFWL_WidgetDelegate { std::unique_ptr<CFWL_WidgetProperties> properties, IFWL_Widget* pOuter); - bool IsEnabled() const { - return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; - } - bool IsActive() const { - return (m_pProperties->m_dwStates & FWL_WGTSTATE_Deactivated) == 0; - } + bool IsEnabled() const; + bool IsActive() const; bool IsLocked() const { return m_iLock > 0; } - bool HasBorder() const { - return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border); - } - bool HasEdge() const { - return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_EdgeMask); - } + bool HasBorder() const; + bool HasEdge() const; void GetEdgeRect(CFX_RectF& rtEdge); FX_FLOAT GetBorderSize(bool bCX = true); FX_FLOAT GetEdgeWidth(); @@ -199,22 +190,11 @@ class IFWL_Widget : public IFWL_WidgetDelegate { IFWL_Widget* GetParent() { return m_pWidgetMgr->GetParentWidget(this); } CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); - bool IsVisible() const { - return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0; - } - bool IsOverLapper() const { - return (m_pProperties->m_dwStyles & FWL_WGTSTYLE_WindowTypeMask) == - FWL_WGTSTYLE_OverLapper; - } - bool IsPopup() const { - return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Popup); - } - bool IsChild() const { - return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child); - } - bool IsOffscreen() const { - return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen); - } + bool IsVisible() const; + bool IsOverLapper() const; + bool IsPopup() const; + bool IsChild() const; + bool IsOffscreen() const; IFWL_Widget* GetRootOuter(); bool GetPopupPosMenu(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index f44ea56606..c9287b5eca 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -11,7 +11,9 @@ #include "xfa/fwl/core/cfwl_listbox.h" #include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_app.h" +#include "xfa/fwl/core/ifwl_combobox.h" #include "xfa/fwl/core/ifwl_edit.h" +#include "xfa/fwl/core/ifwl_listbox.h" #include "xfa/fxfa/app/xfa_fffield.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/cxfa_eventparam.h" |