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_CFWL_LISTBOX_H_ | 7 #ifndef XFA_FWL_CFWL_LISTBOX_H_ |
8 #define XFA_FWL_CFWL_LISTBOX_H_ | 8 #define XFA_FWL_CFWL_LISTBOX_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "xfa/fwl/cfwl_edit.h" | 13 #include "xfa/fwl/cfwl_edit.h" |
14 #include "xfa/fwl/cfwl_event.h" | 14 #include "xfa/fwl/cfwl_event.h" |
15 #include "xfa/fwl/cfwl_listbox.h" | 15 #include "xfa/fwl/cfwl_listbox.h" |
16 #include "xfa/fwl/cfwl_listitem.h" | 16 #include "xfa/fwl/cfwl_listitem.h" |
17 #include "xfa/fwl/cfwl_widget.h" | 17 #include "xfa/fwl/cfwl_widget.h" |
18 #include "xfa/fwl/cfwl_widgetproperties.h" | 18 #include "xfa/fwl/cfwl_widgetproperties.h" |
19 | 19 |
20 #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0) | 20 #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0) |
21 #define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2) | |
22 #define FWL_STYLEEXT_LTB_MultiColumn (1L << 3) | |
23 #define FWL_STYLEEXT_LTB_LeftAlign (0L << 4) | 21 #define FWL_STYLEEXT_LTB_LeftAlign (0L << 4) |
24 #define FWL_STYLEEXT_LTB_CenterAlign (1L << 4) | 22 #define FWL_STYLEEXT_LTB_CenterAlign (1L << 4) |
25 #define FWL_STYLEEXT_LTB_RightAlign (2L << 4) | 23 #define FWL_STYLEEXT_LTB_RightAlign (2L << 4) |
26 #define FWL_STYLEEXT_LTB_MultiLine (1L << 6) | |
27 #define FWL_STYLEEXT_LTB_OwnerDraw (1L << 7) | |
28 #define FWL_STYLEEXT_LTB_Icon (1L << 8) | |
29 #define FWL_STYLEEXT_LTB_Check (1L << 9) | |
30 #define FWL_STYLEEXT_LTB_AlignMask (3L << 4) | 24 #define FWL_STYLEEXT_LTB_AlignMask (3L << 4) |
31 #define FWL_STYLEEXT_LTB_ShowScrollBarFocus (1L << 10) | 25 #define FWL_STYLEEXT_LTB_ShowScrollBarFocus (1L << 10) |
32 #define FWL_ITEMSTATE_LTB_Selected (1L << 0) | 26 #define FWL_ITEMSTATE_LTB_Selected (1L << 0) |
33 #define FWL_ITEMSTATE_LTB_Focused (1L << 1) | 27 #define FWL_ITEMSTATE_LTB_Focused (1L << 1) |
34 #define FWL_ITEMSTATE_LTB_Checked (1L << 2) | |
35 | 28 |
36 class CFWL_MessageKillFocus; | 29 class CFWL_MessageKillFocus; |
37 class CFWL_MessageMouse; | 30 class CFWL_MessageMouse; |
38 class CFWL_MessageMouseWheel; | 31 class CFWL_MessageMouseWheel; |
39 class CFX_DIBitmap; | 32 class CFX_DIBitmap; |
40 | 33 |
41 class CFWL_ListBox : public CFWL_Widget { | 34 class CFWL_ListBox : public CFWL_Widget { |
42 public: | 35 public: |
43 explicit CFWL_ListBox(const CFWL_App* pApp, | 36 explicit CFWL_ListBox(const CFWL_App* pApp, |
44 std::unique_ptr<CFWL_WidgetProperties> properties, | 37 std::unique_ptr<CFWL_WidgetProperties> properties, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const CFX_RectF& GetRTClient() const { return m_rtClient; } | 79 const CFX_RectF& GetRTClient() const { return m_rtClient; } |
87 | 80 |
88 private: | 81 private: |
89 void SetSelectionDirect(CFWL_ListItem* hItem, bool bSelect); | 82 void SetSelectionDirect(CFWL_ListItem* hItem, bool bSelect); |
90 bool IsMultiSelection() const; | 83 bool IsMultiSelection() const; |
91 bool IsItemSelected(CFWL_ListItem* hItem); | 84 bool IsItemSelected(CFWL_ListItem* hItem); |
92 void ClearSelection(); | 85 void ClearSelection(); |
93 void SelectAll(); | 86 void SelectAll(); |
94 CFWL_ListItem* GetFocusedItem(); | 87 CFWL_ListItem* GetFocusedItem(); |
95 void SetFocusItem(CFWL_ListItem* hItem); | 88 void SetFocusItem(CFWL_ListItem* hItem); |
96 bool SetItemChecked(CFWL_ListItem* hItem, bool bChecked); | |
97 bool GetItemChecked(CFWL_ListItem* hItem); | |
98 void DrawBkground(CFX_Graphics* pGraphics, | 89 void DrawBkground(CFX_Graphics* pGraphics, |
99 IFWL_ThemeProvider* pTheme, | 90 IFWL_ThemeProvider* pTheme, |
100 const CFX_Matrix* pMatrix); | 91 const CFX_Matrix* pMatrix); |
101 void DrawItems(CFX_Graphics* pGraphics, | 92 void DrawItems(CFX_Graphics* pGraphics, |
102 IFWL_ThemeProvider* pTheme, | 93 IFWL_ThemeProvider* pTheme, |
103 const CFX_Matrix* pMatrix); | 94 const CFX_Matrix* pMatrix); |
104 void DrawItem(CFX_Graphics* pGraphics, | 95 void DrawItem(CFX_Graphics* pGraphics, |
105 IFWL_ThemeProvider* pTheme, | 96 IFWL_ThemeProvider* pTheme, |
106 CFWL_ListItem* hItem, | 97 CFWL_ListItem* hItem, |
107 int32_t Index, | 98 int32_t Index, |
(...skipping 28 matching lines...) Expand all Loading... |
136 int32_t m_iTTOAligns; | 127 int32_t m_iTTOAligns; |
137 CFWL_ListItem* m_hAnchor; | 128 CFWL_ListItem* m_hAnchor; |
138 FX_FLOAT m_fItemHeight; | 129 FX_FLOAT m_fItemHeight; |
139 FX_FLOAT m_fScorllBarWidth; | 130 FX_FLOAT m_fScorllBarWidth; |
140 bool m_bLButtonDown; | 131 bool m_bLButtonDown; |
141 IFWL_ThemeProvider* m_pScrollBarTP; | 132 IFWL_ThemeProvider* m_pScrollBarTP; |
142 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; | 133 std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; |
143 }; | 134 }; |
144 | 135 |
145 #endif // XFA_FWL_CFWL_LISTBOX_H_ | 136 #endif // XFA_FWL_CFWL_LISTBOX_H_ |
OLD | NEW |