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_INCLUDE_FWL_BASEWIDGET_FWL_COMBOBOX_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_IFWL_COMBOBOX_H_ |
8 #define XFA_INCLUDE_FWL_BASEWIDGET_FWL_COMBOBOX_H_ | 8 #define XFA_FWL_BASEWIDGET_IFWL_COMBOBOX_H_ |
9 | 9 |
10 #include "xfa/include/fwl/basewidget/fwl_listbox.h" | 10 #include "xfa/fwl/basewidget/ifwl_listbox.h" |
| 11 #include "xfa/fxgraphics/include/cfx_graphics.h" |
11 | 12 |
12 class CFWL_WidgetImpProperties; | 13 class CFWL_WidgetImpProperties; |
13 class IFWL_ComboBox; | 14 class IFWL_ComboBox; |
14 | 15 |
15 #define FWL_CLASS_ComboBox L"FWL_COMBOBOX" | 16 #define FWL_CLASS_ComboBox L"FWL_COMBOBOX" |
16 #define FWL_CLASSHASH_ComboBox 602353697 | 17 #define FWL_CLASSHASH_ComboBox 602353697 |
17 #define FWL_STYLEEXT_CMB_DropList (0L << 0) | 18 #define FWL_STYLEEXT_CMB_DropList (0L << 0) |
18 #define FWL_STYLEEXT_CMB_DropDown (1L << 0) | 19 #define FWL_STYLEEXT_CMB_DropDown (1L << 0) |
19 #define FWL_STYLEEXT_CMB_Sort (1L << 1) | 20 #define FWL_STYLEEXT_CMB_Sort (1L << 1) |
20 #define FWL_STYLEEXT_CMB_ListDrag (1L << 2) | 21 #define FWL_STYLEEXT_CMB_ListDrag (1L << 2) |
(...skipping 21 matching lines...) Expand all Loading... |
42 #define FWL_PART_CMB_Background 3 | 43 #define FWL_PART_CMB_Background 3 |
43 #define FWL_PART_CMB_DropDownButton 4 | 44 #define FWL_PART_CMB_DropDownButton 4 |
44 #define FWL_PART_CMB_Caption 5 | 45 #define FWL_PART_CMB_Caption 5 |
45 #define FWL_PART_CMB_StretcgHandler 6 | 46 #define FWL_PART_CMB_StretcgHandler 6 |
46 #define FWL_PARTSTATE_CMB_Normal (0L << 0) | 47 #define FWL_PARTSTATE_CMB_Normal (0L << 0) |
47 #define FWL_PARTSTATE_CMB_Hovered (1L << 0) | 48 #define FWL_PARTSTATE_CMB_Hovered (1L << 0) |
48 #define FWL_PARTSTATE_CMB_Pressed (2L << 0) | 49 #define FWL_PARTSTATE_CMB_Pressed (2L << 0) |
49 #define FWL_PARTSTATE_CMB_Disabled (3L << 0) | 50 #define FWL_PARTSTATE_CMB_Disabled (3L << 0) |
50 #define FWL_PARTSTATE_CMB_Selected (1L << 2) | 51 #define FWL_PARTSTATE_CMB_Selected (1L << 2) |
51 #define FWL_WGTCAPACITY_CMB_ComboFormHandler (FWL_WGTCAPACITY_MAX + 7) | 52 #define FWL_WGTCAPACITY_CMB_ComboFormHandler (FWL_WGTCAPACITY_MAX + 7) |
52 enum FWL_CMB_TEXTCHANGED { | |
53 FWL_CMB_TEXTCHANGED_Insert = 0, | |
54 FWL_CMB_TEXTCHANGED_Delete, | |
55 FWL_CMB_TEXTCHANGED_Replace, | |
56 }; | |
57 #define FWL_EVT_CMB_DropDown L"FWL_EVENT_CMB_PreDropDown" | 53 #define FWL_EVT_CMB_DropDown L"FWL_EVENT_CMB_PreDropDown" |
58 #define FWL_EVT_CMB_PostDropDown L"FWL_EVENT_CMB_PostDropDown" | 54 #define FWL_EVT_CMB_PostDropDown L"FWL_EVENT_CMB_PostDropDown" |
59 #define FWL_EVT_CMB_CloseUp L"FWL_EVENT_CMB_CloseUp" | 55 #define FWL_EVT_CMB_CloseUp L"FWL_EVENT_CMB_CloseUp" |
60 #define FWL_EVT_CMB_EditChanged L"FWL_EVENT_CMB_EditChanged" | 56 #define FWL_EVT_CMB_EditChanged L"FWL_EVENT_CMB_EditChanged" |
61 #define FWL_EVT_CMB_SelChanged L"FWL_EVENT_CMB_SelChanged" | 57 #define FWL_EVT_CMB_SelChanged L"FWL_EVENT_CMB_SelChanged" |
62 #define FWL_EVT_CMB_HoverChanged L"FWL_EVENT_CMB_HoverChanged" | 58 #define FWL_EVT_CMB_HoverChanged L"FWL_EVENT_CMB_HoverChanged" |
63 #define FWL_EVT_CMB_DrawItem L"FWL_EVENT_CMB_DrawItem" | 59 #define FWL_EVT_CMB_DrawItem L"FWL_EVENT_CMB_DrawItem" |
64 #define FWL_EVTHASH_CMB_PreDropDown 1357646798 | 60 #define FWL_EVTHASH_CMB_PreDropDown 1357646798 |
65 #define FWL_EVTHASH_CMB_PostDropDown 3677010285 | 61 #define FWL_EVTHASH_CMB_PostDropDown 3677010285 |
66 #define FWL_EVTHASH_CMB_CloseUp 2871271190 | 62 #define FWL_EVTHASH_CMB_CloseUp 2871271190 |
67 #define FWL_EVTHASH_CMB_EditChanged 1527034762 | 63 #define FWL_EVTHASH_CMB_EditChanged 1527034762 |
68 #define FWL_EVTHASH_CMB_SelChanged 2923227784 | 64 #define FWL_EVTHASH_CMB_SelChanged 2923227784 |
69 #define FWL_EVTHASH_CMB_HoverChanged 944325448 | 65 #define FWL_EVTHASH_CMB_HoverChanged 944325448 |
70 #define FWL_EVTHASH_CMB_DrawItem 917354551 | 66 #define FWL_EVTHASH_CMB_DrawItem 917354551 |
| 67 |
| 68 enum FWL_CMB_TEXTCHANGED { |
| 69 FWL_CMB_TEXTCHANGED_Insert = 0, |
| 70 FWL_CMB_TEXTCHANGED_Delete, |
| 71 FWL_CMB_TEXTCHANGED_Replace, |
| 72 }; |
| 73 |
71 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, FWL_EVTHASH_CMB_PreDropDown) | 74 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, FWL_EVTHASH_CMB_PreDropDown) |
72 END_FWL_EVENT_DEF | 75 END_FWL_EVENT_DEF |
| 76 |
73 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, FWL_EVTHASH_CMB_PostDropDown) | 77 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, FWL_EVTHASH_CMB_PostDropDown) |
74 END_FWL_EVENT_DEF | 78 END_FWL_EVENT_DEF |
| 79 |
75 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbCloseUp, FWL_EVTHASH_CMB_CloseUp) | 80 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbCloseUp, FWL_EVTHASH_CMB_CloseUp) |
76 END_FWL_EVENT_DEF | 81 END_FWL_EVENT_DEF |
| 82 |
77 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbEditChanged, FWL_EVTHASH_CMB_EditChanged) | 83 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbEditChanged, FWL_EVTHASH_CMB_EditChanged) |
78 int32_t nChangeType; | 84 int32_t nChangeType; |
79 CFX_WideString wsInsert; | 85 CFX_WideString wsInsert; |
80 CFX_WideString wsDelete; | 86 CFX_WideString wsDelete; |
81 END_FWL_EVENT_DEF | 87 END_FWL_EVENT_DEF |
| 88 |
82 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbSelChanged, FWL_EVTHASH_CMB_SelChanged) | 89 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbSelChanged, FWL_EVTHASH_CMB_SelChanged) |
83 CFX_Int32Array iArraySels; | 90 CFX_Int32Array iArraySels; |
84 FX_BOOL bLButtonUp; | 91 FX_BOOL bLButtonUp; |
85 END_FWL_EVENT_DEF | 92 END_FWL_EVENT_DEF |
| 93 |
86 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged, FWL_EVTHASH_CMB_HoverChanged) | 94 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged, FWL_EVTHASH_CMB_HoverChanged) |
87 int32_t m_iCurHover; | 95 int32_t m_iCurHover; |
88 END_FWL_EVENT_DEF | 96 END_FWL_EVENT_DEF |
| 97 |
89 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbDrawItem, FWL_EVTHASH_CMB_DrawItem) | 98 BEGIN_FWL_EVENT_DEF(CFWL_EvtCmbDrawItem, FWL_EVTHASH_CMB_DrawItem) |
90 CFX_Graphics* m_pGraphics; | 99 CFX_Graphics* m_pGraphics; |
91 CFX_Matrix m_matrix; | 100 CFX_Matrix m_matrix; |
92 int32_t m_index; | 101 int32_t m_index; |
93 CFX_RectF m_rtItem; | 102 CFX_RectF m_rtItem; |
94 END_FWL_EVENT_DEF | 103 END_FWL_EVENT_DEF |
| 104 |
95 class IFWL_ComboBoxDP : public IFWL_ListBoxDP { | 105 class IFWL_ComboBoxDP : public IFWL_ListBoxDP { |
96 public: | 106 public: |
97 virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget) = 0; | 107 virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget) = 0; |
98 }; | 108 }; |
| 109 |
99 class IFWL_ComboBox : public IFWL_Widget { | 110 class IFWL_ComboBox : public IFWL_Widget { |
100 public: | 111 public: |
101 static IFWL_ComboBox* Create(const CFWL_WidgetImpProperties& properties); | 112 static IFWL_ComboBox* Create(const CFWL_WidgetImpProperties& properties); |
102 | 113 |
103 int32_t GetCurSel(); | 114 int32_t GetCurSel(); |
104 FWL_ERR SetCurSel(int32_t iSel); | 115 FWL_ERR SetCurSel(int32_t iSel); |
105 FWL_ERR SetEditText(const CFX_WideString& wsText); | 116 FWL_ERR SetEditText(const CFX_WideString& wsText); |
106 int32_t GetEditTextLength() const; | 117 int32_t GetEditTextLength() const; |
107 FWL_ERR GetEditText(CFX_WideString& wsText, | 118 FWL_ERR GetEditText(CFX_WideString& wsText, |
108 int32_t nStart = 0, | 119 int32_t nStart = 0, |
(...skipping 22 matching lines...) Expand all Loading... |
131 FX_BOOL EditDelete(); | 142 FX_BOOL EditDelete(); |
132 FX_BOOL EditDeSelect(); | 143 FX_BOOL EditDeSelect(); |
133 FWL_ERR GetBBox(CFX_RectF& rect); | 144 FWL_ERR GetBBox(CFX_RectF& rect); |
134 FWL_ERR EditModifyStylesEx(FX_DWORD dwStylesExAdded, | 145 FWL_ERR EditModifyStylesEx(FX_DWORD dwStylesExAdded, |
135 FX_DWORD dwStylesExRemoved); | 146 FX_DWORD dwStylesExRemoved); |
136 | 147 |
137 protected: | 148 protected: |
138 IFWL_ComboBox(); | 149 IFWL_ComboBox(); |
139 }; | 150 }; |
140 | 151 |
141 #endif // XFA_INCLUDE_FWL_BASEWIDGET_FWL_COMBOBOX_H_ | 152 #endif // XFA_FWL_BASEWIDGET_IFWL_COMBOBOX_H_ |
OLD | NEW |