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/basewidget/fwl_tooltipctrlimp.h" | 7 #include "xfa/fwl/core/ifwl_tooltip.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fwl/basewidget/ifwl_tooltip.h" | |
11 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
12 #include "xfa/fwl/core/cfwl_themepart.h" | 11 #include "xfa/fwl/core/cfwl_themepart.h" |
13 #include "xfa/fwl/core/cfwl_themetext.h" | 12 #include "xfa/fwl/core/cfwl_themetext.h" |
14 #include "xfa/fwl/core/fwl_formimp.h" | |
15 #include "xfa/fwl/core/fwl_noteimp.h" | 13 #include "xfa/fwl/core/fwl_noteimp.h" |
16 #include "xfa/fwl/core/fwl_widgetimp.h" | |
17 #include "xfa/fwl/core/ifwl_themeprovider.h" | 14 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 15 #include "xfa/fwl/core/ifwl_tooltip.h" |
18 #include "xfa/fwl/theme/cfwl_widgettp.h" | 16 #include "xfa/fwl/theme/cfwl_widgettp.h" |
19 | 17 |
20 // static | 18 // static |
21 IFWL_ToolTip* IFWL_ToolTip::Create(const CFWL_WidgetImpProperties& properties, | 19 IFWL_ToolTip* IFWL_ToolTip::Create(const CFWL_WidgetImpProperties& properties, |
22 IFWL_Widget* pOuter) { | 20 IFWL_Widget* pOuter) { |
23 IFWL_ToolTip* pToolTip = new IFWL_ToolTip; | 21 return new IFWL_ToolTip(properties, pOuter); |
24 CFWL_ToolTipImp* pToolTipImpl = new CFWL_ToolTipImp(properties, pOuter); | |
25 pToolTip->SetImpl(pToolTipImpl); | |
26 pToolTipImpl->SetInterface(pToolTip); | |
27 return pToolTip; | |
28 } | 22 } |
29 | 23 |
30 void IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { | 24 IFWL_ToolTip::IFWL_ToolTip(const CFWL_WidgetImpProperties& properties, |
31 static_cast<CFWL_ToolTipImp*>(GetImpl())->SetAnchor(rtAnchor); | 25 IFWL_Widget* pOuter) |
32 } | 26 : IFWL_Form(properties, pOuter), |
33 | |
34 void IFWL_ToolTip::Show() { | |
35 static_cast<CFWL_ToolTipImp*>(GetImpl())->Show(); | |
36 } | |
37 | |
38 void IFWL_ToolTip::Hide() { | |
39 static_cast<CFWL_ToolTipImp*>(GetImpl())->Hide(); | |
40 } | |
41 | |
42 IFWL_ToolTip::IFWL_ToolTip() {} | |
43 | |
44 CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, | |
45 IFWL_Widget* pOuter) | |
46 : CFWL_FormImp(properties, pOuter), | |
47 m_bBtnDown(FALSE), | 27 m_bBtnDown(FALSE), |
48 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), | 28 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), |
49 m_iTTOAlign(FDE_TTOALIGNMENT_Center), | 29 m_iTTOAlign(FDE_TTOALIGNMENT_Center), |
50 m_pTimerInfoShow(nullptr), | 30 m_pTimerInfoShow(nullptr), |
51 m_pTimerInfoHide(nullptr) { | 31 m_pTimerInfoHide(nullptr) { |
52 m_rtClient.Set(0, 0, 0, 0); | 32 m_rtClient.Set(0, 0, 0, 0); |
53 m_rtCaption.Set(0, 0, 0, 0); | 33 m_rtCaption.Set(0, 0, 0, 0); |
54 m_rtAnchor.Set(0, 0, 0, 0); | 34 m_rtAnchor.Set(0, 0, 0, 0); |
55 m_TimerShow.m_pToolTip = this; | 35 m_TimerShow.m_pToolTip = this; |
56 m_TimerHide.m_pToolTip = this; | 36 m_TimerHide.m_pToolTip = this; |
57 } | 37 } |
58 | 38 |
59 CFWL_ToolTipImp::~CFWL_ToolTipImp() {} | 39 IFWL_ToolTip::~IFWL_ToolTip() {} |
60 | 40 |
61 FWL_Error CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const { | 41 FWL_Error IFWL_ToolTip::GetClassName(CFX_WideString& wsClass) const { |
62 wsClass = FWL_CLASS_ToolTip; | 42 wsClass = FWL_CLASS_ToolTip; |
63 return FWL_Error::Succeeded; | 43 return FWL_Error::Succeeded; |
64 } | 44 } |
65 | 45 |
66 FWL_Type CFWL_ToolTipImp::GetClassID() const { | 46 FWL_Type IFWL_ToolTip::GetClassID() const { |
67 return FWL_Type::ToolTip; | 47 return FWL_Type::ToolTip; |
68 } | 48 } |
69 | 49 |
70 FWL_Error CFWL_ToolTipImp::Initialize() { | 50 FWL_Error IFWL_ToolTip::Initialize() { |
71 m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup; | 51 m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup; |
72 m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child; | 52 m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child; |
73 if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) | 53 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) |
74 return FWL_Error::Indefinite; | 54 return FWL_Error::Indefinite; |
75 | 55 |
76 m_pDelegate = new CFWL_ToolTipImpDelegate(this); | 56 m_pDelegate = new CFWL_ToolTipImpDelegate(this); |
77 return FWL_Error::Succeeded; | 57 return FWL_Error::Succeeded; |
78 } | 58 } |
79 | 59 |
80 FWL_Error CFWL_ToolTipImp::Finalize() { | 60 FWL_Error IFWL_ToolTip::Finalize() { |
81 delete m_pDelegate; | 61 delete m_pDelegate; |
82 m_pDelegate = nullptr; | 62 m_pDelegate = nullptr; |
83 return CFWL_WidgetImp::Finalize(); | 63 return IFWL_Widget::Finalize(); |
84 } | 64 } |
85 FWL_Error CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 65 |
| 66 FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
86 if (bAutoSize) { | 67 if (bAutoSize) { |
87 rect.Set(0, 0, 0, 0); | 68 rect.Set(0, 0, 0, 0); |
88 if (!m_pProperties->m_pThemeProvider) { | 69 if (!m_pProperties->m_pThemeProvider) { |
89 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 70 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
90 } | 71 } |
91 CFX_WideString wsCaption; | 72 CFX_WideString wsCaption; |
92 IFWL_ToolTipDP* pData = | 73 IFWL_ToolTipDP* pData = |
93 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); | 74 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); |
94 if (pData) { | 75 if (pData) { |
95 pData->GetCaption(m_pInterface, wsCaption); | 76 pData->GetCaption(this, wsCaption); |
96 } | 77 } |
97 int32_t iLen = wsCaption.GetLength(); | 78 int32_t iLen = wsCaption.GetLength(); |
98 if (iLen > 0) { | 79 if (iLen > 0) { |
99 CFX_SizeF sz = CalcTextSize(wsCaption, m_pProperties->m_pThemeProvider); | 80 CFX_SizeF sz = CalcTextSize(wsCaption, m_pProperties->m_pThemeProvider); |
100 rect.Set(0, 0, sz.x, sz.y); | 81 rect.Set(0, 0, sz.x, sz.y); |
101 rect.width += 25; | 82 rect.width += 25; |
102 rect.height += 16; | 83 rect.height += 16; |
103 } | 84 } |
104 CFWL_WidgetImp::GetWidgetRect(rect, TRUE); | 85 IFWL_Widget::GetWidgetRect(rect, TRUE); |
105 } else { | 86 } else { |
106 rect = m_pProperties->m_rtWidget; | 87 rect = m_pProperties->m_rtWidget; |
107 } | 88 } |
108 return FWL_Error::Succeeded; | 89 return FWL_Error::Succeeded; |
109 } | 90 } |
110 FWL_Error CFWL_ToolTipImp::Update() { | 91 |
| 92 FWL_Error IFWL_ToolTip::Update() { |
111 if (IsLocked()) { | 93 if (IsLocked()) { |
112 return FWL_Error::Indefinite; | 94 return FWL_Error::Indefinite; |
113 } | 95 } |
114 if (!m_pProperties->m_pThemeProvider) { | 96 if (!m_pProperties->m_pThemeProvider) { |
115 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 97 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
116 } | 98 } |
117 UpdateTextOutStyles(); | 99 UpdateTextOutStyles(); |
118 GetClientRect(m_rtClient); | 100 GetClientRect(m_rtClient); |
119 m_rtCaption = m_rtClient; | 101 m_rtCaption = m_rtClient; |
120 return FWL_Error::Succeeded; | 102 return FWL_Error::Succeeded; |
121 } | 103 } |
122 FWL_Error CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) { | 104 |
| 105 FWL_Error IFWL_ToolTip::GetClientRect(CFX_RectF& rect) { |
123 FX_FLOAT x = 0; | 106 FX_FLOAT x = 0; |
124 FX_FLOAT y = 0; | 107 FX_FLOAT y = 0; |
125 FX_FLOAT t = 0; | 108 FX_FLOAT t = 0; |
126 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 109 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
127 if (pTheme) { | 110 if (pTheme) { |
128 CFWL_ThemePart part; | 111 CFWL_ThemePart part; |
129 part.m_pWidget = m_pInterface; | 112 part.m_pWidget = this; |
130 x = *static_cast<FX_FLOAT*>( | 113 x = *static_cast<FX_FLOAT*>( |
131 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder)); | 114 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder)); |
132 y = *static_cast<FX_FLOAT*>( | 115 y = *static_cast<FX_FLOAT*>( |
133 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYBorder)); | 116 pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CYBorder)); |
134 } | 117 } |
135 rect = m_pProperties->m_rtWidget; | 118 rect = m_pProperties->m_rtWidget; |
136 rect.Offset(-rect.left, -rect.top); | 119 rect.Offset(-rect.left, -rect.top); |
137 rect.Deflate(x, t, x, y); | 120 rect.Deflate(x, t, x, y); |
138 return FWL_Error::Succeeded; | 121 return FWL_Error::Succeeded; |
139 } | 122 } |
140 | 123 |
141 FWL_Error CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics, | 124 FWL_Error IFWL_ToolTip::DrawWidget(CFX_Graphics* pGraphics, |
142 const CFX_Matrix* pMatrix) { | 125 const CFX_Matrix* pMatrix) { |
143 if (!pGraphics || !m_pProperties->m_pThemeProvider) | 126 if (!pGraphics || !m_pProperties->m_pThemeProvider) |
144 return FWL_Error::Indefinite; | 127 return FWL_Error::Indefinite; |
145 | 128 |
146 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 129 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; |
147 DrawBkground(pGraphics, pTheme, pMatrix); | 130 DrawBkground(pGraphics, pTheme, pMatrix); |
148 DrawText(pGraphics, pTheme, pMatrix); | 131 DrawText(pGraphics, pTheme, pMatrix); |
149 return FWL_Error::Succeeded; | 132 return FWL_Error::Succeeded; |
150 } | 133 } |
151 | 134 |
152 void CFWL_ToolTipImp::DrawBkground(CFX_Graphics* pGraphics, | 135 void IFWL_ToolTip::DrawBkground(CFX_Graphics* pGraphics, |
153 IFWL_ThemeProvider* pTheme, | 136 IFWL_ThemeProvider* pTheme, |
154 const CFX_Matrix* pMatrix) { | 137 const CFX_Matrix* pMatrix) { |
155 CFWL_ThemeBackground param; | 138 CFWL_ThemeBackground param; |
156 param.m_pWidget = m_pInterface; | 139 param.m_pWidget = this; |
157 param.m_iPart = CFWL_Part::Background; | 140 param.m_iPart = CFWL_Part::Background; |
158 param.m_dwStates = m_pProperties->m_dwStates; | 141 param.m_dwStates = m_pProperties->m_dwStates; |
159 param.m_pGraphics = pGraphics; | 142 param.m_pGraphics = pGraphics; |
160 if (pMatrix) { | 143 if (pMatrix) { |
161 param.m_matrix.Concat(*pMatrix); | 144 param.m_matrix.Concat(*pMatrix); |
162 } | 145 } |
163 param.m_rtPart = m_rtClient; | 146 param.m_rtPart = m_rtClient; |
164 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { | 147 if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { |
165 param.m_pData = &m_rtCaption; | 148 param.m_pData = &m_rtCaption; |
166 } | 149 } |
167 pTheme->DrawBackground(¶m); | 150 pTheme->DrawBackground(¶m); |
168 } | 151 } |
169 void CFWL_ToolTipImp::DrawText(CFX_Graphics* pGraphics, | 152 |
170 IFWL_ThemeProvider* pTheme, | 153 void IFWL_ToolTip::DrawText(CFX_Graphics* pGraphics, |
171 const CFX_Matrix* pMatrix) { | 154 IFWL_ThemeProvider* pTheme, |
| 155 const CFX_Matrix* pMatrix) { |
172 if (!m_pProperties->m_pDataProvider) | 156 if (!m_pProperties->m_pDataProvider) |
173 return; | 157 return; |
174 CFX_WideString wsCaption; | 158 CFX_WideString wsCaption; |
175 m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption); | 159 m_pProperties->m_pDataProvider->GetCaption(this, wsCaption); |
176 if (wsCaption.IsEmpty()) { | 160 if (wsCaption.IsEmpty()) { |
177 return; | 161 return; |
178 } | 162 } |
179 CFWL_ThemeText param; | 163 CFWL_ThemeText param; |
180 param.m_pWidget = m_pInterface; | 164 param.m_pWidget = this; |
181 param.m_iPart = CFWL_Part::Caption; | 165 param.m_iPart = CFWL_Part::Caption; |
182 param.m_dwStates = m_pProperties->m_dwStates; | 166 param.m_dwStates = m_pProperties->m_dwStates; |
183 param.m_pGraphics = pGraphics; | 167 param.m_pGraphics = pGraphics; |
184 if (pMatrix) { | 168 if (pMatrix) { |
185 param.m_matrix.Concat(*pMatrix); | 169 param.m_matrix.Concat(*pMatrix); |
186 } | 170 } |
187 param.m_rtPart = m_rtCaption; | 171 param.m_rtPart = m_rtCaption; |
188 param.m_wsText = wsCaption; | 172 param.m_wsText = wsCaption; |
189 param.m_dwTTOStyles = m_dwTTOStyles; | 173 param.m_dwTTOStyles = m_dwTTOStyles; |
190 param.m_iTTOAlign = m_iTTOAlign; | 174 param.m_iTTOAlign = m_iTTOAlign; |
191 pTheme->DrawText(¶m); | 175 pTheme->DrawText(¶m); |
192 } | 176 } |
193 void CFWL_ToolTipImp::UpdateTextOutStyles() { | 177 |
| 178 void IFWL_ToolTip::UpdateTextOutStyles() { |
194 m_iTTOAlign = FDE_TTOALIGNMENT_Center; | 179 m_iTTOAlign = FDE_TTOALIGNMENT_Center; |
195 m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; | 180 m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; |
196 if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) { | 181 if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) { |
197 m_dwTTOStyles |= FDE_TTOSTYLE_RTL; | 182 m_dwTTOStyles |= FDE_TTOSTYLE_RTL; |
198 } | 183 } |
199 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_Multiline) { | 184 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_Multiline) { |
200 m_dwTTOStyles &= ~FDE_TTOSTYLE_SingleLine; | 185 m_dwTTOStyles &= ~FDE_TTOSTYLE_SingleLine; |
201 } | 186 } |
202 } | 187 } |
203 | 188 |
204 void CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) { | 189 void IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { |
205 m_rtAnchor = rtAnchor; | 190 m_rtAnchor = rtAnchor; |
206 } | 191 } |
207 | 192 |
208 void CFWL_ToolTipImp::Show() { | 193 void IFWL_ToolTip::Show() { |
209 IFWL_ToolTipDP* pData = | 194 IFWL_ToolTipDP* pData = |
210 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); | 195 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); |
211 int32_t nInitDelay = pData->GetInitialDelay(m_pInterface); | 196 int32_t nInitDelay = pData->GetInitialDelay(this); |
212 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible)) | 197 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible)) |
213 m_pTimerInfoShow = m_TimerShow.StartTimer(nInitDelay, false); | 198 m_pTimerInfoShow = m_TimerShow.StartTimer(nInitDelay, false); |
214 } | 199 } |
215 | 200 |
216 void CFWL_ToolTipImp::Hide() { | 201 void IFWL_ToolTip::Hide() { |
217 SetStates(FWL_WGTSTATE_Invisible, TRUE); | 202 SetStates(FWL_WGTSTATE_Invisible, TRUE); |
218 if (m_pTimerInfoHide) { | 203 if (m_pTimerInfoHide) { |
219 m_pTimerInfoHide->StopTimer(); | 204 m_pTimerInfoHide->StopTimer(); |
220 m_pTimerInfoHide = nullptr; | 205 m_pTimerInfoHide = nullptr; |
221 } | 206 } |
222 if (m_pTimerInfoShow) { | 207 if (m_pTimerInfoShow) { |
223 m_pTimerInfoShow->StopTimer(); | 208 m_pTimerInfoShow->StopTimer(); |
224 m_pTimerInfoShow = nullptr; | 209 m_pTimerInfoShow = nullptr; |
225 } | 210 } |
226 } | 211 } |
227 | 212 |
228 void CFWL_ToolTipImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { | 213 void IFWL_ToolTip::SetStates(uint32_t dwStates, FX_BOOL bSet) { |
229 if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) { | 214 if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) { |
230 IFWL_ToolTipDP* pData = | 215 IFWL_ToolTipDP* pData = |
231 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); | 216 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); |
232 int32_t nAutoPopDelay = pData->GetAutoPopDelay(m_pInterface); | 217 int32_t nAutoPopDelay = pData->GetAutoPopDelay(this); |
233 m_pTimerInfoHide = m_TimerHide.StartTimer(nAutoPopDelay, false); | 218 m_pTimerInfoHide = m_TimerHide.StartTimer(nAutoPopDelay, false); |
234 } | 219 } |
235 CFWL_WidgetImp::SetStates(dwStates, bSet); | 220 IFWL_Widget::SetStates(dwStates, bSet); |
236 } | 221 } |
237 | 222 |
238 void CFWL_ToolTipImp::RefreshToolTipPos() { | 223 void IFWL_ToolTip::RefreshToolTipPos() { |
239 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_NoAnchor) == 0) { | 224 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_NoAnchor) == 0) { |
240 CFX_RectF rtPopup; | 225 CFX_RectF rtPopup; |
241 CFX_RectF rtWidget(m_pProperties->m_rtWidget); | 226 CFX_RectF rtWidget(m_pProperties->m_rtWidget); |
242 CFX_RectF rtAnchor(m_rtAnchor); | 227 CFX_RectF rtAnchor(m_rtAnchor); |
243 rtPopup.Set(0, 0, 0, 0); | 228 rtPopup.Set(0, 0, 0, 0); |
244 FX_FLOAT fx = rtAnchor.Center().x + 20; | 229 FX_FLOAT fx = rtAnchor.Center().x + 20; |
245 FX_FLOAT fy = rtAnchor.Center().y + 20; | 230 FX_FLOAT fy = rtAnchor.Center().y + 20; |
246 rtPopup.Set(fx, fy, rtWidget.Width(), rtWidget.Height()); | 231 rtPopup.Set(fx, fy, rtWidget.Width(), rtWidget.Height()); |
247 FX_FLOAT fScreenWidth = 0; | 232 FX_FLOAT fScreenWidth = 0; |
248 FX_FLOAT fScreenHeight = 0; | 233 FX_FLOAT fScreenHeight = 0; |
249 GetScreenSize(fScreenWidth, fScreenHeight); | 234 GetScreenSize(fScreenWidth, fScreenHeight); |
250 if (rtPopup.bottom() > fScreenHeight) { | 235 if (rtPopup.bottom() > fScreenHeight) { |
251 rtPopup.Offset(0, fScreenHeight - rtPopup.bottom()); | 236 rtPopup.Offset(0, fScreenHeight - rtPopup.bottom()); |
252 } | 237 } |
253 if (rtPopup.right() > fScreenWidth) { | 238 if (rtPopup.right() > fScreenWidth) { |
254 rtPopup.Offset(fScreenWidth - rtPopup.right(), 0); | 239 rtPopup.Offset(fScreenWidth - rtPopup.right(), 0); |
255 } | 240 } |
256 if (rtPopup.left < 0) { | 241 if (rtPopup.left < 0) { |
257 rtPopup.Offset(0 - rtPopup.left, 0); | 242 rtPopup.Offset(0 - rtPopup.left, 0); |
258 } | 243 } |
259 if (rtPopup.top < 0) { | 244 if (rtPopup.top < 0) { |
260 rtPopup.Offset(0, 0 - rtPopup.top); | 245 rtPopup.Offset(0, 0 - rtPopup.top); |
261 } | 246 } |
262 SetWidgetRect(rtPopup); | 247 SetWidgetRect(rtPopup); |
263 Update(); | 248 Update(); |
264 } | 249 } |
265 } | 250 } |
266 CFWL_ToolTipImp::CFWL_ToolTipTimer::CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip) | 251 |
| 252 IFWL_ToolTip::CFWL_ToolTipTimer::CFWL_ToolTipTimer(IFWL_ToolTip* pToolTip) |
267 : m_pToolTip(pToolTip) {} | 253 : m_pToolTip(pToolTip) {} |
268 | 254 |
269 void CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(IFWL_TimerInfo* pTimerInfo) { | 255 void IFWL_ToolTip::CFWL_ToolTipTimer::Run(IFWL_TimerInfo* pTimerInfo) { |
270 if (m_pToolTip->m_pTimerInfoShow == pTimerInfo && | 256 if (m_pToolTip->m_pTimerInfoShow == pTimerInfo && |
271 m_pToolTip->m_pTimerInfoShow) { | 257 m_pToolTip->m_pTimerInfoShow) { |
272 if (m_pToolTip->GetStates() & FWL_WGTSTATE_Invisible) { | 258 if (m_pToolTip->GetStates() & FWL_WGTSTATE_Invisible) { |
273 m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, FALSE); | 259 m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, FALSE); |
274 m_pToolTip->RefreshToolTipPos(); | 260 m_pToolTip->RefreshToolTipPos(); |
275 m_pToolTip->m_pTimerInfoShow->StopTimer(); | 261 m_pToolTip->m_pTimerInfoShow->StopTimer(); |
276 m_pToolTip->m_pTimerInfoShow = nullptr; | 262 m_pToolTip->m_pTimerInfoShow = nullptr; |
277 return; | 263 return; |
278 } | 264 } |
279 } | 265 } |
280 if (m_pToolTip->m_pTimerInfoHide == pTimerInfo && | 266 if (m_pToolTip->m_pTimerInfoHide == pTimerInfo && |
281 m_pToolTip->m_pTimerInfoHide) { | 267 m_pToolTip->m_pTimerInfoHide) { |
282 m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, TRUE); | 268 m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, TRUE); |
283 m_pToolTip->m_pTimerInfoHide->StopTimer(); | 269 m_pToolTip->m_pTimerInfoHide->StopTimer(); |
284 m_pToolTip->m_pTimerInfoHide = nullptr; | 270 m_pToolTip->m_pTimerInfoHide = nullptr; |
285 } | 271 } |
286 } | 272 } |
287 | 273 |
288 CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner) | 274 CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(IFWL_ToolTip* pOwner) |
289 : m_pOwner(pOwner) {} | 275 : m_pOwner(pOwner) {} |
290 | 276 |
291 void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 277 void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
292 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 278 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
293 } | 279 } |
294 | 280 |
295 void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} | 281 void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} |
296 | 282 |
297 void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 283 void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
298 const CFX_Matrix* pMatrix) { | 284 const CFX_Matrix* pMatrix) { |
299 m_pOwner->DrawWidget(pGraphics, pMatrix); | 285 m_pOwner->DrawWidget(pGraphics, pMatrix); |
300 } | 286 } |
OLD | NEW |