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