| 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/core/ifwl_combobox.h" | 7 #include "xfa/fwl/core/ifwl_combobox.h" |
| 8 | 8 |
| 9 #include "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
| 10 #include "xfa/fde/cfde_txtedtengine.h" | 10 #include "xfa/fde/cfde_txtedtengine.h" |
| 11 #include "xfa/fde/tto/fde_textout.h" | 11 #include "xfa/fde/tto/fde_textout.h" |
| 12 #include "xfa/fwl/core/cfwl_evteditchanged.h" | 12 #include "xfa/fwl/core/cfwl_evteditchanged.h" |
| 13 #include "xfa/fwl/core/cfwl_evtpostdropdown.h" | 13 #include "xfa/fwl/core/cfwl_evtpostdropdown.h" |
| 14 #include "xfa/fwl/core/cfwl_evtpredropdown.h" | 14 #include "xfa/fwl/core/cfwl_evtpredropdown.h" |
| 15 #include "xfa/fwl/core/cfwl_evtselectchanged.h" | 15 #include "xfa/fwl/core/cfwl_evtselectchanged.h" |
| 16 #include "xfa/fwl/core/cfwl_evttextchanged.h" | 16 #include "xfa/fwl/core/cfwl_evttextchanged.h" |
| 17 #include "xfa/fwl/core/cfwl_msgkey.h" | 17 #include "xfa/fwl/core/cfwl_msgkey.h" |
| 18 #include "xfa/fwl/core/cfwl_msgkillfocus.h" | 18 #include "xfa/fwl/core/cfwl_msgkillfocus.h" |
| 19 #include "xfa/fwl/core/cfwl_msgmouse.h" | 19 #include "xfa/fwl/core/cfwl_msgmouse.h" |
| 20 #include "xfa/fwl/core/cfwl_msgsetfocus.h" | 20 #include "xfa/fwl/core/cfwl_msgsetfocus.h" |
| 21 #include "xfa/fwl/core/cfwl_themebackground.h" | 21 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 22 #include "xfa/fwl/core/cfwl_themepart.h" | 22 #include "xfa/fwl/core/cfwl_themepart.h" |
| 23 #include "xfa/fwl/core/cfwl_themetext.h" | 23 #include "xfa/fwl/core/cfwl_themetext.h" |
| 24 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 24 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
| 25 #include "xfa/fwl/core/fwl_noteimp.h" | 25 #include "xfa/fwl/core/fwl_noteimp.h" |
| 26 #include "xfa/fwl/core/ifwl_app.h" | 26 #include "xfa/fwl/core/ifwl_app.h" |
| 27 #include "xfa/fwl/core/ifwl_combobox.h" |
| 27 #include "xfa/fwl/core/ifwl_formproxy.h" | 28 #include "xfa/fwl/core/ifwl_formproxy.h" |
| 29 #include "xfa/fwl/core/ifwl_listbox.h" |
| 28 #include "xfa/fwl/core/ifwl_themeprovider.h" | 30 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 29 | 31 |
| 30 IFWL_ComboBox::IFWL_ComboBox(const IFWL_App* app, | 32 IFWL_ComboBox::IFWL_ComboBox(const IFWL_App* app, |
| 31 std::unique_ptr<CFWL_WidgetProperties> properties) | 33 std::unique_ptr<CFWL_WidgetProperties> properties) |
| 32 : IFWL_Widget(app, std::move(properties), nullptr), | 34 : IFWL_Widget(app, std::move(properties), nullptr), |
| 33 m_pComboBoxProxy(nullptr), | 35 m_pComboBoxProxy(nullptr), |
| 34 m_bLButtonDown(false), | 36 m_bLButtonDown(false), |
| 35 m_iCurSel(-1), | 37 m_iCurSel(-1), |
| 36 m_iBtnState(CFWL_PartState_Normal), | 38 m_iBtnState(CFWL_PartState_Normal), |
| 37 m_fComboFormHandler(0) { | 39 m_fComboFormHandler(0) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 169 |
| 168 CFWL_ThemeBackground param; | 170 CFWL_ThemeBackground param; |
| 169 param.m_pWidget = this; | 171 param.m_pWidget = this; |
| 170 param.m_iPart = CFWL_Part::Background; | 172 param.m_iPart = CFWL_Part::Background; |
| 171 param.m_pGraphics = pGraphics; | 173 param.m_pGraphics = pGraphics; |
| 172 if (pMatrix) | 174 if (pMatrix) |
| 173 param.m_matrix.Concat(*pMatrix); | 175 param.m_matrix.Concat(*pMatrix); |
| 174 param.m_rtPart = rtTextBk; | 176 param.m_rtPart = rtTextBk; |
| 175 | 177 |
| 176 if (m_iCurSel >= 0) { | 178 if (m_iCurSel >= 0) { |
| 177 IFWL_ListBoxDP* pData = | 179 IFWL_ListBox::DataProvider* pData = |
| 178 static_cast<IFWL_ListBoxDP*>(m_pListBox->GetDataProvider()); | 180 static_cast<IFWL_ListBox::DataProvider*>( |
| 181 m_pListBox->GetDataProvider()); |
| 179 void* p = pData->GetItemData(m_pListBox.get(), | 182 void* p = pData->GetItemData(m_pListBox.get(), |
| 180 pData->GetItem(m_pListBox.get(), m_iCurSel)); | 183 pData->GetItem(m_pListBox.get(), m_iCurSel)); |
| 181 if (p) | 184 if (p) |
| 182 param.m_pData = p; | 185 param.m_pData = p; |
| 183 } | 186 } |
| 184 | 187 |
| 185 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) { | 188 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) { |
| 186 param.m_dwStates = CFWL_PartState_Disabled; | 189 param.m_dwStates = CFWL_PartState_Disabled; |
| 187 } else if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) && | 190 } else if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) && |
| 188 (m_iCurSel >= 0)) { | 191 (m_iCurSel >= 0)) { |
| 189 param.m_dwStates = CFWL_PartState_Selected; | 192 param.m_dwStates = CFWL_PartState_Selected; |
| 190 } else { | 193 } else { |
| 191 param.m_dwStates = CFWL_PartState_Normal; | 194 param.m_dwStates = CFWL_PartState_Normal; |
| 192 } | 195 } |
| 193 pTheme->DrawBackground(¶m); | 196 pTheme->DrawBackground(¶m); |
| 194 | 197 |
| 195 if (m_iCurSel >= 0) { | 198 if (m_iCurSel >= 0) { |
| 196 if (!m_pListBox) | 199 if (!m_pListBox) |
| 197 return; | 200 return; |
| 198 | 201 |
| 199 CFX_WideString wsText; | 202 CFX_WideString wsText; |
| 200 IFWL_ComboBoxDP* pData = | 203 IFWL_ComboBox::DataProvider* pData = |
| 201 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 204 static_cast<IFWL_ComboBox::DataProvider*>( |
| 205 m_pProperties->m_pDataProvider); |
| 202 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); | 206 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); |
| 203 m_pListBox->GetItemText(hItem, wsText); | 207 m_pListBox->GetItemText(hItem, wsText); |
| 204 | 208 |
| 205 CFWL_ThemeText theme_text; | 209 CFWL_ThemeText theme_text; |
| 206 theme_text.m_pWidget = this; | 210 theme_text.m_pWidget = this; |
| 207 theme_text.m_iPart = CFWL_Part::Caption; | 211 theme_text.m_iPart = CFWL_Part::Caption; |
| 208 theme_text.m_dwStates = m_iBtnState; | 212 theme_text.m_dwStates = m_iBtnState; |
| 209 theme_text.m_pGraphics = pGraphics; | 213 theme_text.m_pGraphics = pGraphics; |
| 210 theme_text.m_matrix.Concat(*pMatrix); | 214 theme_text.m_matrix.Concat(*pMatrix); |
| 211 theme_text.m_rtPart = rtTextBk; | 215 theme_text.m_rtPart = rtTextBk; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 } | 247 } |
| 244 | 248 |
| 245 void IFWL_ComboBox::SetCurSel(int32_t iSel) { | 249 void IFWL_ComboBox::SetCurSel(int32_t iSel) { |
| 246 int32_t iCount = m_pListBox->CountItems(); | 250 int32_t iCount = m_pListBox->CountItems(); |
| 247 bool bClearSel = iSel < 0 || iSel >= iCount; | 251 bool bClearSel = iSel < 0 || iSel >= iCount; |
| 248 if (IsDropDownStyle() && m_pEdit) { | 252 if (IsDropDownStyle() && m_pEdit) { |
| 249 if (bClearSel) { | 253 if (bClearSel) { |
| 250 m_pEdit->SetText(CFX_WideString()); | 254 m_pEdit->SetText(CFX_WideString()); |
| 251 } else { | 255 } else { |
| 252 CFX_WideString wsText; | 256 CFX_WideString wsText; |
| 253 IFWL_ComboBoxDP* pData = | 257 IFWL_ComboBox::DataProvider* pData = |
| 254 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 258 static_cast<IFWL_ComboBox::DataProvider*>( |
| 259 m_pProperties->m_pDataProvider); |
| 255 CFWL_ListItem* hItem = pData->GetItem(this, iSel); | 260 CFWL_ListItem* hItem = pData->GetItem(this, iSel); |
| 256 m_pListBox->GetItemText(hItem, wsText); | 261 m_pListBox->GetItemText(hItem, wsText); |
| 257 m_pEdit->SetText(wsText); | 262 m_pEdit->SetText(wsText); |
| 258 } | 263 } |
| 259 m_pEdit->Update(); | 264 m_pEdit->Update(); |
| 260 } | 265 } |
| 261 m_iCurSel = bClearSel ? -1 : iSel; | 266 m_iCurSel = bClearSel ? -1 : iSel; |
| 262 } | 267 } |
| 263 | 268 |
| 264 void IFWL_ComboBox::SetStates(uint32_t dwStates, bool bSet) { | 269 void IFWL_ComboBox::SetStates(uint32_t dwStates, bool bSet) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 280 void IFWL_ComboBox::GetEditText(CFX_WideString& wsText, | 285 void IFWL_ComboBox::GetEditText(CFX_WideString& wsText, |
| 281 int32_t nStart, | 286 int32_t nStart, |
| 282 int32_t nCount) const { | 287 int32_t nCount) const { |
| 283 if (m_pEdit) { | 288 if (m_pEdit) { |
| 284 m_pEdit->GetText(wsText, nStart, nCount); | 289 m_pEdit->GetText(wsText, nStart, nCount); |
| 285 return; | 290 return; |
| 286 } | 291 } |
| 287 if (!m_pListBox) | 292 if (!m_pListBox) |
| 288 return; | 293 return; |
| 289 | 294 |
| 290 IFWL_ComboBoxDP* pData = | 295 IFWL_ComboBox::DataProvider* pData = |
| 291 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 296 static_cast<IFWL_ComboBox::DataProvider*>(m_pProperties->m_pDataProvider); |
| 292 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); | 297 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); |
| 293 m_pListBox->GetItemText(hItem, wsText); | 298 m_pListBox->GetItemText(hItem, wsText); |
| 294 } | 299 } |
| 295 | 300 |
| 296 void IFWL_ComboBox::OpenDropDownList(bool bActivate) { | 301 void IFWL_ComboBox::OpenDropDownList(bool bActivate) { |
| 297 ShowDropList(bActivate); | 302 ShowDropList(bActivate); |
| 298 } | 303 } |
| 299 | 304 |
| 300 void IFWL_ComboBox::GetBBox(CFX_RectF& rect) const { | 305 void IFWL_ComboBox::GetBBox(CFX_RectF& rect) const { |
| 301 if (m_pWidgetMgr->IsFormDisabled()) { | 306 if (m_pWidgetMgr->IsFormDisabled()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 313 rect.Union(rtList); | 318 rect.Union(rtList); |
| 314 } | 319 } |
| 315 | 320 |
| 316 void IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, | 321 void IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, |
| 317 uint32_t dwStylesExRemoved) { | 322 uint32_t dwStylesExRemoved) { |
| 318 if (m_pEdit) | 323 if (m_pEdit) |
| 319 m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); | 324 m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); |
| 320 } | 325 } |
| 321 | 326 |
| 322 FX_FLOAT IFWL_ComboBox::GetListHeight() { | 327 FX_FLOAT IFWL_ComboBox::GetListHeight() { |
| 323 return static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider) | 328 return static_cast<IFWL_ComboBox::DataProvider*>( |
| 329 m_pProperties->m_pDataProvider) |
| 324 ->GetListHeight(this); | 330 ->GetListHeight(this); |
| 325 } | 331 } |
| 326 | 332 |
| 327 void IFWL_ComboBox::DrawStretchHandler(CFX_Graphics* pGraphics, | 333 void IFWL_ComboBox::DrawStretchHandler(CFX_Graphics* pGraphics, |
| 328 const CFX_Matrix* pMatrix) { | 334 const CFX_Matrix* pMatrix) { |
| 329 CFWL_ThemeBackground param; | 335 CFWL_ThemeBackground param; |
| 330 param.m_pGraphics = pGraphics; | 336 param.m_pGraphics = pGraphics; |
| 331 param.m_iPart = CFWL_Part::StretchHandler; | 337 param.m_iPart = CFWL_Part::StretchHandler; |
| 332 param.m_dwStates = CFWL_PartState_Normal; | 338 param.m_dwStates = CFWL_PartState_Normal; |
| 333 param.m_pWidget = this; | 339 param.m_pWidget = this; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 if (iMatch >= 0) | 422 if (iMatch >= 0) |
| 417 SyncEditText(iMatch); | 423 SyncEditText(iMatch); |
| 418 } else if (iMatch >= 0) { | 424 } else if (iMatch >= 0) { |
| 419 m_pEdit->SetSelected(); | 425 m_pEdit->SetSelected(); |
| 420 } | 426 } |
| 421 m_iCurSel = iMatch; | 427 m_iCurSel = iMatch; |
| 422 } | 428 } |
| 423 | 429 |
| 424 void IFWL_ComboBox::SyncEditText(int32_t iListItem) { | 430 void IFWL_ComboBox::SyncEditText(int32_t iListItem) { |
| 425 CFX_WideString wsText; | 431 CFX_WideString wsText; |
| 426 IFWL_ComboBoxDP* pData = | 432 IFWL_ComboBox::DataProvider* pData = |
| 427 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 433 static_cast<IFWL_ComboBox::DataProvider*>(m_pProperties->m_pDataProvider); |
| 428 CFWL_ListItem* hItem = pData->GetItem(this, iListItem); | 434 CFWL_ListItem* hItem = pData->GetItem(this, iListItem); |
| 429 m_pListBox->GetItemText(hItem, wsText); | 435 m_pListBox->GetItemText(hItem, wsText); |
| 430 m_pEdit->SetText(wsText); | 436 m_pEdit->SetText(wsText); |
| 431 m_pEdit->Update(); | 437 m_pEdit->Update(); |
| 432 m_pEdit->SetSelected(); | 438 m_pEdit->SetSelected(); |
| 433 } | 439 } |
| 434 | 440 |
| 435 void IFWL_ComboBox::Layout() { | 441 void IFWL_ComboBox::Layout() { |
| 436 if (m_pWidgetMgr->IsFormDisabled()) | 442 if (m_pWidgetMgr->IsFormDisabled()) |
| 437 return DisForm_Layout(); | 443 return DisForm_Layout(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 448 if (!IsDropDownStyle() || !m_pEdit) | 454 if (!IsDropDownStyle() || !m_pEdit) |
| 449 return; | 455 return; |
| 450 | 456 |
| 451 CFX_RectF rtEdit; | 457 CFX_RectF rtEdit; |
| 452 rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, | 458 rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, |
| 453 m_rtClient.height); | 459 m_rtClient.height); |
| 454 m_pEdit->SetWidgetRect(rtEdit); | 460 m_pEdit->SetWidgetRect(rtEdit); |
| 455 | 461 |
| 456 if (m_iCurSel >= 0) { | 462 if (m_iCurSel >= 0) { |
| 457 CFX_WideString wsText; | 463 CFX_WideString wsText; |
| 458 IFWL_ComboBoxDP* pData = | 464 IFWL_ComboBox::DataProvider* pData = |
| 459 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 465 static_cast<IFWL_ComboBox::DataProvider*>( |
| 466 m_pProperties->m_pDataProvider); |
| 460 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); | 467 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); |
| 461 m_pListBox->GetItemText(hItem, wsText); | 468 m_pListBox->GetItemText(hItem, wsText); |
| 462 m_pEdit->LockUpdate(); | 469 m_pEdit->LockUpdate(); |
| 463 m_pEdit->SetText(wsText); | 470 m_pEdit->SetText(wsText); |
| 464 m_pEdit->UnlockUpdate(); | 471 m_pEdit->UnlockUpdate(); |
| 465 } | 472 } |
| 466 m_pEdit->Update(); | 473 m_pEdit->Update(); |
| 467 } | 474 } |
| 468 | 475 |
| 469 void IFWL_ComboBox::ResetTheme() { | 476 void IFWL_ComboBox::ResetTheme() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 } | 541 } |
| 535 default: { | 542 default: { |
| 536 dwAdd |= FWL_STYLEEXT_LTB_LeftAlign; | 543 dwAdd |= FWL_STYLEEXT_LTB_LeftAlign; |
| 537 break; | 544 break; |
| 538 } | 545 } |
| 539 } | 546 } |
| 540 m_pListBox->ModifyStylesEx(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask); | 547 m_pListBox->ModifyStylesEx(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask); |
| 541 } | 548 } |
| 542 | 549 |
| 543 void IFWL_ComboBox::ProcessSelChanged(bool bLButtonUp) { | 550 void IFWL_ComboBox::ProcessSelChanged(bool bLButtonUp) { |
| 544 IFWL_ComboBoxDP* pDatas = | 551 IFWL_ComboBox::DataProvider* pDatas = |
| 545 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 552 static_cast<IFWL_ComboBox::DataProvider*>(m_pProperties->m_pDataProvider); |
| 546 m_iCurSel = pDatas->GetItemIndex(this, m_pListBox->GetSelItem(0)); | 553 m_iCurSel = pDatas->GetItemIndex(this, m_pListBox->GetSelItem(0)); |
| 547 if (!IsDropDownStyle()) { | 554 if (!IsDropDownStyle()) { |
| 548 Repaint(&m_rtClient); | 555 Repaint(&m_rtClient); |
| 549 return; | 556 return; |
| 550 } | 557 } |
| 551 | 558 |
| 552 IFWL_ComboBoxDP* pData = | 559 IFWL_ComboBox::DataProvider* pData = |
| 553 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 560 static_cast<IFWL_ComboBox::DataProvider*>(m_pProperties->m_pDataProvider); |
| 554 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); | 561 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); |
| 555 if (!hItem) | 562 if (!hItem) |
| 556 return; | 563 return; |
| 557 | 564 |
| 558 CFX_WideString wsText; | 565 CFX_WideString wsText; |
| 559 pData->GetItemText(this, hItem, wsText); | 566 pData->GetItemText(this, hItem, wsText); |
| 560 if (m_pEdit) { | 567 if (m_pEdit) { |
| 561 m_pEdit->SetText(wsText); | 568 m_pEdit->SetText(wsText); |
| 562 m_pEdit->Update(); | 569 m_pEdit->Update(); |
| 563 m_pEdit->SetSelected(); | 570 m_pEdit->SetSelected(); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 if (!IsDropDownStyle() || !m_pEdit) | 790 if (!IsDropDownStyle() || !m_pEdit) |
| 784 return; | 791 return; |
| 785 | 792 |
| 786 CFX_RectF rtEdit; | 793 CFX_RectF rtEdit; |
| 787 rtEdit.Set(m_rtContent.left, m_rtContent.top, m_rtContent.width - fBtn, | 794 rtEdit.Set(m_rtContent.left, m_rtContent.top, m_rtContent.width - fBtn, |
| 788 m_rtContent.height); | 795 m_rtContent.height); |
| 789 m_pEdit->SetWidgetRect(rtEdit); | 796 m_pEdit->SetWidgetRect(rtEdit); |
| 790 | 797 |
| 791 if (m_iCurSel >= 0) { | 798 if (m_iCurSel >= 0) { |
| 792 CFX_WideString wsText; | 799 CFX_WideString wsText; |
| 793 IFWL_ComboBoxDP* pData = | 800 IFWL_ComboBox::DataProvider* pData = |
| 794 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 801 static_cast<IFWL_ComboBox::DataProvider*>( |
| 802 m_pProperties->m_pDataProvider); |
| 795 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); | 803 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); |
| 796 m_pListBox->GetItemText(hItem, wsText); | 804 m_pListBox->GetItemText(hItem, wsText); |
| 797 m_pEdit->LockUpdate(); | 805 m_pEdit->LockUpdate(); |
| 798 m_pEdit->SetText(wsText); | 806 m_pEdit->SetText(wsText); |
| 799 m_pEdit->UnlockUpdate(); | 807 m_pEdit->UnlockUpdate(); |
| 800 } | 808 } |
| 801 m_pEdit->Update(); | 809 m_pEdit->Update(); |
| 802 } | 810 } |
| 803 | 811 |
| 804 void IFWL_ComboBox::OnProcessMessage(CFWL_Message* pMessage) { | 812 void IFWL_ComboBox::OnProcessMessage(CFWL_Message* pMessage) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 | 976 |
| 969 bool bMatchEqual = false; | 977 bool bMatchEqual = false; |
| 970 int32_t iCurSel = m_iCurSel; | 978 int32_t iCurSel = m_iCurSel; |
| 971 bool bDropDown = IsDropDownStyle(); | 979 bool bDropDown = IsDropDownStyle(); |
| 972 if (bDropDown && m_pEdit) { | 980 if (bDropDown && m_pEdit) { |
| 973 CFX_WideString wsText; | 981 CFX_WideString wsText; |
| 974 m_pEdit->GetText(wsText); | 982 m_pEdit->GetText(wsText); |
| 975 iCurSel = m_pListBox->MatchItem(wsText); | 983 iCurSel = m_pListBox->MatchItem(wsText); |
| 976 if (iCurSel >= 0) { | 984 if (iCurSel >= 0) { |
| 977 CFX_WideString wsTemp; | 985 CFX_WideString wsTemp; |
| 978 IFWL_ComboBoxDP* pData = | 986 IFWL_ComboBox::DataProvider* pData = |
| 979 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 987 static_cast<IFWL_ComboBox::DataProvider*>( |
| 988 m_pProperties->m_pDataProvider); |
| 980 CFWL_ListItem* hItem = pData->GetItem(this, iCurSel); | 989 CFWL_ListItem* hItem = pData->GetItem(this, iCurSel); |
| 981 m_pListBox->GetItemText(hItem, wsTemp); | 990 m_pListBox->GetItemText(hItem, wsTemp); |
| 982 bMatchEqual = wsText == wsTemp; | 991 bMatchEqual = wsText == wsTemp; |
| 983 } | 992 } |
| 984 } | 993 } |
| 985 if (iCurSel < 0) { | 994 if (iCurSel < 0) { |
| 986 iCurSel = 0; | 995 iCurSel = 0; |
| 987 } else if (!bDropDown || bMatchEqual) { | 996 } else if (!bDropDown || bMatchEqual) { |
| 988 if ((bUp && iCurSel == 0) || (bDown && iCurSel == iCount - 1)) | 997 if ((bUp && iCurSel == 0) || (bDown && iCurSel == iCount - 1)) |
| 989 return; | 998 return; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 else | 1137 else |
| 1129 iCurSel++; | 1138 iCurSel++; |
| 1130 } | 1139 } |
| 1131 m_iCurSel = iCurSel; | 1140 m_iCurSel = iCurSel; |
| 1132 SyncEditText(m_iCurSel); | 1141 SyncEditText(m_iCurSel); |
| 1133 return; | 1142 return; |
| 1134 } | 1143 } |
| 1135 if (m_pEdit) | 1144 if (m_pEdit) |
| 1136 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); | 1145 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); |
| 1137 } | 1146 } |
| OLD | NEW |