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_LIGHTWIDGET_CFWL_LISTBOX_H_ | 7 #ifndef XFA_FWL_LIGHTWIDGET_CFWL_LISTBOX_H_ |
8 #define XFA_FWL_LIGHTWIDGET_CFWL_LISTBOX_H_ | 8 #define XFA_FWL_LIGHTWIDGET_CFWL_LISTBOX_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "xfa/fwl/basewidget/ifwl_listbox.h" | 13 #include "xfa/fwl/basewidget/ifwl_listbox.h" |
14 #include "xfa/fwl/core/fwl_error.h" | 14 #include "xfa/fwl/core/fwl_error.h" |
15 #include "xfa/fwl/core/ifwl_widget.h" | 15 #include "xfa/fwl/core/ifwl_widget.h" |
16 #include "xfa/fwl/lightwidget/cfwl_widget.h" | 16 #include "xfa/fwl/lightwidget/cfwl_widget.h" |
17 | 17 |
18 class CFWL_ListItem; | 18 class CFWL_ListItem; |
19 | 19 |
20 class CFWL_ListBox : public CFWL_Widget { | 20 class CFWL_ListBox : public CFWL_Widget { |
21 public: | 21 public: |
| 22 CFWL_ListBox(); |
| 23 ~CFWL_ListBox() override; |
| 24 |
22 static CFWL_ListBox* Create(); | 25 static CFWL_ListBox* Create(); |
23 FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); | 26 FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); |
24 FWL_Error AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem); | 27 FWL_Error AddDIBitmap(CFX_DIBitmap* pDIB, IFWL_ListItem* pItem); |
25 IFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, | 28 IFWL_ListItem* AddString(const CFX_WideStringC& wsAdd, |
26 FX_BOOL bSelect = FALSE); | 29 FX_BOOL bSelect = FALSE); |
27 FX_BOOL DeleteString(IFWL_ListItem* pItem); | 30 FX_BOOL DeleteString(IFWL_ListItem* pItem); |
28 void DeleteAll(); | 31 void DeleteAll(); |
29 int32_t CountSelItems(); | 32 int32_t CountSelItems(); |
30 IFWL_ListItem* GetSelItem(int32_t nIndexSel); | 33 IFWL_ListItem* GetSelItem(int32_t nIndexSel); |
31 int32_t GetSelIndex(int32_t nIndex); | 34 int32_t GetSelIndex(int32_t nIndex); |
32 FWL_Error SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect = TRUE); | 35 FWL_Error SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect = TRUE); |
33 FWL_Error GetItemText(IFWL_ListItem* pItem, CFX_WideString& wsText); | 36 FWL_Error GetItemText(IFWL_ListItem* pItem, CFX_WideString& wsText); |
34 FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); | 37 FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); |
35 FWL_Error SetItemHeight(FX_FLOAT fItemHeight); | 38 FWL_Error SetItemHeight(FX_FLOAT fItemHeight); |
36 IFWL_ListItem* GetFocusItem(); | 39 IFWL_ListItem* GetFocusItem(); |
37 FWL_Error SetFocusItem(IFWL_ListItem* pItem); | 40 FWL_Error SetFocusItem(IFWL_ListItem* pItem); |
38 int32_t CountItems(); | 41 int32_t CountItems(); |
39 IFWL_ListItem* GetItem(int32_t nIndex); | 42 IFWL_ListItem* GetItem(int32_t nIndex); |
40 FWL_Error SetItemString(IFWL_ListItem* pItem, const CFX_WideStringC& wsText); | 43 FWL_Error SetItemString(IFWL_ListItem* pItem, const CFX_WideStringC& wsText); |
41 FWL_Error GetItemString(IFWL_ListItem* pItem, CFX_WideString& wsText); | 44 FWL_Error GetItemString(IFWL_ListItem* pItem, CFX_WideString& wsText); |
42 FWL_Error SetItemData(IFWL_ListItem* pItem, void* pData); | 45 FWL_Error SetItemData(IFWL_ListItem* pItem, void* pData); |
43 void* GetItemData(IFWL_ListItem* pItem); | 46 void* GetItemData(IFWL_ListItem* pItem); |
44 IFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); | 47 IFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); |
45 uint32_t GetItemStates(IFWL_ListItem* pItem); | 48 uint32_t GetItemStates(IFWL_ListItem* pItem); |
46 CFWL_ListBox(); | |
47 virtual ~CFWL_ListBox(); | |
48 | 49 |
49 protected: | 50 protected: |
50 class CFWL_ListBoxDP : public IFWL_ListBoxDP { | 51 class CFWL_ListBoxDP : public IFWL_ListBoxDP { |
51 public: | 52 public: |
52 CFWL_ListBoxDP(); | 53 CFWL_ListBoxDP(); |
53 ~CFWL_ListBoxDP(); | 54 ~CFWL_ListBoxDP() override; |
54 | 55 |
55 // IFWL_DataProvider: | 56 // IFWL_DataProvider: |
56 FWL_Error GetCaption(IFWL_Widget* pWidget, | 57 FWL_Error GetCaption(IFWL_Widget* pWidget, |
57 CFX_WideString& wsCaption) override; | 58 CFX_WideString& wsCaption) override; |
58 | 59 |
59 // IFWL_ListBoxDP: | 60 // IFWL_ListBoxDP: |
60 int32_t CountItems(IFWL_Widget* pWidget) override; | 61 int32_t CountItems(IFWL_Widget* pWidget) override; |
61 IFWL_ListItem* GetItem(IFWL_Widget* pWidget, int32_t nIndex) override; | 62 IFWL_ListItem* GetItem(IFWL_Widget* pWidget, int32_t nIndex) override; |
62 int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; | 63 int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override; |
63 FX_BOOL SetItemIndex(IFWL_Widget* pWidget, | 64 FX_BOOL SetItemIndex(IFWL_Widget* pWidget, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; | 99 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; |
99 CFX_WideString m_wsData; | 100 CFX_WideString m_wsData; |
100 FX_FLOAT m_fItemHeight; | 101 FX_FLOAT m_fItemHeight; |
101 }; | 102 }; |
102 | 103 |
103 CFWL_ListBoxDP m_ListBoxDP; | 104 CFWL_ListBoxDP m_ListBoxDP; |
104 }; | 105 }; |
105 | 106 |
106 class CFWL_ListItem : public IFWL_ListItem { | 107 class CFWL_ListItem : public IFWL_ListItem { |
107 public: | 108 public: |
108 CFWL_ListItem() { | 109 CFWL_ListItem(); |
109 m_rtItem.Reset(); | 110 ~CFWL_ListItem(); |
110 m_dwStates = 0; | 111 |
111 m_wsText = L""; | |
112 m_pDIB = NULL; | |
113 m_pData = NULL; | |
114 m_dwCheckState = 0; | |
115 m_rtCheckBox.Reset(); | |
116 } | |
117 CFX_RectF m_rtItem; | 112 CFX_RectF m_rtItem; |
118 uint32_t m_dwStates; | 113 uint32_t m_dwStates; |
119 CFX_WideString m_wsText; | 114 CFX_WideString m_wsText; |
120 CFX_DIBitmap* m_pDIB; | 115 CFX_DIBitmap* m_pDIB; |
121 void* m_pData; | 116 void* m_pData; |
122 uint32_t m_dwCheckState; | 117 uint32_t m_dwCheckState; |
123 CFX_RectF m_rtCheckBox; | 118 CFX_RectF m_rtCheckBox; |
124 }; | 119 }; |
125 | 120 |
126 #endif // XFA_FWL_LIGHTWIDGET_CFWL_LISTBOX_H_ | 121 #endif // XFA_FWL_LIGHTWIDGET_CFWL_LISTBOX_H_ |
OLD | NEW |