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

Side by Side Diff: xfa/src/fwl/src/lightwidget/combobox.cpp

Issue 1671213002: Fix build broken at e059b5ba1260 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 months 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 | « no previous file | no next file » | 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 <utility> 7 #include <utility>
8 8
9 #include "xfa/src/foxitlib.h" 9 #include "xfa/src/foxitlib.h"
10 10
(...skipping 26 matching lines...) Expand all
37 int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText, 37 int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText,
38 CFX_DIBitmap* pIcon) { 38 CFX_DIBitmap* pIcon) {
39 std::unique_ptr<CFWL_ComboBoxItem> pItem(new CFWL_ComboBoxItem); 39 std::unique_ptr<CFWL_ComboBoxItem> pItem(new CFWL_ComboBoxItem);
40 pItem->m_wsText = wsText; 40 pItem->m_wsText = wsText;
41 pItem->m_dwStyles = 0; 41 pItem->m_dwStyles = 0;
42 pItem->m_pDIB = pIcon; 42 pItem->m_pDIB = pIcon;
43 m_comboBoxData.m_ItemArray.push_back(std::move(pItem)); 43 m_comboBoxData.m_ItemArray.push_back(std::move(pItem));
44 return m_comboBoxData.m_ItemArray.size() - 1; 44 return m_comboBoxData.m_ItemArray.size() - 1;
45 } 45 }
46 bool CFWL_ComboBox::RemoveAt(int32_t iIndex) { 46 bool CFWL_ComboBox::RemoveAt(int32_t iIndex) {
47 if (iIndex < 0 || iIndex >= m_comboBoxData.m_ItemArray.size()) 47 if (iIndex < 0 ||
48 static_cast<size_t>(iIndex) >= m_comboBoxData.m_ItemArray.size()) {
48 return false; 49 return false;
49 50 }
50 m_comboBoxData.m_ItemArray.erase(m_comboBoxData.m_ItemArray.begin() + iIndex); 51 m_comboBoxData.m_ItemArray.erase(m_comboBoxData.m_ItemArray.begin() + iIndex);
51 return true; 52 return true;
52 } 53 }
53 void CFWL_ComboBox::RemoveAll() { 54 void CFWL_ComboBox::RemoveAll() {
54 m_comboBoxData.m_ItemArray.clear(); 55 m_comboBoxData.m_ItemArray.clear();
55 } 56 }
56 int32_t CFWL_ComboBox::CountItems() { 57 int32_t CFWL_ComboBox::CountItems() {
57 return m_comboBoxData.CountItems(GetWidget()); 58 return m_comboBoxData.CountItems(GetWidget());
58 } 59 }
59 FWL_ERR CFWL_ComboBox::GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) { 60 FWL_ERR CFWL_ComboBox::GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 CFWL_ComboBox::CFWL_ComboBoxDP::CFWL_ComboBoxDP() { 239 CFWL_ComboBox::CFWL_ComboBoxDP::CFWL_ComboBoxDP() {
239 m_fItemHeight = 0; 240 m_fItemHeight = 0;
240 m_fMaxListHeight = 0; 241 m_fMaxListHeight = 0;
241 } 242 }
242 CFWL_ComboBox::CFWL_ComboBoxDP::~CFWL_ComboBoxDP() {} 243 CFWL_ComboBox::CFWL_ComboBoxDP::~CFWL_ComboBoxDP() {}
243 int32_t CFWL_ComboBox::CFWL_ComboBoxDP::CountItems(IFWL_Widget* pWidget) { 244 int32_t CFWL_ComboBox::CFWL_ComboBoxDP::CountItems(IFWL_Widget* pWidget) {
244 return m_ItemArray.size(); 245 return m_ItemArray.size();
245 } 246 }
246 FWL_HLISTITEM CFWL_ComboBox::CFWL_ComboBoxDP::GetItem(IFWL_Widget* pWidget, 247 FWL_HLISTITEM CFWL_ComboBox::CFWL_ComboBoxDP::GetItem(IFWL_Widget* pWidget,
247 int32_t nIndex) { 248 int32_t nIndex) {
248 return nIndex >= 0 && nIndex < m_ItemArray.size() 249 if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size())
249 ? reinterpret_cast<FWL_HLISTITEM>(m_ItemArray[nIndex].get()) 250 return nullptr;
250 : nullptr; 251
252 return reinterpret_cast<FWL_HLISTITEM>(m_ItemArray[nIndex].get());
251 } 253 }
252 int32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIndex(IFWL_Widget* pWidget, 254 int32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIndex(IFWL_Widget* pWidget,
253 FWL_HLISTITEM hItem) { 255 FWL_HLISTITEM hItem) {
254 auto it = std::find_if( 256 auto it = std::find_if(
255 m_ItemArray.begin(), m_ItemArray.end(), 257 m_ItemArray.begin(), m_ItemArray.end(),
256 [hItem](const std::unique_ptr<CFWL_ComboBoxItem>& candidate) { 258 [hItem](const std::unique_ptr<CFWL_ComboBoxItem>& candidate) {
257 return candidate.get() == reinterpret_cast<CFWL_ComboBoxItem*>(hItem); 259 return candidate.get() == reinterpret_cast<CFWL_ComboBoxItem*>(hItem);
258 }); 260 });
259 return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1; 261 return it != m_ItemArray.end() ? it - m_ItemArray.begin() : -1;
260 } 262 }
261 FX_BOOL CFWL_ComboBox::CFWL_ComboBoxDP::SetItemIndex(IFWL_Widget* pWidget, 263 FX_BOOL CFWL_ComboBox::CFWL_ComboBoxDP::SetItemIndex(IFWL_Widget* pWidget,
262 FWL_HLISTITEM hItem, 264 FWL_HLISTITEM hItem,
263 int32_t nIndex) { 265 int32_t nIndex) {
264 if (nIndex < 0 || nIndex >= m_ItemArray.size()) 266 if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size())
265 return FALSE; 267 return FALSE;
266 268
267 m_ItemArray[nIndex].reset(reinterpret_cast<CFWL_ComboBoxItem*>(hItem)); 269 m_ItemArray[nIndex].reset(reinterpret_cast<CFWL_ComboBoxItem*>(hItem));
268 return TRUE; 270 return TRUE;
269 } 271 }
270 FX_DWORD CFWL_ComboBox::CFWL_ComboBoxDP::GetItemStyles(IFWL_Widget* pWidget, 272 FX_DWORD CFWL_ComboBox::CFWL_ComboBoxDP::GetItemStyles(IFWL_Widget* pWidget,
271 FWL_HLISTITEM hItem) { 273 FWL_HLISTITEM hItem) {
272 if (!hItem) 274 if (!hItem)
273 return 0; 275 return 0;
274 return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles; 276 return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 IFWL_Widget* pWidget, 358 IFWL_Widget* pWidget,
357 FWL_HLISTITEM hItem, 359 FWL_HLISTITEM hItem,
358 FX_DWORD dwCheckState) { 360 FX_DWORD dwCheckState) {
359 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); 361 CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem);
360 pItem->m_dwCheckState = dwCheckState; 362 pItem->m_dwCheckState = dwCheckState;
361 return FWL_ERR_Succeeded; 363 return FWL_ERR_Succeeded;
362 } 364 }
363 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) { 365 FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) {
364 return m_fMaxListHeight; 366 return m_fMaxListHeight;
365 } 367 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698