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

Side by Side Diff: xfa/fwl/core/ifwl_combobox.cpp

Issue 2492563002: Continue IFWL cleanup (Closed)
Patch Set: Rebase to master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/cfwl_listbox.cpp ('k') | xfa/fwl/core/ifwl_combolist.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fwl/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"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText, 285 FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText,
286 int32_t nStart, 286 int32_t nStart,
287 int32_t nCount) const { 287 int32_t nCount) const {
288 if (m_pEdit) { 288 if (m_pEdit) {
289 return m_pEdit->GetText(wsText, nStart, nCount); 289 return m_pEdit->GetText(wsText, nStart, nCount);
290 } else if (m_pListBox) { 290 } else if (m_pListBox) {
291 IFWL_ComboBoxDP* pData = 291 IFWL_ComboBoxDP* pData =
292 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); 292 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
293 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); 293 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
294 return m_pListBox->GetItemText(hItem, wsText); 294 m_pListBox->GetItemText(hItem, wsText);
295 return FWL_Error::Succeeded;
295 } 296 }
296 return FWL_Error::Indefinite; 297 return FWL_Error::Indefinite;
297 } 298 }
298 299
299 FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { 300 FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) {
300 if (!m_pEdit) 301 if (!m_pEdit)
301 return FWL_Error::Indefinite; 302 return FWL_Error::Indefinite;
302 m_pEdit->ClearSelected(); 303 m_pEdit->ClearSelected();
303 m_pEdit->AddSelRange(nStart, nCount); 304 m_pEdit->AddSelRange(nStart, nCount);
304 return FWL_Error::Succeeded; 305 return FWL_Error::Succeeded;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 m_fComboFormHandler); 502 m_fComboFormHandler);
502 } 503 }
503 } 504 }
504 m_pComboBoxProxy->SetWidgetRect(m_rtProxy); 505 m_pComboBoxProxy->SetWidgetRect(m_rtProxy);
505 m_pComboBoxProxy->Update(); 506 m_pComboBoxProxy->Update();
506 m_pListBox->SetWidgetRect(m_rtList); 507 m_pListBox->SetWidgetRect(m_rtList);
507 m_pListBox->Update(); 508 m_pListBox->Update();
508 CFWL_EvtCmbPreDropDown ev; 509 CFWL_EvtCmbPreDropDown ev;
509 ev.m_pSrcTarget = this; 510 ev.m_pSrcTarget = this;
510 DispatchEvent(&ev); 511 DispatchEvent(&ev);
511 m_fItemHeight = m_pListBox->m_fItemHeight; 512 m_fItemHeight = m_pListBox->GetItemHeight();
512 m_pListBox->SetFocus(true); 513 m_pListBox->SetFocus(true);
513 m_pComboBoxProxy->DoModal(); 514 m_pComboBoxProxy->DoModal();
514 m_pListBox->SetFocus(false); 515 m_pListBox->SetFocus(false);
515 } else { 516 } else {
516 m_pComboBoxProxy->EndDoModal(); 517 m_pComboBoxProxy->EndDoModal();
517 CFWL_EvtCmbCloseUp ev; 518 CFWL_EvtCmbCloseUp ev;
518 ev.m_pSrcTarget = this; 519 ev.m_pSrcTarget = this;
519 DispatchEvent(&ev); 520 DispatchEvent(&ev);
520 m_bLButtonDown = false; 521 m_bLButtonDown = false;
521 m_pListBox->m_bNotifyOwner = true; 522 m_pListBox->m_bNotifyOwner = true;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 CFWL_EvtCmbPreDropDown preEvent; 735 CFWL_EvtCmbPreDropDown preEvent;
735 preEvent.m_pSrcTarget = this; 736 preEvent.m_pSrcTarget = this;
736 DispatchEvent(&preEvent); 737 DispatchEvent(&preEvent);
737 IFWL_ComboList* pComboList = m_pListBox.get(); 738 IFWL_ComboList* pComboList = m_pListBox.get();
738 int32_t iItems = pComboList->CountItems(); 739 int32_t iItems = pComboList->CountItems();
739 if (iItems < 1) { 740 if (iItems < 1) {
740 return; 741 return;
741 } 742 }
742 ReSetListItemAlignment(); 743 ReSetListItemAlignment();
743 pComboList->ChangeSelected(m_iCurSel); 744 pComboList->ChangeSelected(m_iCurSel);
744 FX_FLOAT fItemHeight = pComboList->GetItemHeigt(); 745 FX_FLOAT fItemHeight = pComboList->CalcItemHeight();
745 FX_FLOAT fBorder = GetBorderSize(); 746 FX_FLOAT fBorder = GetBorderSize();
746 FX_FLOAT fPopupMin = 0.0f; 747 FX_FLOAT fPopupMin = 0.0f;
747 if (iItems > 3) { 748 if (iItems > 3) {
748 fPopupMin = fItemHeight * 3 + fBorder * 2; 749 fPopupMin = fItemHeight * 3 + fBorder * 2;
749 } 750 }
750 FX_FLOAT fPopupMax = fItemHeight * iItems + fBorder * 2; 751 FX_FLOAT fPopupMax = fItemHeight * iItems + fBorder * 2;
751 CFX_RectF rtList; 752 CFX_RectF rtList;
752 rtList.left = m_rtClient.left; 753 rtList.left = m_rtClient.left;
753 rtList.width = m_pProperties->m_rtWidget.width; 754 rtList.width = m_pProperties->m_rtWidget.width;
754 rtList.top = 0; 755 rtList.top = 0;
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 else 1252 else
1252 iCurSel++; 1253 iCurSel++;
1253 } 1254 }
1254 m_iCurSel = iCurSel; 1255 m_iCurSel = iCurSel;
1255 SynchrEditText(m_iCurSel); 1256 SynchrEditText(m_iCurSel);
1256 return; 1257 return;
1257 } 1258 }
1258 if (m_pEdit) 1259 if (m_pEdit)
1259 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); 1260 m_pEdit->GetDelegate()->OnProcessMessage(pMsg);
1260 } 1261 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_listbox.cpp ('k') | xfa/fwl/core/ifwl_combolist.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698