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

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

Issue 2506493003: Continue nit cleanup in fwl/core (Closed)
Patch Set: Prior review comment 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 | « no previous file | xfa/fwl/core/cfwl_widget.h » ('j') | xfa/fwl/core/cfwl_widget.h » ('J')
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) 53 if (iSel < 0)
npm 2016/11/15 23:27:03 Remove this if: unneeded.
dsinclair 2016/11/16 15:10:47 Done.
55 iSel = -1; 54 iSel = -1;
56 } 55 }
57 if (iSel >= 0) { 56 if (iSel >= 0) {
58 CFWL_ListItem* pSel = 57 CFWL_ListItem* pSel =
59 static_cast<CFWL_ListItem*>(GetItem(m_pIface.get(), iSel)); 58 static_cast<CFWL_ListItem*>(GetItem(m_pIface.get(), iSel));
60 pSel->m_dwStates |= FWL_ITEMSTATE_LTB_Selected; 59 pSel->m_dwStates |= FWL_ITEMSTATE_LTB_Selected;
61 } 60 }
62 m_ItemArray.erase(m_ItemArray.begin() + nIndex); 61 m_ItemArray.erase(m_ItemArray.begin() + nIndex);
63 return true; 62 return true;
64 } 63 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget, 181 uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget,
183 CFWL_ListItem* pItem) { 182 CFWL_ListItem* pItem) {
184 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState; 183 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState;
185 } 184 }
186 185
187 void CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget, 186 void CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget,
188 CFWL_ListItem* pItem, 187 CFWL_ListItem* pItem,
189 uint32_t dwCheckState) { 188 uint32_t dwCheckState) {
190 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState; 189 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState;
191 } 190 }
OLDNEW
« no previous file with comments | « no previous file | xfa/fwl/core/cfwl_widget.h » ('j') | xfa/fwl/core/cfwl_widget.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698