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

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

Issue 2557103002: Cleanup FWL default values part II. (Closed)
Patch Set: Unused Created 4 years 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
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/cfwl_combobox.h" 7 #include "xfa/fwl/core/cfwl_combobox.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { 295 void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
296 if (!m_pEdit) 296 if (!m_pEdit)
297 return; 297 return;
298 298
299 m_pEdit->SetText(wsText); 299 m_pEdit->SetText(wsText);
300 m_pEdit->Update(); 300 m_pEdit->Update();
301 } 301 }
302 302
303 CFX_WideString CFWL_ComboBox::GetEditText(int32_t nStart, 303 CFX_WideString CFWL_ComboBox::GetEditText() const {
304 int32_t nCount) const { 304 if (m_pEdit)
305 if (m_pEdit) { 305 return m_pEdit->GetText();
306 return m_pEdit->GetText(nStart, nCount);
307 }
308 if (!m_pListBox) 306 if (!m_pListBox)
309 return L""; 307 return L"";
310 308
311 CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel); 309 CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
312 return m_pListBox->GetDataProviderItemText(hItem); 310 return m_pListBox->GetDataProviderItemText(hItem);
313 } 311 }
314 312
315 void CFWL_ComboBox::OpenDropDownList(bool bActivate) { 313 void CFWL_ComboBox::OpenDropDownList(bool bActivate) {
316 ShowDropList(bActivate); 314 ShowDropList(bActivate);
317 } 315 }
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 618
621 CFWL_ComboList* pComboList = m_pListBox.get(); 619 CFWL_ComboList* pComboList = m_pListBox.get();
622 int32_t iItems = pComboList->CountItems(nullptr); 620 int32_t iItems = pComboList->CountItems(nullptr);
623 if (iItems < 1) 621 if (iItems < 1)
624 return; 622 return;
625 623
626 ResetListItemAlignment(); 624 ResetListItemAlignment();
627 pComboList->ChangeSelected(m_iCurSel); 625 pComboList->ChangeSelected(m_iCurSel);
628 626
629 FX_FLOAT fItemHeight = pComboList->CalcItemHeight(); 627 FX_FLOAT fItemHeight = pComboList->CalcItemHeight();
630 FX_FLOAT fBorder = GetBorderSize(); 628 FX_FLOAT fBorder = GetBorderSize(true);
631 FX_FLOAT fPopupMin = 0.0f; 629 FX_FLOAT fPopupMin = 0.0f;
632 if (iItems > 3) 630 if (iItems > 3)
633 fPopupMin = fItemHeight * 3 + fBorder * 2; 631 fPopupMin = fItemHeight * 3 + fBorder * 2;
634 632
635 FX_FLOAT fPopupMax = fItemHeight * iItems + fBorder * 2; 633 FX_FLOAT fPopupMax = fItemHeight * iItems + fBorder * 2;
636 CFX_RectF rtList; 634 CFX_RectF rtList;
637 rtList.left = m_rtClient.left; 635 rtList.left = m_rtClient.left;
638 rtList.width = m_pProperties->m_rtWidget.width; 636 rtList.width = m_pProperties->m_rtWidget.width;
639 rtList.top = 0; 637 rtList.top = 0;
640 rtList.height = 0; 638 rtList.height = 0;
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 else 1111 else
1114 iCurSel++; 1112 iCurSel++;
1115 } 1113 }
1116 m_iCurSel = iCurSel; 1114 m_iCurSel = iCurSel;
1117 SyncEditText(m_iCurSel); 1115 SyncEditText(m_iCurSel);
1118 return; 1116 return;
1119 } 1117 }
1120 if (m_pEdit) 1118 if (m_pEdit)
1121 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); 1119 m_pEdit->GetDelegate()->OnProcessMessage(pMsg);
1122 } 1120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698