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_IFWL_COMBOBOX_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_COMBOBOX_H_ |
8 #define XFA_FWL_CORE_IFWL_COMBOBOX_H_ | 8 #define XFA_FWL_CORE_IFWL_COMBOBOX_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #define FWL_STYLEEXT_CMB_ListItemLeftAlign (0L << 10) | 42 #define FWL_STYLEEXT_CMB_ListItemLeftAlign (0L << 10) |
43 #define FWL_STYLEEXT_CMB_ListItemCenterAlign (1L << 10) | 43 #define FWL_STYLEEXT_CMB_ListItemCenterAlign (1L << 10) |
44 #define FWL_STYLEEXT_CMB_ListItemRightAlign (2L << 10) | 44 #define FWL_STYLEEXT_CMB_ListItemRightAlign (2L << 10) |
45 #define FWL_STYLEEXT_CMB_ListItemAlignMask (3L << 10) | 45 #define FWL_STYLEEXT_CMB_ListItemAlignMask (3L << 10) |
46 #define FWL_STYLEEXT_CMB_ListItemText (0L << 12) | 46 #define FWL_STYLEEXT_CMB_ListItemText (0L << 12) |
47 #define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12) | 47 #define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12) |
48 #define FWL_STYLEEXT_CMB_ReadOnly (1L << 13) | 48 #define FWL_STYLEEXT_CMB_ReadOnly (1L << 13) |
49 | 49 |
50 class IFWL_ComboBox : public IFWL_Widget { | 50 class IFWL_ComboBox : public IFWL_Widget { |
51 public: | 51 public: |
52 class DataProvider : public IFWL_Widget::DataProvider { | |
53 public: | |
54 virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget) = 0; | |
55 }; | |
56 | |
57 explicit IFWL_ComboBox(const CFWL_App* app, | 52 explicit IFWL_ComboBox(const CFWL_App* app, |
58 std::unique_ptr<CFWL_WidgetProperties> properties); | 53 std::unique_ptr<CFWL_WidgetProperties> properties); |
59 ~IFWL_ComboBox() override; | 54 ~IFWL_ComboBox() override; |
60 | 55 |
61 // IFWL_Widget | 56 // IFWL_Widget |
62 FWL_Type GetClassID() const override; | 57 FWL_Type GetClassID() const override; |
63 void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; | 58 void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; |
64 void ModifyStylesEx(uint32_t dwStylesExAdded, | 59 void ModifyStylesEx(uint32_t dwStylesExAdded, |
65 uint32_t dwStylesExRemoved) override; | 60 uint32_t dwStylesExRemoved) override; |
66 void SetStates(uint32_t dwStates, bool bSet = true) override; | 61 void SetStates(uint32_t dwStates, bool bSet = true) override; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 !(m_pComboBoxProxy->GetStates() & FWL_WGTSTATE_Invisible); | 113 !(m_pComboBoxProxy->GetStates() & FWL_WGTSTATE_Invisible); |
119 } | 114 } |
120 void ShowDropList(bool bActivate); | 115 void ShowDropList(bool bActivate); |
121 | 116 |
122 IFWL_ComboEdit* GetComboEdit() const { return m_pEdit.get(); } | 117 IFWL_ComboEdit* GetComboEdit() const { return m_pEdit.get(); } |
123 | 118 |
124 void ProcessSelChanged(bool bLButtonUp); | 119 void ProcessSelChanged(bool bLButtonUp); |
125 int32_t GetCurrentSelection() const { return m_iCurSel; } | 120 int32_t GetCurrentSelection() const { return m_iCurSel; } |
126 | 121 |
127 private: | 122 private: |
128 FX_FLOAT GetDataProviderListHeight(); | |
129 bool IsDropDownStyle() const { | 123 bool IsDropDownStyle() const { |
130 return !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown); | 124 return !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown); |
131 } | 125 } |
132 void MatchEditText(); | 126 void MatchEditText(); |
133 void SyncEditText(int32_t iListItem); | 127 void SyncEditText(int32_t iListItem); |
134 void Layout(); | 128 void Layout(); |
135 void ResetTheme(); | 129 void ResetTheme(); |
136 void ResetEditAlignment(); | 130 void ResetEditAlignment(); |
137 void ResetListItemAlignment(); | 131 void ResetListItemAlignment(); |
138 void InitProxyForm(); | 132 void InitProxyForm(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 IFWL_ComboBoxProxy* m_pComboBoxProxy; // Can this be a unique_ptr? | 167 IFWL_ComboBoxProxy* m_pComboBoxProxy; // Can this be a unique_ptr? |
174 bool m_bLButtonDown; | 168 bool m_bLButtonDown; |
175 bool m_bUpFormHandler; | 169 bool m_bUpFormHandler; |
176 int32_t m_iCurSel; | 170 int32_t m_iCurSel; |
177 int32_t m_iBtnState; | 171 int32_t m_iBtnState; |
178 FX_FLOAT m_fComboFormHandler; | 172 FX_FLOAT m_fComboFormHandler; |
179 FX_FLOAT m_fItemHeight; | 173 FX_FLOAT m_fItemHeight; |
180 }; | 174 }; |
181 | 175 |
182 #endif // XFA_FWL_CORE_IFWL_COMBOBOX_H_ | 176 #endif // XFA_FWL_CORE_IFWL_COMBOBOX_H_ |
OLD | NEW |