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

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

Issue 2557103002: Cleanup FWL default values part II. (Closed)
Patch Set: Rebase to master 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
« no previous file with comments | « xfa/fwl/core/cfwl_combobox.h ('k') | xfa/fwl/core/cfwl_datetimepicker.h » ('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/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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 615
618 CFWL_ComboList* pComboList = m_pListBox.get(); 616 CFWL_ComboList* pComboList = m_pListBox.get();
619 int32_t iItems = pComboList->CountItems(nullptr); 617 int32_t iItems = pComboList->CountItems(nullptr);
620 if (iItems < 1) 618 if (iItems < 1)
621 return; 619 return;
622 620
623 ResetListItemAlignment(); 621 ResetListItemAlignment();
624 pComboList->ChangeSelected(m_iCurSel); 622 pComboList->ChangeSelected(m_iCurSel);
625 623
626 FX_FLOAT fItemHeight = pComboList->CalcItemHeight(); 624 FX_FLOAT fItemHeight = pComboList->CalcItemHeight();
627 FX_FLOAT fBorder = GetBorderSize(); 625 FX_FLOAT fBorder = GetBorderSize(true);
628 FX_FLOAT fPopupMin = 0.0f; 626 FX_FLOAT fPopupMin = 0.0f;
629 if (iItems > 3) 627 if (iItems > 3)
630 fPopupMin = fItemHeight * 3 + fBorder * 2; 628 fPopupMin = fItemHeight * 3 + fBorder * 2;
631 629
632 FX_FLOAT fPopupMax = fItemHeight * iItems + fBorder * 2; 630 FX_FLOAT fPopupMax = fItemHeight * iItems + fBorder * 2;
633 CFX_RectF rtList; 631 CFX_RectF rtList;
634 rtList.left = m_rtClient.left; 632 rtList.left = m_rtClient.left;
635 rtList.width = m_pProperties->m_rtWidget.width; 633 rtList.width = m_pProperties->m_rtWidget.width;
636 rtList.top = 0; 634 rtList.top = 0;
637 rtList.height = 0; 635 rtList.height = 0;
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 else 1101 else
1104 iCurSel++; 1102 iCurSel++;
1105 } 1103 }
1106 m_iCurSel = iCurSel; 1104 m_iCurSel = iCurSel;
1107 SyncEditText(m_iCurSel); 1105 SyncEditText(m_iCurSel);
1108 return; 1106 return;
1109 } 1107 }
1110 if (m_pEdit) 1108 if (m_pEdit)
1111 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); 1109 m_pEdit->GetDelegate()->OnProcessMessage(pMsg);
1112 } 1110 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_combobox.h ('k') | xfa/fwl/core/cfwl_datetimepicker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698