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

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

Issue 2492563002: Continue IFWL cleanup (Closed)
Patch Set: Rebase to master 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_listbox.h ('k') | xfa/fwl/core/ifwl_combobox.cpp » ('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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return nullptr; 84 return nullptr;
85 return ToListBox(GetWidget())->GetSelItem(nIndexSel); 85 return ToListBox(GetWidget())->GetSelItem(nIndexSel);
86 } 86 }
87 87
88 int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) { 88 int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) {
89 if (!GetWidget()) 89 if (!GetWidget())
90 return 0; 90 return 0;
91 return ToListBox(GetWidget())->GetSelIndex(nIndex); 91 return ToListBox(GetWidget())->GetSelIndex(nIndex);
92 } 92 }
93 93
94 FWL_Error CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) { 94 void CFWL_ListBox::SetSelItem(CFWL_ListItem* pItem, bool bSelect) {
95 if (!GetWidget()) 95 if (GetWidget())
96 return FWL_Error::Indefinite; 96 ToListBox(GetWidget())->SetSelItem(pItem, bSelect);
97 return ToListBox(GetWidget())->SetSelItem(pItem, bSelect);
98 } 97 }
99 98
100 FWL_Error CFWL_ListBox::GetItemText(CFWL_ListItem* pItem, 99 void CFWL_ListBox::GetItemText(CFWL_ListItem* pItem, CFX_WideString& wsText) {
101 CFX_WideString& wsText) { 100 if (GetWidget())
102 if (!GetWidget()) 101 ToListBox(GetWidget())->GetItemText(pItem, wsText);
103 return FWL_Error::Indefinite;
104 return ToListBox(GetWidget())->GetItemText(pItem, wsText);
105 } 102 }
106 103
107 FWL_Error CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) { 104 void CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) {
108 if (!GetWidget()) 105 if (GetWidget())
109 return FWL_Error::Indefinite; 106 ToListBox(GetWidget())->GetScrollPos(fPos, bVert);
110 return ToListBox(GetWidget())->GetScrollPos(fPos, bVert);
111 } 107 }
112 108
113 FWL_Error CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) { 109 FWL_Error CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) {
114 m_fItemHeight = fItemHeight; 110 m_fItemHeight = fItemHeight;
115 return FWL_Error::Succeeded; 111 return FWL_Error::Succeeded;
116 } 112 }
117 113
118 CFWL_ListItem* CFWL_ListBox::GetFocusItem() { 114 CFWL_ListItem* CFWL_ListBox::GetFocusItem() {
119 for (const auto& pItem : m_ItemArray) { 115 for (const auto& pItem : m_ItemArray) {
120 if (pItem->m_dwStates & FWL_ITEMSTATE_LTB_Focused) 116 if (pItem->m_dwStates & FWL_ITEMSTATE_LTB_Focused)
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return true; 231 return true;
236 } 232 }
237 233
238 uint32_t CFWL_ListBox::GetItemStyles(IFWL_Widget* pWidget, 234 uint32_t CFWL_ListBox::GetItemStyles(IFWL_Widget* pWidget,
239 CFWL_ListItem* pItem) { 235 CFWL_ListItem* pItem) {
240 if (!pItem) 236 if (!pItem)
241 return 0; 237 return 0;
242 return static_cast<CFWL_ListItem*>(pItem)->m_dwStates; 238 return static_cast<CFWL_ListItem*>(pItem)->m_dwStates;
243 } 239 }
244 240
245 FWL_Error CFWL_ListBox::GetItemText(IFWL_Widget* pWidget, 241 void CFWL_ListBox::GetItemText(IFWL_Widget* pWidget,
246 CFWL_ListItem* pItem, 242 CFWL_ListItem* pItem,
247 CFX_WideString& wsText) { 243 CFX_WideString& wsText) {
248 if (!pItem) 244 if (pItem)
249 return FWL_Error::Indefinite; 245 wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText;
250 wsText = static_cast<CFWL_ListItem*>(pItem)->m_wsText;
251 return FWL_Error::Succeeded;
252 } 246 }
253 247
254 FWL_Error CFWL_ListBox::GetItemRect(IFWL_Widget* pWidget, 248 void CFWL_ListBox::GetItemRect(IFWL_Widget* pWidget,
255 CFWL_ListItem* pItem, 249 CFWL_ListItem* pItem,
256 CFX_RectF& rtItem) { 250 CFX_RectF& rtItem) {
257 if (!pItem) 251 if (pItem)
258 return FWL_Error::Indefinite; 252 rtItem = static_cast<CFWL_ListItem*>(pItem)->m_rtItem;
259 rtItem = static_cast<CFWL_ListItem*>(pItem)->m_rtItem;
260 return FWL_Error::Succeeded;
261 } 253 }
262 254
263 void* CFWL_ListBox::GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) { 255 void* CFWL_ListBox::GetItemData(IFWL_Widget* pWidget, CFWL_ListItem* pItem) {
264 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr; 256 return pItem ? static_cast<CFWL_ListItem*>(pItem)->m_pData : nullptr;
265 } 257 }
266 258
267 FWL_Error CFWL_ListBox::SetItemStyles(IFWL_Widget* pWidget, 259 void CFWL_ListBox::SetItemStyles(IFWL_Widget* pWidget,
268 CFWL_ListItem* pItem, 260 CFWL_ListItem* pItem,
269 uint32_t dwStyle) { 261 uint32_t dwStyle) {
270 if (!pItem) 262 if (pItem)
271 return FWL_Error::Indefinite; 263 static_cast<CFWL_ListItem*>(pItem)->m_dwStates = dwStyle;
272 static_cast<CFWL_ListItem*>(pItem)->m_dwStates = dwStyle;
273 return FWL_Error::Succeeded;
274 } 264 }
275 265
276 FWL_Error CFWL_ListBox::SetItemText(IFWL_Widget* pWidget, 266 void CFWL_ListBox::SetItemText(IFWL_Widget* pWidget,
277 CFWL_ListItem* pItem, 267 CFWL_ListItem* pItem,
278 const FX_WCHAR* pszText) { 268 const FX_WCHAR* pszText) {
279 if (!pItem) 269 if (pItem)
280 return FWL_Error::Indefinite; 270 static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText;
281 static_cast<CFWL_ListItem*>(pItem)->m_wsText = pszText;
282 return FWL_Error::Succeeded;
283 } 271 }
284 272
285 FWL_Error CFWL_ListBox::SetItemRect(IFWL_Widget* pWidget, 273 void CFWL_ListBox::SetItemRect(IFWL_Widget* pWidget,
286 CFWL_ListItem* pItem, 274 CFWL_ListItem* pItem,
287 const CFX_RectF& rtItem) { 275 const CFX_RectF& rtItem) {
288 if (!pItem) 276 if (pItem)
289 return FWL_Error::Indefinite; 277 static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem;
290 static_cast<CFWL_ListItem*>(pItem)->m_rtItem = rtItem;
291 return FWL_Error::Succeeded;
292 } 278 }
293 279
294 FX_FLOAT CFWL_ListBox::GetItemHeight(IFWL_Widget* pWidget) { 280 FX_FLOAT CFWL_ListBox::GetItemHeight(IFWL_Widget* pWidget) {
295 return m_fItemHeight; 281 return m_fItemHeight;
296 } 282 }
297 283
298 CFX_DIBitmap* CFWL_ListBox::GetItemIcon(IFWL_Widget* pWidget, 284 CFX_DIBitmap* CFWL_ListBox::GetItemIcon(IFWL_Widget* pWidget,
299 CFWL_ListItem* pItem) { 285 CFWL_ListItem* pItem) {
300 return static_cast<CFWL_ListItem*>(pItem)->m_pDIB; 286 return static_cast<CFWL_ListItem*>(pItem)->m_pDIB;
301 } 287 }
302 288
303 FWL_Error CFWL_ListBox::GetItemCheckRect(IFWL_Widget* pWidget, 289 void CFWL_ListBox::GetItemCheckRect(IFWL_Widget* pWidget,
304 CFWL_ListItem* pItem, 290 CFWL_ListItem* pItem,
305 CFX_RectF& rtCheck) { 291 CFX_RectF& rtCheck) {
306 rtCheck = static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox; 292 rtCheck = static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox;
307 return FWL_Error::Succeeded;
308 } 293 }
309 294
310 FWL_Error CFWL_ListBox::SetItemCheckRect(IFWL_Widget* pWidget, 295 void CFWL_ListBox::SetItemCheckRect(IFWL_Widget* pWidget,
311 CFWL_ListItem* pItem, 296 CFWL_ListItem* pItem,
312 const CFX_RectF& rtCheck) { 297 const CFX_RectF& rtCheck) {
313 static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox = rtCheck; 298 static_cast<CFWL_ListItem*>(pItem)->m_rtCheckBox = rtCheck;
314 return FWL_Error::Succeeded;
315 } 299 }
316 300
317 uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget, 301 uint32_t CFWL_ListBox::GetItemCheckState(IFWL_Widget* pWidget,
318 CFWL_ListItem* pItem) { 302 CFWL_ListItem* pItem) {
319 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState; 303 return static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState;
320 } 304 }
321 305
322 FWL_Error CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget, 306 void CFWL_ListBox::SetItemCheckState(IFWL_Widget* pWidget,
323 CFWL_ListItem* pItem, 307 CFWL_ListItem* pItem,
324 uint32_t dwCheckState) { 308 uint32_t dwCheckState) {
325 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState; 309 static_cast<CFWL_ListItem*>(pItem)->m_dwCheckState = dwCheckState;
326 return FWL_Error::Succeeded;
327 } 310 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_listbox.h ('k') | xfa/fwl/core/ifwl_combobox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698