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

Side by Side Diff: fpdfsdk/pdfwindow/PWL_IconList.cpp

Issue 2031653003: Get rid of NULLs in fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_core
Patch Set: rebase Created 4 years, 6 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 | « fpdfsdk/pdfwindow/PWL_Icon.cpp ('k') | fpdfsdk/pdfwindow/PWL_Label.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 "fpdfsdk/pdfwindow/PWL_IconList.h" 7 #include "fpdfsdk/pdfwindow/PWL_IconList.h"
8 8
9 #include "fpdfsdk/pdfwindow/PWL_Label.h" 9 #include "fpdfsdk/pdfwindow/PWL_Label.h"
10 #include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" 10 #include "fpdfsdk/pdfwindow/PWL_ListCtrl.h"
11 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" 11 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
12 #include "fpdfsdk/pdfwindow/PWL_Utils.h" 12 #include "fpdfsdk/pdfwindow/PWL_Utils.h"
13 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" 13 #include "fpdfsdk/pdfwindow/PWL_Wnd.h"
14 #include "public/fpdf_fwlevent.h" 14 #include "public/fpdf_fwlevent.h"
15 15
16 #define PWL_IconList_ITEM_ICON_LEFTMARGIN 10.0f 16 #define PWL_IconList_ITEM_ICON_LEFTMARGIN 10.0f
17 #define PWL_IconList_ITEM_WIDTH 20.0f 17 #define PWL_IconList_ITEM_WIDTH 20.0f
18 #define PWL_IconList_ITEM_HEIGHT 20.0f 18 #define PWL_IconList_ITEM_HEIGHT 20.0f
19 #define PWL_IconList_ITEM_SPACE 4.0f 19 #define PWL_IconList_ITEM_SPACE 4.0f
20 20
21 CPWL_IconList_Item::CPWL_IconList_Item() 21 CPWL_IconList_Item::CPWL_IconList_Item()
22 : m_nIconIndex(-1), m_pData(NULL), m_bSelected(FALSE), m_pText(NULL) {} 22 : m_nIconIndex(-1),
23 m_pData(nullptr),
24 m_bSelected(FALSE),
25 m_pText(nullptr) {}
23 26
24 CPWL_IconList_Item::~CPWL_IconList_Item() {} 27 CPWL_IconList_Item::~CPWL_IconList_Item() {}
25 28
26 CFX_ByteString CPWL_IconList_Item::GetClassName() const { 29 CFX_ByteString CPWL_IconList_Item::GetClassName() const {
27 return "CPWL_IconList_Item"; 30 return "CPWL_IconList_Item";
28 } 31 }
29 32
30 FX_FLOAT CPWL_IconList_Item::GetItemHeight(FX_FLOAT fLimitWidth) { 33 FX_FLOAT CPWL_IconList_Item::GetItemHeight(FX_FLOAT fLimitWidth) {
31 return PWL_IconList_ITEM_HEIGHT; 34 return PWL_IconList_ITEM_HEIGHT;
32 } 35 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 CPWL_IconList_Item* CPWL_IconList_Content::GetListItem( 284 CPWL_IconList_Item* CPWL_IconList_Content::GetListItem(
282 int32_t nItemIndex) const { 285 int32_t nItemIndex) const {
283 if (nItemIndex >= 0 && nItemIndex < m_aChildren.GetSize()) { 286 if (nItemIndex >= 0 && nItemIndex < m_aChildren.GetSize()) {
284 if (CPWL_Wnd* pChild = m_aChildren.GetAt(nItemIndex)) { 287 if (CPWL_Wnd* pChild = m_aChildren.GetAt(nItemIndex)) {
285 if (pChild->GetClassName() == "CPWL_IconList_Item") { 288 if (pChild->GetClassName() == "CPWL_IconList_Item") {
286 return (CPWL_IconList_Item*)pChild; 289 return (CPWL_IconList_Item*)pChild;
287 } 290 }
288 } 291 }
289 } 292 }
290 293
291 return NULL; 294 return nullptr;
292 } 295 }
293 296
294 void CPWL_IconList_Content::SetListData(int32_t nItemIndex, void* pData) { 297 void CPWL_IconList_Content::SetListData(int32_t nItemIndex, void* pData) {
295 if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) 298 if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex))
296 pItem->SetData(pData); 299 pItem->SetData(pData);
297 } 300 }
298 301
299 void CPWL_IconList_Content::SetListIcon(int32_t nItemIndex, 302 void CPWL_IconList_Content::SetListIcon(int32_t nItemIndex,
300 int32_t nIconIndex) { 303 int32_t nIconIndex) {
301 if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) 304 if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex))
(...skipping 19 matching lines...) Expand all
321 if (pChild->GetClassName() == "CPWL_IconList_Item") { 324 if (pChild->GetClassName() == "CPWL_IconList_Item") {
322 CPWL_IconList_Item* pItem = (CPWL_IconList_Item*)pChild; 325 CPWL_IconList_Item* pItem = (CPWL_IconList_Item*)pChild;
323 pItem->SetIconFillColor(color); 326 pItem->SetIconFillColor(color);
324 pItem->InvalidateRect(); 327 pItem->InvalidateRect();
325 } 328 }
326 } 329 }
327 } 330 }
328 } 331 }
329 332
330 CPWL_IconList::CPWL_IconList(int32_t nListCount) 333 CPWL_IconList::CPWL_IconList(int32_t nListCount)
331 : m_pListContent(NULL), m_nListCount(nListCount) {} 334 : m_pListContent(nullptr), m_nListCount(nListCount) {}
332 335
333 CPWL_IconList::~CPWL_IconList() {} 336 CPWL_IconList::~CPWL_IconList() {}
334 337
335 void CPWL_IconList::RePosChildWnd() { 338 void CPWL_IconList::RePosChildWnd() {
336 CPWL_Wnd::RePosChildWnd(); 339 CPWL_Wnd::RePosChildWnd();
337 340
338 if (m_pListContent) 341 if (m_pListContent)
339 m_pListContent->Move(GetClientRect(), TRUE, FALSE); 342 m_pListContent->Move(GetClientRect(), TRUE, FALSE);
340 } 343 }
341 344
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 388
386 pScrollBar->OnNotify(pWnd, PNM_SETSCROLLINFO, wParam, lParam); 389 pScrollBar->OnNotify(pWnd, PNM_SETSCROLLINFO, wParam, lParam);
387 } 390 }
388 } 391 }
389 return; 392 return;
390 case PNM_SCROLLWINDOW: 393 case PNM_SCROLLWINDOW:
391 if (m_pListContent) { 394 if (m_pListContent) {
392 m_pListContent->SetScrollPos( 395 m_pListContent->SetScrollPos(
393 CFX_FloatPoint(0.0f, *(FX_FLOAT*)lParam)); 396 CFX_FloatPoint(0.0f, *(FX_FLOAT*)lParam));
394 m_pListContent->ResetFace(); 397 m_pListContent->ResetFace();
395 m_pListContent->InvalidateRect(NULL); 398 m_pListContent->InvalidateRect(nullptr);
396 } 399 }
397 return; 400 return;
398 case PNM_SETSCROLLPOS: 401 case PNM_SETSCROLLPOS:
399 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) 402 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar())
400 pScrollBar->OnNotify(pWnd, PNM_SETSCROLLPOS, wParam, lParam); 403 pScrollBar->OnNotify(pWnd, PNM_SETSCROLLPOS, wParam, lParam);
401 return; 404 return;
402 } 405 }
403 } 406 }
404 } 407 }
405 408
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 if (ptNew.y > rcScroll.top) 457 if (ptNew.y > rcScroll.top)
455 ptNew.y = rcScroll.top; 458 ptNew.y = rcScroll.top;
456 if (ptNew.y < rcScroll.bottom + rcContents.Height()) 459 if (ptNew.y < rcScroll.bottom + rcContents.Height())
457 ptNew.y = rcScroll.bottom + rcContents.Height(); 460 ptNew.y = rcScroll.bottom + rcContents.Height();
458 if (ptNew.y < rcScroll.bottom) 461 if (ptNew.y < rcScroll.bottom)
459 ptNew.y = rcScroll.bottom; 462 ptNew.y = rcScroll.bottom;
460 463
461 if (ptNew.y != ptScroll.y) { 464 if (ptNew.y != ptScroll.y) {
462 m_pListContent->SetScrollPos(ptNew); 465 m_pListContent->SetScrollPos(ptNew);
463 m_pListContent->ResetFace(); 466 m_pListContent->ResetFace();
464 m_pListContent->InvalidateRect(NULL); 467 m_pListContent->InvalidateRect(nullptr);
465 468
466 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) 469 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar())
467 pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, 470 pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
468 (intptr_t)&ptNew.y); 471 (intptr_t)&ptNew.y);
469 472
470 return TRUE; 473 return TRUE;
471 } 474 }
472 } 475 }
473 476
474 return FALSE; 477 return FALSE;
475 } 478 }
OLDNEW
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_Icon.cpp ('k') | fpdfsdk/pdfwindow/PWL_Label.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698