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_BASEWIDGET_FWL_COMBOBOXIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 26 matching lines...) Expand all Loading... |
37 void FlagFocus(FX_BOOL bSet); | 37 void FlagFocus(FX_BOOL bSet); |
38 | 38 |
39 protected: | 39 protected: |
40 void SetComboBoxFocus(FX_BOOL bSet); | 40 void SetComboBoxFocus(FX_BOOL bSet); |
41 CFWL_ComboBoxImp* m_pOuter; | 41 CFWL_ComboBoxImp* m_pOuter; |
42 friend class CFWL_ComboEditImpDelegate; | 42 friend class CFWL_ComboEditImpDelegate; |
43 }; | 43 }; |
44 class CFWL_ComboEditImpDelegate : public CFWL_EditImpDelegate { | 44 class CFWL_ComboEditImpDelegate : public CFWL_EditImpDelegate { |
45 public: | 45 public: |
46 CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner); | 46 CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner); |
47 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 47 void OnProcessMessage(CFWL_Message* pMessage) override; |
48 | 48 |
49 protected: | 49 protected: |
50 CFWL_ComboEditImp* m_pOwner; | 50 CFWL_ComboEditImp* m_pOwner; |
51 }; | 51 }; |
52 class CFWL_ComboListImp : public CFWL_ListBoxImp { | 52 class CFWL_ComboListImp : public CFWL_ListBoxImp { |
53 public: | 53 public: |
54 CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, | 54 CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, |
55 IFWL_Widget* pOuter); | 55 IFWL_Widget* pOuter); |
56 virtual FWL_ERR Initialize(); | 56 virtual FWL_Error Initialize(); |
57 virtual FWL_ERR Finalize(); | 57 virtual FWL_Error Finalize(); |
58 int32_t MatchItem(const CFX_WideString& wsMatch); | 58 int32_t MatchItem(const CFX_WideString& wsMatch); |
59 void ChangeSelected(int32_t iSel); | 59 void ChangeSelected(int32_t iSel); |
60 int32_t CountItems(); | 60 int32_t CountItems(); |
61 void GetItemRect(int32_t nIndex, CFX_RectF& rtItem); | 61 void GetItemRect(int32_t nIndex, CFX_RectF& rtItem); |
62 void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy); | 62 void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy); |
63 void SetFocus(FX_BOOL bSet); | 63 void SetFocus(FX_BOOL bSet); |
64 FX_BOOL m_bNotifyOwner; | 64 FX_BOOL m_bNotifyOwner; |
65 friend class CFWL_ComboListImpDelegate; | 65 friend class CFWL_ComboListImpDelegate; |
66 friend class CFWL_ComboBoxImp; | 66 friend class CFWL_ComboBoxImp; |
67 }; | 67 }; |
68 class CFWL_ComboListImpDelegate : public CFWL_ListBoxImpDelegate { | 68 class CFWL_ComboListImpDelegate : public CFWL_ListBoxImpDelegate { |
69 public: | 69 public: |
70 CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner); | 70 CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner); |
71 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 71 void OnProcessMessage(CFWL_Message* pMessage) override; |
72 | 72 |
73 protected: | 73 protected: |
74 void OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 74 void OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
75 int32_t OnDropListMouseMove(CFWL_MsgMouse* pMsg); | 75 int32_t OnDropListMouseMove(CFWL_MsgMouse* pMsg); |
76 int32_t OnDropListLButtonDown(CFWL_MsgMouse* pMsg); | 76 int32_t OnDropListLButtonDown(CFWL_MsgMouse* pMsg); |
77 int32_t OnDropListLButtonUp(CFWL_MsgMouse* pMsg); | 77 int32_t OnDropListLButtonUp(CFWL_MsgMouse* pMsg); |
78 int32_t OnDropListKey(CFWL_MsgKey* pKey); | 78 int32_t OnDropListKey(CFWL_MsgKey* pKey); |
79 void OnDropListKeyDown(CFWL_MsgKey* pKey); | 79 void OnDropListKeyDown(CFWL_MsgKey* pKey); |
80 CFWL_ComboListImp* m_pOwner; | 80 CFWL_ComboListImp* m_pOwner; |
81 }; | 81 }; |
82 class CFWL_ComboBoxImp : public CFWL_WidgetImp { | 82 class CFWL_ComboBoxImp : public CFWL_WidgetImp { |
83 public: | 83 public: |
84 CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties, | 84 CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties, |
85 IFWL_Widget* pOuter); | 85 IFWL_Widget* pOuter); |
86 virtual ~CFWL_ComboBoxImp(); | 86 virtual ~CFWL_ComboBoxImp(); |
87 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; | 87 virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; |
88 virtual uint32_t GetClassID() const; | 88 virtual uint32_t GetClassID() const; |
89 virtual FWL_ERR Initialize(); | 89 virtual FWL_Error Initialize(); |
90 virtual FWL_ERR Finalize(); | 90 virtual FWL_Error Finalize(); |
91 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 91 virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
92 virtual FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, | 92 virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, |
93 uint32_t dwStylesExRemoved); | 93 uint32_t dwStylesExRemoved); |
94 virtual FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); | 94 virtual FWL_Error SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); |
95 virtual FWL_ERR Update(); | 95 virtual FWL_Error Update(); |
96 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); | 96 virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); |
97 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, | 97 virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
98 const CFX_Matrix* pMatrix = NULL); | 98 const CFX_Matrix* pMatrix = NULL); |
99 virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 99 virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); |
100 virtual int32_t GetCurSel(); | 100 virtual int32_t GetCurSel(); |
101 virtual FWL_ERR SetCurSel(int32_t iSel); | 101 virtual FWL_Error SetCurSel(int32_t iSel); |
102 virtual FWL_ERR SetEditText(const CFX_WideString& wsText); | 102 virtual FWL_Error SetEditText(const CFX_WideString& wsText); |
103 virtual int32_t GetEditTextLength() const; | 103 virtual int32_t GetEditTextLength() const; |
104 virtual FWL_ERR GetEditText(CFX_WideString& wsText, | 104 virtual FWL_Error GetEditText(CFX_WideString& wsText, |
105 int32_t nStart = 0, | 105 int32_t nStart = 0, |
106 int32_t nCount = -1) const; | 106 int32_t nCount = -1) const; |
107 virtual FWL_ERR SetEditSelRange(int32_t nStart, int32_t nCount = -1); | 107 virtual FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); |
108 virtual int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); | 108 virtual int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); |
109 virtual int32_t GetEditLimit(); | 109 virtual int32_t GetEditLimit(); |
110 virtual FWL_ERR SetEditLimit(int32_t nLimit); | 110 virtual FWL_Error SetEditLimit(int32_t nLimit); |
111 virtual FWL_ERR EditDoClipboard(int32_t iCmd); | 111 virtual FWL_Error EditDoClipboard(int32_t iCmd); |
112 virtual FX_BOOL EditRedo(const CFX_ByteStringC& bsRecord); | 112 virtual FX_BOOL EditRedo(const CFX_ByteStringC& bsRecord); |
113 virtual FX_BOOL EditUndo(const CFX_ByteStringC& bsRecord); | 113 virtual FX_BOOL EditUndo(const CFX_ByteStringC& bsRecord); |
114 virtual IFWL_ListBox* GetListBoxt(); | 114 virtual IFWL_ListBox* GetListBoxt(); |
115 virtual FX_BOOL AfterFocusShowDropList(); | 115 virtual FX_BOOL AfterFocusShowDropList(); |
116 virtual FX_ERR OpenDropDownList(FX_BOOL bActivate); | 116 virtual FWL_Error OpenDropDownList(FX_BOOL bActivate); |
117 virtual FX_BOOL EditCanUndo(); | 117 virtual FX_BOOL EditCanUndo(); |
118 virtual FX_BOOL EditCanRedo(); | 118 virtual FX_BOOL EditCanRedo(); |
119 virtual FX_BOOL EditUndo(); | 119 virtual FX_BOOL EditUndo(); |
120 virtual FX_BOOL EditRedo(); | 120 virtual FX_BOOL EditRedo(); |
121 virtual FX_BOOL EditCanCopy(); | 121 virtual FX_BOOL EditCanCopy(); |
122 virtual FX_BOOL EditCanCut(); | 122 virtual FX_BOOL EditCanCut(); |
123 virtual FX_BOOL EditCanSelectAll(); | 123 virtual FX_BOOL EditCanSelectAll(); |
124 virtual FX_BOOL EditCopy(CFX_WideString& wsCopy); | 124 virtual FX_BOOL EditCopy(CFX_WideString& wsCopy); |
125 virtual FX_BOOL EditCut(CFX_WideString& wsCut); | 125 virtual FX_BOOL EditCut(CFX_WideString& wsCut); |
126 virtual FX_BOOL EditPaste(const CFX_WideString& wsPaste); | 126 virtual FX_BOOL EditPaste(const CFX_WideString& wsPaste); |
127 virtual FX_BOOL EditSelectAll(); | 127 virtual FX_BOOL EditSelectAll(); |
128 virtual FX_BOOL EditDelete(); | 128 virtual FX_BOOL EditDelete(); |
129 virtual FX_BOOL EditDeSelect(); | 129 virtual FX_BOOL EditDeSelect(); |
130 virtual FWL_ERR GetBBox(CFX_RectF& rect); | 130 virtual FWL_Error GetBBox(CFX_RectF& rect); |
131 virtual FWL_ERR EditModifyStylesEx(uint32_t dwStylesExAdded, | 131 virtual FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, |
132 uint32_t dwStylesExRemoved); | 132 uint32_t dwStylesExRemoved); |
133 | 133 |
134 protected: | 134 protected: |
135 void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); | 135 void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); |
136 FX_FLOAT GetListHeight(); | 136 FX_FLOAT GetListHeight(); |
137 void ShowDropList(FX_BOOL bActivate); | 137 void ShowDropList(FX_BOOL bActivate); |
138 FX_BOOL IsDropListShowed(); | 138 FX_BOOL IsDropListShowed(); |
139 FX_BOOL IsDropDownStyle() const; | 139 FX_BOOL IsDropDownStyle() const; |
140 void MatchEditText(); | 140 void MatchEditText(); |
141 void SynchrEditText(int32_t iListItem); | 141 void SynchrEditText(int32_t iListItem); |
142 void Layout(); | 142 void Layout(); |
143 void ReSetTheme(); | 143 void ReSetTheme(); |
144 void ReSetEditAlignment(); | 144 void ReSetEditAlignment(); |
145 void ReSetListItemAlignment(); | 145 void ReSetListItemAlignment(); |
146 void ProcessSelChanged(FX_BOOL bLButtonUp); | 146 void ProcessSelChanged(FX_BOOL bLButtonUp); |
147 void InitProxyForm(); | 147 void InitProxyForm(); |
148 FWL_ERR DisForm_Initialize(); | 148 FWL_Error DisForm_Initialize(); |
149 void DisForm_InitComboList(); | 149 void DisForm_InitComboList(); |
150 void DisForm_InitComboEdit(); | 150 void DisForm_InitComboEdit(); |
151 void DisForm_ShowDropList(FX_BOOL bActivate); | 151 void DisForm_ShowDropList(FX_BOOL bActivate); |
152 FX_BOOL DisForm_IsDropListShowed(); | 152 FX_BOOL DisForm_IsDropListShowed(); |
153 FWL_ERR DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, | 153 FWL_Error DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, |
154 uint32_t dwStylesExRemoved); | 154 uint32_t dwStylesExRemoved); |
155 FWL_ERR DisForm_Update(); | 155 FWL_Error DisForm_Update(); |
156 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); | 156 FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); |
157 FWL_ERR DisForm_DrawWidget(CFX_Graphics* pGraphics, | 157 FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, |
158 const CFX_Matrix* pMatrix = NULL); | 158 const CFX_Matrix* pMatrix = NULL); |
159 FWL_ERR DisForm_GetBBox(CFX_RectF& rect); | 159 FWL_Error DisForm_GetBBox(CFX_RectF& rect); |
160 void DisForm_Layout(); | 160 void DisForm_Layout(); |
161 | 161 |
162 CFX_RectF m_rtClient; | 162 CFX_RectF m_rtClient; |
163 CFX_RectF m_rtContent; | 163 CFX_RectF m_rtContent; |
164 CFX_RectF m_rtBtn; | 164 CFX_RectF m_rtBtn; |
165 CFX_RectF m_rtList; | 165 CFX_RectF m_rtList; |
166 CFX_RectF m_rtProxy; | 166 CFX_RectF m_rtProxy; |
167 CFX_RectF m_rtHandler; | 167 CFX_RectF m_rtHandler; |
168 std::unique_ptr<IFWL_Edit> m_pEdit; | 168 std::unique_ptr<IFWL_Edit> m_pEdit; |
169 std::unique_ptr<IFWL_ListBox> m_pListBox; | 169 std::unique_ptr<IFWL_ListBox> m_pListBox; |
(...skipping 11 matching lines...) Expand all Loading... |
181 friend class CFWL_ComboListImp; | 181 friend class CFWL_ComboListImp; |
182 friend class CFWL_ComboEditImp; | 182 friend class CFWL_ComboEditImp; |
183 friend class CFWL_ComboEditImpDelegate; | 183 friend class CFWL_ComboEditImpDelegate; |
184 friend class CFWL_ComboListImpDelegate; | 184 friend class CFWL_ComboListImpDelegate; |
185 friend class CFWL_ComboBoxImpDelegate; | 185 friend class CFWL_ComboBoxImpDelegate; |
186 friend class CFWL_ComboProxyImpDelegate; | 186 friend class CFWL_ComboProxyImpDelegate; |
187 }; | 187 }; |
188 class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { | 188 class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { |
189 public: | 189 public: |
190 CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner); | 190 CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner); |
191 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 191 void OnProcessMessage(CFWL_Message* pMessage) override; |
192 FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; | 192 void OnProcessEvent(CFWL_Event* pEvent) override; |
193 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | 193 void OnDrawWidget(CFX_Graphics* pGraphics, |
194 const CFX_Matrix* pMatrix = NULL) override; | 194 const CFX_Matrix* pMatrix = NULL) override; |
195 | 195 |
196 protected: | 196 protected: |
197 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 197 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
198 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 198 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
199 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 199 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
200 void OnMouseMove(CFWL_MsgMouse* pMsg); | 200 void OnMouseMove(CFWL_MsgMouse* pMsg); |
201 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 201 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
202 void OnKey(CFWL_MsgKey* pMsg); | 202 void OnKey(CFWL_MsgKey* pMsg); |
203 void DoSubCtrlKey(CFWL_MsgKey* pMsg); | 203 void DoSubCtrlKey(CFWL_MsgKey* pMsg); |
204 | 204 |
205 protected: | 205 protected: |
206 int32_t DisForm_OnProcessMessage(CFWL_Message* pMessage); | 206 void DisForm_OnProcessMessage(CFWL_Message* pMessage); |
207 void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg); | 207 void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg); |
208 void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 208 void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
209 void DisForm_OnKey(CFWL_MsgKey* pMsg); | 209 void DisForm_OnKey(CFWL_MsgKey* pMsg); |
210 | 210 |
211 protected: | 211 protected: |
212 CFWL_ComboBoxImp* m_pOwner; | 212 CFWL_ComboBoxImp* m_pOwner; |
213 friend class CFWL_ComboEditImpDelegate; | 213 friend class CFWL_ComboEditImpDelegate; |
214 friend class CFWL_ComboListImpDelegate; | 214 friend class CFWL_ComboListImpDelegate; |
215 }; | 215 }; |
216 class CFWL_ComboProxyImpDelegate : public CFWL_WidgetImpDelegate { | 216 class CFWL_ComboProxyImpDelegate : public CFWL_WidgetImpDelegate { |
217 public: | 217 public: |
218 CFWL_ComboProxyImpDelegate(IFWL_Form* pForm, CFWL_ComboBoxImp* pComboBox); | 218 CFWL_ComboProxyImpDelegate(IFWL_Form* pForm, CFWL_ComboBoxImp* pComboBox); |
219 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 219 void OnProcessMessage(CFWL_Message* pMessage) override; |
220 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | 220 void OnDrawWidget(CFX_Graphics* pGraphics, |
221 const CFX_Matrix* pMatrix = NULL) override; | 221 const CFX_Matrix* pMatrix = NULL) override; |
222 void Reset() { m_bLButtonUpSelf = FALSE; } | 222 void Reset() { m_bLButtonUpSelf = FALSE; } |
223 | 223 |
224 protected: | 224 protected: |
225 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 225 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
226 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 226 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
227 void OnMouseMove(CFWL_MsgMouse* pMsg); | 227 void OnMouseMove(CFWL_MsgMouse* pMsg); |
228 void OnDeactive(CFWL_MsgDeactivate* pMsg); | 228 void OnDeactive(CFWL_MsgDeactivate* pMsg); |
229 void OnFocusChanged(CFWL_MsgKillFocus* pMsg, FX_BOOL bSet); | 229 void OnFocusChanged(CFWL_MsgKillFocus* pMsg, FX_BOOL bSet); |
230 FX_BOOL m_bLButtonDown; | 230 FX_BOOL m_bLButtonDown; |
231 FX_BOOL m_bLButtonUpSelf; | 231 FX_BOOL m_bLButtonUpSelf; |
232 FX_FLOAT m_fStartPos; | 232 FX_FLOAT m_fStartPos; |
233 IFWL_Form* m_pForm; | 233 IFWL_Form* m_pForm; |
234 CFWL_ComboBoxImp* m_pComboBox; | 234 CFWL_ComboBoxImp* m_pComboBox; |
235 }; | 235 }; |
236 | 236 |
237 #endif // XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_ | 237 #endif // XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_ |
OLD | NEW |