| 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 #ifndef XFA_FWL_CORE_CFWL_COMBOBOX_H_ | 7 #ifndef XFA_FWL_CORE_CFWL_COMBOBOX_H_ |
| 8 #define XFA_FWL_CORE_CFWL_COMBOBOX_H_ | 8 #define XFA_FWL_CORE_CFWL_COMBOBOX_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "xfa/fwl/core/cfwl_widget.h" | 13 #include "xfa/fwl/core/cfwl_widget.h" |
| 14 #include "xfa/fwl/core/ifwl_combobox.h" | 14 #include "xfa/fwl/core/ifwl_combobox.h" |
| 15 | 15 |
| 16 class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { | 16 class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { |
| 17 public: | 17 public: |
| 18 CFWL_ComboBox(const IFWL_App*); | 18 CFWL_ComboBox(const IFWL_App*); |
| 19 ~CFWL_ComboBox() override; | 19 ~CFWL_ComboBox() override; |
| 20 | 20 |
| 21 void Initialize(); | 21 void Initialize(); |
| 22 | 22 |
| 23 int32_t AddString(const CFX_WideStringC& wsText); | |
| 24 int32_t AddString(const CFX_WideStringC& wsText, CFX_DIBitmap* pIcon); | |
| 25 bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range. | |
| 26 void RemoveAll(); | |
| 27 int32_t CountItems(); | |
| 28 FWL_Error GetTextByIndex(int32_t iIndex, CFX_WideString& wsText); | |
| 29 int32_t GetCurSel(); | |
| 30 FWL_Error SetCurSel(int32_t iSel); | |
| 31 void SetEditText(const CFX_WideString& wsText); | |
| 32 int32_t GetEditTextLength() const; | |
| 33 FWL_Error GetEditText(CFX_WideString& wsText, | |
| 34 int32_t nStart = 0, | |
| 35 int32_t nCount = -1) const; | |
| 36 FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); | |
| 37 int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); | |
| 38 int32_t GetEditLimit(); | |
| 39 FWL_Error SetEditLimit(int32_t nLimit); | |
| 40 bool EditRedo(const IFDE_TxtEdtDoRecord* pRecord); | |
| 41 bool EditUndo(const IFDE_TxtEdtDoRecord* pRecord); | |
| 42 FWL_Error SetMaxListHeight(FX_FLOAT fMaxHeight); | |
| 43 FWL_Error SetItemData(int32_t iIndex, void* pData); | |
| 44 void* GetItemData(int32_t iIndex); | |
| 45 void SetListTheme(IFWL_ThemeProvider* pTheme); | |
| 46 bool AfterFocusShowDropList(); | |
| 47 FWL_Error OpenDropDownList(bool bActivate); | |
| 48 | |
| 49 bool EditCanUndo(); | |
| 50 bool EditCanRedo(); | |
| 51 bool EditUndo(); | |
| 52 bool EditRedo(); | |
| 53 bool EditCanCopy(); | |
| 54 bool EditCanCut(); | |
| 55 bool EditCanSelectAll(); | |
| 56 bool EditCopy(CFX_WideString& wsCopy); | |
| 57 bool EditCut(CFX_WideString& wsCut); | |
| 58 bool EditPaste(const CFX_WideString& wsPaste); | |
| 59 bool EditSelectAll(); | |
| 60 bool EditDelete(); | |
| 61 bool EditDeSelect(); | |
| 62 FWL_Error GetBBox(CFX_RectF& rect); | |
| 63 void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); | |
| 64 | |
| 65 // IFWL_DataProvider | 23 // IFWL_DataProvider |
| 66 void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; | 24 void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; |
| 67 | 25 |
| 68 // IFWL_ListBoxDP | 26 // IFWL_ListBoxDP |
| 69 int32_t CountItems(const IFWL_Widget* pWidget) override; | 27 int32_t CountItems(const IFWL_Widget* pWidget) const override; |
| 70 CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override; | 28 CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, |
| 29 int32_t nIndex) const override; |
| 71 int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; | 30 int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; |
| 72 bool SetItemIndex(IFWL_Widget* pWidget, | 31 bool SetItemIndex(IFWL_Widget* pWidget, |
| 73 CFWL_ListItem* pItem, | 32 CFWL_ListItem* pItem, |
| 74 int32_t nIndex) override; | 33 int32_t nIndex) override; |
| 75 | 34 |
| 76 uint32_t GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; | 35 uint32_t GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; |
| 77 void GetItemText(IFWL_Widget* pWidget, | 36 void GetItemText(IFWL_Widget* pWidget, |
| 78 CFWL_ListItem* pItem, | 37 CFWL_ListItem* pItem, |
| 79 CFX_WideString& wsText) override; | 38 CFX_WideString& wsText) override; |
| 80 void GetItemRect(IFWL_Widget* pWidget, | 39 void GetItemRect(IFWL_Widget* pWidget, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 101 const CFX_RectF& rtCheck) override; | 60 const CFX_RectF& rtCheck) override; |
| 102 uint32_t GetItemCheckState(IFWL_Widget* pWidget, | 61 uint32_t GetItemCheckState(IFWL_Widget* pWidget, |
| 103 CFWL_ListItem* pItem) override; | 62 CFWL_ListItem* pItem) override; |
| 104 void SetItemCheckState(IFWL_Widget* pWidget, | 63 void SetItemCheckState(IFWL_Widget* pWidget, |
| 105 CFWL_ListItem* pItem, | 64 CFWL_ListItem* pItem, |
| 106 uint32_t dwCheckState) override; | 65 uint32_t dwCheckState) override; |
| 107 | 66 |
| 108 // IFWL_ComboBoxDP | 67 // IFWL_ComboBoxDP |
| 109 FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override; | 68 FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override; |
| 110 | 69 |
| 70 int32_t AddString(const CFX_WideStringC& wsText); |
| 71 |
| 72 bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range. |
| 73 void RemoveAll(); |
| 74 |
| 75 void GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) const; |
| 76 int32_t GetCurSel() const; |
| 77 void SetCurSel(int32_t iSel); |
| 78 |
| 79 void SetEditText(const CFX_WideString& wsText); |
| 80 void GetEditText(CFX_WideString& wsText, |
| 81 int32_t nStart = 0, |
| 82 int32_t nCount = -1) const; |
| 83 |
| 84 void OpenDropDownList(bool bActivate); |
| 85 |
| 86 bool EditCanUndo(); |
| 87 bool EditCanRedo(); |
| 88 bool EditUndo(); |
| 89 bool EditRedo(); |
| 90 bool EditCanCopy(); |
| 91 bool EditCanCut(); |
| 92 bool EditCanSelectAll(); |
| 93 bool EditCopy(CFX_WideString& wsCopy); |
| 94 bool EditCut(CFX_WideString& wsCut); |
| 95 bool EditPaste(const CFX_WideString& wsPaste); |
| 96 bool EditSelectAll(); |
| 97 bool EditDelete(); |
| 98 bool EditDeSelect(); |
| 99 |
| 100 void GetBBox(CFX_RectF& rect); |
| 101 void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); |
| 102 |
| 111 private: | 103 private: |
| 112 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; | 104 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; |
| 113 FX_FLOAT m_fMaxListHeight; | 105 FX_FLOAT m_fMaxListHeight; |
| 114 FX_FLOAT m_fItemHeight; | 106 FX_FLOAT m_fItemHeight; |
| 115 }; | 107 }; |
| 116 | 108 |
| 117 #endif // XFA_FWL_CORE_CFWL_COMBOBOX_H_ | 109 #endif // XFA_FWL_CORE_CFWL_COMBOBOX_H_ |
| OLD | NEW |