Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: xfa/fwl/core/ifwl_combobox.h

Issue 2467993003: Merge delegates into IFWL_* classes. (Closed)
Patch Set: Add const version Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_checkbox.cpp ('k') | xfa/fwl/core/ifwl_combobox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_form.h" 10 #include "xfa/fwl/core/ifwl_form.h"
11 #include "xfa/fwl/core/ifwl_listbox.h" 11 #include "xfa/fwl/core/ifwl_listbox.h"
12 #include "xfa/fxgraphics/cfx_graphics.h" 12 #include "xfa/fxgraphics/cfx_graphics.h"
13 13
14 class CFWL_ComboBoxImpDelegate;
15 class CFWL_ComboEditImpDelegate;
16 class CFWL_ComboListImpDelegate;
17 class CFWL_ComboProxyImpDelegate;
18 class CFWL_ListBoxImpDelegate;
19 class CFWL_WidgetImpProperties; 14 class CFWL_WidgetImpProperties;
20 class CFWL_WidgetImpDelegate;
21 class IFWL_ComboBox; 15 class IFWL_ComboBox;
16 class IFWL_ComboBoxProxy;
22 class IFWL_ComboEdit; 17 class IFWL_ComboEdit;
23 class IFWL_ComboList; 18 class IFWL_ComboList;
24 class IFWL_FormProxy; 19 class IFWL_FormProxy;
25 class IFWL_ListBox; 20 class IFWL_ListBox;
26 class IFWL_Widget; 21 class IFWL_Widget;
27 22
28 #define FWL_STYLEEXT_CMB_DropList (0L << 0) 23 #define FWL_STYLEEXT_CMB_DropList (0L << 0)
29 #define FWL_STYLEEXT_CMB_DropDown (1L << 0) 24 #define FWL_STYLEEXT_CMB_DropDown (1L << 0)
30 #define FWL_STYLEEXT_CMB_Sort (1L << 1) 25 #define FWL_STYLEEXT_CMB_Sort (1L << 1)
31 #define FWL_STYLEEXT_CMB_ListDrag (1L << 2) 26 #define FWL_STYLEEXT_CMB_ListDrag (1L << 2)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 FWL_Type GetClassID() const override; 87 FWL_Type GetClassID() const override;
93 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; 88 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
94 FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, 89 FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded,
95 uint32_t dwStylesExRemoved) override; 90 uint32_t dwStylesExRemoved) override;
96 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; 91 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override;
97 FWL_Error Update() override; 92 FWL_Error Update() override;
98 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; 93 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
99 FWL_Error DrawWidget(CFX_Graphics* pGraphics, 94 FWL_Error DrawWidget(CFX_Graphics* pGraphics,
100 const CFX_Matrix* pMatrix = nullptr) override; 95 const CFX_Matrix* pMatrix = nullptr) override;
101 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; 96 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
97 void OnProcessMessage(CFWL_Message* pMessage) override;
98 void OnProcessEvent(CFWL_Event* pEvent) override;
99 void OnDrawWidget(CFX_Graphics* pGraphics,
100 const CFX_Matrix* pMatrix) override;
102 101
103 int32_t GetCurSel(); 102 int32_t GetCurSel();
104 FWL_Error SetCurSel(int32_t iSel); 103 FWL_Error SetCurSel(int32_t iSel);
105 FWL_Error SetEditText(const CFX_WideString& wsText); 104 FWL_Error SetEditText(const CFX_WideString& wsText);
106 int32_t GetEditTextLength() const; 105 int32_t GetEditTextLength() const;
107 FWL_Error GetEditText(CFX_WideString& wsText, 106 FWL_Error GetEditText(CFX_WideString& wsText,
108 int32_t nStart = 0, 107 int32_t nStart = 0,
109 int32_t nCount = -1) const; 108 int32_t nCount = -1) const;
110 FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); 109 FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1);
111 int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); 110 int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart);
(...skipping 15 matching lines...) Expand all
127 FX_BOOL EditCopy(CFX_WideString& wsCopy); 126 FX_BOOL EditCopy(CFX_WideString& wsCopy);
128 FX_BOOL EditCut(CFX_WideString& wsCut); 127 FX_BOOL EditCut(CFX_WideString& wsCut);
129 FX_BOOL EditPaste(const CFX_WideString& wsPaste); 128 FX_BOOL EditPaste(const CFX_WideString& wsPaste);
130 FX_BOOL EditSelectAll(); 129 FX_BOOL EditSelectAll();
131 FX_BOOL EditDelete(); 130 FX_BOOL EditDelete();
132 FX_BOOL EditDeSelect(); 131 FX_BOOL EditDeSelect();
133 FWL_Error GetBBox(CFX_RectF& rect); 132 FWL_Error GetBBox(CFX_RectF& rect);
134 FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, 133 FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded,
135 uint32_t dwStylesExRemoved); 134 uint32_t dwStylesExRemoved);
136 135
136 void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix);
137 FX_BOOL IsDropListShowed();
138 void ShowDropList(FX_BOOL bActivate);
139
140 IFWL_ComboEdit* GetComboEdit() const { return m_pEdit.get(); }
141 void ProcessSelChanged(FX_BOOL bLButtonUp);
142 int32_t GetCurrentSelection() const { return m_iCurSel; }
143
137 protected: 144 protected:
138 friend class CFWL_ComboBoxImpDelegate;
139 friend class CFWL_ComboEditImpDelegate;
140 friend class CFWL_ComboListImpDelegate;
141 friend class CFWL_ComboProxyImpDelegate;
142 friend class IFWL_ComboEdit;
143 friend class IFWL_ComboList;
144
145 void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix);
146 FX_FLOAT GetListHeight(); 145 FX_FLOAT GetListHeight();
147 void ShowDropList(FX_BOOL bActivate);
148 FX_BOOL IsDropListShowed();
149 FX_BOOL IsDropDownStyle() const; 146 FX_BOOL IsDropDownStyle() const;
150 void MatchEditText(); 147 void MatchEditText();
151 void SynchrEditText(int32_t iListItem); 148 void SynchrEditText(int32_t iListItem);
152 void Layout(); 149 void Layout();
153 void ReSetTheme(); 150 void ReSetTheme();
154 void ReSetEditAlignment(); 151 void ReSetEditAlignment();
155 void ReSetListItemAlignment(); 152 void ReSetListItemAlignment();
156 void ProcessSelChanged(FX_BOOL bLButtonUp);
157 void InitProxyForm(); 153 void InitProxyForm();
158 void DisForm_InitComboList(); 154 void DisForm_InitComboList();
159 void DisForm_InitComboEdit(); 155 void DisForm_InitComboEdit();
160 void DisForm_ShowDropList(FX_BOOL bActivate); 156 void DisForm_ShowDropList(FX_BOOL bActivate);
161 FX_BOOL DisForm_IsDropListShowed(); 157 FX_BOOL DisForm_IsDropListShowed();
162 FWL_Error DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, 158 FWL_Error DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
163 uint32_t dwStylesExRemoved); 159 uint32_t dwStylesExRemoved);
164 FWL_Error DisForm_Update(); 160 FWL_Error DisForm_Update();
165 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); 161 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy);
166 FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, 162 FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics,
167 const CFX_Matrix* pMatrix = nullptr); 163 const CFX_Matrix* pMatrix = nullptr);
168 FWL_Error DisForm_GetBBox(CFX_RectF& rect); 164 FWL_Error DisForm_GetBBox(CFX_RectF& rect);
169 void DisForm_Layout(); 165 void DisForm_Layout();
170 166
171 CFX_RectF m_rtClient; 167 CFX_RectF m_rtClient;
172 CFX_RectF m_rtContent; 168 CFX_RectF m_rtContent;
173 CFX_RectF m_rtBtn; 169 CFX_RectF m_rtBtn;
174 CFX_RectF m_rtList; 170 CFX_RectF m_rtList;
175 CFX_RectF m_rtProxy; 171 CFX_RectF m_rtProxy;
176 CFX_RectF m_rtHandler; 172 CFX_RectF m_rtHandler;
177 std::unique_ptr<IFWL_ComboEdit> m_pEdit; 173 std::unique_ptr<IFWL_ComboEdit> m_pEdit;
178 std::unique_ptr<IFWL_ComboList> m_pListBox; 174 std::unique_ptr<IFWL_ComboList> m_pListBox;
179 IFWL_FormProxy* m_pForm; 175 IFWL_ComboBoxProxy* m_pComboBoxProxy;
180 FX_BOOL m_bLButtonDown; 176 FX_BOOL m_bLButtonDown;
181 FX_BOOL m_bUpFormHandler; 177 FX_BOOL m_bUpFormHandler;
182 int32_t m_iCurSel; 178 int32_t m_iCurSel;
183 int32_t m_iBtnState; 179 int32_t m_iBtnState;
184 FX_FLOAT m_fComboFormHandler; 180 FX_FLOAT m_fComboFormHandler;
185 FX_FLOAT m_fItemHeight; 181 FX_FLOAT m_fItemHeight;
186 FX_BOOL m_bNeedShowList; 182 FX_BOOL m_bNeedShowList;
187 CFWL_ComboProxyImpDelegate* m_pListProxyDelegate;
188 };
189 183
190 class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { 184 private:
191 public:
192 CFWL_ComboBoxImpDelegate(IFWL_ComboBox* pOwner);
193 void OnProcessMessage(CFWL_Message* pMessage) override;
194 void OnProcessEvent(CFWL_Event* pEvent) override;
195 void OnDrawWidget(CFX_Graphics* pGraphics,
196 const CFX_Matrix* pMatrix = nullptr) override;
197
198 protected:
199 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); 185 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
200 void OnLButtonDown(CFWL_MsgMouse* pMsg); 186 void OnLButtonDown(CFWL_MsgMouse* pMsg);
201 void OnLButtonUp(CFWL_MsgMouse* pMsg); 187 void OnLButtonUp(CFWL_MsgMouse* pMsg);
202 void OnMouseMove(CFWL_MsgMouse* pMsg); 188 void OnMouseMove(CFWL_MsgMouse* pMsg);
203 void OnMouseLeave(CFWL_MsgMouse* pMsg); 189 void OnMouseLeave(CFWL_MsgMouse* pMsg);
204 void OnKey(CFWL_MsgKey* pMsg); 190 void OnKey(CFWL_MsgKey* pMsg);
205 void DoSubCtrlKey(CFWL_MsgKey* pMsg); 191 void DoSubCtrlKey(CFWL_MsgKey* pMsg);
206 void DisForm_OnProcessMessage(CFWL_Message* pMessage); 192 void DisForm_OnProcessMessage(CFWL_Message* pMessage);
207 void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg); 193 void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg);
208 void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); 194 void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
209 void DisForm_OnKey(CFWL_MsgKey* pMsg); 195 void DisForm_OnKey(CFWL_MsgKey* pMsg);
210 196
211 IFWL_ComboBox* m_pOwner;
212 friend class CFWL_ComboEditImpDelegate;
213 friend class CFWL_ComboListImpDelegate;
214 };
215
216 class CFWL_ComboProxyImpDelegate : public CFWL_WidgetImpDelegate {
217 public:
218 CFWL_ComboProxyImpDelegate(IFWL_Form* pForm, IFWL_ComboBox* pComboBox);
219 void OnProcessMessage(CFWL_Message* pMessage) override;
220 void OnDrawWidget(CFX_Graphics* pGraphics,
221 const CFX_Matrix* pMatrix = nullptr) override;
222 void Reset() { m_bLButtonUpSelf = FALSE; }
223
224 protected:
225 void OnLButtonDown(CFWL_MsgMouse* pMsg);
226 void OnLButtonUp(CFWL_MsgMouse* pMsg);
227 void OnMouseMove(CFWL_MsgMouse* pMsg);
228 void OnDeactive(CFWL_MsgDeactivate* pMsg);
229 void OnFocusChanged(CFWL_MsgKillFocus* pMsg, FX_BOOL bSet);
230 FX_BOOL m_bLButtonDown;
231 FX_BOOL m_bLButtonUpSelf;
232 FX_FLOAT m_fStartPos;
233 IFWL_Form* m_pForm;
234 IFWL_ComboBox* m_pComboBox;
235 }; 197 };
236 198
237 #endif // XFA_FWL_CORE_IFWL_COMBOBOX_H_ 199 #endif // XFA_FWL_CORE_IFWL_COMBOBOX_H_
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_checkbox.cpp ('k') | xfa/fwl/core/ifwl_combobox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698