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_tooltip.h" | 7 #include "xfa/fwl/lightwidget/cfwl_tooltip.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "xfa/fwl/core/fwl_formimp.h" | 11 #include "xfa/fwl/core/fwl_formimp.h" |
12 #include "xfa/fwl/core/fwl_noteimp.h" | 12 #include "xfa/fwl/core/fwl_noteimp.h" |
13 #include "xfa/fwl/core/fwl_widgetimp.h" | 13 #include "xfa/fwl/core/fwl_widgetimp.h" |
14 | 14 |
15 CFWL_ToolTip* CFWL_ToolTip::Create() { | 15 CFWL_ToolTip* CFWL_ToolTip::Create() { |
16 return new CFWL_ToolTip; | 16 return new CFWL_ToolTip; |
17 } | 17 } |
18 | 18 |
19 FWL_ERR CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) { | 19 FWL_Error CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) { |
20 if (m_pIface) | 20 if (m_pIface) |
21 return FWL_ERR_Indefinite; | 21 return FWL_Error::Indefinite; |
22 if (pProperties) { | 22 if (pProperties) { |
23 *m_pProperties = *pProperties; | 23 *m_pProperties = *pProperties; |
24 } | 24 } |
25 std::unique_ptr<IFWL_ToolTip> pToolTip(IFWL_ToolTip::Create( | 25 std::unique_ptr<IFWL_ToolTip> pToolTip(IFWL_ToolTip::Create( |
26 m_pProperties->MakeWidgetImpProperties(&m_tooltipData), nullptr)); | 26 m_pProperties->MakeWidgetImpProperties(&m_tooltipData), nullptr)); |
27 FWL_ERR ret = pToolTip->Initialize(); | 27 FWL_Error ret = pToolTip->Initialize(); |
28 if (ret != FWL_ERR_Succeeded) { | 28 if (ret != FWL_Error::Succeeded) { |
29 return ret; | 29 return ret; |
30 } | 30 } |
31 m_pIface = pToolTip.release(); | 31 m_pIface = pToolTip.release(); |
32 CFWL_Widget::Initialize(); | 32 CFWL_Widget::Initialize(); |
33 return FWL_ERR_Succeeded; | 33 return FWL_Error::Succeeded; |
34 } | 34 } |
35 | 35 |
36 FWL_ERR CFWL_ToolTip::GetCaption(CFX_WideString& wsCaption) { | 36 void CFWL_ToolTip::GetCaption(CFX_WideString& wsCaption) { |
37 wsCaption = m_tooltipData.m_wsCaption; | 37 wsCaption = m_tooltipData.m_wsCaption; |
38 return FWL_ERR_Succeeded; | |
39 } | 38 } |
40 | 39 |
41 FWL_ERR CFWL_ToolTip::SetCaption(const CFX_WideStringC& wsCaption) { | 40 void CFWL_ToolTip::SetCaption(const CFX_WideStringC& wsCaption) { |
42 m_tooltipData.m_wsCaption = wsCaption; | 41 m_tooltipData.m_wsCaption = wsCaption; |
43 return FWL_ERR_Succeeded; | |
44 } | 42 } |
45 | 43 |
46 int32_t CFWL_ToolTip::GetInitialDelay() { | 44 int32_t CFWL_ToolTip::GetInitialDelay() { |
47 return m_tooltipData.m_nInitDelayTime; | 45 return m_tooltipData.m_nInitDelayTime; |
48 } | 46 } |
49 | 47 |
50 int32_t CFWL_ToolTip::SetInitialDelay(int32_t nDelayTime) { | 48 void CFWL_ToolTip::SetInitialDelay(int32_t nDelayTime) { |
51 m_tooltipData.m_nInitDelayTime = nDelayTime; | 49 m_tooltipData.m_nInitDelayTime = nDelayTime; |
52 return FWL_ERR_Succeeded; | |
53 } | 50 } |
54 | 51 |
55 int32_t CFWL_ToolTip::GetAutoPopDelay() { | 52 int32_t CFWL_ToolTip::GetAutoPopDelay() { |
56 return m_tooltipData.m_nAutoPopDelayTime; | 53 return m_tooltipData.m_nAutoPopDelayTime; |
57 } | 54 } |
58 | 55 |
59 int32_t CFWL_ToolTip::SetAutoPopDelay(int32_t nDelayTime) { | 56 void CFWL_ToolTip::SetAutoPopDelay(int32_t nDelayTime) { |
60 m_tooltipData.m_nAutoPopDelayTime = nDelayTime; | 57 m_tooltipData.m_nAutoPopDelayTime = nDelayTime; |
61 return FWL_ERR_Succeeded; | |
62 } | 58 } |
63 | 59 |
64 CFX_DIBitmap* CFWL_ToolTip::GetToolTipIcon() { | 60 CFX_DIBitmap* CFWL_ToolTip::GetToolTipIcon() { |
65 return m_tooltipData.m_pBitmap; | 61 return m_tooltipData.m_pBitmap; |
66 } | 62 } |
67 | 63 |
68 FWL_ERR CFWL_ToolTip::SetToolTipIcon(CFX_DIBitmap* pBitmap) { | 64 void CFWL_ToolTip::SetToolTipIcon(CFX_DIBitmap* pBitmap) { |
69 m_tooltipData.m_pBitmap = pBitmap; | 65 m_tooltipData.m_pBitmap = pBitmap; |
70 return FWL_ERR_Succeeded; | |
71 } | 66 } |
72 | 67 |
73 CFX_SizeF CFWL_ToolTip::GetToolTipIconSize() { | 68 CFX_SizeF CFWL_ToolTip::GetToolTipIconSize() { |
74 return m_tooltipData.m_fIconSize; | 69 return m_tooltipData.m_fIconSize; |
75 } | 70 } |
76 | 71 |
77 FWL_ERR CFWL_ToolTip::SetToolTipIconSize(CFX_SizeF fSize) { | 72 void CFWL_ToolTip::SetToolTipIconSize(CFX_SizeF fSize) { |
78 m_tooltipData.m_fIconSize = fSize; | 73 m_tooltipData.m_fIconSize = fSize; |
79 return FWL_ERR_Succeeded; | |
80 } | 74 } |
81 | 75 |
82 FWL_ERR CFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { | 76 void CFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { |
83 return static_cast<IFWL_ToolTip*>(m_pIface)->SetAnchor(rtAnchor); | 77 static_cast<IFWL_ToolTip*>(m_pIface)->SetAnchor(rtAnchor); |
84 } | 78 } |
85 | 79 |
86 FWL_ERR CFWL_ToolTip::Show() { | 80 void CFWL_ToolTip::Show() { |
87 return static_cast<IFWL_ToolTip*>(m_pIface)->Show(); | 81 static_cast<IFWL_ToolTip*>(m_pIface)->Show(); |
88 } | 82 } |
89 | 83 |
90 FWL_ERR CFWL_ToolTip::Hide() { | 84 void CFWL_ToolTip::Hide() { |
91 return static_cast<IFWL_ToolTip*>(m_pIface)->Hide(); | 85 static_cast<IFWL_ToolTip*>(m_pIface)->Hide(); |
92 } | 86 } |
93 | 87 |
94 CFWL_ToolTip::CFWL_ToolTip() {} | 88 CFWL_ToolTip::CFWL_ToolTip() {} |
95 | 89 |
96 CFWL_ToolTip::~CFWL_ToolTip() {} | 90 CFWL_ToolTip::~CFWL_ToolTip() {} |
97 | 91 |
98 CFWL_ToolTip::CFWL_ToolTipDP::CFWL_ToolTipDP() : m_pBitmap(NULL) { | 92 CFWL_ToolTip::CFWL_ToolTipDP::CFWL_ToolTipDP() : m_pBitmap(NULL) { |
99 m_wsCaption = L""; | 93 m_wsCaption = L""; |
100 m_nInitDelayTime = 500; | 94 m_nInitDelayTime = 500; |
101 m_nAutoPopDelayTime = 50000; | 95 m_nAutoPopDelayTime = 50000; |
102 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); | 96 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); |
103 } | 97 } |
104 | 98 |
105 FWL_ERR CFWL_ToolTip::CFWL_ToolTipDP::GetCaption(IFWL_Widget* pWidget, | 99 FWL_Error CFWL_ToolTip::CFWL_ToolTipDP::GetCaption(IFWL_Widget* pWidget, |
106 CFX_WideString& wsCaption) { | 100 CFX_WideString& wsCaption) { |
107 wsCaption = m_wsCaption; | 101 wsCaption = m_wsCaption; |
108 return FWL_ERR_Succeeded; | 102 return FWL_Error::Succeeded; |
109 } | 103 } |
110 | 104 |
111 int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { | 105 int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { |
112 return m_nInitDelayTime; | 106 return m_nInitDelayTime; |
113 } | 107 } |
114 | 108 |
115 int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { | 109 int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { |
116 return m_nAutoPopDelayTime; | 110 return m_nAutoPopDelayTime; |
117 } | 111 } |
118 | 112 |
119 CFX_DIBitmap* CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIcon( | 113 CFX_DIBitmap* CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIcon( |
120 IFWL_Widget* pWidget) { | 114 IFWL_Widget* pWidget) { |
121 return m_pBitmap; | 115 return m_pBitmap; |
122 } | 116 } |
123 | 117 |
124 CFX_SizeF CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIconSize( | 118 CFX_SizeF CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIconSize( |
125 IFWL_Widget* pWidget) { | 119 IFWL_Widget* pWidget) { |
126 return m_fIconSize; | 120 return m_fIconSize; |
127 } | 121 } |
128 | 122 |
129 CFX_RectF CFWL_ToolTip::CFWL_ToolTipDP::GetAnchor() { | 123 CFX_RectF CFWL_ToolTip::CFWL_ToolTipDP::GetAnchor() { |
130 return m_fAnchor; | 124 return m_fAnchor; |
131 } | 125 } |
OLD | NEW |