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 FWL_Error AddDIBitmap(CFX_DIBitmap* pDIB, CFWL_ListItem* pItem); | |
26 CFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, bool bSelect = false); | |
27 bool DeleteString(CFWL_ListItem* pItem); | |
28 void DeleteAll(); | |
29 int32_t CountSelItems(); | |
30 CFWL_ListItem* GetSelItem(int32_t nIndexSel); | |
31 int32_t GetSelIndex(int32_t nIndex); | |
32 void SetSelItem(CFWL_ListItem* pItem, bool bSelect = true); | |
33 void GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText); | |
34 void GetScrollPos(FX_FLOAT& fPos, bool bVert = true); | |
35 FWL_Error SetItemHeight(FX_FLOAT fItemHeight); | |
36 CFWL_ListItem* GetFocusItem(); | |
37 FWL_Error SetFocusItem(CFWL_ListItem* pItem); | |
38 int32_t CountItems(); | |
39 CFWL_ListItem* GetItem(int32_t nIndex); | |
40 FWL_Error SetItemString(CFWL_ListItem* pItem, const CFX_WideStringC& wsText); | |
41 FWL_Error GetItemString(CFWL_ListItem* pItem, CFX_WideString& wsText); | |
42 FWL_Error SetItemData(CFWL_ListItem* pItem, void* pData); | |
43 void* GetItemData(CFWL_ListItem* pItem); | |
44 CFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); | |
45 uint32_t GetItemStates(CFWL_ListItem* pItem); | |
46 | |
47 // IFWL_DataProvider: | 25 // IFWL_DataProvider: |
48 FWL_Error GetCaption(IFWL_Widget* pWidget, | 26 FWL_Error GetCaption(IFWL_Widget* pWidget, |
49 CFX_WideString& wsCaption) override; | 27 CFX_WideString& wsCaption) override; |
50 | 28 |
51 // IFWL_ListBoxDP: | 29 // IFWL_ListBoxDP: |
52 int32_t CountItems(const IFWL_Widget* pWidget) override; | 30 int32_t CountItems(const IFWL_Widget* pWidget) override; |
53 CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override; | 31 CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override; |
54 int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; | 32 int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override; |
55 bool SetItemIndex(IFWL_Widget* pWidget, | 33 bool SetItemIndex(IFWL_Widget* pWidget, |
56 CFWL_ListItem* pItem, | 34 CFWL_ListItem* pItem, |
(...skipping 23 matching lines...) Expand all Loading... | |
80 CFX_RectF& rtCheck) override; | 58 CFX_RectF& rtCheck) override; |
81 void SetItemCheckRect(IFWL_Widget* pWidget, | 59 void SetItemCheckRect(IFWL_Widget* pWidget, |
82 CFWL_ListItem* pItem, | 60 CFWL_ListItem* pItem, |
83 const CFX_RectF& rtCheck) override; | 61 const CFX_RectF& rtCheck) override; |
84 uint32_t GetItemCheckState(IFWL_Widget* pWidget, | 62 uint32_t GetItemCheckState(IFWL_Widget* pWidget, |
85 CFWL_ListItem* pItem) override; | 63 CFWL_ListItem* pItem) override; |
86 void SetItemCheckState(IFWL_Widget* pWidget, | 64 void SetItemCheckState(IFWL_Widget* pWidget, |
87 CFWL_ListItem* pItem, | 65 CFWL_ListItem* pItem, |
88 uint32_t dwCheckState) override; | 66 uint32_t dwCheckState) override; |
89 | 67 |
68 CFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, bool bSelect = false); | |
npm
2016/11/10 19:12:07
Just curious, why are we moving these methods down
| |
69 bool DeleteString(CFWL_ListItem* pItem); | |
70 void DeleteAll(); | |
71 | |
72 int32_t CountSelItems(); | |
73 | |
74 void SetSelItem(CFWL_ListItem* pItem, bool bSelect = true); | |
75 CFWL_ListItem* GetSelItem(int32_t nIndexSel); | |
76 int32_t GetSelIndex(int32_t nIndex); | |
77 | |
78 void GetScrollPos(FX_FLOAT& fPos, bool bVert = true); | |
79 | |
80 CFWL_ListItem* GetItem(int32_t nIndex); | |
81 void GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText); | |
82 uint32_t GetItemStates(CFWL_ListItem* pItem); | |
83 | |
90 private: | 84 private: |
85 int32_t CountItems(); | |
86 | |
91 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; | 87 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; |
92 CFX_WideString m_wsData; | |
93 FX_FLOAT m_fItemHeight; | |
94 }; | 88 }; |
95 | 89 |
96 #endif // XFA_FWL_CORE_CFWL_LISTBOX_H_ | 90 #endif // XFA_FWL_CORE_CFWL_LISTBOX_H_ |
OLD | NEW |