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/ifwl_scrollbar.h" | 7 #include "xfa/fwl/core/ifwl_scrollbar.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_message.h" | 9 #include "xfa/fwl/core/cfwl_message.h" |
10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 m_fLastTrackPos(0), | 34 m_fLastTrackPos(0), |
35 m_cpTrackPointX(0), | 35 m_cpTrackPointX(0), |
36 m_cpTrackPointY(0), | 36 m_cpTrackPointY(0), |
37 m_iMouseWheel(0), | 37 m_iMouseWheel(0), |
38 m_bTrackMouseLeave(FALSE), | 38 m_bTrackMouseLeave(FALSE), |
39 m_bMouseHover(FALSE), | 39 m_bMouseHover(FALSE), |
40 m_bMouseDown(FALSE), | 40 m_bMouseDown(FALSE), |
41 m_bRepaintThumb(FALSE), | 41 m_bRepaintThumb(FALSE), |
42 m_fButtonLen(0), | 42 m_fButtonLen(0), |
43 m_bMinSize(FALSE), | 43 m_bMinSize(FALSE), |
44 m_bCustomLayout(FALSE), | 44 m_bCustomLayout(false), |
45 m_fMinThumb(FWL_SCROLLBAR_MinThumb) { | 45 m_fMinThumb(FWL_SCROLLBAR_MinThumb) { |
46 m_rtClient.Reset(); | 46 m_rtClient.Reset(); |
47 m_rtThumb.Reset(); | 47 m_rtThumb.Reset(); |
48 m_rtMinBtn.Reset(); | 48 m_rtMinBtn.Reset(); |
49 m_rtMaxBtn.Reset(); | 49 m_rtMaxBtn.Reset(); |
50 m_rtMinTrack.Reset(); | 50 m_rtMinTrack.Reset(); |
51 m_rtMaxTrack.Reset(); | 51 m_rtMaxTrack.Reset(); |
52 } | 52 } |
53 | 53 |
54 IFWL_ScrollBar::~IFWL_ScrollBar() {} | 54 IFWL_ScrollBar::~IFWL_ScrollBar() {} |
55 | 55 |
56 FWL_Error IFWL_ScrollBar::GetClassName(CFX_WideString& wsClass) const { | |
57 wsClass = FWL_CLASS_ScrollBar; | |
58 return FWL_Error::Succeeded; | |
59 } | |
60 | |
61 FWL_Type IFWL_ScrollBar::GetClassID() const { | 56 FWL_Type IFWL_ScrollBar::GetClassID() const { |
62 return FWL_Type::ScrollBar; | 57 return FWL_Type::ScrollBar; |
63 } | 58 } |
64 | 59 |
65 FWL_Error IFWL_ScrollBar::Initialize() { | 60 FWL_Error IFWL_ScrollBar::Initialize() { |
66 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) | 61 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) |
67 return FWL_Error::Indefinite; | 62 return FWL_Error::Indefinite; |
68 | 63 |
69 m_pDelegate = new CFWL_ScrollBarImpDelegate(this); | 64 m_pDelegate = new CFWL_ScrollBarImpDelegate(this); |
70 return FWL_Error::Succeeded; | 65 return FWL_Error::Succeeded; |
71 } | 66 } |
72 | 67 |
73 FWL_Error IFWL_ScrollBar::Finalize() { | 68 void IFWL_ScrollBar::Finalize() { |
74 delete m_pDelegate; | 69 delete m_pDelegate; |
75 m_pDelegate = nullptr; | 70 m_pDelegate = nullptr; |
76 return IFWL_Widget::Finalize(); | 71 IFWL_Widget::Finalize(); |
77 } | 72 } |
78 | 73 |
79 FWL_Error IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 74 FWL_Error IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
80 if (bAutoSize) { | 75 if (bAutoSize) { |
81 rect.Set(0, 0, 0, 0); | 76 rect.Set(0, 0, 0, 0); |
82 FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>( | 77 FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>( |
83 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); | 78 GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); |
84 if (!pfMinWidth) | 79 if (!pfMinWidth) |
85 return FWL_Error::Indefinite; | 80 return FWL_Error::Indefinite; |
86 if (IsVertical()) { | 81 if (IsVertical()) { |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 | 767 |
773 void CFWL_ScrollBarImpDelegate::DoMouseHover(int32_t iItem, | 768 void CFWL_ScrollBarImpDelegate::DoMouseHover(int32_t iItem, |
774 const CFX_RectF& rtItem, | 769 const CFX_RectF& rtItem, |
775 int32_t& iState) { | 770 int32_t& iState) { |
776 if (iState == CFWL_PartState_Hovered) { | 771 if (iState == CFWL_PartState_Hovered) { |
777 return; | 772 return; |
778 } | 773 } |
779 iState = CFWL_PartState_Hovered; | 774 iState = CFWL_PartState_Hovered; |
780 m_pOwner->Repaint(&rtItem); | 775 m_pOwner->Repaint(&rtItem); |
781 } | 776 } |
OLD | NEW |