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

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

Issue 2506493003: Continue nit cleanup in fwl/core (Closed)
Patch Set: review feedback 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_edit.cpp ('k') | xfa/fwl/core/cfwl_widget.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_listbox.h" 7 #include "xfa/fwl/core/cfwl_listbox.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 29 matching lines...) Expand all
40 pItem->m_dwStates = bSelect ? FWL_ITEMSTATE_LTB_Selected : 0; 40 pItem->m_dwStates = bSelect ? FWL_ITEMSTATE_LTB_Selected : 0;
41 m_ItemArray.push_back(std::move(pItem)); 41 m_ItemArray.push_back(std::move(pItem));
42 return m_ItemArray.back().get(); 42 return m_ItemArray.back().get();
43 } 43 }
44 44
45 bool CFWL_ListBox::DeleteString(CFWL_ListItem* pItem) { 45 bool CFWL_ListBox::DeleteString(CFWL_ListItem* pItem) {
46 int32_t nIndex = GetItemIndex(GetWidget(), pItem); 46 int32_t nIndex = GetItemIndex(GetWidget(), pItem);
47 if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size()) 47 if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size())
48 return false; 48 return false;
49 49
50 int32_t iCount = CountItems(m_pIface.get());
51 int32_t iSel = nIndex + 1; 50 int32_t iSel = nIndex + 1;
52 if (iSel >= iCount) { 51 if (iSel >= CountItems(m_pIface.get()))
53 iSel = nIndex - 1; 52 iSel = nIndex - 1;
54 if (iSel < 0)
55 iSel = -1;
56 }
57 if (iSel >= 0) { 53 if (iSel >= 0) {
58 CFWL_ListItem* pSel = 54 CFWL_ListItem* pSel =
59 static_cast<CFWL_ListItem*>(GetItem(m_pIface.get(), iSel)); 55 static_cast<CFWL_ListItem*>(GetItem(m_pIface.get(), iSel));
60 pSel->m_dwStates |= FWL_ITEMSTATE_LTB_Selected; 56 pSel->m_dwStates |= FWL_ITEMSTATE_LTB_Selected;
61 } 57 }
62 m_ItemArray.erase(m_ItemArray.begin() + nIndex); 58 m_ItemArray.erase(m_ItemArray.begin() + nIndex);
63 return true; 59 return true;
64 } 60 }
65 61
66 void CFWL_ListBox::DeleteAll() { 62 void CFWL_ListBox::DeleteAll() {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget, 178 uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget,
183 CFWL_ListItem* pItem) { 179 CFWL_ListItem* pItem) {
184 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState; 180 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState;
185 } 181 }
186 182
187 void CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget, 183 void CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget,
188 CFWL_ListItem* pItem, 184 CFWL_ListItem* pItem,
189 uint32_t dwCheckState) { 185 uint32_t dwCheckState) {
190 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState; 186 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState;
191 } 187 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_edit.cpp ('k') | xfa/fwl/core/cfwl_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698