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/lightwidget/cfwl_scrollbar.h" | 7 #include "xfa/fwl/lightwidget/cfwl_scrollbar.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" | 11 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" |
12 | 12 |
13 CFWL_ScrollBar* CFWL_ScrollBar::Create() { | 13 CFWL_ScrollBar* CFWL_ScrollBar::Create() { |
14 return new CFWL_ScrollBar; | 14 return new CFWL_ScrollBar; |
15 } | 15 } |
16 | 16 |
17 CFWL_ScrollBar::CFWL_ScrollBar() {} | 17 CFWL_ScrollBar::CFWL_ScrollBar() {} |
18 | 18 |
19 CFWL_ScrollBar::~CFWL_ScrollBar() {} | 19 CFWL_ScrollBar::~CFWL_ScrollBar() {} |
20 | 20 |
21 FWL_ERR CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) { | 21 FWL_Error CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) { |
22 if (m_pIface) | 22 if (m_pIface) |
23 return FWL_ERR_Indefinite; | 23 return FWL_Error::Indefinite; |
24 if (pProperties) { | 24 if (pProperties) { |
25 *m_pProperties = *pProperties; | 25 *m_pProperties = *pProperties; |
26 } | 26 } |
27 std::unique_ptr<IFWL_ScrollBar> pScrollBar(IFWL_ScrollBar::Create( | 27 std::unique_ptr<IFWL_ScrollBar> pScrollBar(IFWL_ScrollBar::Create( |
28 m_pProperties->MakeWidgetImpProperties(nullptr), nullptr)); | 28 m_pProperties->MakeWidgetImpProperties(nullptr), nullptr)); |
29 FWL_ERR ret = pScrollBar->Initialize(); | 29 FWL_Error ret = pScrollBar->Initialize(); |
30 if (ret != FWL_ERR_Succeeded) { | 30 if (ret != FWL_Error::Succeeded) { |
31 return ret; | 31 return ret; |
32 } | 32 } |
33 m_pIface = pScrollBar.release(); | 33 m_pIface = pScrollBar.release(); |
34 CFWL_Widget::Initialize(); | 34 CFWL_Widget::Initialize(); |
35 return FWL_ERR_Succeeded; | 35 return FWL_Error::Succeeded; |
36 } | 36 } |
37 | 37 |
38 FX_BOOL CFWL_ScrollBar::IsVertical() { | 38 FX_BOOL CFWL_ScrollBar::IsVertical() { |
39 if (!m_pIface) | 39 if (!m_pIface) |
40 return FALSE; | 40 return FALSE; |
41 return static_cast<IFWL_ScrollBar*>(m_pIface)->IsVertical(); | 41 return static_cast<IFWL_ScrollBar*>(m_pIface)->IsVertical(); |
42 } | 42 } |
43 | 43 |
44 FWL_ERR CFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { | 44 FWL_Error CFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { |
45 if (!m_pIface) | 45 if (!m_pIface) |
46 return FWL_ERR_Indefinite; | 46 return FWL_Error::Indefinite; |
47 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetRange(fMin, fMax); | 47 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetRange(fMin, fMax); |
48 } | 48 } |
49 | 49 |
50 FWL_ERR CFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { | 50 FWL_Error CFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { |
51 if (!m_pIface) | 51 if (!m_pIface) |
52 return FWL_ERR_Indefinite; | 52 return FWL_Error::Indefinite; |
53 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetRange(fMin, fMax); | 53 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetRange(fMin, fMax); |
54 } | 54 } |
55 | 55 |
56 FX_FLOAT CFWL_ScrollBar::GetPageSize() { | 56 FX_FLOAT CFWL_ScrollBar::GetPageSize() { |
57 if (!m_pIface) | 57 if (!m_pIface) |
58 return 0; | 58 return 0; |
59 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPageSize(); | 59 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPageSize(); |
60 } | 60 } |
61 | 61 |
62 FWL_ERR CFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { | 62 FWL_Error CFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { |
63 if (!m_pIface) | 63 if (!m_pIface) |
64 return FWL_ERR_Indefinite; | 64 return FWL_Error::Indefinite; |
65 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPageSize(fPageSize); | 65 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPageSize(fPageSize); |
66 } | 66 } |
67 | 67 |
68 FX_FLOAT CFWL_ScrollBar::GetStepSize() { | 68 FX_FLOAT CFWL_ScrollBar::GetStepSize() { |
69 if (!m_pIface) | 69 if (!m_pIface) |
70 return 0; | 70 return 0; |
71 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetStepSize(); | 71 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetStepSize(); |
72 } | 72 } |
73 | 73 |
74 FWL_ERR CFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { | 74 FWL_Error CFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { |
75 if (!m_pIface) | 75 if (!m_pIface) |
76 return FWL_ERR_Indefinite; | 76 return FWL_Error::Indefinite; |
77 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetStepSize(fStepSize); | 77 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetStepSize(fStepSize); |
78 } | 78 } |
79 | 79 |
80 FX_FLOAT CFWL_ScrollBar::GetPos() { | 80 FX_FLOAT CFWL_ScrollBar::GetPos() { |
81 if (!m_pIface) | 81 if (!m_pIface) |
82 return -1; | 82 return -1; |
83 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPos(); | 83 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPos(); |
84 } | 84 } |
85 | 85 |
86 FWL_ERR CFWL_ScrollBar::SetPos(FX_FLOAT fPos) { | 86 FWL_Error CFWL_ScrollBar::SetPos(FX_FLOAT fPos) { |
87 if (!m_pIface) | 87 if (!m_pIface) |
88 return FWL_ERR_Indefinite; | 88 return FWL_Error::Indefinite; |
89 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPos(fPos); | 89 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPos(fPos); |
90 } | 90 } |
91 | 91 |
92 FX_FLOAT CFWL_ScrollBar::GetTrackPos() { | 92 FX_FLOAT CFWL_ScrollBar::GetTrackPos() { |
93 if (!m_pIface) | 93 if (!m_pIface) |
94 return -1; | 94 return -1; |
95 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetTrackPos(); | 95 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetTrackPos(); |
96 } | 96 } |
97 | 97 |
98 FWL_ERR CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { | 98 FWL_Error CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { |
99 if (!m_pIface) | 99 if (!m_pIface) |
100 return FWL_ERR_Indefinite; | 100 return FWL_Error::Indefinite; |
101 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetTrackPos(fTrackPos); | 101 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetTrackPos(fTrackPos); |
102 } | 102 } |
103 | 103 |
104 FX_BOOL CFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { | 104 FX_BOOL CFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { |
105 if (!m_pIface) | 105 if (!m_pIface) |
106 return FALSE; | 106 return FALSE; |
107 return static_cast<IFWL_ScrollBar*>(m_pIface)->DoScroll(dwCode, fPos); | 107 return static_cast<IFWL_ScrollBar*>(m_pIface)->DoScroll(dwCode, fPos); |
108 } | 108 } |
OLD | NEW |