OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #include "xfa/include/fwl/lightwidget/scrollbar.h" | |
8 | |
9 #include <memory> | |
10 | |
11 #include "xfa/include/fwl/basewidget/fwl_scrollbar.h" | |
12 | |
13 CFWL_ScrollBar* CFWL_ScrollBar::Create() { | |
14 return new CFWL_ScrollBar; | |
15 } | |
16 FWL_ERR CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) { | |
17 if (m_pIface) | |
18 return FWL_ERR_Indefinite; | |
19 if (pProperties) { | |
20 *m_pProperties = *pProperties; | |
21 } | |
22 std::unique_ptr<IFWL_ScrollBar> pScrollBar(IFWL_ScrollBar::Create( | |
23 m_pProperties->MakeWidgetImpProperties(nullptr), nullptr)); | |
24 FWL_ERR ret = pScrollBar->Initialize(); | |
25 if (ret != FWL_ERR_Succeeded) { | |
26 return ret; | |
27 } | |
28 m_pIface = pScrollBar.release(); | |
29 CFWL_Widget::Initialize(); | |
30 return FWL_ERR_Succeeded; | |
31 } | |
32 FX_BOOL CFWL_ScrollBar::IsVertical() { | |
33 if (!m_pIface) | |
34 return FALSE; | |
35 return static_cast<IFWL_ScrollBar*>(m_pIface)->IsVertical(); | |
36 } | |
37 FWL_ERR CFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { | |
38 if (!m_pIface) | |
39 return FWL_ERR_Indefinite; | |
40 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetRange(fMin, fMax); | |
41 } | |
42 FWL_ERR CFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { | |
43 if (!m_pIface) | |
44 return FWL_ERR_Indefinite; | |
45 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetRange(fMin, fMax); | |
46 } | |
47 FX_FLOAT CFWL_ScrollBar::GetPageSize() { | |
48 if (!m_pIface) | |
49 return 0; | |
50 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPageSize(); | |
51 } | |
52 FWL_ERR CFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { | |
53 if (!m_pIface) | |
54 return FWL_ERR_Indefinite; | |
55 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPageSize(fPageSize); | |
56 } | |
57 FX_FLOAT CFWL_ScrollBar::GetStepSize() { | |
58 if (!m_pIface) | |
59 return 0; | |
60 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetStepSize(); | |
61 } | |
62 FWL_ERR CFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { | |
63 if (!m_pIface) | |
64 return FWL_ERR_Indefinite; | |
65 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetStepSize(fStepSize); | |
66 } | |
67 FX_FLOAT CFWL_ScrollBar::GetPos() { | |
68 if (!m_pIface) | |
69 return -1; | |
70 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPos(); | |
71 } | |
72 FWL_ERR CFWL_ScrollBar::SetPos(FX_FLOAT fPos) { | |
73 if (!m_pIface) | |
74 return FWL_ERR_Indefinite; | |
75 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPos(fPos); | |
76 } | |
77 FX_FLOAT CFWL_ScrollBar::GetTrackPos() { | |
78 if (!m_pIface) | |
79 return -1; | |
80 return static_cast<IFWL_ScrollBar*>(m_pIface)->GetTrackPos(); | |
81 } | |
82 FWL_ERR CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { | |
83 if (!m_pIface) | |
84 return FWL_ERR_Indefinite; | |
85 return static_cast<IFWL_ScrollBar*>(m_pIface)->SetTrackPos(fTrackPos); | |
86 } | |
87 FX_BOOL CFWL_ScrollBar::DoScroll(FX_DWORD dwCode, FX_FLOAT fPos) { | |
88 if (!m_pIface) | |
89 return FALSE; | |
90 return static_cast<IFWL_ScrollBar*>(m_pIface)->DoScroll(dwCode, fPos); | |
91 } | |
92 CFWL_ScrollBar::CFWL_ScrollBar() {} | |
93 CFWL_ScrollBar::~CFWL_ScrollBar() {} | |
OLD | NEW |