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 explicit CFWL_ListBox(const IFWL_App* pApp); |
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) const override; | 29 int32_t CountItems(const IFWL_Widget* pWidget) const override; |
30 CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, | 30 CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, |
31 int32_t nIndex) const override; | 31 int32_t nIndex) const override; |
32 int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; | 32 int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; |
33 bool SetItemIndex(IFWL_Widget* pWidget, | |
34 CFWL_ListItem* pItem, | |
35 int32_t nIndex) override; | |
36 uint32_t GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; | 33 uint32_t GetItemStyles(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; |
37 void GetItemText(IFWL_Widget* pWidget, | 34 void GetItemText(IFWL_Widget* pWidget, |
38 CFWL_ListItem* pItem, | 35 CFWL_ListItem* pItem, |
39 CFX_WideString& wsText) override; | 36 CFX_WideString& wsText) override; |
40 void GetItemRect(IFWL_Widget* pWidget, | 37 void GetItemRect(IFWL_Widget* pWidget, |
41 CFWL_ListItem* pItem, | 38 CFWL_ListItem* pItem, |
42 CFX_RectF& rtItem) override; | 39 CFX_RectF& rtItem) override; |
43 void* GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; | 40 void* GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; |
44 void SetItemStyles(IFWL_Widget* pWidget, | 41 void SetItemStyles(IFWL_Widget* pWidget, |
45 CFWL_ListItem* pItem, | 42 CFWL_ListItem* pItem, |
46 uint32_t dwStyle) override; | 43 uint32_t dwStyle) override; |
47 void SetItemText(IFWL_Widget* pWidget, | |
48 CFWL_ListItem* pItem, | |
49 const FX_WCHAR* pszText) override; | |
50 void SetItemRect(IFWL_Widget* pWidget, | 44 void SetItemRect(IFWL_Widget* pWidget, |
51 CFWL_ListItem* pItem, | 45 CFWL_ListItem* pItem, |
52 const CFX_RectF& rtItem) override; | 46 const CFX_RectF& rtItem) override; |
53 FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override; | |
54 CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, | 47 CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, |
55 CFWL_ListItem* pItem) override; | 48 CFWL_ListItem* pItem) override; |
56 void GetItemCheckRect(IFWL_Widget* pWidget, | 49 void GetItemCheckRect(IFWL_Widget* pWidget, |
57 CFWL_ListItem* pItem, | 50 CFWL_ListItem* pItem, |
58 CFX_RectF& rtCheck) override; | 51 CFX_RectF& rtCheck) override; |
59 void SetItemCheckRect(IFWL_Widget* pWidget, | 52 void SetItemCheckRect(IFWL_Widget* pWidget, |
60 CFWL_ListItem* pItem, | 53 CFWL_ListItem* pItem, |
61 const CFX_RectF& rtCheck) override; | 54 const CFX_RectF& rtCheck) override; |
62 uint32_t GetItemCheckState(IFWL_Widget* pWidget, | 55 uint32_t GetItemCheckState(IFWL_Widget* pWidget, |
63 CFWL_ListItem* pItem) override; | 56 CFWL_ListItem* pItem) override; |
64 void SetItemCheckState(IFWL_Widget* pWidget, | 57 void SetItemCheckState(IFWL_Widget* pWidget, |
65 CFWL_ListItem* pItem, | 58 CFWL_ListItem* pItem, |
66 uint32_t dwCheckState) override; | 59 uint32_t dwCheckState) override; |
67 | 60 |
68 CFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, bool bSelect = false); | 61 CFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, bool bSelect = false); |
69 bool DeleteString(CFWL_ListItem* pItem); | 62 bool DeleteString(CFWL_ListItem* pItem); |
70 void DeleteAll(); | 63 void DeleteAll(); |
71 | 64 |
72 int32_t CountSelItems(); | 65 int32_t CountSelItems(); |
73 | |
74 void SetSelItem(CFWL_ListItem* pItem, bool bSelect = true); | 66 void SetSelItem(CFWL_ListItem* pItem, bool bSelect = true); |
75 CFWL_ListItem* GetSelItem(int32_t nIndexSel); | 67 CFWL_ListItem* GetSelItem(int32_t nIndexSel); |
76 int32_t GetSelIndex(int32_t nIndex); | 68 int32_t GetSelIndex(int32_t nIndex); |
77 | 69 |
78 void GetScrollPos(FX_FLOAT& fPos, bool bVert = true); | |
79 | |
80 CFWL_ListItem* GetItem(int32_t nIndex); | 70 CFWL_ListItem* GetItem(int32_t nIndex); |
81 void GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText); | 71 void GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText); |
82 uint32_t GetItemStates(CFWL_ListItem* pItem); | 72 uint32_t GetItemStates(CFWL_ListItem* pItem); |
83 | 73 |
84 private: | 74 private: |
85 int32_t CountItems() const; | |
86 | |
87 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; | 75 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; |
88 }; | 76 }; |
89 | 77 |
90 #endif // XFA_FWL_CORE_CFWL_LISTBOX_H_ | 78 #endif // XFA_FWL_CORE_CFWL_LISTBOX_H_ |
OLD | NEW |