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