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_LISTBOX_H_ | 7 #ifndef XFA_FWL_CORE_CFWL_LISTBOX_H_ |
8 #define XFA_FWL_CORE_CFWL_LISTBOX_H_ | 8 #define XFA_FWL_CORE_CFWL_LISTBOX_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/fwl_error.h" | 14 #include "xfa/fwl/core/fwl_error.h" |
15 #include "xfa/fwl/core/ifwl_listbox.h" | 15 #include "xfa/fwl/core/ifwl_listbox.h" |
16 #include "xfa/fwl/core/ifwl_widget.h" | 16 #include "xfa/fwl/core/ifwl_widget.h" |
17 | 17 |
18 class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP { | 18 class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP { |
19 public: | 19 public: |
20 CFWL_ListBox(const IFWL_App*); | 20 CFWL_ListBox(const IFWL_App*); |
21 ~CFWL_ListBox() override; | 21 ~CFWL_ListBox() override; |
22 | 22 |
23 void Initialize(); | 23 void Initialize(); |
24 | 24 |
25 // IFWL_DataProvider: | 25 // IFWL_DataProvider: |
26 void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; | 26 void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; |
27 | 27 |
28 // IFWL_ListBoxDP: | 28 // IFWL_ListBoxDP: |
29 int32_t CountItems(const IFWL_Widget* pWidget) override; | 29 int32_t CountItems(const IFWL_Widget* pWidget) const override; |
30 CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override; | 30 CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, |
| 31 int32_t nIndex) const override; |
31 int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; | 32 int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; |
32 bool SetItemIndex(IFWL_Widget* pWidget, | 33 bool SetItemIndex(IFWL_Widget* pWidget, |
33 CFWL_ListItem* pItem, | 34 CFWL_ListItem* pItem, |
34 int32_t nIndex) override; | 35 int32_t nIndex) override; |
35 uint32_t GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; | 36 uint32_t GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; |
36 void GetItemText(IFWL_Widget* pWidget, | 37 void GetItemText(IFWL_Widget* pWidget, |
37 CFWL_ListItem* pItem, | 38 CFWL_ListItem* pItem, |
38 CFX_WideString& wsText) override; | 39 CFX_WideString& wsText) override; |
39 void GetItemRect(IFWL_Widget* pWidget, | 40 void GetItemRect(IFWL_Widget* pWidget, |
40 CFWL_ListItem* pItem, | 41 CFWL_ListItem* pItem, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 CFWL_ListItem* GetSelItem(int32_t nIndexSel); | 75 CFWL_ListItem* GetSelItem(int32_t nIndexSel); |
75 int32_t GetSelIndex(int32_t nIndex); | 76 int32_t GetSelIndex(int32_t nIndex); |
76 | 77 |
77 void GetScrollPos(FX_FLOAT& fPos, bool bVert = true); | 78 void GetScrollPos(FX_FLOAT& fPos, bool bVert = true); |
78 | 79 |
79 CFWL_ListItem* GetItem(int32_t nIndex); | 80 CFWL_ListItem* GetItem(int32_t nIndex); |
80 void GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText); | 81 void GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText); |
81 uint32_t GetItemStates(CFWL_ListItem* pItem); | 82 uint32_t GetItemStates(CFWL_ListItem* pItem); |
82 | 83 |
83 private: | 84 private: |
84 int32_t CountItems(); | 85 int32_t CountItems() const; |
85 | 86 |
86 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; | 87 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; |
87 }; | 88 }; |
88 | 89 |
89 #endif // XFA_FWL_CORE_CFWL_LISTBOX_H_ | 90 #endif // XFA_FWL_CORE_CFWL_LISTBOX_H_ |
OLD | NEW |