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

Side by Side Diff: xfa/fwl/basewidget/fwl_comboboximp.cpp

Issue 1943413002: Convert FWL_ERR into an enum class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@bcdattribute
Patch Set: Rebase to master Created 4 years, 7 months 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/basewidget/fwl_comboboximp.h ('k') | xfa/fwl/basewidget/fwl_datetimepickerimp.h » ('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 #include "xfa/fwl/basewidget/fwl_comboboximp.h" 7 #include "xfa/fwl/basewidget/fwl_comboboximp.h"
8 8
9 #include "xfa/fde/tto/fde_textout.h" 9 #include "xfa/fde/tto/fde_textout.h"
10 #include "xfa/fee/fde_txtedtengine.h" 10 #include "xfa/fee/fde_txtedtengine.h"
(...skipping 19 matching lines...) Expand all
30 IFWL_ComboBox* pComboBox = new IFWL_ComboBox; 30 IFWL_ComboBox* pComboBox = new IFWL_ComboBox;
31 CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, nullptr); 31 CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, nullptr);
32 pComboBox->SetImpl(pComboBoxImpl); 32 pComboBox->SetImpl(pComboBoxImpl);
33 pComboBoxImpl->SetInterface(pComboBox); 33 pComboBoxImpl->SetInterface(pComboBox);
34 return pComboBox; 34 return pComboBox;
35 } 35 }
36 IFWL_ComboBox::IFWL_ComboBox() {} 36 IFWL_ComboBox::IFWL_ComboBox() {}
37 int32_t IFWL_ComboBox::GetCurSel() { 37 int32_t IFWL_ComboBox::GetCurSel() {
38 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetCurSel(); 38 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetCurSel();
39 } 39 }
40 FWL_ERR IFWL_ComboBox::SetCurSel(int32_t iSel) { 40 FWL_Error IFWL_ComboBox::SetCurSel(int32_t iSel) {
41 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetCurSel(iSel); 41 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetCurSel(iSel);
42 } 42 }
43 FWL_ERR IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { 43 FWL_Error IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
44 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetEditText(wsText); 44 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetEditText(wsText);
45 } 45 }
46 int32_t IFWL_ComboBox::GetEditTextLength() const { 46 int32_t IFWL_ComboBox::GetEditTextLength() const {
47 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetEditTextLength(); 47 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetEditTextLength();
48 } 48 }
49 FWL_ERR IFWL_ComboBox::GetEditText(CFX_WideString& wsText, 49 FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText,
50 int32_t nStart, 50 int32_t nStart,
51 int32_t nCount) const { 51 int32_t nCount) const {
52 return static_cast<CFWL_ComboBoxImp*>(GetImpl()) 52 return static_cast<CFWL_ComboBoxImp*>(GetImpl())
53 ->GetEditText(wsText, nStart, nCount); 53 ->GetEditText(wsText, nStart, nCount);
54 } 54 }
55 FWL_ERR IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { 55 FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) {
56 return static_cast<CFWL_ComboBoxImp*>(GetImpl()) 56 return static_cast<CFWL_ComboBoxImp*>(GetImpl())
57 ->SetEditSelRange(nStart, nCount); 57 ->SetEditSelRange(nStart, nCount);
58 } 58 }
59 int32_t IFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) { 59 int32_t IFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
60 return static_cast<CFWL_ComboBoxImp*>(GetImpl()) 60 return static_cast<CFWL_ComboBoxImp*>(GetImpl())
61 ->GetEditSelRange(nIndex, nStart); 61 ->GetEditSelRange(nIndex, nStart);
62 } 62 }
63 int32_t IFWL_ComboBox::GetEditLimit() { 63 int32_t IFWL_ComboBox::GetEditLimit() {
64 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetEditLimit(); 64 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetEditLimit();
65 } 65 }
66 FWL_ERR IFWL_ComboBox::SetEditLimit(int32_t nLimit) { 66 FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) {
67 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetEditLimit(nLimit); 67 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetEditLimit(nLimit);
68 } 68 }
69 FWL_ERR IFWL_ComboBox::EditDoClipboard(int32_t iCmd) { 69 FWL_Error IFWL_ComboBox::EditDoClipboard(int32_t iCmd) {
70 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDoClipboard(iCmd); 70 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDoClipboard(iCmd);
71 } 71 }
72 FX_BOOL IFWL_ComboBox::EditRedo(const CFX_ByteStringC& bsRecord) { 72 FX_BOOL IFWL_ComboBox::EditRedo(const CFX_ByteStringC& bsRecord) {
73 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditRedo(bsRecord); 73 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditRedo(bsRecord);
74 } 74 }
75 FX_BOOL IFWL_ComboBox::EditUndo(const CFX_ByteStringC& bsRecord) { 75 FX_BOOL IFWL_ComboBox::EditUndo(const CFX_ByteStringC& bsRecord) {
76 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditUndo(bsRecord); 76 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditUndo(bsRecord);
77 } 77 }
78 IFWL_ListBox* IFWL_ComboBox::GetListBoxt() { 78 IFWL_ListBox* IFWL_ComboBox::GetListBoxt() {
79 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetListBoxt(); 79 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetListBoxt();
80 } 80 }
81 FX_BOOL IFWL_ComboBox::AfterFocusShowDropList() { 81 FX_BOOL IFWL_ComboBox::AfterFocusShowDropList() {
82 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->AfterFocusShowDropList(); 82 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->AfterFocusShowDropList();
83 } 83 }
84 FX_ERR IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { 84 FWL_Error IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) {
85 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->OpenDropDownList(bActivate); 85 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->OpenDropDownList(bActivate);
86 } 86 }
87 FX_BOOL IFWL_ComboBox::EditCanUndo() { 87 FX_BOOL IFWL_ComboBox::EditCanUndo() {
88 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanUndo(); 88 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanUndo();
89 } 89 }
90 FX_BOOL IFWL_ComboBox::EditCanRedo() { 90 FX_BOOL IFWL_ComboBox::EditCanRedo() {
91 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanRedo(); 91 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanRedo();
92 } 92 }
93 FX_BOOL IFWL_ComboBox::EditUndo() { 93 FX_BOOL IFWL_ComboBox::EditUndo() {
94 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditUndo(); 94 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditUndo();
(...skipping 21 matching lines...) Expand all
116 } 116 }
117 FX_BOOL IFWL_ComboBox::EditSelectAll() { 117 FX_BOOL IFWL_ComboBox::EditSelectAll() {
118 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditSelectAll(); 118 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditSelectAll();
119 } 119 }
120 FX_BOOL IFWL_ComboBox::EditDelete() { 120 FX_BOOL IFWL_ComboBox::EditDelete() {
121 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDelete(); 121 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDelete();
122 } 122 }
123 FX_BOOL IFWL_ComboBox::EditDeSelect() { 123 FX_BOOL IFWL_ComboBox::EditDeSelect() {
124 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDeSelect(); 124 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDeSelect();
125 } 125 }
126 FWL_ERR IFWL_ComboBox::GetBBox(CFX_RectF& rect) { 126 FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) {
127 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetBBox(rect); 127 return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetBBox(rect);
128 } 128 }
129 FWL_ERR IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, 129 FWL_Error IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
130 uint32_t dwStylesExRemoved) { 130 uint32_t dwStylesExRemoved) {
131 return static_cast<CFWL_ComboBoxImp*>(GetImpl()) 131 return static_cast<CFWL_ComboBoxImp*>(GetImpl())
132 ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); 132 ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
133 } 133 }
134 134
135 CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties, 135 CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties,
136 IFWL_Widget* pOuter) 136 IFWL_Widget* pOuter)
137 : CFWL_EditImp(properties, pOuter) { 137 : CFWL_EditImp(properties, pOuter) {
138 m_pOuter = static_cast<CFWL_ComboBoxImp*>(pOuter->GetImpl()); 138 m_pOuter = static_cast<CFWL_ComboBoxImp*>(pOuter->GetImpl());
139 } 139 }
140 140
141 CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner) 141 CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner)
142 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} 142 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {}
143 143
144 int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 144 void CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
145 if (!pMessage) 145 if (!pMessage)
146 return 0; 146 return;
147 147
148 FX_BOOL backDefault = TRUE; 148 FX_BOOL backDefault = TRUE;
149 switch (pMessage->GetClassID()) { 149 switch (pMessage->GetClassID()) {
150 case CFWL_MessageType::SetFocus: { 150 case CFWL_MessageType::SetFocus: {
151 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; 151 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
152 backDefault = FALSE; 152 backDefault = FALSE;
153 break; 153 break;
154 } 154 }
155 case CFWL_MessageType::KillFocus: { 155 case CFWL_MessageType::KillFocus: {
156 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; 156 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
157 backDefault = FALSE; 157 backDefault = FALSE;
158 break; 158 break;
159 } 159 }
160 case CFWL_MessageType::Mouse: { 160 case CFWL_MessageType::Mouse: {
161 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 161 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
162 if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) && 162 if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) &&
163 ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) { 163 ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) {
164 m_pOwner->SetSelected(); 164 m_pOwner->SetSelected();
165 m_pOwner->SetComboBoxFocus(TRUE); 165 m_pOwner->SetComboBoxFocus(TRUE);
166 } 166 }
167 break; 167 break;
168 } 168 }
169 default: 169 default:
170 break; 170 break;
171 } 171 }
172 if (!backDefault) 172 if (!backDefault)
Tom Sepez 2016/05/04 20:40:14 nit: or just: if (backDefault) CFWL_....();
dsinclair 2016/05/04 21:13:07 Done.
173 return 1; 173 return;
174 return CFWL_EditImpDelegate::OnProcessMessage(pMessage); 174
175 CFWL_EditImpDelegate::OnProcessMessage(pMessage);
175 } 176 }
176 177
177 void CFWL_ComboEditImp::ClearSelected() { 178 void CFWL_ComboEditImp::ClearSelected() {
178 ClearSelections(); 179 ClearSelections();
179 Repaint(&m_rtClient); 180 Repaint(&m_rtClient);
180 } 181 }
181 void CFWL_ComboEditImp::SetSelected() { 182 void CFWL_ComboEditImp::SetSelected() {
182 FlagFocus(TRUE); 183 FlagFocus(TRUE);
183 EndCaret(); 184 EndCaret();
184 AddSelRange(0); 185 AddSelRange(0);
(...skipping 10 matching lines...) Expand all
195 } 196 }
196 } 197 }
197 void CFWL_ComboEditImp::SetComboBoxFocus(FX_BOOL bSet) { 198 void CFWL_ComboEditImp::SetComboBoxFocus(FX_BOOL bSet) {
198 m_pOuter->SetFocus(bSet); 199 m_pOuter->SetFocus(bSet);
199 } 200 }
200 CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, 201 CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties,
201 IFWL_Widget* pOuter) 202 IFWL_Widget* pOuter)
202 : CFWL_ListBoxImp(properties, pOuter), m_bNotifyOwner(TRUE) { 203 : CFWL_ListBoxImp(properties, pOuter), m_bNotifyOwner(TRUE) {
203 ASSERT(pOuter != NULL); 204 ASSERT(pOuter != NULL);
204 } 205 }
205 FWL_ERR CFWL_ComboListImp::Initialize() { 206 FWL_Error CFWL_ComboListImp::Initialize() {
206 if (CFWL_ListBoxImp::Initialize() != FWL_ERR_Succeeded) 207 if (CFWL_ListBoxImp::Initialize() != FWL_Error::Succeeded)
207 return FWL_ERR_Indefinite; 208 return FWL_Error::Indefinite;
208 delete m_pDelegate; 209 delete m_pDelegate;
209 m_pDelegate = new CFWL_ComboListImpDelegate(this); 210 m_pDelegate = new CFWL_ComboListImpDelegate(this);
210 return FWL_ERR_Succeeded; 211 return FWL_Error::Succeeded;
211 } 212 }
212 FWL_ERR CFWL_ComboListImp::Finalize() { 213 FWL_Error CFWL_ComboListImp::Finalize() {
213 delete m_pDelegate; 214 delete m_pDelegate;
214 m_pDelegate = nullptr; 215 m_pDelegate = nullptr;
215 return CFWL_ListBoxImp::Finalize(); 216 return CFWL_ListBoxImp::Finalize();
216 } 217 }
217 int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) { 218 int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) {
218 if (wsMatch.IsEmpty()) { 219 if (wsMatch.IsEmpty()) {
219 return -1; 220 return -1;
220 } 221 }
221 if (!m_pProperties->m_pDataProvider) 222 if (!m_pProperties->m_pDataProvider)
222 return -1; 223 return -1;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 return; 280 return;
280 pOwner->TransformTo(m_pOuter, fx, fy); 281 pOwner->TransformTo(m_pOuter, fx, fy);
281 } 282 }
282 void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) { 283 void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) {
283 CFWL_WidgetImp::SetFocus(bSet); 284 CFWL_WidgetImp::SetFocus(bSet);
284 } 285 }
285 286
286 CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner) 287 CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner)
287 : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {} 288 : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {}
288 289
289 int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 290 void CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
290 if (!pMessage) 291 if (!pMessage)
291 return 0; 292 return;
292 293
293 CFWL_MessageType dwHashCode = pMessage->GetClassID(); 294 CFWL_MessageType dwHashCode = pMessage->GetClassID();
294 FX_BOOL backDefault = TRUE; 295 FX_BOOL backDefault = TRUE;
295 if (dwHashCode == CFWL_MessageType::SetFocus || 296 if (dwHashCode == CFWL_MessageType::SetFocus ||
296 dwHashCode == CFWL_MessageType::KillFocus) { 297 dwHashCode == CFWL_MessageType::KillFocus) {
297 OnDropListFocusChanged(pMessage, dwHashCode == CFWL_MessageType::SetFocus); 298 OnDropListFocusChanged(pMessage, dwHashCode == CFWL_MessageType::SetFocus);
298 } else if (dwHashCode == CFWL_MessageType::Mouse) { 299 } else if (dwHashCode == CFWL_MessageType::Mouse) {
299 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 300 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
300 if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { 301 if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
301 CFX_RectF rect; 302 CFX_RectF rect;
302 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); 303 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
303 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { 304 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
304 pMsg->m_fx -= rect.left; 305 pMsg->m_fx -= rect.left;
305 pMsg->m_fy -= rect.top; 306 pMsg->m_fy -= rect.top;
306 IFWL_WidgetDelegate* pDelegate = 307 IFWL_WidgetDelegate* pDelegate =
307 m_pOwner->m_pVertScrollBar->SetDelegate(NULL); 308 m_pOwner->m_pVertScrollBar->SetDelegate(NULL);
308 return pDelegate->OnProcessMessage(pMsg); 309 pDelegate->OnProcessMessage(pMsg);
310 return;
309 } 311 }
310 } 312 }
311 switch (pMsg->m_dwCmd) { 313 switch (pMsg->m_dwCmd) {
312 case FWL_MouseCommand::Move: { 314 case FWL_MouseCommand::Move: {
313 backDefault = FALSE; 315 backDefault = FALSE;
314 OnDropListMouseMove(pMsg); 316 OnDropListMouseMove(pMsg);
315 break; 317 break;
316 } 318 }
317 case FWL_MouseCommand::LeftButtonDown: { 319 case FWL_MouseCommand::LeftButtonDown: {
318 backDefault = FALSE; 320 backDefault = FALSE;
319 OnDropListLButtonDown(pMsg); 321 OnDropListLButtonDown(pMsg);
320 break; 322 break;
321 } 323 }
322 case FWL_MouseCommand::LeftButtonUp: { 324 case FWL_MouseCommand::LeftButtonUp: {
323 backDefault = FALSE; 325 backDefault = FALSE;
324 OnDropListLButtonUp(pMsg); 326 OnDropListLButtonUp(pMsg);
325 break; 327 break;
326 } 328 }
327 default: 329 default:
328 break; 330 break;
329 } 331 }
330 } else if (dwHashCode == CFWL_MessageType::Key) { 332 } else if (dwHashCode == CFWL_MessageType::Key) {
331 backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage)); 333 backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage));
332 } 334 }
333 if (!backDefault) 335 if (!backDefault)
334 return 1; 336 return;
335 return CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); 337
338 CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage);
336 } 339 }
337 340
338 void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg, 341 void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg,
339 FX_BOOL bSet) { 342 FX_BOOL bSet) {
340 if (!bSet) { 343 if (!bSet) {
341 CFWL_MsgKillFocus* pKill = static_cast<CFWL_MsgKillFocus*>(pMsg); 344 CFWL_MsgKillFocus* pKill = static_cast<CFWL_MsgKillFocus*>(pMsg);
342 CFWL_ComboBoxImp* pOuter = 345 CFWL_ComboBoxImp* pOuter =
343 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); 346 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
344 if (pKill->m_pSetFocus == m_pOwner->m_pOuter || 347 if (pKill->m_pSetFocus == m_pOwner->m_pOuter ||
345 pKill->m_pSetFocus == pOuter->m_pEdit.get()) { 348 pKill->m_pSetFocus == pOuter->m_pEdit.get()) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 m_pForm(NULL), 479 m_pForm(NULL),
477 m_bLButtonDown(FALSE), 480 m_bLButtonDown(FALSE),
478 m_iCurSel(-1), 481 m_iCurSel(-1),
479 m_iBtnState(CFWL_PartState_Normal), 482 m_iBtnState(CFWL_PartState_Normal),
480 m_fComboFormHandler(0), 483 m_fComboFormHandler(0),
481 m_bNeedShowList(FALSE) { 484 m_bNeedShowList(FALSE) {
482 m_rtClient.Reset(); 485 m_rtClient.Reset();
483 m_rtBtn.Reset(); 486 m_rtBtn.Reset();
484 m_rtHandler.Reset(); 487 m_rtHandler.Reset();
485 } 488 }
489
486 CFWL_ComboBoxImp::~CFWL_ComboBoxImp() {} 490 CFWL_ComboBoxImp::~CFWL_ComboBoxImp() {}
487 FWL_ERR CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const { 491
492 FWL_Error CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const {
488 wsClass = FWL_CLASS_ComboBox; 493 wsClass = FWL_CLASS_ComboBox;
489 return FWL_ERR_Succeeded; 494 return FWL_Error::Succeeded;
490 } 495 }
496
491 uint32_t CFWL_ComboBoxImp::GetClassID() const { 497 uint32_t CFWL_ComboBoxImp::GetClassID() const {
492 return FWL_CLASSHASH_ComboBox; 498 return FWL_CLASSHASH_ComboBox;
493 } 499 }
494 FWL_ERR CFWL_ComboBoxImp::Initialize() { 500
495 if (m_pWidgetMgr->IsFormDisabled()) { 501 FWL_Error CFWL_ComboBoxImp::Initialize() {
502 if (m_pWidgetMgr->IsFormDisabled())
496 return DisForm_Initialize(); 503 return DisForm_Initialize();
497 } 504 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
498 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) 505 return FWL_Error::Indefinite;
499 return FWL_WGTSTATE_Invisible; // Probably a bug; not a FWL_ERR_ value. 506
500 m_pDelegate = new CFWL_ComboBoxImpDelegate(this); 507 m_pDelegate = new CFWL_ComboBoxImpDelegate(this);
501 CFWL_WidgetImpProperties prop; 508 CFWL_WidgetImpProperties prop;
502 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; 509 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
503 prop.m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; 510 prop.m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
504 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText) { 511 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText)
505 prop.m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon; 512 prop.m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon;
506 } 513
507 prop.m_pDataProvider = m_pProperties->m_pDataProvider; 514 prop.m_pDataProvider = m_pProperties->m_pDataProvider;
508 m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface)); 515 m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface));
509 m_pListBox->Initialize(); 516 m_pListBox->Initialize();
510 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) { 517 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) {
511 CFWL_WidgetImpProperties prop2; 518 CFWL_WidgetImpProperties prop2;
512 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop2, m_pInterface)); 519 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop2, m_pInterface));
513 m_pEdit->Initialize(); 520 m_pEdit->Initialize();
514 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface); 521 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface);
515 } 522 }
516 if (m_pEdit) { 523 if (m_pEdit)
517 m_pEdit->SetParent(m_pInterface); 524 m_pEdit->SetParent(m_pInterface);
518 } 525
519 SetStates(m_pProperties->m_dwStates); 526 SetStates(m_pProperties->m_dwStates);
520 return FWL_ERR_Succeeded; 527 return FWL_Error::Succeeded;
521 } 528 }
522 FWL_ERR CFWL_ComboBoxImp::Finalize() { 529
530 FWL_Error CFWL_ComboBoxImp::Finalize() {
523 if (m_pEdit) { 531 if (m_pEdit) {
524 m_pEdit->Finalize(); 532 m_pEdit->Finalize();
525 } 533 }
526 m_pListBox->Finalize(); 534 m_pListBox->Finalize();
527 delete m_pDelegate; 535 delete m_pDelegate;
528 m_pDelegate = nullptr; 536 m_pDelegate = nullptr;
529 return CFWL_WidgetImp::Finalize(); 537 return CFWL_WidgetImp::Finalize();
530 } 538 }
531 FWL_ERR CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { 539 FWL_Error CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
532 if (bAutoSize) { 540 if (bAutoSize) {
533 rect.Reset(); 541 rect.Reset();
534 FX_BOOL bIsDropDown = IsDropDownStyle(); 542 FX_BOOL bIsDropDown = IsDropDownStyle();
535 if (bIsDropDown && m_pEdit) { 543 if (bIsDropDown && m_pEdit) {
536 m_pEdit->GetWidgetRect(rect, TRUE); 544 m_pEdit->GetWidgetRect(rect, TRUE);
537 } else { 545 } else {
538 rect.width = 100; 546 rect.width = 100;
539 rect.height = 16; 547 rect.height = 16;
540 } 548 }
541 if (!m_pProperties->m_pThemeProvider) { 549 if (!m_pProperties->m_pThemeProvider) {
542 ReSetTheme(); 550 ReSetTheme();
543 } 551 }
544 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( 552 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>(
545 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); 553 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
546 if (!pFWidth) 554 if (!pFWidth)
547 return FWL_ERR_Indefinite; 555 return FWL_Error::Indefinite;
548 rect.Inflate(0, 0, *pFWidth, 0); 556 rect.Inflate(0, 0, *pFWidth, 0);
549 CFWL_WidgetImp::GetWidgetRect(rect, TRUE); 557 CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
550 } else { 558 } else {
551 rect = m_pProperties->m_rtWidget; 559 rect = m_pProperties->m_rtWidget;
552 } 560 }
553 return FWL_ERR_Succeeded; 561 return FWL_Error::Succeeded;
554 } 562 }
555 FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, 563 FWL_Error CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded,
556 uint32_t dwStylesExRemoved) { 564 uint32_t dwStylesExRemoved) {
557 if (m_pWidgetMgr->IsFormDisabled()) { 565 if (m_pWidgetMgr->IsFormDisabled()) {
558 return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); 566 return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
559 } 567 }
560 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; 568 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown;
561 FX_BOOL bRemoveDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; 569 FX_BOOL bRemoveDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown;
562 if (bAddDropDown && !m_pEdit) { 570 if (bAddDropDown && !m_pEdit) {
563 CFWL_WidgetImpProperties prop; 571 CFWL_WidgetImpProperties prop;
564 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr)); 572 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr));
565 m_pEdit->Initialize(); 573 m_pEdit->Initialize();
566 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface); 574 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface);
567 m_pEdit->SetParent(m_pInterface); 575 m_pEdit->SetParent(m_pInterface);
568 } else if (bRemoveDropDown && m_pEdit) { 576 } else if (bRemoveDropDown && m_pEdit) {
569 m_pEdit->SetStates(FWL_WGTSTATE_Invisible, TRUE); 577 m_pEdit->SetStates(FWL_WGTSTATE_Invisible, TRUE);
570 } 578 }
571 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); 579 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
572 } 580 }
573 FWL_ERR CFWL_ComboBoxImp::Update() { 581 FWL_Error CFWL_ComboBoxImp::Update() {
574 if (m_pWidgetMgr->IsFormDisabled()) { 582 if (m_pWidgetMgr->IsFormDisabled()) {
575 return DisForm_Update(); 583 return DisForm_Update();
576 } 584 }
577 if (IsLocked()) { 585 if (IsLocked()) {
578 return FWL_ERR_Indefinite; 586 return FWL_Error::Indefinite;
579 } 587 }
580 ReSetTheme(); 588 ReSetTheme();
581 FX_BOOL bDropDown = IsDropDownStyle(); 589 FX_BOOL bDropDown = IsDropDownStyle();
582 if (bDropDown && m_pEdit) { 590 if (bDropDown && m_pEdit) {
583 ReSetEditAlignment(); 591 ReSetEditAlignment();
584 } 592 }
585 if (m_pProperties->m_pThemeProvider == NULL) { 593 if (m_pProperties->m_pThemeProvider == NULL) {
586 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 594 m_pProperties->m_pThemeProvider = GetAvailableTheme();
587 } 595 }
588 Layout(); 596 Layout();
589 CFWL_ThemePart part; 597 CFWL_ThemePart part;
590 part.m_pWidget = m_pInterface; 598 part.m_pWidget = m_pInterface;
591 m_fComboFormHandler = 599 m_fComboFormHandler =
592 *static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity( 600 *static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity(
593 &part, CFWL_WidgetCapacity::ComboFormHandler)); 601 &part, CFWL_WidgetCapacity::ComboFormHandler));
594 return FWL_ERR_Succeeded; 602 return FWL_Error::Succeeded;
595 } 603 }
596 FWL_WidgetHit CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { 604 FWL_WidgetHit CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
597 if (m_pWidgetMgr->IsFormDisabled()) { 605 if (m_pWidgetMgr->IsFormDisabled()) {
598 return DisForm_HitTest(fx, fy); 606 return DisForm_HitTest(fx, fy);
599 } 607 }
600 return CFWL_WidgetImp::HitTest(fx, fy); 608 return CFWL_WidgetImp::HitTest(fx, fy);
601 } 609 }
602 FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, 610 FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
603 const CFX_Matrix* pMatrix) { 611 const CFX_Matrix* pMatrix) {
604 if (m_pWidgetMgr->IsFormDisabled()) { 612 if (m_pWidgetMgr->IsFormDisabled()) {
605 return DisForm_DrawWidget(pGraphics, pMatrix); 613 return DisForm_DrawWidget(pGraphics, pMatrix);
606 } 614 }
607 if (!pGraphics) 615 if (!pGraphics)
608 return FWL_ERR_Indefinite; 616 return FWL_Error::Indefinite;
609 if (!m_pProperties->m_pThemeProvider) 617 if (!m_pProperties->m_pThemeProvider)
610 return FWL_ERR_Indefinite; 618 return FWL_Error::Indefinite;
611 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; 619 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
612 FX_BOOL bIsDropDown = IsDropDownStyle(); 620 FX_BOOL bIsDropDown = IsDropDownStyle();
613 if (HasBorder()) { 621 if (HasBorder()) {
614 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); 622 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix);
615 } 623 }
616 if (HasEdge()) { 624 if (HasEdge()) {
617 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); 625 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix);
618 } 626 }
619 if (!bIsDropDown) { 627 if (!bIsDropDown) {
620 CFX_RectF rtTextBk(m_rtClient); 628 CFX_RectF rtTextBk(m_rtClient);
(...skipping 20 matching lines...) Expand all
641 param.m_dwStates = CFWL_PartState_Disabled; 649 param.m_dwStates = CFWL_PartState_Disabled;
642 } else if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) && 650 } else if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) &&
643 (m_iCurSel >= 0)) { 651 (m_iCurSel >= 0)) {
644 param.m_dwStates = CFWL_PartState_Selected; 652 param.m_dwStates = CFWL_PartState_Selected;
645 } else { 653 } else {
646 param.m_dwStates = CFWL_PartState_Normal; 654 param.m_dwStates = CFWL_PartState_Normal;
647 } 655 }
648 pTheme->DrawBackground(&param); 656 pTheme->DrawBackground(&param);
649 if (m_iCurSel >= 0) { 657 if (m_iCurSel >= 0) {
650 if (!m_pListBox) 658 if (!m_pListBox)
651 return FWL_ERR_Indefinite; 659 return FWL_Error::Indefinite;
652 CFX_WideString wsText; 660 CFX_WideString wsText;
653 IFWL_ComboBoxDP* pData = 661 IFWL_ComboBoxDP* pData =
654 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); 662 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
655 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); 663 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel);
656 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) 664 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
657 ->GetItemText(hItem, wsText); 665 ->GetItemText(hItem, wsText);
658 CFWL_ThemeText param; 666 CFWL_ThemeText param;
659 param.m_pWidget = m_pInterface; 667 param.m_pWidget = m_pInterface;
660 param.m_iPart = CFWL_Part::Caption; 668 param.m_iPart = CFWL_Part::Caption;
661 param.m_dwStates = m_iBtnState; 669 param.m_dwStates = m_iBtnState;
(...skipping 14 matching lines...) Expand all
676 param.m_pWidget = m_pInterface; 684 param.m_pWidget = m_pInterface;
677 param.m_iPart = CFWL_Part::DropDownButton; 685 param.m_iPart = CFWL_Part::DropDownButton;
678 param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) 686 param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)
679 ? CFWL_PartState_Disabled 687 ? CFWL_PartState_Disabled
680 : m_iBtnState; 688 : m_iBtnState;
681 param.m_pGraphics = pGraphics; 689 param.m_pGraphics = pGraphics;
682 param.m_matrix.Concat(*pMatrix); 690 param.m_matrix.Concat(*pMatrix);
683 param.m_rtPart = m_rtBtn; 691 param.m_rtPart = m_rtBtn;
684 pTheme->DrawBackground(&param); 692 pTheme->DrawBackground(&param);
685 } 693 }
686 return FWL_ERR_Succeeded; 694 return FWL_Error::Succeeded;
687 } 695 }
688 FWL_ERR CFWL_ComboBoxImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { 696 FWL_Error CFWL_ComboBoxImp::SetThemeProvider(
697 IFWL_ThemeProvider* pThemeProvider) {
689 if (!pThemeProvider) 698 if (!pThemeProvider)
690 return FWL_ERR_Indefinite; 699 return FWL_Error::Indefinite;
691 m_pProperties->m_pThemeProvider = pThemeProvider; 700 m_pProperties->m_pThemeProvider = pThemeProvider;
692 if (m_pListBox && pThemeProvider->IsValidWidget(m_pListBox.get())) { 701 if (m_pListBox && pThemeProvider->IsValidWidget(m_pListBox.get())) {
693 m_pListBox->SetThemeProvider(pThemeProvider); 702 m_pListBox->SetThemeProvider(pThemeProvider);
694 } 703 }
695 if (m_pEdit && pThemeProvider->IsValidWidget(m_pEdit.get())) { 704 if (m_pEdit && pThemeProvider->IsValidWidget(m_pEdit.get())) {
696 m_pEdit->SetThemeProvider(pThemeProvider); 705 m_pEdit->SetThemeProvider(pThemeProvider);
697 } 706 }
698 return FWL_ERR_Succeeded; 707 return FWL_Error::Succeeded;
699 } 708 }
700 int32_t CFWL_ComboBoxImp::GetCurSel() { 709 int32_t CFWL_ComboBoxImp::GetCurSel() {
701 return m_iCurSel; 710 return m_iCurSel;
702 } 711 }
703 FWL_ERR CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { 712 FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) {
704 int32_t iCount = 713 int32_t iCount =
705 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->CountItems(); 714 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->CountItems();
706 FX_BOOL bClearSel = iSel < 0 || iSel >= iCount; 715 FX_BOOL bClearSel = iSel < 0 || iSel >= iCount;
707 FX_BOOL bDropDown = IsDropDownStyle(); 716 FX_BOOL bDropDown = IsDropDownStyle();
708 if (bDropDown && m_pEdit) { 717 if (bDropDown && m_pEdit) {
709 if (bClearSel) { 718 if (bClearSel) {
710 m_pEdit->SetText(CFX_WideString()); 719 m_pEdit->SetText(CFX_WideString());
711 } else { 720 } else {
712 CFX_WideString wsText; 721 CFX_WideString wsText;
713 IFWL_ComboBoxDP* pData = 722 IFWL_ComboBoxDP* pData =
714 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); 723 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
715 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel); 724 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel);
716 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) 725 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
717 ->GetItemText(hItem, wsText); 726 ->GetItemText(hItem, wsText);
718 m_pEdit->SetText(wsText); 727 m_pEdit->SetText(wsText);
719 } 728 }
720 m_pEdit->Update(); 729 m_pEdit->Update();
721 } 730 }
722 m_iCurSel = bClearSel ? -1 : iSel; 731 m_iCurSel = bClearSel ? -1 : iSel;
723 return FWL_ERR_Succeeded; 732 return FWL_Error::Succeeded;
724 } 733 }
725 FWL_ERR CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { 734 FWL_Error CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
726 FX_BOOL bIsDropDown = IsDropDownStyle(); 735 FX_BOOL bIsDropDown = IsDropDownStyle();
727 if (bIsDropDown && m_pEdit) { 736 if (bIsDropDown && m_pEdit) {
728 m_pEdit->SetStates(dwStates, bSet); 737 m_pEdit->SetStates(dwStates, bSet);
729 } 738 }
730 if (m_pListBox) { 739 if (m_pListBox) {
731 m_pListBox->SetStates(dwStates, bSet); 740 m_pListBox->SetStates(dwStates, bSet);
732 } 741 }
733 return CFWL_WidgetImp::SetStates(dwStates, bSet); 742 return CFWL_WidgetImp::SetStates(dwStates, bSet);
734 } 743 }
735 FWL_ERR CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) { 744 FWL_Error CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) {
736 if (!m_pEdit) 745 if (!m_pEdit)
737 return FWL_ERR_Indefinite; 746 return FWL_Error::Indefinite;
738 m_pEdit->SetText(wsText); 747 m_pEdit->SetText(wsText);
739 return m_pEdit->Update(); 748 return m_pEdit->Update();
740 } 749 }
741 int32_t CFWL_ComboBoxImp::GetEditTextLength() const { 750 int32_t CFWL_ComboBoxImp::GetEditTextLength() const {
742 if (!m_pEdit) 751 if (!m_pEdit)
743 return -1; 752 return -1;
744 return m_pEdit->GetTextLength(); 753 return m_pEdit->GetTextLength();
745 } 754 }
746 FWL_ERR CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, 755 FWL_Error CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText,
747 int32_t nStart, 756 int32_t nStart,
748 int32_t nCount) const { 757 int32_t nCount) const {
749 if (m_pEdit) { 758 if (m_pEdit) {
750 return m_pEdit->GetText(wsText, nStart, nCount); 759 return m_pEdit->GetText(wsText, nStart, nCount);
751 } else if (m_pListBox) { 760 } else if (m_pListBox) {
752 IFWL_ComboBoxDP* pData = 761 IFWL_ComboBoxDP* pData =
753 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); 762 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
754 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); 763 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel);
755 return m_pListBox->GetItemText(hItem, wsText); 764 return m_pListBox->GetItemText(hItem, wsText);
756 } 765 }
757 return FWL_ERR_Indefinite; 766 return FWL_Error::Indefinite;
758 } 767 }
759 FWL_ERR CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) { 768 FWL_Error CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) {
760 if (!m_pEdit) 769 if (!m_pEdit)
761 return FWL_ERR_Indefinite; 770 return FWL_Error::Indefinite;
762 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->ClearSelected(); 771 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->ClearSelected();
763 m_pEdit->AddSelRange(nStart, nCount); 772 m_pEdit->AddSelRange(nStart, nCount);
764 return FWL_ERR_Succeeded; 773 return FWL_Error::Succeeded;
765 } 774 }
766 int32_t CFWL_ComboBoxImp::GetEditSelRange(int32_t nIndex, int32_t& nStart) { 775 int32_t CFWL_ComboBoxImp::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
767 if (!m_pEdit) 776 if (!m_pEdit)
768 return -1; 777 return -1;
769 return m_pEdit->GetSelRange(nIndex, nStart); 778 return m_pEdit->GetSelRange(nIndex, nStart);
770 } 779 }
771 int32_t CFWL_ComboBoxImp::GetEditLimit() { 780 int32_t CFWL_ComboBoxImp::GetEditLimit() {
772 if (!m_pEdit) 781 if (!m_pEdit)
773 return -1; 782 return -1;
774 return m_pEdit->GetLimit(); 783 return m_pEdit->GetLimit();
775 } 784 }
776 FWL_ERR CFWL_ComboBoxImp::SetEditLimit(int32_t nLimit) { 785 FWL_Error CFWL_ComboBoxImp::SetEditLimit(int32_t nLimit) {
777 if (!m_pEdit) 786 if (!m_pEdit)
778 return FWL_ERR_Indefinite; 787 return FWL_Error::Indefinite;
779 return m_pEdit->SetLimit(nLimit); 788 return m_pEdit->SetLimit(nLimit);
780 } 789 }
781 FWL_ERR CFWL_ComboBoxImp::EditDoClipboard(int32_t iCmd) { 790 FWL_Error CFWL_ComboBoxImp::EditDoClipboard(int32_t iCmd) {
782 if (!m_pEdit) 791 if (!m_pEdit)
783 return FWL_ERR_Indefinite; 792 return FWL_Error::Indefinite;
784 return m_pEdit->DoClipboard(iCmd); 793 return m_pEdit->DoClipboard(iCmd);
785 } 794 }
786 FX_BOOL CFWL_ComboBoxImp::EditRedo(const CFX_ByteStringC& bsRecord) { 795 FX_BOOL CFWL_ComboBoxImp::EditRedo(const CFX_ByteStringC& bsRecord) {
787 if (!m_pEdit) 796 if (!m_pEdit)
788 return FALSE; 797 return FALSE;
789 return m_pEdit->Redo(bsRecord); 798 return m_pEdit->Redo(bsRecord);
790 } 799 }
791 FX_BOOL CFWL_ComboBoxImp::EditUndo(const CFX_ByteStringC& bsRecord) { 800 FX_BOOL CFWL_ComboBoxImp::EditUndo(const CFX_ByteStringC& bsRecord) {
792 if (!m_pEdit) 801 if (!m_pEdit)
793 return FALSE; 802 return FALSE;
794 return m_pEdit->Undo(bsRecord); 803 return m_pEdit->Undo(bsRecord);
795 } 804 }
796 IFWL_ListBox* CFWL_ComboBoxImp::GetListBoxt() { 805 IFWL_ListBox* CFWL_ComboBoxImp::GetListBoxt() {
797 return m_pListBox.get(); 806 return m_pListBox.get();
798 } 807 }
799 FX_BOOL CFWL_ComboBoxImp::AfterFocusShowDropList() { 808 FX_BOOL CFWL_ComboBoxImp::AfterFocusShowDropList() {
800 if (!m_bNeedShowList) { 809 if (!m_bNeedShowList) {
801 return FALSE; 810 return FALSE;
802 } 811 }
803 if (m_pEdit) { 812 if (m_pEdit) {
804 MatchEditText(); 813 MatchEditText();
805 } 814 }
806 ShowDropList(TRUE); 815 ShowDropList(TRUE);
807 m_bNeedShowList = FALSE; 816 m_bNeedShowList = FALSE;
808 return TRUE; 817 return TRUE;
809 } 818 }
810 FX_ERR CFWL_ComboBoxImp::OpenDropDownList(FX_BOOL bActivate) { 819 FWL_Error CFWL_ComboBoxImp::OpenDropDownList(FX_BOOL bActivate) {
811 ShowDropList(bActivate); 820 ShowDropList(bActivate);
812 return FWL_ERR_Succeeded; 821 return FWL_Error::Succeeded;
813 } 822 }
814 FX_BOOL CFWL_ComboBoxImp::EditCanUndo() { 823 FX_BOOL CFWL_ComboBoxImp::EditCanUndo() {
815 return m_pEdit->CanUndo(); 824 return m_pEdit->CanUndo();
816 } 825 }
817 FX_BOOL CFWL_ComboBoxImp::EditCanRedo() { 826 FX_BOOL CFWL_ComboBoxImp::EditCanRedo() {
818 return m_pEdit->CanRedo(); 827 return m_pEdit->CanRedo();
819 } 828 }
820 FX_BOOL CFWL_ComboBoxImp::EditUndo() { 829 FX_BOOL CFWL_ComboBoxImp::EditUndo() {
821 return m_pEdit->Undo(); 830 return m_pEdit->Undo();
822 } 831 }
(...skipping 15 matching lines...) Expand all
838 FX_BOOL CFWL_ComboBoxImp::EditCopy(CFX_WideString& wsCopy) { 847 FX_BOOL CFWL_ComboBoxImp::EditCopy(CFX_WideString& wsCopy) {
839 return m_pEdit->Copy(wsCopy); 848 return m_pEdit->Copy(wsCopy);
840 } 849 }
841 FX_BOOL CFWL_ComboBoxImp::EditCut(CFX_WideString& wsCut) { 850 FX_BOOL CFWL_ComboBoxImp::EditCut(CFX_WideString& wsCut) {
842 return m_pEdit->Cut(wsCut); 851 return m_pEdit->Cut(wsCut);
843 } 852 }
844 FX_BOOL CFWL_ComboBoxImp::EditPaste(const CFX_WideString& wsPaste) { 853 FX_BOOL CFWL_ComboBoxImp::EditPaste(const CFX_WideString& wsPaste) {
845 return m_pEdit->Paste(wsPaste); 854 return m_pEdit->Paste(wsPaste);
846 } 855 }
847 FX_BOOL CFWL_ComboBoxImp::EditSelectAll() { 856 FX_BOOL CFWL_ComboBoxImp::EditSelectAll() {
848 return m_pEdit->AddSelRange(0) == FWL_ERR_Succeeded; 857 return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded;
849 } 858 }
850 FX_BOOL CFWL_ComboBoxImp::EditDelete() { 859 FX_BOOL CFWL_ComboBoxImp::EditDelete() {
851 return m_pEdit->ClearText() == FWL_ERR_Succeeded; 860 return m_pEdit->ClearText() == FWL_Error::Succeeded;
852 } 861 }
853 FX_BOOL CFWL_ComboBoxImp::EditDeSelect() { 862 FX_BOOL CFWL_ComboBoxImp::EditDeSelect() {
854 return m_pEdit->ClearSelections() == FWL_ERR_Succeeded; 863 return m_pEdit->ClearSelections() == FWL_Error::Succeeded;
855 } 864 }
856 FWL_ERR CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) { 865 FWL_Error CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) {
857 if (m_pWidgetMgr->IsFormDisabled()) { 866 if (m_pWidgetMgr->IsFormDisabled()) {
858 return DisForm_GetBBox(rect); 867 return DisForm_GetBBox(rect);
859 } 868 }
860 rect = m_pProperties->m_rtWidget; 869 rect = m_pProperties->m_rtWidget;
861 if (m_pListBox && IsDropListShowed()) { 870 if (m_pListBox && IsDropListShowed()) {
862 CFX_RectF rtList; 871 CFX_RectF rtList;
863 m_pListBox->GetWidgetRect(rtList); 872 m_pListBox->GetWidgetRect(rtList);
864 rtList.Offset(rect.left, rect.top); 873 rtList.Offset(rect.left, rect.top);
865 rect.Union(rtList); 874 rect.Union(rtList);
866 } 875 }
867 return FWL_ERR_Succeeded; 876 return FWL_Error::Succeeded;
868 } 877 }
869 FWL_ERR CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded, 878 FWL_Error CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded,
870 uint32_t dwStylesExRemoved) { 879 uint32_t dwStylesExRemoved) {
871 if (m_pEdit != NULL) { 880 if (m_pEdit != NULL) {
872 return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); 881 return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
873 } else { 882 } else {
874 return FWL_ERR_Parameter_Invalid; 883 return FWL_Error::ParameterInvalid;
875 } 884 }
876 } 885 }
877 FX_FLOAT CFWL_ComboBoxImp::GetListHeight() { 886 FX_FLOAT CFWL_ComboBoxImp::GetListHeight() {
878 return static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider) 887 return static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider)
879 ->GetListHeight(m_pInterface); 888 ->GetListHeight(m_pInterface);
880 } 889 }
881 void CFWL_ComboBoxImp::DrawStretchHandler(CFX_Graphics* pGraphics, 890 void CFWL_ComboBoxImp::DrawStretchHandler(CFX_Graphics* pGraphics,
882 const CFX_Matrix* pMatrix) { 891 const CFX_Matrix* pMatrix) {
883 CFWL_ThemeBackground param; 892 CFWL_ThemeBackground param;
884 param.m_pGraphics = pGraphics; 893 param.m_pGraphics = pGraphics;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 CFWL_EvtCmbSelChanged ev; 1131 CFWL_EvtCmbSelChanged ev;
1123 ev.bLButtonUp = bLButtonUp; 1132 ev.bLButtonUp = bLButtonUp;
1124 ev.m_pSrcTarget = m_pInterface; 1133 ev.m_pSrcTarget = m_pInterface;
1125 ev.iArraySels.Add(m_iCurSel); 1134 ev.iArraySels.Add(m_iCurSel);
1126 DispatchEvent(&ev); 1135 DispatchEvent(&ev);
1127 } 1136 }
1128 } else { 1137 } else {
1129 Repaint(&m_rtClient); 1138 Repaint(&m_rtClient);
1130 } 1139 }
1131 } 1140 }
1141
1132 void CFWL_ComboBoxImp::InitProxyForm() { 1142 void CFWL_ComboBoxImp::InitProxyForm() {
1133 if (m_pForm) 1143 if (m_pForm)
1134 return; 1144 return;
1135 if (!m_pListBox) 1145 if (!m_pListBox)
1136 return; 1146 return;
1147
1137 CFWL_WidgetImpProperties propForm; 1148 CFWL_WidgetImpProperties propForm;
1138 propForm.m_pOwner = m_pInterface; 1149 propForm.m_pOwner = m_pInterface;
1139 propForm.m_dwStyles = FWL_WGTSTYLE_Popup; 1150 propForm.m_dwStyles = FWL_WGTSTYLE_Popup;
1140 propForm.m_dwStates = FWL_WGTSTATE_Invisible; 1151 propForm.m_dwStates = FWL_WGTSTATE_Invisible;
1141 CFX_WideString className; 1152 CFX_WideString className;
1142 m_pForm = IFWL_Form::CreateFormProxy(propForm, &className, m_pListBox.get()); 1153 m_pForm = IFWL_Form::CreateFormProxy(propForm, &className, m_pListBox.get());
1143 m_pForm->Initialize(); 1154 m_pForm->Initialize();
1144 m_pProxy = static_cast<CFWL_FormProxyImp*>(m_pForm->GetImpl()); 1155 m_pProxy = static_cast<CFWL_FormProxyImp*>(m_pForm->GetImpl());
1145 m_pListBox->SetParent(m_pForm); 1156 m_pListBox->SetParent(m_pForm);
1146 m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this); 1157 m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this);
1147 m_pProxy->SetDelegate(m_pListProxyDelegate); 1158 m_pProxy->SetDelegate(m_pListProxyDelegate);
1148 } 1159 }
1149 FWL_ERR CFWL_ComboBoxImp::DisForm_Initialize() { 1160
1150 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) 1161 FWL_Error CFWL_ComboBoxImp::DisForm_Initialize() {
1151 return FWL_WGTSTATE_Invisible; // Ditto. 1162 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
1163 return FWL_Error::Indefinite;
1164
1152 m_pDelegate = new CFWL_ComboBoxImpDelegate(this); 1165 m_pDelegate = new CFWL_ComboBoxImpDelegate(this);
1153 DisForm_InitComboList(); 1166 DisForm_InitComboList();
1154 DisForm_InitComboEdit(); 1167 DisForm_InitComboEdit();
1155 return FWL_ERR_Succeeded; 1168 return FWL_Error::Succeeded;
1156 } 1169 }
1170
1157 void CFWL_ComboBoxImp::DisForm_InitComboList() { 1171 void CFWL_ComboBoxImp::DisForm_InitComboList() {
1158 if (m_pListBox) { 1172 if (m_pListBox)
1159 return; 1173 return;
1160 } 1174
1161 CFWL_WidgetImpProperties prop; 1175 CFWL_WidgetImpProperties prop;
1162 prop.m_pParent = m_pInterface; 1176 prop.m_pParent = m_pInterface;
1163 prop.m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; 1177 prop.m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
1164 prop.m_dwStates = FWL_WGTSTATE_Invisible; 1178 prop.m_dwStates = FWL_WGTSTATE_Invisible;
1165 prop.m_pDataProvider = m_pProperties->m_pDataProvider; 1179 prop.m_pDataProvider = m_pProperties->m_pDataProvider;
1166 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; 1180 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
1167 m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface)); 1181 m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface));
1168 m_pListBox->Initialize(); 1182 m_pListBox->Initialize();
1169 } 1183 }
1170 void CFWL_ComboBoxImp::DisForm_InitComboEdit() { 1184 void CFWL_ComboBoxImp::DisForm_InitComboEdit() {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 DispatchEvent(&postEvent); 1234 DispatchEvent(&postEvent);
1221 } 1235 }
1222 CFX_RectF rect; 1236 CFX_RectF rect;
1223 m_pListBox->GetWidgetRect(rect); 1237 m_pListBox->GetWidgetRect(rect);
1224 rect.Inflate(2, 2); 1238 rect.Inflate(2, 2);
1225 Repaint(&rect); 1239 Repaint(&rect);
1226 } 1240 }
1227 FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() { 1241 FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() {
1228 return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); 1242 return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible);
1229 } 1243 }
1230 FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, 1244 FWL_Error CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
1231 uint32_t dwStylesExRemoved) { 1245 uint32_t dwStylesExRemoved) {
1232 if (!m_pEdit) { 1246 if (!m_pEdit) {
1233 DisForm_InitComboEdit(); 1247 DisForm_InitComboEdit();
1234 } 1248 }
1235 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; 1249 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown;
1236 FX_BOOL bDelDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; 1250 FX_BOOL bDelDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown;
1237 dwStylesExRemoved &= ~FWL_STYLEEXT_CMB_DropDown; 1251 dwStylesExRemoved &= ~FWL_STYLEEXT_CMB_DropDown;
1238 m_pProperties->m_dwStyleExes |= FWL_STYLEEXT_CMB_DropDown; 1252 m_pProperties->m_dwStyleExes |= FWL_STYLEEXT_CMB_DropDown;
1239 if (bAddDropDown) { 1253 if (bAddDropDown) {
1240 m_pEdit->ModifyStylesEx(0, FWL_STYLEEXT_EDT_ReadOnly); 1254 m_pEdit->ModifyStylesEx(0, FWL_STYLEEXT_EDT_ReadOnly);
1241 } else if (bDelDropDown) { 1255 } else if (bDelDropDown) {
1242 m_pEdit->ModifyStylesEx(FWL_STYLEEXT_EDT_ReadOnly, 0); 1256 m_pEdit->ModifyStylesEx(FWL_STYLEEXT_EDT_ReadOnly, 0);
1243 } 1257 }
1244 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); 1258 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
1245 } 1259 }
1246 FWL_ERR CFWL_ComboBoxImp::DisForm_Update() { 1260 FWL_Error CFWL_ComboBoxImp::DisForm_Update() {
1247 if (m_iLock) { 1261 if (m_iLock) {
1248 return FWL_ERR_Indefinite; 1262 return FWL_Error::Indefinite;
1249 } 1263 }
1250 if (m_pEdit) { 1264 if (m_pEdit) {
1251 ReSetEditAlignment(); 1265 ReSetEditAlignment();
1252 } 1266 }
1253 ReSetTheme(); 1267 ReSetTheme();
1254 Layout(); 1268 Layout();
1255 return FWL_ERR_Succeeded; 1269 return FWL_Error::Succeeded;
1256 } 1270 }
1257 FWL_WidgetHit CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { 1271 FWL_WidgetHit CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
1258 CFX_RectF rect; 1272 CFX_RectF rect;
1259 rect.Set(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width, 1273 rect.Set(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width,
1260 m_pProperties->m_rtWidget.height); 1274 m_pProperties->m_rtWidget.height);
1261 if (rect.Contains(fx, fy)) 1275 if (rect.Contains(fx, fy))
1262 return FWL_WidgetHit::Edit; 1276 return FWL_WidgetHit::Edit;
1263 if (m_rtBtn.Contains(fx, fy)) 1277 if (m_rtBtn.Contains(fx, fy))
1264 return FWL_WidgetHit::Client; 1278 return FWL_WidgetHit::Client;
1265 if (DisForm_IsDropListShowed()) { 1279 if (DisForm_IsDropListShowed()) {
1266 m_pListBox->GetWidgetRect(rect); 1280 m_pListBox->GetWidgetRect(rect);
1267 if (rect.Contains(fx, fy)) 1281 if (rect.Contains(fx, fy))
1268 return FWL_WidgetHit::Client; 1282 return FWL_WidgetHit::Client;
1269 } 1283 }
1270 return FWL_WidgetHit::Unknown; 1284 return FWL_WidgetHit::Unknown;
1271 } 1285 }
1272 FWL_ERR CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, 1286 FWL_Error CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics,
1273 const CFX_Matrix* pMatrix) { 1287 const CFX_Matrix* pMatrix) {
1274 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; 1288 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
1275 CFX_Matrix mtOrg; 1289 CFX_Matrix mtOrg;
1276 mtOrg.Set(1, 0, 0, 1, 0, 0); 1290 mtOrg.Set(1, 0, 0, 1, 0, 0);
1277 if (pMatrix) { 1291 if (pMatrix) {
1278 mtOrg = *pMatrix; 1292 mtOrg = *pMatrix;
1279 } 1293 }
1280 FX_BOOL bListShowed = m_pListBox && DisForm_IsDropListShowed(); 1294 FX_BOOL bListShowed = m_pListBox && DisForm_IsDropListShowed();
1281 pGraphics->SaveGraphState(); 1295 pGraphics->SaveGraphState();
1282 pGraphics->ConcatMatrix(&mtOrg); 1296 pGraphics->ConcatMatrix(&mtOrg);
1283 if (!m_rtBtn.IsEmpty(0.1f)) { 1297 if (!m_rtBtn.IsEmpty(0.1f)) {
(...skipping 15 matching lines...) Expand all
1299 m_pEdit->DrawWidget(pGraphics, &mt); 1313 m_pEdit->DrawWidget(pGraphics, &mt);
1300 } 1314 }
1301 if (bListShowed) { 1315 if (bListShowed) {
1302 CFX_RectF rtList; 1316 CFX_RectF rtList;
1303 m_pListBox->GetWidgetRect(rtList); 1317 m_pListBox->GetWidgetRect(rtList);
1304 CFX_Matrix mt; 1318 CFX_Matrix mt;
1305 mt.Set(1, 0, 0, 1, rtList.left, rtList.top); 1319 mt.Set(1, 0, 0, 1, rtList.left, rtList.top);
1306 mt.Concat(mtOrg); 1320 mt.Concat(mtOrg);
1307 m_pListBox->DrawWidget(pGraphics, &mt); 1321 m_pListBox->DrawWidget(pGraphics, &mt);
1308 } 1322 }
1309 return FWL_ERR_Succeeded; 1323 return FWL_Error::Succeeded;
1310 } 1324 }
1311 FWL_ERR CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) { 1325 FWL_Error CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) {
1312 rect = m_pProperties->m_rtWidget; 1326 rect = m_pProperties->m_rtWidget;
1313 if (m_pListBox && DisForm_IsDropListShowed()) { 1327 if (m_pListBox && DisForm_IsDropListShowed()) {
1314 CFX_RectF rtList; 1328 CFX_RectF rtList;
1315 m_pListBox->GetWidgetRect(rtList); 1329 m_pListBox->GetWidgetRect(rtList);
1316 rtList.Offset(rect.left, rect.top); 1330 rtList.Offset(rect.left, rect.top);
1317 rect.Union(rtList); 1331 rect.Union(rtList);
1318 } 1332 }
1319 return FWL_ERR_Succeeded; 1333 return FWL_Error::Succeeded;
1320 } 1334 }
1321 void CFWL_ComboBoxImp::DisForm_Layout() { 1335 void CFWL_ComboBoxImp::DisForm_Layout() {
1322 GetClientRect(m_rtClient); 1336 GetClientRect(m_rtClient);
1323 m_rtContent = m_rtClient; 1337 m_rtContent = m_rtClient;
1324 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( 1338 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>(
1325 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); 1339 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
1326 if (!pFWidth) 1340 if (!pFWidth)
1327 return; 1341 return;
1328 FX_FLOAT borderWidth = 1; 1342 FX_FLOAT borderWidth = 1;
1329 FX_FLOAT fBtn = *pFWidth; 1343 FX_FLOAT fBtn = *pFWidth;
(...skipping 24 matching lines...) Expand all
1354 m_pEdit->SetText(wsText); 1368 m_pEdit->SetText(wsText);
1355 m_pEdit->UnlockUpdate(); 1369 m_pEdit->UnlockUpdate();
1356 } 1370 }
1357 m_pEdit->Update(); 1371 m_pEdit->Update();
1358 } 1372 }
1359 } 1373 }
1360 1374
1361 CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner) 1375 CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner)
1362 : m_pOwner(pOwner) {} 1376 : m_pOwner(pOwner) {}
1363 1377
1364 int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 1378 void CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
1365 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) 1379 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
1366 return DisForm_OnProcessMessage(pMessage); 1380 DisForm_OnProcessMessage(pMessage);
1381 return;
1382 }
1383 if (!pMessage)
1384 return;
1367 1385
1368 if (!pMessage)
1369 return 0;
1370
1371 FX_BOOL iRet = 1;
1372 switch (pMessage->GetClassID()) { 1386 switch (pMessage->GetClassID()) {
1373 case CFWL_MessageType::SetFocus: { 1387 case CFWL_MessageType::SetFocus: {
1374 OnFocusChanged(pMessage, TRUE); 1388 OnFocusChanged(pMessage, TRUE);
1375 break; 1389 break;
1376 } 1390 }
1377 case CFWL_MessageType::KillFocus: { 1391 case CFWL_MessageType::KillFocus: {
1378 OnFocusChanged(pMessage, FALSE); 1392 OnFocusChanged(pMessage, FALSE);
1379 break; 1393 break;
1380 } 1394 }
1381 case CFWL_MessageType::Mouse: { 1395 case CFWL_MessageType::Mouse: {
(...skipping 18 matching lines...) Expand all
1400 default: 1414 default:
1401 break; 1415 break;
1402 } 1416 }
1403 break; 1417 break;
1404 } 1418 }
1405 case CFWL_MessageType::Key: { 1419 case CFWL_MessageType::Key: {
1406 OnKey(static_cast<CFWL_MsgKey*>(pMessage)); 1420 OnKey(static_cast<CFWL_MsgKey*>(pMessage));
1407 break; 1421 break;
1408 } 1422 }
1409 default: { 1423 default: {
1410 iRet = 0;
1411 break; 1424 break;
1412 } 1425 }
1413 } 1426 }
1414 1427
1415 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); 1428 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
1416 return iRet;
1417 } 1429 }
1418 1430
1419 FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { 1431 void CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
1420 CFWL_EventType dwFlag = pEvent->GetClassID(); 1432 CFWL_EventType dwFlag = pEvent->GetClassID();
1421 if (dwFlag == CFWL_EventType::DrawItem) { 1433 if (dwFlag == CFWL_EventType::DrawItem) {
1422 CFWL_EvtLtbDrawItem* pDrawItemEvent = 1434 CFWL_EvtLtbDrawItem* pDrawItemEvent =
1423 static_cast<CFWL_EvtLtbDrawItem*>(pEvent); 1435 static_cast<CFWL_EvtLtbDrawItem*>(pEvent);
1424 CFWL_EvtCmbDrawItem pTemp; 1436 CFWL_EvtCmbDrawItem pTemp;
1425 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; 1437 pTemp.m_pSrcTarget = m_pOwner->m_pInterface;
1426 pTemp.m_pGraphics = pDrawItemEvent->m_pGraphics; 1438 pTemp.m_pGraphics = pDrawItemEvent->m_pGraphics;
1427 pTemp.m_index = pDrawItemEvent->m_index; 1439 pTemp.m_index = pDrawItemEvent->m_index;
1428 pTemp.m_rtItem = pDrawItemEvent->m_rect; 1440 pTemp.m_rtItem = pDrawItemEvent->m_rect;
1429 m_pOwner->DispatchEvent(&pTemp); 1441 m_pOwner->DispatchEvent(&pTemp);
1430 } else if (dwFlag == CFWL_EventType::Scroll) { 1442 } else if (dwFlag == CFWL_EventType::Scroll) {
1431 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); 1443 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent);
1432 CFWL_EvtScroll pScrollEv; 1444 CFWL_EvtScroll pScrollEv;
1433 pScrollEv.m_pSrcTarget = m_pOwner->m_pInterface; 1445 pScrollEv.m_pSrcTarget = m_pOwner->m_pInterface;
1434 pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode; 1446 pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode;
1435 pScrollEv.m_fPos = pScrollEvent->m_fPos; 1447 pScrollEv.m_fPos = pScrollEvent->m_fPos;
1436 m_pOwner->DispatchEvent(&pScrollEv); 1448 m_pOwner->DispatchEvent(&pScrollEv);
1437 } else if (dwFlag == CFWL_EventType::TextChanged) { 1449 } else if (dwFlag == CFWL_EventType::TextChanged) {
1438 CFWL_EvtEdtTextChanged* pTextChangedEvent = 1450 CFWL_EvtEdtTextChanged* pTextChangedEvent =
1439 static_cast<CFWL_EvtEdtTextChanged*>(pEvent); 1451 static_cast<CFWL_EvtEdtTextChanged*>(pEvent);
1440 CFWL_EvtCmbEditChanged pTemp; 1452 CFWL_EvtCmbEditChanged pTemp;
1441 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; 1453 pTemp.m_pSrcTarget = m_pOwner->m_pInterface;
1442 pTemp.wsInsert = pTextChangedEvent->wsInsert; 1454 pTemp.wsInsert = pTextChangedEvent->wsInsert;
1443 pTemp.wsDelete = pTextChangedEvent->wsDelete; 1455 pTemp.wsDelete = pTextChangedEvent->wsDelete;
1444 pTemp.nChangeType = pTextChangedEvent->nChangeType; 1456 pTemp.nChangeType = pTextChangedEvent->nChangeType;
1445 m_pOwner->DispatchEvent(&pTemp); 1457 m_pOwner->DispatchEvent(&pTemp);
1446 } 1458 }
1447 return FWL_ERR_Succeeded;
1448 } 1459 }
1449 1460
1450 FWL_ERR CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 1461 void CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
1451 const CFX_Matrix* pMatrix) { 1462 const CFX_Matrix* pMatrix) {
1452 return m_pOwner->DrawWidget(pGraphics, pMatrix); 1463 m_pOwner->DrawWidget(pGraphics, pMatrix);
1453 } 1464 }
1465
1454 void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, 1466 void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
1455 FX_BOOL bSet) { 1467 FX_BOOL bSet) {
1456 IFWL_Widget* pDstTarget = pMsg->m_pDstTarget; 1468 IFWL_Widget* pDstTarget = pMsg->m_pDstTarget;
1457 IFWL_Widget* pSrcTarget = pMsg->m_pSrcTarget; 1469 IFWL_Widget* pSrcTarget = pMsg->m_pSrcTarget;
1458 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); 1470 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle();
1459 if (bSet) { 1471 if (bSet) {
1460 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; 1472 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
1461 if (bDropDown && pSrcTarget != m_pOwner->m_pListBox.get()) { 1473 if (bDropDown && pSrcTarget != m_pOwner->m_pListBox.get()) {
1462 if (!m_pOwner->m_pEdit) 1474 if (!m_pOwner->m_pEdit)
1463 return; 1475 return;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 m_pOwner->Repaint(&m_pOwner->m_rtClient); 1599 m_pOwner->Repaint(&m_pOwner->m_rtClient);
1588 } 1600 }
1589 return; 1601 return;
1590 } 1602 }
1591 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); 1603 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle();
1592 if (bDropDown) { 1604 if (bDropDown) {
1593 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); 1605 IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL);
1594 pDelegate->OnProcessMessage(pMsg); 1606 pDelegate->OnProcessMessage(pMsg);
1595 } 1607 }
1596 } 1608 }
1597 int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( 1609 void CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage(
1598 CFWL_Message* pMessage) { 1610 CFWL_Message* pMessage) {
1599 if (!pMessage) 1611 if (!pMessage)
1600 return 0; 1612 return;
1601 1613
1602 FX_BOOL backDefault = TRUE; 1614 FX_BOOL backDefault = TRUE;
1603 switch (pMessage->GetClassID()) { 1615 switch (pMessage->GetClassID()) {
1604 case CFWL_MessageType::SetFocus: { 1616 case CFWL_MessageType::SetFocus: {
1605 backDefault = FALSE; 1617 backDefault = FALSE;
1606 DisForm_OnFocusChanged(pMessage, TRUE); 1618 DisForm_OnFocusChanged(pMessage, TRUE);
1607 break; 1619 break;
1608 } 1620 }
1609 case CFWL_MessageType::KillFocus: { 1621 case CFWL_MessageType::KillFocus: {
1610 backDefault = FALSE; 1622 backDefault = FALSE;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 break; 1658 break;
1647 } 1659 }
1648 } 1660 }
1649 DisForm_OnKey(pKey); 1661 DisForm_OnKey(pKey);
1650 break; 1662 break;
1651 } 1663 }
1652 default: 1664 default:
1653 break; 1665 break;
1654 } 1666 }
1655 if (!backDefault) 1667 if (!backDefault)
1656 return 1; 1668 return;
1657 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); 1669
1670 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
1658 } 1671 }
1659 1672
1660 void CFWL_ComboBoxImpDelegate::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) { 1673 void CFWL_ComboBoxImpDelegate::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) {
1661 FX_BOOL bDropDown = m_pOwner->DisForm_IsDropListShowed(); 1674 FX_BOOL bDropDown = m_pOwner->DisForm_IsDropListShowed();
1662 CFX_RectF& rtBtn = bDropDown ? m_pOwner->m_rtBtn : m_pOwner->m_rtClient; 1675 CFX_RectF& rtBtn = bDropDown ? m_pOwner->m_rtBtn : m_pOwner->m_rtClient;
1663 FX_BOOL bClickBtn = rtBtn.Contains(pMsg->m_fx, pMsg->m_fy); 1676 FX_BOOL bClickBtn = rtBtn.Contains(pMsg->m_fx, pMsg->m_fy);
1664 if (bClickBtn) { 1677 if (bClickBtn) {
1665 if (m_pOwner->DisForm_IsDropListShowed()) { 1678 if (m_pOwner->DisForm_IsDropListShowed()) {
1666 m_pOwner->DisForm_ShowDropList(FALSE); 1679 m_pOwner->DisForm_ShowDropList(FALSE);
1667 return; 1680 return;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 1756
1744 CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate( 1757 CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate(
1745 IFWL_Form* pForm, 1758 IFWL_Form* pForm,
1746 CFWL_ComboBoxImp* pComboBox) 1759 CFWL_ComboBoxImp* pComboBox)
1747 : m_bLButtonDown(FALSE), 1760 : m_bLButtonDown(FALSE),
1748 m_bLButtonUpSelf(FALSE), 1761 m_bLButtonUpSelf(FALSE),
1749 m_fStartPos(0), 1762 m_fStartPos(0),
1750 m_pForm(pForm), 1763 m_pForm(pForm),
1751 m_pComboBox(pComboBox) {} 1764 m_pComboBox(pComboBox) {}
1752 1765
1753 int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 1766 void CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
1754 if (!pMessage) 1767 if (!pMessage)
1755 return 0; 1768 return;
1756 1769
1757 switch (pMessage->GetClassID()) { 1770 switch (pMessage->GetClassID()) {
1758 case CFWL_MessageType::Mouse: { 1771 case CFWL_MessageType::Mouse: {
1759 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 1772 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
1760 switch (pMsg->m_dwCmd) { 1773 switch (pMsg->m_dwCmd) {
1761 case FWL_MouseCommand::LeftButtonDown: { 1774 case FWL_MouseCommand::LeftButtonDown: {
1762 OnLButtonDown(pMsg); 1775 OnLButtonDown(pMsg);
1763 break; 1776 break;
1764 } 1777 }
1765 case FWL_MouseCommand::LeftButtonUp: { 1778 case FWL_MouseCommand::LeftButtonUp: {
(...skipping 17 matching lines...) Expand all
1783 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), FALSE); 1796 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), FALSE);
1784 break; 1797 break;
1785 } 1798 }
1786 case CFWL_MessageType::SetFocus: { 1799 case CFWL_MessageType::SetFocus: {
1787 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), TRUE); 1800 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), TRUE);
1788 break; 1801 break;
1789 } 1802 }
1790 default: 1803 default:
1791 break; 1804 break;
1792 } 1805 }
1793 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); 1806 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
1794 } 1807 }
1795 1808
1796 FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 1809 void CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
1797 const CFX_Matrix* pMatrix) { 1810 const CFX_Matrix* pMatrix) {
1798 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); 1811 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix);
1799 return FWL_ERR_Succeeded;
1800 } 1812 }
1813
1801 void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { 1814 void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
1802 IFWL_App* pApp = m_pForm->GetOwnerApp(); 1815 IFWL_App* pApp = m_pForm->GetOwnerApp();
1803 if (!pApp) 1816 if (!pApp)
1804 return; 1817 return;
1805 1818
1806 CFWL_NoteDriver* pDriver = 1819 CFWL_NoteDriver* pDriver =
1807 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); 1820 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
1808 CFX_RectF rtWidget; 1821 CFX_RectF rtWidget;
1809 m_pForm->GetWidgetRect(rtWidget); 1822 m_pForm->GetWidgetRect(rtWidget);
1810 rtWidget.left = rtWidget.top = 0; 1823 rtWidget.left = rtWidget.top = 0;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 m_pComboBox->ShowDropList(FALSE); 1856 m_pComboBox->ShowDropList(FALSE);
1844 } 1857 }
1845 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, 1858 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg,
1846 FX_BOOL bSet) { 1859 FX_BOOL bSet) {
1847 if (!bSet) { 1860 if (!bSet) {
1848 if (pMsg->m_pSetFocus == NULL) { 1861 if (pMsg->m_pSetFocus == NULL) {
1849 m_pComboBox->ShowDropList(FALSE); 1862 m_pComboBox->ShowDropList(FALSE);
1850 } 1863 }
1851 } 1864 }
1852 } 1865 }
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/fwl_comboboximp.h ('k') | xfa/fwl/basewidget/fwl_datetimepickerimp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698