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

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

Issue 2488953003: Cleanup IFWL_Widget visibility and virtual parameters (Closed)
Patch Set: fixes 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/ifwl_scrollbar.h ('k') | xfa/fwl/core/ifwl_spinbutton.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/ifwl_scrollbar.h" 7 #include "xfa/fwl/core/ifwl_scrollbar.h"
8 8
9 #include "third_party/base/ptr_util.h" 9 #include "third_party/base/ptr_util.h"
10 #include "xfa/fwl/core/cfwl_message.h" 10 #include "xfa/fwl/core/cfwl_message.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 m_rtMinTrack.Reset(); 54 m_rtMinTrack.Reset();
55 m_rtMaxTrack.Reset(); 55 m_rtMaxTrack.Reset();
56 } 56 }
57 57
58 IFWL_ScrollBar::~IFWL_ScrollBar() {} 58 IFWL_ScrollBar::~IFWL_ScrollBar() {}
59 59
60 FWL_Type IFWL_ScrollBar::GetClassID() const { 60 FWL_Type IFWL_ScrollBar::GetClassID() const {
61 return FWL_Type::ScrollBar; 61 return FWL_Type::ScrollBar;
62 } 62 }
63 63
64 FWL_Error IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { 64 void IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
65 if (bAutoSize) { 65 if (bAutoSize) {
66 rect.Set(0, 0, 0, 0); 66 rect.Set(0, 0, 0, 0);
67 FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>( 67 FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>(
68 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); 68 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
69 if (!pfMinWidth) 69 if (!pfMinWidth)
70 return FWL_Error::Indefinite; 70 return;
71 if (IsVertical()) { 71 if (IsVertical()) {
72 rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3); 72 rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3);
73 } else { 73 } else {
74 rect.Set(0, 0, (*pfMinWidth) * 3, (*pfMinWidth)); 74 rect.Set(0, 0, (*pfMinWidth) * 3, (*pfMinWidth));
75 } 75 }
76 IFWL_Widget::GetWidgetRect(rect, true); 76 IFWL_Widget::GetWidgetRect(rect, true);
77 } else { 77 } else {
78 rect = m_pProperties->m_rtWidget; 78 rect = m_pProperties->m_rtWidget;
79 } 79 }
80 return FWL_Error::Succeeded;
81 } 80 }
82 81
83 FWL_Error IFWL_ScrollBar::Update() { 82 void IFWL_ScrollBar::Update() {
84 if (IsLocked()) { 83 if (IsLocked()) {
85 return FWL_Error::Indefinite; 84 return;
86 } 85 }
87 if (!m_pProperties->m_pThemeProvider) { 86 if (!m_pProperties->m_pThemeProvider) {
88 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 87 m_pProperties->m_pThemeProvider = GetAvailableTheme();
89 } 88 }
90 Layout(); 89 Layout();
91 return FWL_Error::Succeeded;
92 } 90 }
93 91
94 FWL_Error IFWL_ScrollBar::DrawWidget(CFX_Graphics* pGraphics, 92 void IFWL_ScrollBar::DrawWidget(CFX_Graphics* pGraphics,
95 const CFX_Matrix* pMatrix) { 93 const CFX_Matrix* pMatrix) {
96 if (!pGraphics) 94 if (!pGraphics)
97 return FWL_Error::Indefinite; 95 return;
98 if (!m_pProperties->m_pThemeProvider) 96 if (!m_pProperties->m_pThemeProvider)
99 return FWL_Error::Indefinite; 97 return;
100 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; 98 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
101 if (HasBorder()) { 99 if (HasBorder()) {
102 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); 100 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix);
103 } 101 }
104 if (HasEdge()) { 102 if (HasEdge()) {
105 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); 103 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix);
106 } 104 }
107 DrawTrack(pGraphics, pTheme, true, pMatrix); 105 DrawTrack(pGraphics, pTheme, true, pMatrix);
108 DrawTrack(pGraphics, pTheme, false, pMatrix); 106 DrawTrack(pGraphics, pTheme, false, pMatrix);
109 DrawArrowBtn(pGraphics, pTheme, true, pMatrix); 107 DrawArrowBtn(pGraphics, pTheme, true, pMatrix);
110 DrawArrowBtn(pGraphics, pTheme, false, pMatrix); 108 DrawArrowBtn(pGraphics, pTheme, false, pMatrix);
111 DrawThumb(pGraphics, pTheme, pMatrix); 109 DrawThumb(pGraphics, pTheme, pMatrix);
112 return FWL_Error::Succeeded;
113 } 110 }
114 111
115 inline bool IFWL_ScrollBar::IsVertical() { 112 inline bool IFWL_ScrollBar::IsVertical() {
116 return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_SCB_Vert; 113 return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_SCB_Vert;
117 } 114 }
118 115
119 FWL_Error IFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { 116 FWL_Error IFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) {
120 fMin = m_fRangeMin; 117 fMin = m_fRangeMin;
121 fMax = m_fRangeMax; 118 fMax = m_fRangeMax;
122 return FWL_Error::Succeeded; 119 return FWL_Error::Succeeded;
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 733
737 void IFWL_ScrollBar::Timer::Run(IFWL_TimerInfo* pTimerInfo) { 734 void IFWL_ScrollBar::Timer::Run(IFWL_TimerInfo* pTimerInfo) {
738 IFWL_ScrollBar* pButton = static_cast<IFWL_ScrollBar*>(m_pWidget); 735 IFWL_ScrollBar* pButton = static_cast<IFWL_ScrollBar*>(m_pWidget);
739 736
740 if (pButton->m_pTimerInfo) 737 if (pButton->m_pTimerInfo)
741 pButton->m_pTimerInfo->StopTimer(); 738 pButton->m_pTimerInfo->StopTimer();
742 739
743 if (!pButton->SendEvent()) 740 if (!pButton->SendEvent())
744 pButton->m_pTimerInfo = StartTimer(0, true); 741 pButton->m_pTimerInfo = StartTimer(0, true);
745 } 742 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_scrollbar.h ('k') | xfa/fwl/core/ifwl_spinbutton.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698