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) override; |
70 CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override; | 28 CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override; |
71 int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; | 29 int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; |
72 bool SetItemIndex(IFWL_Widget* pWidget, | 30 bool SetItemIndex(IFWL_Widget* pWidget, |
73 CFWL_ListItem* pItem, | 31 CFWL_ListItem* pItem, |
74 int32_t nIndex) override; | 32 int32_t nIndex) override; |
(...skipping 26 matching lines...) Expand all Loading... | |
101 const CFX_RectF& rtCheck) override; | 59 const CFX_RectF& rtCheck) override; |
102 uint32_t GetItemCheckState(IFWL_Widget* pWidget, | 60 uint32_t GetItemCheckState(IFWL_Widget* pWidget, |
103 CFWL_ListItem* pItem) override; | 61 CFWL_ListItem* pItem) override; |
104 void SetItemCheckState(IFWL_Widget* pWidget, | 62 void SetItemCheckState(IFWL_Widget* pWidget, |
105 CFWL_ListItem* pItem, | 63 CFWL_ListItem* pItem, |
106 uint32_t dwCheckState) override; | 64 uint32_t dwCheckState) override; |
107 | 65 |
108 // IFWL_ComboBoxDP | 66 // IFWL_ComboBoxDP |
109 FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override; | 67 FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override; |
110 | 68 |
69 int32_t AddString(const CFX_WideStringC& wsText); | |
70 | |
71 bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range. | |
72 void RemoveAll(); | |
73 | |
74 void GetTextByIndex(int32_t iIndex, CFX_WideString& wsText); | |
Tom Sepez
2016/11/10 21:56:00
nit: const method?
dsinclair
2016/11/12 01:54:17
Done.
| |
75 int32_t GetCurSel(); | |
Tom Sepez
2016/11/10 21:56:00
nitto
dsinclair
2016/11/12 01:54:17
Done.
| |
76 void SetCurSel(int32_t iSel); | |
77 | |
78 void SetEditText(const CFX_WideString& wsText); | |
79 void GetEditText(CFX_WideString& wsText, | |
80 int32_t nStart = 0, | |
81 int32_t nCount = -1) const; | |
82 | |
83 void OpenDropDownList(bool bActivate); | |
84 | |
85 bool EditCanUndo(); | |
86 bool EditCanRedo(); | |
87 bool EditUndo(); | |
88 bool EditRedo(); | |
89 bool EditCanCopy(); | |
90 bool EditCanCut(); | |
91 bool EditCanSelectAll(); | |
92 bool EditCopy(CFX_WideString& wsCopy); | |
93 bool EditCut(CFX_WideString& wsCut); | |
94 bool EditPaste(const CFX_WideString& wsPaste); | |
95 bool EditSelectAll(); | |
96 bool EditDelete(); | |
97 bool EditDeSelect(); | |
98 | |
99 void GetBBox(CFX_RectF& rect); | |
100 void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); | |
101 | |
111 private: | 102 private: |
112 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; | 103 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; |
113 FX_FLOAT m_fMaxListHeight; | 104 FX_FLOAT m_fMaxListHeight; |
114 FX_FLOAT m_fItemHeight; | 105 FX_FLOAT m_fItemHeight; |
115 }; | 106 }; |
116 | 107 |
117 #endif // XFA_FWL_CORE_CFWL_COMBOBOX_H_ | 108 #endif // XFA_FWL_CORE_CFWL_COMBOBOX_H_ |
OLD | NEW |