| 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/cfde_txtedtengine.h" | 9 #include "xfa/fde/cfde_txtedtengine.h" |
| 10 #include "xfa/fde/tto/fde_textout.h" | 10 #include "xfa/fde/tto/fde_textout.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) { | 216 int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) { |
| 217 if (wsMatch.IsEmpty()) { | 217 if (wsMatch.IsEmpty()) { |
| 218 return -1; | 218 return -1; |
| 219 } | 219 } |
| 220 if (!m_pProperties->m_pDataProvider) | 220 if (!m_pProperties->m_pDataProvider) |
| 221 return -1; | 221 return -1; |
| 222 IFWL_ListBoxDP* pData = | 222 IFWL_ListBoxDP* pData = |
| 223 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); | 223 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); |
| 224 int32_t iCount = pData->CountItems(m_pInterface); | 224 int32_t iCount = pData->CountItems(m_pInterface); |
| 225 for (int32_t i = 0; i < iCount; i++) { | 225 for (int32_t i = 0; i < iCount; i++) { |
| 226 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i); | 226 IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i); |
| 227 CFX_WideString wsText; | 227 CFX_WideString wsText; |
| 228 pData->GetItemText(m_pInterface, hItem, wsText); | 228 pData->GetItemText(m_pInterface, hItem, wsText); |
| 229 FX_STRSIZE pos = wsText.Find(wsMatch.c_str()); | 229 FX_STRSIZE pos = wsText.Find(wsMatch.c_str()); |
| 230 if (!pos) { | 230 if (!pos) { |
| 231 return i; | 231 return i; |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 return -1; | 234 return -1; |
| 235 } | 235 } |
| 236 void CFWL_ComboListImp::ChangeSelected(int32_t iSel) { | 236 void CFWL_ComboListImp::ChangeSelected(int32_t iSel) { |
| 237 if (!m_pProperties->m_pDataProvider) | 237 if (!m_pProperties->m_pDataProvider) |
| 238 return; | 238 return; |
| 239 IFWL_ListBoxDP* pData = | 239 IFWL_ListBoxDP* pData = |
| 240 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); | 240 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); |
| 241 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel); | 241 IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iSel); |
| 242 CFX_RectF rtInvalidate; | 242 CFX_RectF rtInvalidate; |
| 243 rtInvalidate.Reset(); | 243 rtInvalidate.Reset(); |
| 244 FWL_HLISTITEM hOld = GetSelItem(0); | 244 IFWL_ListItem* hOld = GetSelItem(0); |
| 245 int32_t iOld = pData->GetItemIndex(m_pInterface, hOld); | 245 int32_t iOld = pData->GetItemIndex(m_pInterface, hOld); |
| 246 if (iOld == iSel) { | 246 if (iOld == iSel) { |
| 247 return; | 247 return; |
| 248 } else if (iOld > -1) { | 248 } else if (iOld > -1) { |
| 249 GetItemRect(iOld, rtInvalidate); | 249 GetItemRect(iOld, rtInvalidate); |
| 250 SetSelItem(hOld, FALSE); | 250 SetSelItem(hOld, FALSE); |
| 251 } | 251 } |
| 252 if (hItem) { | 252 if (hItem) { |
| 253 CFX_RectF rect; | 253 CFX_RectF rect; |
| 254 GetItemRect(iSel, rect); | 254 GetItemRect(iSel, rect); |
| 255 rtInvalidate.Union(rect); | 255 rtInvalidate.Union(rect); |
| 256 FWL_HLISTITEM hSel = pData->GetItem(m_pInterface, iSel); | 256 IFWL_ListItem* hSel = pData->GetItem(m_pInterface, iSel); |
| 257 SetSelItem(hSel, TRUE); | 257 SetSelItem(hSel, TRUE); |
| 258 } | 258 } |
| 259 if (!rtInvalidate.IsEmpty()) { | 259 if (!rtInvalidate.IsEmpty()) { |
| 260 Repaint(&rtInvalidate); | 260 Repaint(&rtInvalidate); |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 int32_t CFWL_ComboListImp::CountItems() { | 263 int32_t CFWL_ComboListImp::CountItems() { |
| 264 IFWL_ListBoxDP* pData = | 264 IFWL_ListBoxDP* pData = |
| 265 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); | 265 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); |
| 266 return pData ? pData->CountItems(m_pInterface) : 0; | 266 return pData ? pData->CountItems(m_pInterface) : 0; |
| 267 } | 267 } |
| 268 void CFWL_ComboListImp::GetItemRect(int32_t nIndex, CFX_RectF& rtItem) { | 268 void CFWL_ComboListImp::GetItemRect(int32_t nIndex, CFX_RectF& rtItem) { |
| 269 IFWL_ListBoxDP* pData = | 269 IFWL_ListBoxDP* pData = |
| 270 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); | 270 static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); |
| 271 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, nIndex); | 271 IFWL_ListItem* hItem = pData->GetItem(m_pInterface, nIndex); |
| 272 pData->GetItemRect(m_pInterface, hItem, rtItem); | 272 pData->GetItemRect(m_pInterface, hItem, rtItem); |
| 273 } | 273 } |
| 274 void CFWL_ComboListImp::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) { | 274 void CFWL_ComboListImp::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) { |
| 275 fx += m_pProperties->m_rtWidget.left, fy += m_pProperties->m_rtWidget.top; | 275 fx += m_pProperties->m_rtWidget.left, fy += m_pProperties->m_rtWidget.top; |
| 276 IFWL_Widget* pOwner = GetOwner(); | 276 IFWL_Widget* pOwner = GetOwner(); |
| 277 if (!pOwner) | 277 if (!pOwner) |
| 278 return; | 278 return; |
| 279 pOwner->TransformTo(m_pOuter, fx, fy); | 279 pOwner->TransformTo(m_pOuter, fx, fy); |
| 280 } | 280 } |
| 281 void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) { | 281 void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 if (m_pOwner->m_bNotifyOwner) { | 351 if (m_pOwner->m_bNotifyOwner) { |
| 352 m_pOwner->m_bNotifyOwner = FALSE; | 352 m_pOwner->m_bNotifyOwner = FALSE; |
| 353 } | 353 } |
| 354 if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { | 354 if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { |
| 355 CFX_RectF rect; | 355 CFX_RectF rect; |
| 356 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); | 356 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); |
| 357 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { | 357 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { |
| 358 return 1; | 358 return 1; |
| 359 } | 359 } |
| 360 } | 360 } |
| 361 FWL_HLISTITEM hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); | 361 IFWL_ListItem* hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
| 362 if (hItem) { | 362 if (hItem) { |
| 363 if (!m_pOwner->m_pProperties->m_pDataProvider) | 363 if (!m_pOwner->m_pProperties->m_pDataProvider) |
| 364 return 0; | 364 return 0; |
| 365 IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>( | 365 IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>( |
| 366 m_pOwner->m_pProperties->m_pDataProvider); | 366 m_pOwner->m_pProperties->m_pDataProvider); |
| 367 int32_t iSel = pData->GetItemIndex(m_pOwner->m_pInterface, hItem); | 367 int32_t iSel = pData->GetItemIndex(m_pOwner->m_pInterface, hItem); |
| 368 CFWL_EvtCmbHoverChanged event; | 368 CFWL_EvtCmbHoverChanged event; |
| 369 event.m_pSrcTarget = m_pOwner->m_pOuter; | 369 event.m_pSrcTarget = m_pOwner->m_pOuter; |
| 370 event.m_iCurHover = iSel; | 370 event.m_iCurHover = iSel; |
| 371 m_pOwner->DispatchEvent(&event); | 371 m_pOwner->DispatchEvent(&event); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 396 pOuter->m_pDelegate->OnProcessMessage(pMsg); | 396 pOuter->m_pDelegate->OnProcessMessage(pMsg); |
| 397 } else { | 397 } else { |
| 398 if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { | 398 if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) { |
| 399 CFX_RectF rect; | 399 CFX_RectF rect; |
| 400 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); | 400 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); |
| 401 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { | 401 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { |
| 402 return 1; | 402 return 1; |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 pOuter->ShowDropList(FALSE); | 405 pOuter->ShowDropList(FALSE); |
| 406 FWL_HLISTITEM hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); | 406 IFWL_ListItem* hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
| 407 if (hItem) { | 407 if (hItem) { |
| 408 pOuter->ProcessSelChanged(TRUE); | 408 pOuter->ProcessSelChanged(TRUE); |
| 409 } | 409 } |
| 410 } | 410 } |
| 411 return 1; | 411 return 1; |
| 412 } | 412 } |
| 413 int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { | 413 int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { |
| 414 CFWL_ComboBoxImp* pOuter = | 414 CFWL_ComboBoxImp* pOuter = |
| 415 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); | 415 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); |
| 416 FX_BOOL bPropagate = FALSE; | 416 FX_BOOL bPropagate = FALSE; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 445 uint32_t dwKeyCode = pKey->m_dwKeyCode; | 445 uint32_t dwKeyCode = pKey->m_dwKeyCode; |
| 446 switch (dwKeyCode) { | 446 switch (dwKeyCode) { |
| 447 case FWL_VKEY_Up: | 447 case FWL_VKEY_Up: |
| 448 case FWL_VKEY_Down: | 448 case FWL_VKEY_Down: |
| 449 case FWL_VKEY_Home: | 449 case FWL_VKEY_Home: |
| 450 case FWL_VKEY_End: { | 450 case FWL_VKEY_End: { |
| 451 CFWL_ComboBoxImp* pOuter = | 451 CFWL_ComboBoxImp* pOuter = |
| 452 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); | 452 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); |
| 453 IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>( | 453 IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>( |
| 454 m_pOwner->m_pProperties->m_pDataProvider); | 454 m_pOwner->m_pProperties->m_pDataProvider); |
| 455 FWL_HLISTITEM hItem = | 455 IFWL_ListItem* hItem = |
| 456 pData->GetItem(m_pOwner->m_pInterface, pOuter->m_iCurSel); | 456 pData->GetItem(m_pOwner->m_pInterface, pOuter->m_iCurSel); |
| 457 hItem = m_pOwner->GetItem(hItem, dwKeyCode); | 457 hItem = m_pOwner->GetItem(hItem, dwKeyCode); |
| 458 if (!hItem) { | 458 if (!hItem) { |
| 459 break; | 459 break; |
| 460 } | 460 } |
| 461 m_pOwner->SetSelection(hItem, hItem, TRUE); | 461 m_pOwner->SetSelection(hItem, hItem, TRUE); |
| 462 m_pOwner->ScrollToVisible(hItem); | 462 m_pOwner->ScrollToVisible(hItem); |
| 463 CFX_RectF rtInvalidate; | 463 CFX_RectF rtInvalidate; |
| 464 rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width, | 464 rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width, |
| 465 m_pOwner->m_pProperties->m_rtWidget.height); | 465 m_pOwner->m_pProperties->m_rtWidget.height); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 } else { | 650 } else { |
| 651 param.m_dwStates = CFWL_PartState_Normal; | 651 param.m_dwStates = CFWL_PartState_Normal; |
| 652 } | 652 } |
| 653 pTheme->DrawBackground(¶m); | 653 pTheme->DrawBackground(¶m); |
| 654 if (m_iCurSel >= 0) { | 654 if (m_iCurSel >= 0) { |
| 655 if (!m_pListBox) | 655 if (!m_pListBox) |
| 656 return FWL_Error::Indefinite; | 656 return FWL_Error::Indefinite; |
| 657 CFX_WideString wsText; | 657 CFX_WideString wsText; |
| 658 IFWL_ComboBoxDP* pData = | 658 IFWL_ComboBoxDP* pData = |
| 659 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 659 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
| 660 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); | 660 IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel); |
| 661 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) | 661 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) |
| 662 ->GetItemText(hItem, wsText); | 662 ->GetItemText(hItem, wsText); |
| 663 CFWL_ThemeText param; | 663 CFWL_ThemeText param; |
| 664 param.m_pWidget = m_pInterface; | 664 param.m_pWidget = m_pInterface; |
| 665 param.m_iPart = CFWL_Part::Caption; | 665 param.m_iPart = CFWL_Part::Caption; |
| 666 param.m_dwStates = m_iBtnState; | 666 param.m_dwStates = m_iBtnState; |
| 667 param.m_pGraphics = pGraphics; | 667 param.m_pGraphics = pGraphics; |
| 668 param.m_matrix.Concat(*pMatrix); | 668 param.m_matrix.Concat(*pMatrix); |
| 669 param.m_rtPart = rtTextBk; | 669 param.m_rtPart = rtTextBk; |
| 670 param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) | 670 param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->CountItems(); | 711 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->CountItems(); |
| 712 FX_BOOL bClearSel = iSel < 0 || iSel >= iCount; | 712 FX_BOOL bClearSel = iSel < 0 || iSel >= iCount; |
| 713 FX_BOOL bDropDown = IsDropDownStyle(); | 713 FX_BOOL bDropDown = IsDropDownStyle(); |
| 714 if (bDropDown && m_pEdit) { | 714 if (bDropDown && m_pEdit) { |
| 715 if (bClearSel) { | 715 if (bClearSel) { |
| 716 m_pEdit->SetText(CFX_WideString()); | 716 m_pEdit->SetText(CFX_WideString()); |
| 717 } else { | 717 } else { |
| 718 CFX_WideString wsText; | 718 CFX_WideString wsText; |
| 719 IFWL_ComboBoxDP* pData = | 719 IFWL_ComboBoxDP* pData = |
| 720 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 720 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
| 721 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel); | 721 IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iSel); |
| 722 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) | 722 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) |
| 723 ->GetItemText(hItem, wsText); | 723 ->GetItemText(hItem, wsText); |
| 724 m_pEdit->SetText(wsText); | 724 m_pEdit->SetText(wsText); |
| 725 } | 725 } |
| 726 m_pEdit->Update(); | 726 m_pEdit->Update(); |
| 727 } | 727 } |
| 728 m_iCurSel = bClearSel ? -1 : iSel; | 728 m_iCurSel = bClearSel ? -1 : iSel; |
| 729 return FWL_Error::Succeeded; | 729 return FWL_Error::Succeeded; |
| 730 } | 730 } |
| 731 | 731 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 750 return m_pEdit->GetTextLength(); | 750 return m_pEdit->GetTextLength(); |
| 751 } | 751 } |
| 752 FWL_Error CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, | 752 FWL_Error CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, |
| 753 int32_t nStart, | 753 int32_t nStart, |
| 754 int32_t nCount) const { | 754 int32_t nCount) const { |
| 755 if (m_pEdit) { | 755 if (m_pEdit) { |
| 756 return m_pEdit->GetText(wsText, nStart, nCount); | 756 return m_pEdit->GetText(wsText, nStart, nCount); |
| 757 } else if (m_pListBox) { | 757 } else if (m_pListBox) { |
| 758 IFWL_ComboBoxDP* pData = | 758 IFWL_ComboBoxDP* pData = |
| 759 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 759 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
| 760 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); | 760 IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel); |
| 761 return m_pListBox->GetItemText(hItem, wsText); | 761 return m_pListBox->GetItemText(hItem, wsText); |
| 762 } | 762 } |
| 763 return FWL_Error::Indefinite; | 763 return FWL_Error::Indefinite; |
| 764 } | 764 } |
| 765 FWL_Error CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) { | 765 FWL_Error CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) { |
| 766 if (!m_pEdit) | 766 if (!m_pEdit) |
| 767 return FWL_Error::Indefinite; | 767 return FWL_Error::Indefinite; |
| 768 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->ClearSelected(); | 768 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->ClearSelected(); |
| 769 m_pEdit->AddSelRange(nStart, nCount); | 769 m_pEdit->AddSelRange(nStart, nCount); |
| 770 return FWL_Error::Succeeded; | 770 return FWL_Error::Succeeded; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 } | 990 } |
| 991 } else if (iMatch >= 0) { | 991 } else if (iMatch >= 0) { |
| 992 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected(); | 992 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected(); |
| 993 } | 993 } |
| 994 m_iCurSel = iMatch; | 994 m_iCurSel = iMatch; |
| 995 } | 995 } |
| 996 void CFWL_ComboBoxImp::SynchrEditText(int32_t iListItem) { | 996 void CFWL_ComboBoxImp::SynchrEditText(int32_t iListItem) { |
| 997 CFX_WideString wsText; | 997 CFX_WideString wsText; |
| 998 IFWL_ComboBoxDP* pData = | 998 IFWL_ComboBoxDP* pData = |
| 999 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 999 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
| 1000 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iListItem); | 1000 IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iListItem); |
| 1001 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) | 1001 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) |
| 1002 ->GetItemText(hItem, wsText); | 1002 ->GetItemText(hItem, wsText); |
| 1003 m_pEdit->SetText(wsText); | 1003 m_pEdit->SetText(wsText); |
| 1004 m_pEdit->Update(); | 1004 m_pEdit->Update(); |
| 1005 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected(); | 1005 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected(); |
| 1006 } | 1006 } |
| 1007 void CFWL_ComboBoxImp::Layout() { | 1007 void CFWL_ComboBoxImp::Layout() { |
| 1008 if (m_pWidgetMgr->IsFormDisabled()) { | 1008 if (m_pWidgetMgr->IsFormDisabled()) { |
| 1009 return DisForm_Layout(); | 1009 return DisForm_Layout(); |
| 1010 } | 1010 } |
| 1011 GetClientRect(m_rtClient); | 1011 GetClientRect(m_rtClient); |
| 1012 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( | 1012 FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( |
| 1013 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); | 1013 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); |
| 1014 if (!pFWidth) | 1014 if (!pFWidth) |
| 1015 return; | 1015 return; |
| 1016 FX_FLOAT fBtn = *pFWidth; | 1016 FX_FLOAT fBtn = *pFWidth; |
| 1017 m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn, | 1017 m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn, |
| 1018 m_rtClient.height); | 1018 m_rtClient.height); |
| 1019 FX_BOOL bIsDropDown = IsDropDownStyle(); | 1019 FX_BOOL bIsDropDown = IsDropDownStyle(); |
| 1020 if (bIsDropDown && m_pEdit) { | 1020 if (bIsDropDown && m_pEdit) { |
| 1021 CFX_RectF rtEdit; | 1021 CFX_RectF rtEdit; |
| 1022 rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, | 1022 rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, |
| 1023 m_rtClient.height); | 1023 m_rtClient.height); |
| 1024 m_pEdit->SetWidgetRect(rtEdit); | 1024 m_pEdit->SetWidgetRect(rtEdit); |
| 1025 if (m_iCurSel >= 0) { | 1025 if (m_iCurSel >= 0) { |
| 1026 CFX_WideString wsText; | 1026 CFX_WideString wsText; |
| 1027 IFWL_ComboBoxDP* pData = | 1027 IFWL_ComboBoxDP* pData = |
| 1028 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 1028 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
| 1029 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); | 1029 IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel); |
| 1030 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) | 1030 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) |
| 1031 ->GetItemText(hItem, wsText); | 1031 ->GetItemText(hItem, wsText); |
| 1032 m_pEdit->LockUpdate(); | 1032 m_pEdit->LockUpdate(); |
| 1033 m_pEdit->SetText(wsText); | 1033 m_pEdit->SetText(wsText); |
| 1034 m_pEdit->UnlockUpdate(); | 1034 m_pEdit->UnlockUpdate(); |
| 1035 } | 1035 } |
| 1036 m_pEdit->Update(); | 1036 m_pEdit->Update(); |
| 1037 } | 1037 } |
| 1038 } | 1038 } |
| 1039 void CFWL_ComboBoxImp::ReSetTheme() { | 1039 void CFWL_ComboBoxImp::ReSetTheme() { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 m_pListBox->ModifyStylesEx(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask); | 1108 m_pListBox->ModifyStylesEx(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask); |
| 1109 } | 1109 } |
| 1110 void CFWL_ComboBoxImp::ProcessSelChanged(FX_BOOL bLButtonUp) { | 1110 void CFWL_ComboBoxImp::ProcessSelChanged(FX_BOOL bLButtonUp) { |
| 1111 IFWL_ComboBoxDP* pDatas = | 1111 IFWL_ComboBoxDP* pDatas = |
| 1112 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 1112 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
| 1113 m_iCurSel = pDatas->GetItemIndex(m_pInterface, m_pListBox->GetSelItem(0)); | 1113 m_iCurSel = pDatas->GetItemIndex(m_pInterface, m_pListBox->GetSelItem(0)); |
| 1114 FX_BOOL bDropDown = IsDropDownStyle(); | 1114 FX_BOOL bDropDown = IsDropDownStyle(); |
| 1115 if (bDropDown) { | 1115 if (bDropDown) { |
| 1116 IFWL_ComboBoxDP* pData = | 1116 IFWL_ComboBoxDP* pData = |
| 1117 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 1117 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
| 1118 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); | 1118 IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel); |
| 1119 if (hItem) { | 1119 if (hItem) { |
| 1120 CFX_WideString wsText; | 1120 CFX_WideString wsText; |
| 1121 pData->GetItemText(m_pInterface, hItem, wsText); | 1121 pData->GetItemText(m_pInterface, hItem, wsText); |
| 1122 if (m_pEdit) { | 1122 if (m_pEdit) { |
| 1123 m_pEdit->SetText(wsText); | 1123 m_pEdit->SetText(wsText); |
| 1124 m_pEdit->Update(); | 1124 m_pEdit->Update(); |
| 1125 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected(); | 1125 static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected(); |
| 1126 } | 1126 } |
| 1127 CFWL_EvtCmbSelChanged ev; | 1127 CFWL_EvtCmbSelChanged ev; |
| 1128 ev.bLButtonUp = bLButtonUp; | 1128 ev.bLButtonUp = bLButtonUp; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 FX_BOOL bIsDropDown = IsDropDownStyle(); | 1350 FX_BOOL bIsDropDown = IsDropDownStyle(); |
| 1351 if (bIsDropDown && m_pEdit) { | 1351 if (bIsDropDown && m_pEdit) { |
| 1352 CFX_RectF rtEdit; | 1352 CFX_RectF rtEdit; |
| 1353 rtEdit.Set(m_rtContent.left, m_rtContent.top, m_rtContent.width - fBtn, | 1353 rtEdit.Set(m_rtContent.left, m_rtContent.top, m_rtContent.width - fBtn, |
| 1354 m_rtContent.height); | 1354 m_rtContent.height); |
| 1355 m_pEdit->SetWidgetRect(rtEdit); | 1355 m_pEdit->SetWidgetRect(rtEdit); |
| 1356 if (m_iCurSel >= 0) { | 1356 if (m_iCurSel >= 0) { |
| 1357 CFX_WideString wsText; | 1357 CFX_WideString wsText; |
| 1358 IFWL_ComboBoxDP* pData = | 1358 IFWL_ComboBoxDP* pData = |
| 1359 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 1359 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
| 1360 FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); | 1360 IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel); |
| 1361 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) | 1361 static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl()) |
| 1362 ->GetItemText(hItem, wsText); | 1362 ->GetItemText(hItem, wsText); |
| 1363 m_pEdit->LockUpdate(); | 1363 m_pEdit->LockUpdate(); |
| 1364 m_pEdit->SetText(wsText); | 1364 m_pEdit->SetText(wsText); |
| 1365 m_pEdit->UnlockUpdate(); | 1365 m_pEdit->UnlockUpdate(); |
| 1366 } | 1366 } |
| 1367 m_pEdit->Update(); | 1367 m_pEdit->Update(); |
| 1368 } | 1368 } |
| 1369 } | 1369 } |
| 1370 | 1370 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); | 1563 FX_BOOL bDropDown = m_pOwner->IsDropDownStyle(); |
| 1564 if (bDropDown && m_pOwner->m_pEdit) { | 1564 if (bDropDown && m_pOwner->m_pEdit) { |
| 1565 CFX_WideString wsText; | 1565 CFX_WideString wsText; |
| 1566 m_pOwner->m_pEdit->GetText(wsText); | 1566 m_pOwner->m_pEdit->GetText(wsText); |
| 1567 iCurSel = static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) | 1567 iCurSel = static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) |
| 1568 ->MatchItem(wsText); | 1568 ->MatchItem(wsText); |
| 1569 if (iCurSel >= 0) { | 1569 if (iCurSel >= 0) { |
| 1570 CFX_WideString wsTemp; | 1570 CFX_WideString wsTemp; |
| 1571 IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>( | 1571 IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>( |
| 1572 m_pOwner->m_pProperties->m_pDataProvider); | 1572 m_pOwner->m_pProperties->m_pDataProvider); |
| 1573 FWL_HLISTITEM hItem = pData->GetItem(m_pOwner->m_pInterface, iCurSel); | 1573 IFWL_ListItem* hItem = pData->GetItem(m_pOwner->m_pInterface, iCurSel); |
| 1574 static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) | 1574 static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl()) |
| 1575 ->GetItemText(hItem, wsTemp); | 1575 ->GetItemText(hItem, wsTemp); |
| 1576 bMatchEqual = wsText == wsTemp; | 1576 bMatchEqual = wsText == wsTemp; |
| 1577 } | 1577 } |
| 1578 } | 1578 } |
| 1579 if (iCurSel < 0) { | 1579 if (iCurSel < 0) { |
| 1580 iCurSel = 0; | 1580 iCurSel = 0; |
| 1581 } else if (!bDropDown || bMatchEqual) { | 1581 } else if (!bDropDown || bMatchEqual) { |
| 1582 if ((bUp && iCurSel == 0) || (bDown && iCurSel == iCount - 1)) { | 1582 if ((bUp && iCurSel == 0) || (bDown && iCurSel == iCount - 1)) { |
| 1583 return; | 1583 return; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 return; | 1714 return; |
| 1715 } | 1715 } |
| 1716 FX_BOOL bMatchEqual = FALSE; | 1716 FX_BOOL bMatchEqual = FALSE; |
| 1717 int32_t iCurSel = m_pOwner->m_iCurSel; | 1717 int32_t iCurSel = m_pOwner->m_iCurSel; |
| 1718 if (m_pOwner->m_pEdit) { | 1718 if (m_pOwner->m_pEdit) { |
| 1719 CFX_WideString wsText; | 1719 CFX_WideString wsText; |
| 1720 m_pOwner->m_pEdit->GetText(wsText); | 1720 m_pOwner->m_pEdit->GetText(wsText); |
| 1721 iCurSel = pComboList->MatchItem(wsText); | 1721 iCurSel = pComboList->MatchItem(wsText); |
| 1722 if (iCurSel >= 0) { | 1722 if (iCurSel >= 0) { |
| 1723 CFX_WideString wsTemp; | 1723 CFX_WideString wsTemp; |
| 1724 FWL_HLISTITEM item = m_pOwner->m_pListBox->GetSelItem(iCurSel); | 1724 IFWL_ListItem* item = m_pOwner->m_pListBox->GetSelItem(iCurSel); |
| 1725 m_pOwner->m_pListBox->GetItemText(item, wsTemp); | 1725 m_pOwner->m_pListBox->GetItemText(item, wsTemp); |
| 1726 bMatchEqual = wsText == wsTemp; | 1726 bMatchEqual = wsText == wsTemp; |
| 1727 } | 1727 } |
| 1728 } | 1728 } |
| 1729 if (iCurSel < 0) { | 1729 if (iCurSel < 0) { |
| 1730 iCurSel = 0; | 1730 iCurSel = 0; |
| 1731 } else if (bMatchEqual) { | 1731 } else if (bMatchEqual) { |
| 1732 if ((bUp && iCurSel == 0) || (bDown && iCurSel == iCount - 1)) { | 1732 if ((bUp && iCurSel == 0) || (bDown && iCurSel == iCount - 1)) { |
| 1733 return; | 1733 return; |
| 1734 } | 1734 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 m_pComboBox->ShowDropList(FALSE); | 1850 m_pComboBox->ShowDropList(FALSE); |
| 1851 } | 1851 } |
| 1852 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, | 1852 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, |
| 1853 FX_BOOL bSet) { | 1853 FX_BOOL bSet) { |
| 1854 if (!bSet) { | 1854 if (!bSet) { |
| 1855 if (pMsg->m_pSetFocus == NULL) { | 1855 if (pMsg->m_pSetFocus == NULL) { |
| 1856 m_pComboBox->ShowDropList(FALSE); | 1856 m_pComboBox->ShowDropList(FALSE); |
| 1857 } | 1857 } |
| 1858 } | 1858 } |
| 1859 } | 1859 } |
| OLD | NEW |