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