diff options
author | dsinclair <dsinclair@chromium.org> | 2016-11-07 10:28:47 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-07 10:28:47 -0800 |
commit | eb3f68cc7f25a1e28464eb251161b8f08fcd04bc (patch) | |
tree | 36e565bac1a7760e605b181b7da4c08bda151cdd /xfa/fwl/core/cfwl_combobox.h | |
parent | a97fc7c6392c0adbd702bdf898cb9e20cee00a3e (diff) | |
download | pdfium-eb3f68cc7f25a1e28464eb251161b8f08fcd04bc.tar.xz |
Fold DataProviders into parent classes
This CL removes the data provider classes and folds the code into the parent
classes.
Review-Url: https://codereview.chromium.org/2480233003
Diffstat (limited to 'xfa/fwl/core/cfwl_combobox.h')
-rw-r--r-- | xfa/fwl/core/cfwl_combobox.h | 139 |
1 files changed, 64 insertions, 75 deletions
diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h index c85b0e7bca..cd409ffbc1 100644 --- a/xfa/fwl/core/cfwl_combobox.h +++ b/xfa/fwl/core/cfwl_combobox.h @@ -13,11 +13,21 @@ #include "xfa/fwl/core/cfwl_widget.h" #include "xfa/fwl/core/ifwl_combobox.h" -class IFWL_ComboBoxDP; -class CFWL_ComboBoxDP; -class CFWL_ComboBoxItem; +class CFWL_ComboBoxItem : public IFWL_ListItem { + public: + CFWL_ComboBoxItem(); + ~CFWL_ComboBoxItem(); -class CFWL_ComboBox : public CFWL_Widget { + CFX_RectF m_rtItem; + uint32_t m_dwStyles; + CFX_WideString m_wsText; + CFX_DIBitmap* m_pDIB; + uint32_t m_dwCheckState; + CFX_RectF m_rtCheckBox; + void* m_pData; +}; + +class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { public: CFWL_ComboBox(const IFWL_App*); ~CFWL_ComboBox() override; @@ -68,78 +78,57 @@ class CFWL_ComboBox : public CFWL_Widget { FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); - protected: - class CFWL_ComboBoxDP : public IFWL_ComboBoxDP { - public: - CFWL_ComboBoxDP(); - ~CFWL_ComboBoxDP() override; - - // IFWL_DataProvider - FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; - - // IFWL_ListBoxDP - int32_t CountItems(const IFWL_Widget* pWidget) override; - IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override; - int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; - bool SetItemIndex(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - int32_t nIndex) override; - - uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; - FWL_Error GetItemText(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - CFX_WideString& wsText) override; - FWL_Error GetItemRect(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - CFX_RectF& rtItem) override; - void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; - FWL_Error SetItemStyles(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - uint32_t dwStyle) override; - FWL_Error SetItemText(IFWL_Widget* pWidget, + // IFWL_DataProvider + FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) override; + + // IFWL_ListBoxDP + int32_t CountItems(const IFWL_Widget* pWidget) override; + IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override; + int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; + bool SetItemIndex(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + int32_t nIndex) override; + + uint32_t GetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; + FWL_Error GetItemText(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + CFX_WideString& wsText) override; + FWL_Error GetItemRect(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + CFX_RectF& rtItem) override; + void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; + FWL_Error SetItemStyles(IFWL_Widget* pWidget, IFWL_ListItem* pItem, - const FX_WCHAR* pszText) override; - FWL_Error SetItemRect(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - const CFX_RectF& rtItem) override; - FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override; - CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, - IFWL_ListItem* pItem) override; - FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - CFX_RectF& rtCheck) override; - FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - const CFX_RectF& rtCheck) override; - uint32_t GetItemCheckState(IFWL_Widget* pWidget, - IFWL_ListItem* pItem) override; - FWL_Error SetItemCheckState(IFWL_Widget* pWidget, - IFWL_ListItem* pItem, - uint32_t dwCheckState) override; - - // IFWL_ComboBoxDP - FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override; - - std::vector<std::unique_ptr<CFWL_ComboBoxItem>> m_ItemArray; - FX_FLOAT m_fMaxListHeight; - FX_FLOAT m_fItemHeight; - }; - CFWL_ComboBoxDP m_comboBoxData; -}; - -class CFWL_ComboBoxItem : public IFWL_ListItem { - public: - CFWL_ComboBoxItem(); - ~CFWL_ComboBoxItem(); - - CFX_RectF m_rtItem; - uint32_t m_dwStyles; - CFX_WideString m_wsText; - CFX_DIBitmap* m_pDIB; - uint32_t m_dwCheckState; - CFX_RectF m_rtCheckBox; - void* m_pData; + uint32_t dwStyle) override; + FWL_Error SetItemText(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + const FX_WCHAR* pszText) override; + FWL_Error SetItemRect(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + const CFX_RectF& rtItem) override; + FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override; + CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, + IFWL_ListItem* pItem) override; + FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + CFX_RectF& rtCheck) override; + FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + const CFX_RectF& rtCheck) override; + uint32_t GetItemCheckState(IFWL_Widget* pWidget, + IFWL_ListItem* pItem) override; + FWL_Error SetItemCheckState(IFWL_Widget* pWidget, + IFWL_ListItem* pItem, + uint32_t dwCheckState) override; + + // IFWL_ComboBoxDP + FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override; + + private: + std::vector<std::unique_ptr<CFWL_ComboBoxItem>> m_ItemArray; + FX_FLOAT m_fMaxListHeight; + FX_FLOAT m_fItemHeight; }; #endif // XFA_FWL_CORE_CFWL_COMBOBOX_H_ |