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 #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 Loading... |
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 Loading... |
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 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 195 } |
196 } | 196 } |
197 void CFWL_ComboEditImp::SetComboBoxFocus(FX_BOOL bSet) { | 197 void CFWL_ComboEditImp::SetComboBoxFocus(FX_BOOL bSet) { |
198 m_pOuter->SetFocus(bSet); | 198 m_pOuter->SetFocus(bSet); |
199 } | 199 } |
200 CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, | 200 CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, |
201 IFWL_Widget* pOuter) | 201 IFWL_Widget* pOuter) |
202 : CFWL_ListBoxImp(properties, pOuter), m_bNotifyOwner(TRUE) { | 202 : CFWL_ListBoxImp(properties, pOuter), m_bNotifyOwner(TRUE) { |
203 ASSERT(pOuter != NULL); | 203 ASSERT(pOuter != NULL); |
204 } | 204 } |
205 FWL_ERR CFWL_ComboListImp::Initialize() { | 205 FWL_Error CFWL_ComboListImp::Initialize() { |
206 if (CFWL_ListBoxImp::Initialize() != FWL_ERR_Succeeded) | 206 if (CFWL_ListBoxImp::Initialize() != FWL_Error::Succeeded) |
207 return FWL_ERR_Indefinite; | 207 return FWL_Error::Indefinite; |
208 delete m_pDelegate; | 208 delete m_pDelegate; |
209 m_pDelegate = new CFWL_ComboListImpDelegate(this); | 209 m_pDelegate = new CFWL_ComboListImpDelegate(this); |
210 return FWL_ERR_Succeeded; | 210 return FWL_Error::Succeeded; |
211 } | 211 } |
212 FWL_ERR CFWL_ComboListImp::Finalize() { | 212 FWL_Error CFWL_ComboListImp::Finalize() { |
213 delete m_pDelegate; | 213 delete m_pDelegate; |
214 m_pDelegate = nullptr; | 214 m_pDelegate = nullptr; |
215 return CFWL_ListBoxImp::Finalize(); | 215 return CFWL_ListBoxImp::Finalize(); |
216 } | 216 } |
217 int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) { | 217 int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) { |
218 if (wsMatch.IsEmpty()) { | 218 if (wsMatch.IsEmpty()) { |
219 return -1; | 219 return -1; |
220 } | 220 } |
221 if (!m_pProperties->m_pDataProvider) | 221 if (!m_pProperties->m_pDataProvider) |
222 return -1; | 222 return -1; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 m_pForm(NULL), | 476 m_pForm(NULL), |
477 m_bLButtonDown(FALSE), | 477 m_bLButtonDown(FALSE), |
478 m_iCurSel(-1), | 478 m_iCurSel(-1), |
479 m_iBtnState(CFWL_PartState_Normal), | 479 m_iBtnState(CFWL_PartState_Normal), |
480 m_fComboFormHandler(0), | 480 m_fComboFormHandler(0), |
481 m_bNeedShowList(FALSE) { | 481 m_bNeedShowList(FALSE) { |
482 m_rtClient.Reset(); | 482 m_rtClient.Reset(); |
483 m_rtBtn.Reset(); | 483 m_rtBtn.Reset(); |
484 m_rtHandler.Reset(); | 484 m_rtHandler.Reset(); |
485 } | 485 } |
| 486 |
486 CFWL_ComboBoxImp::~CFWL_ComboBoxImp() {} | 487 CFWL_ComboBoxImp::~CFWL_ComboBoxImp() {} |
487 FWL_ERR CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const { | 488 |
| 489 FWL_Error CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const { |
488 wsClass = FWL_CLASS_ComboBox; | 490 wsClass = FWL_CLASS_ComboBox; |
489 return FWL_ERR_Succeeded; | 491 return FWL_Error::Succeeded; |
490 } | 492 } |
| 493 |
491 uint32_t CFWL_ComboBoxImp::GetClassID() const { | 494 uint32_t CFWL_ComboBoxImp::GetClassID() const { |
492 return FWL_CLASSHASH_ComboBox; | 495 return FWL_CLASSHASH_ComboBox; |
493 } | 496 } |
494 FWL_ERR CFWL_ComboBoxImp::Initialize() { | 497 |
495 if (m_pWidgetMgr->IsFormDisabled()) { | 498 FWL_Error CFWL_ComboBoxImp::Initialize() { |
| 499 if (m_pWidgetMgr->IsFormDisabled()) |
496 return DisForm_Initialize(); | 500 return DisForm_Initialize(); |
497 } | 501 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) |
498 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) | 502 return FWL_Error::Indefinite; |
499 return FWL_WGTSTATE_Invisible; // Probably a bug; not a FWL_ERR_ value. | 503 |
500 m_pDelegate = new CFWL_ComboBoxImpDelegate(this); | 504 m_pDelegate = new CFWL_ComboBoxImpDelegate(this); |
501 CFWL_WidgetImpProperties prop; | 505 CFWL_WidgetImpProperties prop; |
502 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; | 506 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; |
503 prop.m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; | 507 prop.m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; |
504 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText) { | 508 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText) |
505 prop.m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon; | 509 prop.m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon; |
506 } | 510 |
507 prop.m_pDataProvider = m_pProperties->m_pDataProvider; | 511 prop.m_pDataProvider = m_pProperties->m_pDataProvider; |
508 m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface)); | 512 m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface)); |
509 m_pListBox->Initialize(); | 513 m_pListBox->Initialize(); |
510 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) { | 514 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) { |
511 CFWL_WidgetImpProperties prop2; | 515 CFWL_WidgetImpProperties prop2; |
512 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop2, m_pInterface)); | 516 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop2, m_pInterface)); |
513 m_pEdit->Initialize(); | 517 m_pEdit->Initialize(); |
514 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface); | 518 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface); |
515 } | 519 } |
516 if (m_pEdit) { | 520 if (m_pEdit) |
517 m_pEdit->SetParent(m_pInterface); | 521 m_pEdit->SetParent(m_pInterface); |
518 } | 522 |
519 SetStates(m_pProperties->m_dwStates); | 523 SetStates(m_pProperties->m_dwStates); |
520 return FWL_ERR_Succeeded; | 524 return FWL_Error::Succeeded; |
521 } | 525 } |
522 FWL_ERR CFWL_ComboBoxImp::Finalize() { | 526 |
| 527 FWL_Error CFWL_ComboBoxImp::Finalize() { |
523 if (m_pEdit) { | 528 if (m_pEdit) { |
524 m_pEdit->Finalize(); | 529 m_pEdit->Finalize(); |
525 } | 530 } |
526 m_pListBox->Finalize(); | 531 m_pListBox->Finalize(); |
527 delete m_pDelegate; | 532 delete m_pDelegate; |
528 m_pDelegate = nullptr; | 533 m_pDelegate = nullptr; |
529 return CFWL_WidgetImp::Finalize(); | 534 return CFWL_WidgetImp::Finalize(); |
530 } | 535 } |
531 FWL_ERR CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 536 FWL_Error CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
532 if (bAutoSize) { | 537 if (bAutoSize) { |
533 rect.Reset(); | 538 rect.Reset(); |
534 FX_BOOL bIsDropDown = IsDropDownStyle(); | 539 FX_BOOL bIsDropDown = IsDropDownStyle(); |
535 if (bIsDropDown && m_pEdit) { | 540 if (bIsDropDown && m_pEdit) { |
536 m_pEdit->GetWidgetRect(rect, TRUE); | 541 m_pEdit->GetWidgetRect(rect, TRUE); |
537 } else { | 542 } else { |
538 rect.width = 100; | 543 rect.width = 100; |
539 rect.height = 16; | 544 rect.height = 16; |
540 } | 545 } |
541 if (!m_pProperties->m_pThemeProvider) { | 546 if (!m_pProperties->m_pThemeProvider) { |
542 ReSetTheme(); | 547 ReSetTheme(); |
543 } | 548 } |
544 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( | 549 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( |
545 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); | 550 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); |
546 if (!pFWidth) | 551 if (!pFWidth) |
547 return FWL_ERR_Indefinite; | 552 return FWL_Error::Indefinite; |
548 rect.Inflate(0, 0, *pFWidth, 0); | 553 rect.Inflate(0, 0, *pFWidth, 0); |
549 CFWL_WidgetImp::GetWidgetRect(rect, TRUE); | 554 CFWL_WidgetImp::GetWidgetRect(rect, TRUE); |
550 } else { | 555 } else { |
551 rect = m_pProperties->m_rtWidget; | 556 rect = m_pProperties->m_rtWidget; |
552 } | 557 } |
553 return FWL_ERR_Succeeded; | 558 return FWL_Error::Succeeded; |
554 } | 559 } |
555 FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, | 560 FWL_Error CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, |
556 uint32_t dwStylesExRemoved) { | 561 uint32_t dwStylesExRemoved) { |
557 if (m_pWidgetMgr->IsFormDisabled()) { | 562 if (m_pWidgetMgr->IsFormDisabled()) { |
558 return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 563 return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
559 } | 564 } |
560 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; | 565 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; |
561 FX_BOOL bRemoveDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; | 566 FX_BOOL bRemoveDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; |
562 if (bAddDropDown && !m_pEdit) { | 567 if (bAddDropDown && !m_pEdit) { |
563 CFWL_WidgetImpProperties prop; | 568 CFWL_WidgetImpProperties prop; |
564 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr)); | 569 m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr)); |
565 m_pEdit->Initialize(); | 570 m_pEdit->Initialize(); |
566 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface); | 571 static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface); |
567 m_pEdit->SetParent(m_pInterface); | 572 m_pEdit->SetParent(m_pInterface); |
568 } else if (bRemoveDropDown && m_pEdit) { | 573 } else if (bRemoveDropDown && m_pEdit) { |
569 m_pEdit->SetStates(FWL_WGTSTATE_Invisible, TRUE); | 574 m_pEdit->SetStates(FWL_WGTSTATE_Invisible, TRUE); |
570 } | 575 } |
571 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 576 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
572 } | 577 } |
573 FWL_ERR CFWL_ComboBoxImp::Update() { | 578 FWL_Error CFWL_ComboBoxImp::Update() { |
574 if (m_pWidgetMgr->IsFormDisabled()) { | 579 if (m_pWidgetMgr->IsFormDisabled()) { |
575 return DisForm_Update(); | 580 return DisForm_Update(); |
576 } | 581 } |
577 if (IsLocked()) { | 582 if (IsLocked()) { |
578 return FWL_ERR_Indefinite; | 583 return FWL_Error::Indefinite; |
579 } | 584 } |
580 ReSetTheme(); | 585 ReSetTheme(); |
581 FX_BOOL bDropDown = IsDropDownStyle(); | 586 FX_BOOL bDropDown = IsDropDownStyle(); |
582 if (bDropDown && m_pEdit) { | 587 if (bDropDown && m_pEdit) { |
583 ReSetEditAlignment(); | 588 ReSetEditAlignment(); |
584 } | 589 } |
585 if (m_pProperties->m_pThemeProvider == NULL) { | 590 if (m_pProperties->m_pThemeProvider == NULL) { |
586 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 591 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
587 } | 592 } |
588 Layout(); | 593 Layout(); |
589 CFWL_ThemePart part; | 594 CFWL_ThemePart part; |
590 part.m_pWidget = m_pInterface; | 595 part.m_pWidget = m_pInterface; |
591 m_fComboFormHandler = | 596 m_fComboFormHandler = |
592 *static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity( | 597 *static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity( |
593 &part, CFWL_WidgetCapacity::ComboFormHandler)); | 598 &part, CFWL_WidgetCapacity::ComboFormHandler)); |
594 return FWL_ERR_Succeeded; | 599 return FWL_Error::Succeeded; |
595 } | 600 } |
596 uint32_t CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 601 uint32_t CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
597 if (m_pWidgetMgr->IsFormDisabled()) { | 602 if (m_pWidgetMgr->IsFormDisabled()) { |
598 return DisForm_HitTest(fx, fy); | 603 return DisForm_HitTest(fx, fy); |
599 } | 604 } |
600 return CFWL_WidgetImp::HitTest(fx, fy); | 605 return CFWL_WidgetImp::HitTest(fx, fy); |
601 } | 606 } |
602 FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, | 607 FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, |
603 const CFX_Matrix* pMatrix) { | 608 const CFX_Matrix* pMatrix) { |
604 if (m_pWidgetMgr->IsFormDisabled()) { | 609 if (m_pWidgetMgr->IsFormDisabled()) { |
605 return DisForm_DrawWidget(pGraphics, pMatrix); | 610 return DisForm_DrawWidget(pGraphics, pMatrix); |
606 } | 611 } |
607 if (!pGraphics) | 612 if (!pGraphics) |
608 return FWL_ERR_Indefinite; | 613 return FWL_Error::Indefinite; |
609 if (!m_pProperties->m_pThemeProvider) | 614 if (!m_pProperties->m_pThemeProvider) |
610 return FWL_ERR_Indefinite; | 615 return FWL_Error::Indefinite; |
611 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 616 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
612 FX_BOOL bIsDropDown = IsDropDownStyle(); | 617 FX_BOOL bIsDropDown = IsDropDownStyle(); |
613 if (HasBorder()) { | 618 if (HasBorder()) { |
614 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); | 619 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); |
615 } | 620 } |
616 if (HasEdge()) { | 621 if (HasEdge()) { |
617 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); | 622 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); |
618 } | 623 } |
619 if (!bIsDropDown) { | 624 if (!bIsDropDown) { |
620 CFX_RectF rtTextBk(m_rtClient); | 625 CFX_RectF rtTextBk(m_rtClient); |
(...skipping 20 matching lines...) Expand all Loading... |
641 param.m_dwStates = CFWL_PartState_Disabled; | 646 param.m_dwStates = CFWL_PartState_Disabled; |
642 } else if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) && | 647 } else if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) && |
643 (m_iCurSel >= 0)) { | 648 (m_iCurSel >= 0)) { |
644 param.m_dwStates = CFWL_PartState_Selected; | 649 param.m_dwStates = CFWL_PartState_Selected; |
645 } else { | 650 } else { |
646 param.m_dwStates = CFWL_PartState_Normal; | 651 param.m_dwStates = CFWL_PartState_Normal; |
647 } | 652 } |
648 pTheme->DrawBackground(¶m); | 653 pTheme->DrawBackground(¶m); |
649 if (m_iCurSel >= 0) { | 654 if (m_iCurSel >= 0) { |
650 if (!m_pListBox) | 655 if (!m_pListBox) |
651 return FWL_ERR_Indefinite; | 656 return FWL_Error::Indefinite; |
652 CFX_WideString wsText; | 657 CFX_WideString wsText; |
653 IFWL_ComboBoxDP* pData = | 658 IFWL_ComboBoxDP* pData = |
654 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 659 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
655 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); | 660 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); |
656 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) | 661 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) |
657 ->GetItemText(hItem, wsText); | 662 ->GetItemText(hItem, wsText); |
658 CFWL_ThemeText param; | 663 CFWL_ThemeText param; |
659 param.m_pWidget = m_pInterface; | 664 param.m_pWidget = m_pInterface; |
660 param.m_iPart = CFWL_Part::Caption; | 665 param.m_iPart = CFWL_Part::Caption; |
661 param.m_dwStates = m_iBtnState; | 666 param.m_dwStates = m_iBtnState; |
(...skipping 14 matching lines...) Expand all Loading... |
676 param.m_pWidget = m_pInterface; | 681 param.m_pWidget = m_pInterface; |
677 param.m_iPart = CFWL_Part::DropDownButton; | 682 param.m_iPart = CFWL_Part::DropDownButton; |
678 param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) | 683 param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) |
679 ? CFWL_PartState_Disabled | 684 ? CFWL_PartState_Disabled |
680 : m_iBtnState; | 685 : m_iBtnState; |
681 param.m_pGraphics = pGraphics; | 686 param.m_pGraphics = pGraphics; |
682 param.m_matrix.Concat(*pMatrix); | 687 param.m_matrix.Concat(*pMatrix); |
683 param.m_rtPart = m_rtBtn; | 688 param.m_rtPart = m_rtBtn; |
684 pTheme->DrawBackground(¶m); | 689 pTheme->DrawBackground(¶m); |
685 } | 690 } |
686 return FWL_ERR_Succeeded; | 691 return FWL_Error::Succeeded; |
687 } | 692 } |
688 FWL_ERR CFWL_ComboBoxImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { | 693 FWL_Error CFWL_ComboBoxImp::SetThemeProvider( |
| 694 IFWL_ThemeProvider* pThemeProvider) { |
689 if (!pThemeProvider) | 695 if (!pThemeProvider) |
690 return FWL_ERR_Indefinite; | 696 return FWL_Error::Indefinite; |
691 m_pProperties->m_pThemeProvider = pThemeProvider; | 697 m_pProperties->m_pThemeProvider = pThemeProvider; |
692 if (m_pListBox && pThemeProvider->IsValidWidget(m_pListBox.get())) { | 698 if (m_pListBox && pThemeProvider->IsValidWidget(m_pListBox.get())) { |
693 m_pListBox->SetThemeProvider(pThemeProvider); | 699 m_pListBox->SetThemeProvider(pThemeProvider); |
694 } | 700 } |
695 if (m_pEdit && pThemeProvider->IsValidWidget(m_pEdit.get())) { | 701 if (m_pEdit && pThemeProvider->IsValidWidget(m_pEdit.get())) { |
696 m_pEdit->SetThemeProvider(pThemeProvider); | 702 m_pEdit->SetThemeProvider(pThemeProvider); |
697 } | 703 } |
698 return FWL_ERR_Succeeded; | 704 return FWL_Error::Succeeded; |
699 } | 705 } |
700 int32_t CFWL_ComboBoxImp::GetCurSel() { | 706 int32_t CFWL_ComboBoxImp::GetCurSel() { |
701 return m_iCurSel; | 707 return m_iCurSel; |
702 } | 708 } |
703 FWL_ERR CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { | 709 FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { |
704 int32_t iCount = | 710 int32_t iCount = |
705 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->CountItems(); | 711 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->CountItems(); |
706 FX_BOOL bClearSel = iSel < 0 || iSel >= iCount; | 712 FX_BOOL bClearSel = iSel < 0 || iSel >= iCount; |
707 FX_BOOL bDropDown = IsDropDownStyle(); | 713 FX_BOOL bDropDown = IsDropDownStyle(); |
708 if (bDropDown && m_pEdit) { | 714 if (bDropDown && m_pEdit) { |
709 if (bClearSel) { | 715 if (bClearSel) { |
710 m_pEdit->SetText(CFX_WideString()); | 716 m_pEdit->SetText(CFX_WideString()); |
711 } else { | 717 } else { |
712 CFX_WideString wsText; | 718 CFX_WideString wsText; |
713 IFWL_ComboBoxDP* pData = | 719 IFWL_ComboBoxDP* pData = |
714 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 720 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
715 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel); | 721 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel); |
716 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) | 722 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) |
717 ->GetItemText(hItem, wsText); | 723 ->GetItemText(hItem, wsText); |
718 m_pEdit->SetText(wsText); | 724 m_pEdit->SetText(wsText); |
719 } | 725 } |
720 m_pEdit->Update(); | 726 m_pEdit->Update(); |
721 } | 727 } |
722 m_iCurSel = bClearSel ? -1 : iSel; | 728 m_iCurSel = bClearSel ? -1 : iSel; |
723 return FWL_ERR_Succeeded; | 729 return FWL_Error::Succeeded; |
724 } | 730 } |
725 FWL_ERR CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { | 731 FWL_Error CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { |
726 FX_BOOL bIsDropDown = IsDropDownStyle(); | 732 FX_BOOL bIsDropDown = IsDropDownStyle(); |
727 if (bIsDropDown && m_pEdit) { | 733 if (bIsDropDown && m_pEdit) { |
728 m_pEdit->SetStates(dwStates, bSet); | 734 m_pEdit->SetStates(dwStates, bSet); |
729 } | 735 } |
730 if (m_pListBox) { | 736 if (m_pListBox) { |
731 m_pListBox->SetStates(dwStates, bSet); | 737 m_pListBox->SetStates(dwStates, bSet); |
732 } | 738 } |
733 return CFWL_WidgetImp::SetStates(dwStates, bSet); | 739 return CFWL_WidgetImp::SetStates(dwStates, bSet); |
734 } | 740 } |
735 FWL_ERR CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) { | 741 FWL_Error CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) { |
736 if (!m_pEdit) | 742 if (!m_pEdit) |
737 return FWL_ERR_Indefinite; | 743 return FWL_Error::Indefinite; |
738 m_pEdit->SetText(wsText); | 744 m_pEdit->SetText(wsText); |
739 return m_pEdit->Update(); | 745 return m_pEdit->Update(); |
740 } | 746 } |
741 int32_t CFWL_ComboBoxImp::GetEditTextLength() const { | 747 int32_t CFWL_ComboBoxImp::GetEditTextLength() const { |
742 if (!m_pEdit) | 748 if (!m_pEdit) |
743 return -1; | 749 return -1; |
744 return m_pEdit->GetTextLength(); | 750 return m_pEdit->GetTextLength(); |
745 } | 751 } |
746 FWL_ERR CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, | 752 FWL_Error CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, |
747 int32_t nStart, | 753 int32_t nStart, |
748 int32_t nCount) const { | 754 int32_t nCount) const { |
749 if (m_pEdit) { | 755 if (m_pEdit) { |
750 return m_pEdit->GetText(wsText, nStart, nCount); | 756 return m_pEdit->GetText(wsText, nStart, nCount); |
751 } else if (m_pListBox) { | 757 } else if (m_pListBox) { |
752 IFWL_ComboBoxDP* pData = | 758 IFWL_ComboBoxDP* pData = |
753 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 759 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
754 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); | 760 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); |
755 return m_pListBox->GetItemText(hItem, wsText); | 761 return m_pListBox->GetItemText(hItem, wsText); |
756 } | 762 } |
757 return FWL_ERR_Indefinite; | 763 return FWL_Error::Indefinite; |
758 } | 764 } |
759 FWL_ERR CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) { | 765 FWL_Error CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) { |
760 if (!m_pEdit) | 766 if (!m_pEdit) |
761 return FWL_ERR_Indefinite; | 767 return FWL_Error::Indefinite; |
762 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->ClearSelected(); | 768 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->ClearSelected(); |
763 m_pEdit->AddSelRange(nStart, nCount); | 769 m_pEdit->AddSelRange(nStart, nCount); |
764 return FWL_ERR_Succeeded; | 770 return FWL_Error::Succeeded; |
765 } | 771 } |
766 int32_t CFWL_ComboBoxImp::GetEditSelRange(int32_t nIndex, int32_t& nStart) { | 772 int32_t CFWL_ComboBoxImp::GetEditSelRange(int32_t nIndex, int32_t& nStart) { |
767 if (!m_pEdit) | 773 if (!m_pEdit) |
768 return -1; | 774 return -1; |
769 return m_pEdit->GetSelRange(nIndex, nStart); | 775 return m_pEdit->GetSelRange(nIndex, nStart); |
770 } | 776 } |
771 int32_t CFWL_ComboBoxImp::GetEditLimit() { | 777 int32_t CFWL_ComboBoxImp::GetEditLimit() { |
772 if (!m_pEdit) | 778 if (!m_pEdit) |
773 return -1; | 779 return -1; |
774 return m_pEdit->GetLimit(); | 780 return m_pEdit->GetLimit(); |
775 } | 781 } |
776 FWL_ERR CFWL_ComboBoxImp::SetEditLimit(int32_t nLimit) { | 782 FWL_Error CFWL_ComboBoxImp::SetEditLimit(int32_t nLimit) { |
777 if (!m_pEdit) | 783 if (!m_pEdit) |
778 return FWL_ERR_Indefinite; | 784 return FWL_Error::Indefinite; |
779 return m_pEdit->SetLimit(nLimit); | 785 return m_pEdit->SetLimit(nLimit); |
780 } | 786 } |
781 FWL_ERR CFWL_ComboBoxImp::EditDoClipboard(int32_t iCmd) { | 787 FWL_Error CFWL_ComboBoxImp::EditDoClipboard(int32_t iCmd) { |
782 if (!m_pEdit) | 788 if (!m_pEdit) |
783 return FWL_ERR_Indefinite; | 789 return FWL_Error::Indefinite; |
784 return m_pEdit->DoClipboard(iCmd); | 790 return m_pEdit->DoClipboard(iCmd); |
785 } | 791 } |
786 FX_BOOL CFWL_ComboBoxImp::EditRedo(const CFX_ByteStringC& bsRecord) { | 792 FX_BOOL CFWL_ComboBoxImp::EditRedo(const CFX_ByteStringC& bsRecord) { |
787 if (!m_pEdit) | 793 if (!m_pEdit) |
788 return FALSE; | 794 return FALSE; |
789 return m_pEdit->Redo(bsRecord); | 795 return m_pEdit->Redo(bsRecord); |
790 } | 796 } |
791 FX_BOOL CFWL_ComboBoxImp::EditUndo(const CFX_ByteStringC& bsRecord) { | 797 FX_BOOL CFWL_ComboBoxImp::EditUndo(const CFX_ByteStringC& bsRecord) { |
792 if (!m_pEdit) | 798 if (!m_pEdit) |
793 return FALSE; | 799 return FALSE; |
794 return m_pEdit->Undo(bsRecord); | 800 return m_pEdit->Undo(bsRecord); |
795 } | 801 } |
796 IFWL_ListBox* CFWL_ComboBoxImp::GetListBoxt() { | 802 IFWL_ListBox* CFWL_ComboBoxImp::GetListBoxt() { |
797 return m_pListBox.get(); | 803 return m_pListBox.get(); |
798 } | 804 } |
799 FX_BOOL CFWL_ComboBoxImp::AfterFocusShowDropList() { | 805 FX_BOOL CFWL_ComboBoxImp::AfterFocusShowDropList() { |
800 if (!m_bNeedShowList) { | 806 if (!m_bNeedShowList) { |
801 return FALSE; | 807 return FALSE; |
802 } | 808 } |
803 if (m_pEdit) { | 809 if (m_pEdit) { |
804 MatchEditText(); | 810 MatchEditText(); |
805 } | 811 } |
806 ShowDropList(TRUE); | 812 ShowDropList(TRUE); |
807 m_bNeedShowList = FALSE; | 813 m_bNeedShowList = FALSE; |
808 return TRUE; | 814 return TRUE; |
809 } | 815 } |
810 FX_ERR CFWL_ComboBoxImp::OpenDropDownList(FX_BOOL bActivate) { | 816 FWL_Error CFWL_ComboBoxImp::OpenDropDownList(FX_BOOL bActivate) { |
811 ShowDropList(bActivate); | 817 ShowDropList(bActivate); |
812 return FWL_ERR_Succeeded; | 818 return FWL_Error::Succeeded; |
813 } | 819 } |
814 FX_BOOL CFWL_ComboBoxImp::EditCanUndo() { | 820 FX_BOOL CFWL_ComboBoxImp::EditCanUndo() { |
815 return m_pEdit->CanUndo(); | 821 return m_pEdit->CanUndo(); |
816 } | 822 } |
817 FX_BOOL CFWL_ComboBoxImp::EditCanRedo() { | 823 FX_BOOL CFWL_ComboBoxImp::EditCanRedo() { |
818 return m_pEdit->CanRedo(); | 824 return m_pEdit->CanRedo(); |
819 } | 825 } |
820 FX_BOOL CFWL_ComboBoxImp::EditUndo() { | 826 FX_BOOL CFWL_ComboBoxImp::EditUndo() { |
821 return m_pEdit->Undo(); | 827 return m_pEdit->Undo(); |
822 } | 828 } |
(...skipping 15 matching lines...) Expand all Loading... |
838 FX_BOOL CFWL_ComboBoxImp::EditCopy(CFX_WideString& wsCopy) { | 844 FX_BOOL CFWL_ComboBoxImp::EditCopy(CFX_WideString& wsCopy) { |
839 return m_pEdit->Copy(wsCopy); | 845 return m_pEdit->Copy(wsCopy); |
840 } | 846 } |
841 FX_BOOL CFWL_ComboBoxImp::EditCut(CFX_WideString& wsCut) { | 847 FX_BOOL CFWL_ComboBoxImp::EditCut(CFX_WideString& wsCut) { |
842 return m_pEdit->Cut(wsCut); | 848 return m_pEdit->Cut(wsCut); |
843 } | 849 } |
844 FX_BOOL CFWL_ComboBoxImp::EditPaste(const CFX_WideString& wsPaste) { | 850 FX_BOOL CFWL_ComboBoxImp::EditPaste(const CFX_WideString& wsPaste) { |
845 return m_pEdit->Paste(wsPaste); | 851 return m_pEdit->Paste(wsPaste); |
846 } | 852 } |
847 FX_BOOL CFWL_ComboBoxImp::EditSelectAll() { | 853 FX_BOOL CFWL_ComboBoxImp::EditSelectAll() { |
848 return m_pEdit->AddSelRange(0) == FWL_ERR_Succeeded; | 854 return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded; |
849 } | 855 } |
850 FX_BOOL CFWL_ComboBoxImp::EditDelete() { | 856 FX_BOOL CFWL_ComboBoxImp::EditDelete() { |
851 return m_pEdit->ClearText() == FWL_ERR_Succeeded; | 857 return m_pEdit->ClearText() == FWL_Error::Succeeded; |
852 } | 858 } |
853 FX_BOOL CFWL_ComboBoxImp::EditDeSelect() { | 859 FX_BOOL CFWL_ComboBoxImp::EditDeSelect() { |
854 return m_pEdit->ClearSelections() == FWL_ERR_Succeeded; | 860 return m_pEdit->ClearSelections() == FWL_Error::Succeeded; |
855 } | 861 } |
856 FWL_ERR CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) { | 862 FWL_Error CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) { |
857 if (m_pWidgetMgr->IsFormDisabled()) { | 863 if (m_pWidgetMgr->IsFormDisabled()) { |
858 return DisForm_GetBBox(rect); | 864 return DisForm_GetBBox(rect); |
859 } | 865 } |
860 rect = m_pProperties->m_rtWidget; | 866 rect = m_pProperties->m_rtWidget; |
861 if (m_pListBox && IsDropListShowed()) { | 867 if (m_pListBox && IsDropListShowed()) { |
862 CFX_RectF rtList; | 868 CFX_RectF rtList; |
863 m_pListBox->GetWidgetRect(rtList); | 869 m_pListBox->GetWidgetRect(rtList); |
864 rtList.Offset(rect.left, rect.top); | 870 rtList.Offset(rect.left, rect.top); |
865 rect.Union(rtList); | 871 rect.Union(rtList); |
866 } | 872 } |
867 return FWL_ERR_Succeeded; | 873 return FWL_Error::Succeeded; |
868 } | 874 } |
869 FWL_ERR CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded, | 875 FWL_Error CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded, |
870 uint32_t dwStylesExRemoved) { | 876 uint32_t dwStylesExRemoved) { |
871 if (m_pEdit != NULL) { | 877 if (m_pEdit != NULL) { |
872 return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 878 return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
873 } else { | 879 } else { |
874 return FWL_ERR_Parameter_Invalid; | 880 return FWL_Error::ParameterInvalid; |
875 } | 881 } |
876 } | 882 } |
877 FX_FLOAT CFWL_ComboBoxImp::GetListHeight() { | 883 FX_FLOAT CFWL_ComboBoxImp::GetListHeight() { |
878 return static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider) | 884 return static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider) |
879 ->GetListHeight(m_pInterface); | 885 ->GetListHeight(m_pInterface); |
880 } | 886 } |
881 void CFWL_ComboBoxImp::DrawStretchHandler(CFX_Graphics* pGraphics, | 887 void CFWL_ComboBoxImp::DrawStretchHandler(CFX_Graphics* pGraphics, |
882 const CFX_Matrix* pMatrix) { | 888 const CFX_Matrix* pMatrix) { |
883 CFWL_ThemeBackground param; | 889 CFWL_ThemeBackground param; |
884 param.m_pGraphics = pGraphics; | 890 param.m_pGraphics = pGraphics; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 CFWL_EvtCmbSelChanged ev; | 1128 CFWL_EvtCmbSelChanged ev; |
1123 ev.bLButtonUp = bLButtonUp; | 1129 ev.bLButtonUp = bLButtonUp; |
1124 ev.m_pSrcTarget = m_pInterface; | 1130 ev.m_pSrcTarget = m_pInterface; |
1125 ev.iArraySels.Add(m_iCurSel); | 1131 ev.iArraySels.Add(m_iCurSel); |
1126 DispatchEvent(&ev); | 1132 DispatchEvent(&ev); |
1127 } | 1133 } |
1128 } else { | 1134 } else { |
1129 Repaint(&m_rtClient); | 1135 Repaint(&m_rtClient); |
1130 } | 1136 } |
1131 } | 1137 } |
| 1138 |
1132 void CFWL_ComboBoxImp::InitProxyForm() { | 1139 void CFWL_ComboBoxImp::InitProxyForm() { |
1133 if (m_pForm) | 1140 if (m_pForm) |
1134 return; | 1141 return; |
1135 if (!m_pListBox) | 1142 if (!m_pListBox) |
1136 return; | 1143 return; |
| 1144 |
1137 CFWL_WidgetImpProperties propForm; | 1145 CFWL_WidgetImpProperties propForm; |
1138 propForm.m_pOwner = m_pInterface; | 1146 propForm.m_pOwner = m_pInterface; |
1139 propForm.m_dwStyles = FWL_WGTSTYLE_Popup; | 1147 propForm.m_dwStyles = FWL_WGTSTYLE_Popup; |
1140 propForm.m_dwStates = FWL_WGTSTATE_Invisible; | 1148 propForm.m_dwStates = FWL_WGTSTATE_Invisible; |
1141 CFX_WideString className; | 1149 CFX_WideString className; |
1142 m_pForm = IFWL_Form::CreateFormProxy(propForm, &className, m_pListBox.get()); | 1150 m_pForm = IFWL_Form::CreateFormProxy(propForm, &className, m_pListBox.get()); |
1143 m_pForm->Initialize(); | 1151 m_pForm->Initialize(); |
1144 m_pProxy = static_cast<CFWL_FormProxyImp*>(m_pForm->GetImpl()); | 1152 m_pProxy = static_cast<CFWL_FormProxyImp*>(m_pForm->GetImpl()); |
1145 m_pListBox->SetParent(m_pForm); | 1153 m_pListBox->SetParent(m_pForm); |
1146 m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this); | 1154 m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this); |
1147 m_pProxy->SetDelegate(m_pListProxyDelegate); | 1155 m_pProxy->SetDelegate(m_pListProxyDelegate); |
1148 } | 1156 } |
1149 FWL_ERR CFWL_ComboBoxImp::DisForm_Initialize() { | 1157 |
1150 if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) | 1158 FWL_Error CFWL_ComboBoxImp::DisForm_Initialize() { |
1151 return FWL_WGTSTATE_Invisible; // Ditto. | 1159 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) |
| 1160 return FWL_Error::Indefinite; |
| 1161 |
1152 m_pDelegate = new CFWL_ComboBoxImpDelegate(this); | 1162 m_pDelegate = new CFWL_ComboBoxImpDelegate(this); |
1153 DisForm_InitComboList(); | 1163 DisForm_InitComboList(); |
1154 DisForm_InitComboEdit(); | 1164 DisForm_InitComboEdit(); |
1155 return FWL_ERR_Succeeded; | 1165 return FWL_Error::Succeeded; |
1156 } | 1166 } |
| 1167 |
1157 void CFWL_ComboBoxImp::DisForm_InitComboList() { | 1168 void CFWL_ComboBoxImp::DisForm_InitComboList() { |
1158 if (m_pListBox) { | 1169 if (m_pListBox) |
1159 return; | 1170 return; |
1160 } | 1171 |
1161 CFWL_WidgetImpProperties prop; | 1172 CFWL_WidgetImpProperties prop; |
1162 prop.m_pParent = m_pInterface; | 1173 prop.m_pParent = m_pInterface; |
1163 prop.m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; | 1174 prop.m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; |
1164 prop.m_dwStates = FWL_WGTSTATE_Invisible; | 1175 prop.m_dwStates = FWL_WGTSTATE_Invisible; |
1165 prop.m_pDataProvider = m_pProperties->m_pDataProvider; | 1176 prop.m_pDataProvider = m_pProperties->m_pDataProvider; |
1166 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; | 1177 prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; |
1167 m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface)); | 1178 m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface)); |
1168 m_pListBox->Initialize(); | 1179 m_pListBox->Initialize(); |
1169 } | 1180 } |
1170 void CFWL_ComboBoxImp::DisForm_InitComboEdit() { | 1181 void CFWL_ComboBoxImp::DisForm_InitComboEdit() { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 DispatchEvent(&postEvent); | 1231 DispatchEvent(&postEvent); |
1221 } | 1232 } |
1222 CFX_RectF rect; | 1233 CFX_RectF rect; |
1223 m_pListBox->GetWidgetRect(rect); | 1234 m_pListBox->GetWidgetRect(rect); |
1224 rect.Inflate(2, 2); | 1235 rect.Inflate(2, 2); |
1225 Repaint(&rect); | 1236 Repaint(&rect); |
1226 } | 1237 } |
1227 FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() { | 1238 FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() { |
1228 return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); | 1239 return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); |
1229 } | 1240 } |
1230 FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, | 1241 FWL_Error CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, |
1231 uint32_t dwStylesExRemoved) { | 1242 uint32_t dwStylesExRemoved) { |
1232 if (!m_pEdit) { | 1243 if (!m_pEdit) { |
1233 DisForm_InitComboEdit(); | 1244 DisForm_InitComboEdit(); |
1234 } | 1245 } |
1235 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; | 1246 FX_BOOL bAddDropDown = dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown; |
1236 FX_BOOL bDelDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; | 1247 FX_BOOL bDelDropDown = dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown; |
1237 dwStylesExRemoved &= ~FWL_STYLEEXT_CMB_DropDown; | 1248 dwStylesExRemoved &= ~FWL_STYLEEXT_CMB_DropDown; |
1238 m_pProperties->m_dwStyleExes |= FWL_STYLEEXT_CMB_DropDown; | 1249 m_pProperties->m_dwStyleExes |= FWL_STYLEEXT_CMB_DropDown; |
1239 if (bAddDropDown) { | 1250 if (bAddDropDown) { |
1240 m_pEdit->ModifyStylesEx(0, FWL_STYLEEXT_EDT_ReadOnly); | 1251 m_pEdit->ModifyStylesEx(0, FWL_STYLEEXT_EDT_ReadOnly); |
1241 } else if (bDelDropDown) { | 1252 } else if (bDelDropDown) { |
1242 m_pEdit->ModifyStylesEx(FWL_STYLEEXT_EDT_ReadOnly, 0); | 1253 m_pEdit->ModifyStylesEx(FWL_STYLEEXT_EDT_ReadOnly, 0); |
1243 } | 1254 } |
1244 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 1255 return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
1245 } | 1256 } |
1246 FWL_ERR CFWL_ComboBoxImp::DisForm_Update() { | 1257 FWL_Error CFWL_ComboBoxImp::DisForm_Update() { |
1247 if (m_iLock) { | 1258 if (m_iLock) { |
1248 return FWL_ERR_Indefinite; | 1259 return FWL_Error::Indefinite; |
1249 } | 1260 } |
1250 if (m_pEdit) { | 1261 if (m_pEdit) { |
1251 ReSetEditAlignment(); | 1262 ReSetEditAlignment(); |
1252 } | 1263 } |
1253 ReSetTheme(); | 1264 ReSetTheme(); |
1254 Layout(); | 1265 Layout(); |
1255 return FWL_ERR_Succeeded; | 1266 return FWL_Error::Succeeded; |
1256 } | 1267 } |
1257 uint32_t CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 1268 uint32_t CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
1258 CFX_RectF rect; | 1269 CFX_RectF rect; |
1259 rect.Set(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width, | 1270 rect.Set(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width, |
1260 m_pProperties->m_rtWidget.height); | 1271 m_pProperties->m_rtWidget.height); |
1261 if (rect.Contains(fx, fy)) { | 1272 if (rect.Contains(fx, fy)) { |
1262 return FWL_WGTHITTEST_Edit; | 1273 return FWL_WGTHITTEST_Edit; |
1263 } | 1274 } |
1264 if (m_rtBtn.Contains(fx, fy)) { | 1275 if (m_rtBtn.Contains(fx, fy)) { |
1265 return FWL_WGTHITTEST_Client; | 1276 return FWL_WGTHITTEST_Client; |
1266 } | 1277 } |
1267 if (DisForm_IsDropListShowed()) { | 1278 if (DisForm_IsDropListShowed()) { |
1268 m_pListBox->GetWidgetRect(rect); | 1279 m_pListBox->GetWidgetRect(rect); |
1269 if (rect.Contains(fx, fy)) { | 1280 if (rect.Contains(fx, fy)) { |
1270 return FWL_WGTHITTEST_Client; | 1281 return FWL_WGTHITTEST_Client; |
1271 } | 1282 } |
1272 } | 1283 } |
1273 return FWL_WGTHITTEST_Unknown; | 1284 return FWL_WGTHITTEST_Unknown; |
1274 } | 1285 } |
1275 FWL_ERR CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, | 1286 FWL_Error CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, |
1276 const CFX_Matrix* pMatrix) { | 1287 const CFX_Matrix* pMatrix) { |
1277 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 1288 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
1278 CFX_Matrix mtOrg; | 1289 CFX_Matrix mtOrg; |
1279 mtOrg.Set(1, 0, 0, 1, 0, 0); | 1290 mtOrg.Set(1, 0, 0, 1, 0, 0); |
1280 if (pMatrix) { | 1291 if (pMatrix) { |
1281 mtOrg = *pMatrix; | 1292 mtOrg = *pMatrix; |
1282 } | 1293 } |
1283 FX_BOOL bListShowed = m_pListBox && DisForm_IsDropListShowed(); | 1294 FX_BOOL bListShowed = m_pListBox && DisForm_IsDropListShowed(); |
1284 pGraphics->SaveGraphState(); | 1295 pGraphics->SaveGraphState(); |
1285 pGraphics->ConcatMatrix(&mtOrg); | 1296 pGraphics->ConcatMatrix(&mtOrg); |
1286 if (!m_rtBtn.IsEmpty(0.1f)) { | 1297 if (!m_rtBtn.IsEmpty(0.1f)) { |
(...skipping 15 matching lines...) Expand all Loading... |
1302 m_pEdit->DrawWidget(pGraphics, &mt); | 1313 m_pEdit->DrawWidget(pGraphics, &mt); |
1303 } | 1314 } |
1304 if (bListShowed) { | 1315 if (bListShowed) { |
1305 CFX_RectF rtList; | 1316 CFX_RectF rtList; |
1306 m_pListBox->GetWidgetRect(rtList); | 1317 m_pListBox->GetWidgetRect(rtList); |
1307 CFX_Matrix mt; | 1318 CFX_Matrix mt; |
1308 mt.Set(1, 0, 0, 1, rtList.left, rtList.top); | 1319 mt.Set(1, 0, 0, 1, rtList.left, rtList.top); |
1309 mt.Concat(mtOrg); | 1320 mt.Concat(mtOrg); |
1310 m_pListBox->DrawWidget(pGraphics, &mt); | 1321 m_pListBox->DrawWidget(pGraphics, &mt); |
1311 } | 1322 } |
1312 return FWL_ERR_Succeeded; | 1323 return FWL_Error::Succeeded; |
1313 } | 1324 } |
1314 FWL_ERR CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) { | 1325 FWL_Error CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) { |
1315 rect = m_pProperties->m_rtWidget; | 1326 rect = m_pProperties->m_rtWidget; |
1316 if (m_pListBox && DisForm_IsDropListShowed()) { | 1327 if (m_pListBox && DisForm_IsDropListShowed()) { |
1317 CFX_RectF rtList; | 1328 CFX_RectF rtList; |
1318 m_pListBox->GetWidgetRect(rtList); | 1329 m_pListBox->GetWidgetRect(rtList); |
1319 rtList.Offset(rect.left, rect.top); | 1330 rtList.Offset(rect.left, rect.top); |
1320 rect.Union(rtList); | 1331 rect.Union(rtList); |
1321 } | 1332 } |
1322 return FWL_ERR_Succeeded; | 1333 return FWL_Error::Succeeded; |
1323 } | 1334 } |
1324 void CFWL_ComboBoxImp::DisForm_Layout() { | 1335 void CFWL_ComboBoxImp::DisForm_Layout() { |
1325 GetClientRect(m_rtClient); | 1336 GetClientRect(m_rtClient); |
1326 m_rtContent = m_rtClient; | 1337 m_rtContent = m_rtClient; |
1327 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( | 1338 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( |
1328 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); | 1339 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); |
1329 if (!pFWidth) | 1340 if (!pFWidth) |
1330 return; | 1341 return; |
1331 FX_FLOAT borderWidth = 1; | 1342 FX_FLOAT borderWidth = 1; |
1332 FX_FLOAT fBtn = *pFWidth; | 1343 FX_FLOAT fBtn = *pFWidth; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 default: { | 1423 default: { |
1413 iRet = 0; | 1424 iRet = 0; |
1414 break; | 1425 break; |
1415 } | 1426 } |
1416 } | 1427 } |
1417 | 1428 |
1418 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1429 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
1419 return iRet; | 1430 return iRet; |
1420 } | 1431 } |
1421 | 1432 |
1422 FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 1433 FWL_Error CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
1423 CFWL_EventType dwFlag = pEvent->GetClassID(); | 1434 CFWL_EventType dwFlag = pEvent->GetClassID(); |
1424 if (dwFlag == CFWL_EventType::DrawItem) { | 1435 if (dwFlag == CFWL_EventType::DrawItem) { |
1425 CFWL_EvtLtbDrawItem* pDrawItemEvent = | 1436 CFWL_EvtLtbDrawItem* pDrawItemEvent = |
1426 static_cast<CFWL_EvtLtbDrawItem*>(pEvent); | 1437 static_cast<CFWL_EvtLtbDrawItem*>(pEvent); |
1427 CFWL_EvtCmbDrawItem pTemp; | 1438 CFWL_EvtCmbDrawItem pTemp; |
1428 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; | 1439 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; |
1429 pTemp.m_pGraphics = pDrawItemEvent->m_pGraphics; | 1440 pTemp.m_pGraphics = pDrawItemEvent->m_pGraphics; |
1430 pTemp.m_index = pDrawItemEvent->m_index; | 1441 pTemp.m_index = pDrawItemEvent->m_index; |
1431 pTemp.m_rtItem = pDrawItemEvent->m_rect; | 1442 pTemp.m_rtItem = pDrawItemEvent->m_rect; |
1432 m_pOwner->DispatchEvent(&pTemp); | 1443 m_pOwner->DispatchEvent(&pTemp); |
1433 } else if (dwFlag == CFWL_EventType::Scroll) { | 1444 } else if (dwFlag == CFWL_EventType::Scroll) { |
1434 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); | 1445 CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent); |
1435 CFWL_EvtScroll pScrollEv; | 1446 CFWL_EvtScroll pScrollEv; |
1436 pScrollEv.m_pSrcTarget = m_pOwner->m_pInterface; | 1447 pScrollEv.m_pSrcTarget = m_pOwner->m_pInterface; |
1437 pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode; | 1448 pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode; |
1438 pScrollEv.m_fPos = pScrollEvent->m_fPos; | 1449 pScrollEv.m_fPos = pScrollEvent->m_fPos; |
1439 m_pOwner->DispatchEvent(&pScrollEv); | 1450 m_pOwner->DispatchEvent(&pScrollEv); |
1440 } else if (dwFlag == CFWL_EventType::TextChanged) { | 1451 } else if (dwFlag == CFWL_EventType::TextChanged) { |
1441 CFWL_EvtEdtTextChanged* pTextChangedEvent = | 1452 CFWL_EvtEdtTextChanged* pTextChangedEvent = |
1442 static_cast<CFWL_EvtEdtTextChanged*>(pEvent); | 1453 static_cast<CFWL_EvtEdtTextChanged*>(pEvent); |
1443 CFWL_EvtCmbEditChanged pTemp; | 1454 CFWL_EvtCmbEditChanged pTemp; |
1444 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; | 1455 pTemp.m_pSrcTarget = m_pOwner->m_pInterface; |
1445 pTemp.wsInsert = pTextChangedEvent->wsInsert; | 1456 pTemp.wsInsert = pTextChangedEvent->wsInsert; |
1446 pTemp.wsDelete = pTextChangedEvent->wsDelete; | 1457 pTemp.wsDelete = pTextChangedEvent->wsDelete; |
1447 pTemp.nChangeType = pTextChangedEvent->nChangeType; | 1458 pTemp.nChangeType = pTextChangedEvent->nChangeType; |
1448 m_pOwner->DispatchEvent(&pTemp); | 1459 m_pOwner->DispatchEvent(&pTemp); |
1449 } | 1460 } |
1450 return FWL_ERR_Succeeded; | 1461 return FWL_Error::Succeeded; |
1451 } | 1462 } |
1452 | 1463 |
1453 FWL_ERR CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1464 FWL_Error CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
1454 const CFX_Matrix* pMatrix) { | 1465 const CFX_Matrix* pMatrix) { |
1455 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 1466 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
1456 } | 1467 } |
1457 void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, | 1468 void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, |
1458 FX_BOOL bSet) { | 1469 FX_BOOL bSet) { |
1459 IFWL_Widget* pDstTarget = pMsg->m_pDstTarget; | 1470 IFWL_Widget* pDstTarget = pMsg->m_pDstTarget; |
1460 IFWL_Widget* pSrcTarget = pMsg->m_pSrcTarget; | 1471 IFWL_Widget* pSrcTarget = pMsg->m_pSrcTarget; |
1461 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); | 1472 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); |
1462 if (bSet) { | 1473 if (bSet) { |
1463 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; | 1474 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; |
1464 if (bDropDown && pSrcTarget != m_pOwner->m_pListBox.get()) { | 1475 if (bDropDown && pSrcTarget != m_pOwner->m_pListBox.get()) { |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1789 case CFWL_MessageType::SetFocus: { | 1800 case CFWL_MessageType::SetFocus: { |
1790 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), TRUE); | 1801 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), TRUE); |
1791 break; | 1802 break; |
1792 } | 1803 } |
1793 default: | 1804 default: |
1794 break; | 1805 break; |
1795 } | 1806 } |
1796 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 1807 return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
1797 } | 1808 } |
1798 | 1809 |
1799 FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 1810 FWL_Error CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
1800 const CFX_Matrix* pMatrix) { | 1811 const CFX_Matrix* pMatrix) { |
1801 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); | 1812 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); |
1802 return FWL_ERR_Succeeded; | 1813 return FWL_Error::Succeeded; |
1803 } | 1814 } |
1804 void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { | 1815 void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { |
1805 IFWL_App* pApp = m_pForm->GetOwnerApp(); | 1816 IFWL_App* pApp = m_pForm->GetOwnerApp(); |
1806 if (!pApp) | 1817 if (!pApp) |
1807 return; | 1818 return; |
1808 | 1819 |
1809 CFWL_NoteDriver* pDriver = | 1820 CFWL_NoteDriver* pDriver = |
1810 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 1821 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
1811 CFX_RectF rtWidget; | 1822 CFX_RectF rtWidget; |
1812 m_pForm->GetWidgetRect(rtWidget); | 1823 m_pForm->GetWidgetRect(rtWidget); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 m_pComboBox->ShowDropList(FALSE); | 1857 m_pComboBox->ShowDropList(FALSE); |
1847 } | 1858 } |
1848 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, | 1859 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, |
1849 FX_BOOL bSet) { | 1860 FX_BOOL bSet) { |
1850 if (!bSet) { | 1861 if (!bSet) { |
1851 if (pMsg->m_pSetFocus == NULL) { | 1862 if (pMsg->m_pSetFocus == NULL) { |
1852 m_pComboBox->ShowDropList(FALSE); | 1863 m_pComboBox->ShowDropList(FALSE); |
1853 } | 1864 } |
1854 } | 1865 } |
1855 } | 1866 } |
OLD | NEW |