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 "xfa/fwl/core/ifwl_combolist.h" |
10 #include "xfa/fwl/core/ifwl_form.h" | 11 #include "xfa/fwl/core/ifwl_form.h" |
11 #include "xfa/fwl/core/ifwl_listbox.h" | 12 #include "xfa/fwl/core/ifwl_listbox.h" |
12 #include "xfa/fxgraphics/cfx_graphics.h" | 13 #include "xfa/fxgraphics/cfx_graphics.h" |
13 | 14 |
14 class CFWL_WidgetProperties; | 15 class CFWL_WidgetProperties; |
15 class IFWL_ComboBox; | 16 class IFWL_ComboBox; |
16 class IFWL_ComboBoxProxy; | 17 class IFWL_ComboBoxProxy; |
17 class IFWL_ComboEdit; | 18 class IFWL_ComboEdit; |
18 class IFWL_ComboList; | |
19 class IFWL_FormProxy; | 19 class IFWL_FormProxy; |
20 class IFWL_ListBox; | 20 class IFWL_ListBox; |
21 class IFWL_Widget; | 21 class IFWL_Widget; |
22 | 22 |
23 #define FWL_STYLEEXT_CMB_DropList (0L << 0) | 23 #define FWL_STYLEEXT_CMB_DropList (0L << 0) |
24 #define FWL_STYLEEXT_CMB_DropDown (1L << 0) | 24 #define FWL_STYLEEXT_CMB_DropDown (1L << 0) |
25 #define FWL_STYLEEXT_CMB_Sort (1L << 1) | 25 #define FWL_STYLEEXT_CMB_Sort (1L << 1) |
26 #define FWL_STYLEEXT_CMB_ListDrag (1L << 2) | 26 #define FWL_STYLEEXT_CMB_ListDrag (1L << 2) |
27 #define FWL_STYLEEXT_CMB_OwnerDraw (1L << 3) | 27 #define FWL_STYLEEXT_CMB_OwnerDraw (1L << 3) |
28 #define FWL_STYLEEXT_CMB_EditHNear (0L << 4) | 28 #define FWL_STYLEEXT_CMB_EditHNear (0L << 4) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 void Update() override; | 92 void Update() override; |
93 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; | 93 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
94 void DrawWidget(CFX_Graphics* pGraphics, | 94 void DrawWidget(CFX_Graphics* pGraphics, |
95 const CFX_Matrix* pMatrix = nullptr) override; | 95 const CFX_Matrix* pMatrix = nullptr) override; |
96 void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; | 96 void SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; |
97 void OnProcessMessage(CFWL_Message* pMessage) override; | 97 void OnProcessMessage(CFWL_Message* pMessage) override; |
98 void OnProcessEvent(CFWL_Event* pEvent) override; | 98 void OnProcessEvent(CFWL_Event* pEvent) override; |
99 void OnDrawWidget(CFX_Graphics* pGraphics, | 99 void OnDrawWidget(CFX_Graphics* pGraphics, |
100 const CFX_Matrix* pMatrix) override; | 100 const CFX_Matrix* pMatrix) override; |
101 | 101 |
102 int32_t GetCurSel(); | 102 int32_t GetCurSel() const; |
103 FWL_Error SetCurSel(int32_t iSel); | 103 void SetCurSel(int32_t iSel); |
| 104 |
104 void SetEditText(const CFX_WideString& wsText); | 105 void SetEditText(const CFX_WideString& wsText); |
105 int32_t GetEditTextLength() const; | 106 void GetEditText(CFX_WideString& wsText, |
106 FWL_Error GetEditText(CFX_WideString& wsText, | 107 int32_t nStart = 0, |
107 int32_t nStart = 0, | 108 int32_t nCount = -1) const; |
108 int32_t nCount = -1) const; | 109 |
109 FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); | 110 void OpenDropDownList(bool bActivate); |
110 int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); | 111 |
111 int32_t GetEditLimit(); | |
112 FWL_Error SetEditLimit(int32_t nLimit); | |
113 bool EditRedo(const IFDE_TxtEdtDoRecord* pRecord); | |
114 bool EditUndo(const IFDE_TxtEdtDoRecord* pRecord); | |
115 IFWL_ListBox* GetListBoxt(); | |
116 bool AfterFocusShowDropList(); | |
117 FWL_Error OpenDropDownList(bool bActivate); | |
118 bool EditCanUndo(); | 112 bool EditCanUndo(); |
119 bool EditCanRedo(); | 113 bool EditCanRedo(); |
120 bool EditUndo(); | 114 bool EditUndo(); |
121 bool EditRedo(); | 115 bool EditRedo(); |
122 bool EditCanCopy(); | 116 bool EditCanCopy(); |
123 bool EditCanCut(); | 117 bool EditCanCut(); |
124 bool EditCanSelectAll(); | 118 bool EditCanSelectAll(); |
125 bool EditCopy(CFX_WideString& wsCopy); | 119 bool EditCopy(CFX_WideString& wsCopy); |
126 bool EditCut(CFX_WideString& wsCut); | 120 bool EditCut(CFX_WideString& wsCut); |
127 bool EditPaste(const CFX_WideString& wsPaste); | 121 bool EditPaste(const CFX_WideString& wsPaste); |
128 bool EditSelectAll(); | 122 bool EditSelectAll(); |
129 bool EditDelete(); | 123 bool EditDelete(); |
130 bool EditDeSelect(); | 124 bool EditDeSelect(); |
131 FWL_Error GetBBox(CFX_RectF& rect); | 125 |
| 126 void GetBBox(CFX_RectF& rect); |
132 void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); | 127 void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); |
133 | 128 |
134 void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); | 129 void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); |
135 bool IsDropListShowed(); | 130 bool IsDropListVisible(); |
| 131 |
136 void ShowDropList(bool bActivate); | 132 void ShowDropList(bool bActivate); |
137 | 133 |
138 IFWL_ComboEdit* GetComboEdit() const { return m_pEdit.get(); } | 134 IFWL_ComboEdit* GetComboEdit() const { return m_pEdit.get(); } |
| 135 |
139 void ProcessSelChanged(bool bLButtonUp); | 136 void ProcessSelChanged(bool bLButtonUp); |
140 int32_t GetCurrentSelection() const { return m_iCurSel; } | 137 int32_t GetCurrentSelection() const { return m_iCurSel; } |
141 | 138 |
142 protected: | 139 private: |
143 FX_FLOAT GetListHeight(); | 140 FX_FLOAT GetListHeight(); |
144 bool IsDropDownStyle() const; | 141 bool IsDropDownStyle() const { |
| 142 return !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown); |
| 143 } |
145 void MatchEditText(); | 144 void MatchEditText(); |
146 void SynchrEditText(int32_t iListItem); | 145 void SyncEditText(int32_t iListItem); |
147 void Layout(); | 146 void Layout(); |
148 void ReSetTheme(); | 147 void ResetTheme(); |
149 void ReSetEditAlignment(); | 148 void ResetEditAlignment(); |
150 void ReSetListItemAlignment(); | 149 void ResetListItemAlignment(); |
151 void InitProxyForm(); | 150 void InitProxyForm(); |
152 void DisForm_InitComboList(); | 151 void DisForm_InitComboList(); |
153 void DisForm_InitComboEdit(); | 152 void DisForm_InitComboEdit(); |
154 void DisForm_ShowDropList(bool bActivate); | 153 void DisForm_ShowDropList(bool bActivate); |
155 bool DisForm_IsDropListShowed(); | 154 bool DisForm_IsDropListVisible() const { |
| 155 return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); |
| 156 } |
156 void DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, | 157 void DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, |
157 uint32_t dwStylesExRemoved); | 158 uint32_t dwStylesExRemoved); |
158 void DisForm_Update(); | 159 void DisForm_Update(); |
159 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); | 160 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); |
160 void DisForm_DrawWidget(CFX_Graphics* pGraphics, | 161 void DisForm_DrawWidget(CFX_Graphics* pGraphics, |
161 const CFX_Matrix* pMatrix = nullptr); | 162 const CFX_Matrix* pMatrix = nullptr); |
162 FWL_Error DisForm_GetBBox(CFX_RectF& rect); | 163 void DisForm_GetBBox(CFX_RectF& rect); |
163 void DisForm_Layout(); | 164 void DisForm_Layout(); |
| 165 void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true); |
| 166 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
| 167 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
| 168 void OnMouseMove(CFWL_MsgMouse* pMsg); |
| 169 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
| 170 void OnKey(CFWL_MsgKey* pMsg); |
| 171 void DoSubCtrlKey(CFWL_MsgKey* pMsg); |
| 172 void DisForm_OnProcessMessage(CFWL_Message* pMessage); |
| 173 void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg); |
| 174 void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet = true); |
| 175 void DisForm_OnKey(CFWL_MsgKey* pMsg); |
164 | 176 |
165 CFX_RectF m_rtClient; | 177 CFX_RectF m_rtClient; |
166 CFX_RectF m_rtContent; | 178 CFX_RectF m_rtContent; |
167 CFX_RectF m_rtBtn; | 179 CFX_RectF m_rtBtn; |
168 CFX_RectF m_rtList; | 180 CFX_RectF m_rtList; |
169 CFX_RectF m_rtProxy; | 181 CFX_RectF m_rtProxy; |
170 CFX_RectF m_rtHandler; | 182 CFX_RectF m_rtHandler; |
171 std::unique_ptr<IFWL_ComboEdit> m_pEdit; | 183 std::unique_ptr<IFWL_ComboEdit> m_pEdit; |
172 std::unique_ptr<IFWL_ComboList> m_pListBox; | 184 std::unique_ptr<IFWL_ComboList> m_pListBox; |
173 IFWL_ComboBoxProxy* m_pComboBoxProxy; | 185 IFWL_ComboBoxProxy* m_pComboBoxProxy; |
174 bool m_bLButtonDown; | 186 bool m_bLButtonDown; |
175 bool m_bUpFormHandler; | 187 bool m_bUpFormHandler; |
176 int32_t m_iCurSel; | 188 int32_t m_iCurSel; |
177 int32_t m_iBtnState; | 189 int32_t m_iBtnState; |
178 FX_FLOAT m_fComboFormHandler; | 190 FX_FLOAT m_fComboFormHandler; |
179 FX_FLOAT m_fItemHeight; | 191 FX_FLOAT m_fItemHeight; |
180 bool m_bNeedShowList; | |
181 | |
182 private: | |
183 void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true); | |
184 void OnLButtonDown(CFWL_MsgMouse* pMsg); | |
185 void OnLButtonUp(CFWL_MsgMouse* pMsg); | |
186 void OnMouseMove(CFWL_MsgMouse* pMsg); | |
187 void OnMouseLeave(CFWL_MsgMouse* pMsg); | |
188 void OnKey(CFWL_MsgKey* pMsg); | |
189 void DoSubCtrlKey(CFWL_MsgKey* pMsg); | |
190 void DisForm_OnProcessMessage(CFWL_Message* pMessage); | |
191 void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg); | |
192 void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet = true); | |
193 void DisForm_OnKey(CFWL_MsgKey* pMsg); | |
194 | |
195 }; | 192 }; |
196 | 193 |
197 #endif // XFA_FWL_CORE_IFWL_COMBOBOX_H_ | 194 #endif // XFA_FWL_CORE_IFWL_COMBOBOX_H_ |
OLD | NEW |