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_BASEWIDGET_IFWL_LISTBOX_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_ |
8 #define XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_ | 8 #define XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_ |
9 | 9 |
10 #include "xfa/fwl/core/ifwl_widget.h" | 10 #include "xfa/fwl/core/ifwl_widget.h" |
11 #include "xfa/fwl/core/ifwl_dataprovider.h" | 11 #include "xfa/fwl/core/ifwl_dataprovider.h" |
12 #include "xfa/fwl/core/cfwl_event.h" | 12 #include "xfa/fwl/core/cfwl_event.h" |
13 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" | 13 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" |
14 | 14 |
15 #define FWL_CLASS_ListBox L"FWL_LISTBOX" | 15 #define FWL_CLASS_ListBox L"FWL_LISTBOX" |
16 #define FWL_CLASSHASH_ListBox 1777358317 | 16 #define FWL_CLASSHASH_ListBox 1777358317 |
17 #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0) | 17 #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0) |
18 #define FWL_STYLEEXT_LTB_Sort (1L << 1) | |
19 #define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2) | 18 #define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2) |
20 #define FWL_STYLEEXT_LTB_MultiColumn (1L << 3) | 19 #define FWL_STYLEEXT_LTB_MultiColumn (1L << 3) |
21 #define FWL_STYLEEXT_LTB_LeftAlign (0L << 4) | 20 #define FWL_STYLEEXT_LTB_LeftAlign (0L << 4) |
22 #define FWL_STYLEEXT_LTB_CenterAlign (1L << 4) | 21 #define FWL_STYLEEXT_LTB_CenterAlign (1L << 4) |
23 #define FWL_STYLEEXT_LTB_RightAlign (2L << 4) | 22 #define FWL_STYLEEXT_LTB_RightAlign (2L << 4) |
24 #define FWL_STYLEEXT_LTB_MultiLine (1L << 6) | 23 #define FWL_STYLEEXT_LTB_MultiLine (1L << 6) |
25 #define FWL_STYLEEXT_LTB_OwnerDraw (1L << 7) | 24 #define FWL_STYLEEXT_LTB_OwnerDraw (1L << 7) |
26 #define FWL_STYLEEXT_LTB_Icon (1L << 8) | 25 #define FWL_STYLEEXT_LTB_Icon (1L << 8) |
27 #define FWL_STYLEEXT_LTB_Check (1L << 9) | 26 #define FWL_STYLEEXT_LTB_Check (1L << 9) |
28 #define FWL_STYLEEXT_LTB_AlignMask (3L << 4) | 27 #define FWL_STYLEEXT_LTB_AlignMask (3L << 4) |
(...skipping 19 matching lines...) Expand all Loading... |
48 | 47 |
49 class IFWL_ListBoxDP : public IFWL_DataProvider { | 48 class IFWL_ListBoxDP : public IFWL_DataProvider { |
50 public: | 49 public: |
51 virtual int32_t CountItems(IFWL_Widget* pWidget) = 0; | 50 virtual int32_t CountItems(IFWL_Widget* pWidget) = 0; |
52 virtual FWL_HLISTITEM GetItem(IFWL_Widget* pWidget, int32_t nIndex) = 0; | 51 virtual FWL_HLISTITEM GetItem(IFWL_Widget* pWidget, int32_t nIndex) = 0; |
53 virtual int32_t GetItemIndex(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; | 52 virtual int32_t GetItemIndex(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; |
54 virtual FX_BOOL SetItemIndex(IFWL_Widget* pWidget, | 53 virtual FX_BOOL SetItemIndex(IFWL_Widget* pWidget, |
55 FWL_HLISTITEM hItem, | 54 FWL_HLISTITEM hItem, |
56 int32_t nIndex) = 0; | 55 int32_t nIndex) = 0; |
57 virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; | 56 virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; |
58 virtual FWL_ERR GetItemText(IFWL_Widget* pWidget, | 57 virtual FWL_Error GetItemText(IFWL_Widget* pWidget, |
59 FWL_HLISTITEM hItem, | 58 FWL_HLISTITEM hItem, |
60 CFX_WideString& wsText) = 0; | 59 CFX_WideString& wsText) = 0; |
61 virtual FWL_ERR GetItemRect(IFWL_Widget* pWidget, | 60 virtual FWL_Error GetItemRect(IFWL_Widget* pWidget, |
62 FWL_HLISTITEM hItem, | 61 FWL_HLISTITEM hItem, |
63 CFX_RectF& rtItem) = 0; | 62 CFX_RectF& rtItem) = 0; |
64 virtual void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; | 63 virtual void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; |
65 virtual FWL_ERR SetItemStyles(IFWL_Widget* pWidget, | 64 virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget, |
| 65 FWL_HLISTITEM hItem, |
| 66 uint32_t dwStyle) = 0; |
| 67 virtual FWL_Error SetItemText(IFWL_Widget* pWidget, |
66 FWL_HLISTITEM hItem, | 68 FWL_HLISTITEM hItem, |
67 uint32_t dwStyle) = 0; | 69 const FX_WCHAR* pszText) = 0; |
68 virtual FWL_ERR SetItemText(IFWL_Widget* pWidget, | 70 virtual FWL_Error SetItemRect(IFWL_Widget* pWidget, |
69 FWL_HLISTITEM hItem, | 71 FWL_HLISTITEM hItem, |
70 const FX_WCHAR* pszText) = 0; | 72 const CFX_RectF& rtItem) = 0; |
71 virtual FWL_ERR SetItemRect(IFWL_Widget* pWidget, | |
72 FWL_HLISTITEM hItem, | |
73 const CFX_RectF& rtItem) = 0; | |
74 virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0; | 73 virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0; |
75 virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, | 74 virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, |
76 FWL_HLISTITEM hItem) = 0; | 75 FWL_HLISTITEM hItem) = 0; |
77 virtual FWL_ERR GetItemCheckRect(IFWL_Widget* pWidget, | 76 virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, |
78 FWL_HLISTITEM hItem, | 77 FWL_HLISTITEM hItem, |
79 CFX_RectF& rtCheck) = 0; | 78 CFX_RectF& rtCheck) = 0; |
80 virtual FWL_ERR SetItemCheckRect(IFWL_Widget* pWidget, | 79 virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, |
81 FWL_HLISTITEM hItem, | 80 FWL_HLISTITEM hItem, |
82 const CFX_RectF& rtCheck) = 0; | 81 const CFX_RectF& rtCheck) = 0; |
83 virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, | 82 virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, |
84 FWL_HLISTITEM hItem) = 0; | 83 FWL_HLISTITEM hItem) = 0; |
85 virtual FWL_ERR SetItemCheckState(IFWL_Widget* pWidget, | 84 virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget, |
86 FWL_HLISTITEM hItem, | 85 FWL_HLISTITEM hItem, |
87 uint32_t dwCheckState) = 0; | 86 uint32_t dwCheckState) = 0; |
88 }; | 87 }; |
89 | 88 |
90 class IFWL_ListBoxCompare { | 89 class IFWL_ListBoxCompare { |
91 public: | 90 public: |
92 virtual ~IFWL_ListBoxCompare() {} | 91 virtual ~IFWL_ListBoxCompare() {} |
93 virtual int32_t Compare(FWL_HLISTITEM hLeft, FWL_HLISTITEM hRight) = 0; | 92 virtual int32_t Compare(FWL_HLISTITEM hLeft, FWL_HLISTITEM hRight) = 0; |
94 }; | 93 }; |
95 | 94 |
96 class IFWL_ListBox : public IFWL_Widget { | 95 class IFWL_ListBox : public IFWL_Widget { |
97 public: | 96 public: |
98 static IFWL_ListBox* Create(const CFWL_WidgetImpProperties& properties, | 97 static IFWL_ListBox* Create(const CFWL_WidgetImpProperties& properties, |
99 IFWL_Widget* pOuter); | 98 IFWL_Widget* pOuter); |
100 static IFWL_ListBox* CreateComboList( | 99 static IFWL_ListBox* CreateComboList( |
101 const CFWL_WidgetImpProperties& properties, | 100 const CFWL_WidgetImpProperties& properties, |
102 IFWL_Widget* pOuter); | 101 IFWL_Widget* pOuter); |
103 | 102 |
104 int32_t CountSelItems(); | 103 int32_t CountSelItems(); |
105 FWL_HLISTITEM GetSelItem(int32_t nIndexSel); | 104 FWL_HLISTITEM GetSelItem(int32_t nIndexSel); |
106 int32_t GetSelIndex(int32_t nIndex); | 105 int32_t GetSelIndex(int32_t nIndex); |
107 FWL_ERR SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); | 106 FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); |
108 FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); | 107 FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); |
109 FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); | 108 FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); |
110 FWL_ERR* Sort(IFWL_ListBoxCompare* pCom); | |
111 | 109 |
112 protected: | 110 protected: |
113 IFWL_ListBox(); | 111 IFWL_ListBox(); |
114 }; | 112 }; |
115 | 113 |
116 #endif // XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_ | 114 #endif // XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_ |
OLD | NEW |