OLD | NEW |
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_scrollbar.h" | 7 #include "xfa/fwl/core/cfwl_scrollbar.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "third_party/base/ptr_util.h" | 13 #include "third_party/base/ptr_util.h" |
14 #include "xfa/fwl/core/cfwl_msgmouse.h" | 14 #include "xfa/fwl/core/cfwl_msgmouse.h" |
15 #include "xfa/fwl/core/cfwl_msgmousewheel.h" | 15 #include "xfa/fwl/core/cfwl_msgmousewheel.h" |
16 #include "xfa/fwl/core/cfwl_notedriver.h" | 16 #include "xfa/fwl/core/cfwl_notedriver.h" |
17 #include "xfa/fwl/core/cfwl_themebackground.h" | 17 #include "xfa/fwl/core/cfwl_themebackground.h" |
18 #include "xfa/fwl/core/cfwl_themepart.h" | 18 #include "xfa/fwl/core/cfwl_themepart.h" |
19 #include "xfa/fwl/core/cfwl_timerinfo.h" | 19 #include "xfa/fwl/core/cfwl_timerinfo.h" |
20 #include "xfa/fwl/core/ifwl_themeprovider.h" | 20 #include "xfa/fwl/core/ifwl_themeprovider.h" |
21 | 21 |
22 #define FWL_SCROLLBAR_Elapse 500 | 22 #define FWL_SCROLLBAR_Elapse 500 |
23 #define FWL_SCROLLBAR_MinThumb 5 | 23 #define FWL_SCROLLBAR_MinThumb 5 |
24 | 24 |
25 CFWL_ScrollBar::CFWL_ScrollBar( | 25 CFWL_ScrollBar::CFWL_ScrollBar( |
26 const CFWL_App* app, | 26 const CFWL_App* app, |
27 std::unique_ptr<CFWL_WidgetProperties> properties, | 27 std::unique_ptr<CFWL_WidgetProperties> properties, |
28 IFWL_Widget* pOuter) | 28 CFWL_Widget* pOuter) |
29 : IFWL_Widget(app, std::move(properties), pOuter), | 29 : CFWL_Widget(app, std::move(properties), pOuter), |
30 m_pTimerInfo(nullptr), | 30 m_pTimerInfo(nullptr), |
31 m_fRangeMin(0), | 31 m_fRangeMin(0), |
32 m_fRangeMax(-1), | 32 m_fRangeMax(-1), |
33 m_fPageSize(0), | 33 m_fPageSize(0), |
34 m_fStepSize(0), | 34 m_fStepSize(0), |
35 m_fPos(0), | 35 m_fPos(0), |
36 m_fTrackPos(0), | 36 m_fTrackPos(0), |
37 m_iMinButtonState(CFWL_PartState_Normal), | 37 m_iMinButtonState(CFWL_PartState_Normal), |
38 m_iMaxButtonState(CFWL_PartState_Normal), | 38 m_iMaxButtonState(CFWL_PartState_Normal), |
39 m_iThumbButtonState(CFWL_PartState_Normal), | 39 m_iThumbButtonState(CFWL_PartState_Normal), |
(...skipping 30 matching lines...) Expand all Loading... |
70 | 70 |
71 rect.Set(0, 0, 0, 0); | 71 rect.Set(0, 0, 0, 0); |
72 FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>( | 72 FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>( |
73 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); | 73 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); |
74 if (!pfMinWidth) | 74 if (!pfMinWidth) |
75 return; | 75 return; |
76 if (IsVertical()) | 76 if (IsVertical()) |
77 rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3); | 77 rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3); |
78 else | 78 else |
79 rect.Set(0, 0, (*pfMinWidth) * 3, (*pfMinWidth)); | 79 rect.Set(0, 0, (*pfMinWidth) * 3, (*pfMinWidth)); |
80 IFWL_Widget::GetWidgetRect(rect, true); | 80 CFWL_Widget::GetWidgetRect(rect, true); |
81 } | 81 } |
82 | 82 |
83 void CFWL_ScrollBar::Update() { | 83 void CFWL_ScrollBar::Update() { |
84 if (IsLocked()) | 84 if (IsLocked()) |
85 return; | 85 return; |
86 if (!m_pProperties->m_pThemeProvider) | 86 if (!m_pProperties->m_pThemeProvider) |
87 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 87 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
88 | 88 |
89 Layout(); | 89 Layout(); |
90 } | 90 } |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 554 |
555 void CFWL_ScrollBar::Timer::Run(CFWL_TimerInfo* pTimerInfo) { | 555 void CFWL_ScrollBar::Timer::Run(CFWL_TimerInfo* pTimerInfo) { |
556 CFWL_ScrollBar* pButton = static_cast<CFWL_ScrollBar*>(m_pWidget); | 556 CFWL_ScrollBar* pButton = static_cast<CFWL_ScrollBar*>(m_pWidget); |
557 | 557 |
558 if (pButton->m_pTimerInfo) | 558 if (pButton->m_pTimerInfo) |
559 pButton->m_pTimerInfo->StopTimer(); | 559 pButton->m_pTimerInfo->StopTimer(); |
560 | 560 |
561 if (!pButton->SendEvent()) | 561 if (!pButton->SendEvent()) |
562 pButton->m_pTimerInfo = StartTimer(0, true); | 562 pButton->m_pTimerInfo = StartTimer(0, true); |
563 } | 563 } |
OLD | NEW |