Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: xfa/fwl/core/ifwl_tooltip.cpp

Issue 2436103002: Remove FWL globals. (Closed)
Patch Set: Review feedback Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_tooltip.h ('k') | xfa/fwl/core/ifwl_widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/core/ifwl_tooltip.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/core/cfwl_themebackground.h" 10 #include "xfa/fwl/core/cfwl_themebackground.h"
11 #include "xfa/fwl/core/cfwl_themepart.h" 11 #include "xfa/fwl/core/cfwl_themepart.h"
12 #include "xfa/fwl/core/cfwl_themetext.h" 12 #include "xfa/fwl/core/cfwl_themetext.h"
13 #include "xfa/fwl/core/fwl_noteimp.h" 13 #include "xfa/fwl/core/fwl_noteimp.h"
14 #include "xfa/fwl/core/ifwl_themeprovider.h" 14 #include "xfa/fwl/core/ifwl_themeprovider.h"
15 #include "xfa/fwl/core/ifwl_tooltip.h" 15 #include "xfa/fwl/core/ifwl_tooltip.h"
16 #include "xfa/fwl/theme/cfwl_widgettp.h" 16 #include "xfa/fwl/theme/cfwl_widgettp.h"
17 17
18 IFWL_ToolTip::IFWL_ToolTip(const CFWL_WidgetImpProperties& properties, 18 IFWL_ToolTip::IFWL_ToolTip(const IFWL_App* app,
19 const CFWL_WidgetImpProperties& properties,
19 IFWL_Widget* pOuter) 20 IFWL_Widget* pOuter)
20 : IFWL_Form(properties, pOuter), 21 : IFWL_Form(app, properties, pOuter),
21 m_bBtnDown(FALSE), 22 m_bBtnDown(FALSE),
22 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), 23 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
23 m_iTTOAlign(FDE_TTOALIGNMENT_Center), 24 m_iTTOAlign(FDE_TTOALIGNMENT_Center),
24 m_pTimerInfoShow(nullptr), 25 m_pTimerInfoShow(nullptr),
25 m_pTimerInfoHide(nullptr) { 26 m_pTimerInfoHide(nullptr),
27 m_TimerShow(this),
28 m_TimerHide(this) {
26 m_rtClient.Set(0, 0, 0, 0); 29 m_rtClient.Set(0, 0, 0, 0);
27 m_rtCaption.Set(0, 0, 0, 0); 30 m_rtCaption.Set(0, 0, 0, 0);
28 m_rtAnchor.Set(0, 0, 0, 0); 31 m_rtAnchor.Set(0, 0, 0, 0);
29 m_TimerShow.m_pToolTip = this;
30 m_TimerHide.m_pToolTip = this;
31 } 32 }
32 33
33 IFWL_ToolTip::~IFWL_ToolTip() {} 34 IFWL_ToolTip::~IFWL_ToolTip() {}
34 35
35 FWL_Type IFWL_ToolTip::GetClassID() const { 36 void IFWL_ToolTip::Initialize() {
36 return FWL_Type::ToolTip; 37 IFWL_Widget::Initialize();
37 }
38 38
39 FWL_Error IFWL_ToolTip::Initialize() {
40 m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup; 39 m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup;
41 m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child; 40 m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child;
42 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
43 return FWL_Error::Indefinite;
44 41
45 m_pDelegate = new CFWL_ToolTipImpDelegate(this); 42 m_pDelegate = new CFWL_ToolTipImpDelegate(this);
46 return FWL_Error::Succeeded;
47 } 43 }
48 44
49 void IFWL_ToolTip::Finalize() { 45 void IFWL_ToolTip::Finalize() {
50 delete m_pDelegate; 46 delete m_pDelegate;
51 m_pDelegate = nullptr; 47 m_pDelegate = nullptr;
52 IFWL_Widget::Finalize(); 48 IFWL_Widget::Finalize();
53 } 49 }
54 50
51 FWL_Type IFWL_ToolTip::GetClassID() const {
52 return FWL_Type::ToolTip;
53 }
54
55 FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { 55 FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
56 if (bAutoSize) { 56 if (bAutoSize) {
57 rect.Set(0, 0, 0, 0); 57 rect.Set(0, 0, 0, 0);
58 if (!m_pProperties->m_pThemeProvider) { 58 if (!m_pProperties->m_pThemeProvider) {
59 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 59 m_pProperties->m_pThemeProvider = GetAvailableTheme();
60 } 60 }
61 CFX_WideString wsCaption; 61 CFX_WideString wsCaption;
62 IFWL_ToolTipDP* pData = 62 IFWL_ToolTipDP* pData =
63 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); 63 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
64 if (pData) { 64 if (pData) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 rtPopup.Offset(0 - rtPopup.left, 0); 231 rtPopup.Offset(0 - rtPopup.left, 0);
232 } 232 }
233 if (rtPopup.top < 0) { 233 if (rtPopup.top < 0) {
234 rtPopup.Offset(0, 0 - rtPopup.top); 234 rtPopup.Offset(0, 0 - rtPopup.top);
235 } 235 }
236 SetWidgetRect(rtPopup); 236 SetWidgetRect(rtPopup);
237 Update(); 237 Update();
238 } 238 }
239 } 239 }
240 240
241 IFWL_ToolTip::CFWL_ToolTipTimer::CFWL_ToolTipTimer(IFWL_ToolTip* pToolTip) 241 IFWL_ToolTip::Timer::Timer(IFWL_ToolTip* pToolTip) : IFWL_Timer(pToolTip) {}
242 : m_pToolTip(pToolTip) {}
243 242
244 void IFWL_ToolTip::CFWL_ToolTipTimer::Run(IFWL_TimerInfo* pTimerInfo) { 243 void IFWL_ToolTip::Timer::Run(IFWL_TimerInfo* pTimerInfo) {
245 if (m_pToolTip->m_pTimerInfoShow == pTimerInfo && 244 IFWL_ToolTip* pToolTip = static_cast<IFWL_ToolTip*>(m_pWidget);
246 m_pToolTip->m_pTimerInfoShow) { 245
247 if (m_pToolTip->GetStates() & FWL_WGTSTATE_Invisible) { 246 if (pToolTip->m_pTimerInfoShow == pTimerInfo && pToolTip->m_pTimerInfoShow) {
248 m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, FALSE); 247 if (pToolTip->GetStates() & FWL_WGTSTATE_Invisible) {
249 m_pToolTip->RefreshToolTipPos(); 248 pToolTip->SetStates(FWL_WGTSTATE_Invisible, FALSE);
250 m_pToolTip->m_pTimerInfoShow->StopTimer(); 249 pToolTip->RefreshToolTipPos();
251 m_pToolTip->m_pTimerInfoShow = nullptr; 250 pToolTip->m_pTimerInfoShow->StopTimer();
251 pToolTip->m_pTimerInfoShow = nullptr;
252 return; 252 return;
253 } 253 }
254 } 254 }
255 if (m_pToolTip->m_pTimerInfoHide == pTimerInfo && 255 if (pToolTip->m_pTimerInfoHide == pTimerInfo && pToolTip->m_pTimerInfoHide) {
256 m_pToolTip->m_pTimerInfoHide) { 256 pToolTip->SetStates(FWL_WGTSTATE_Invisible, TRUE);
257 m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, TRUE); 257 pToolTip->m_pTimerInfoHide->StopTimer();
258 m_pToolTip->m_pTimerInfoHide->StopTimer(); 258 pToolTip->m_pTimerInfoHide = nullptr;
259 m_pToolTip->m_pTimerInfoHide = nullptr;
260 } 259 }
261 } 260 }
262 261
263 CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(IFWL_ToolTip* pOwner) 262 CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(IFWL_ToolTip* pOwner)
264 : m_pOwner(pOwner) {} 263 : m_pOwner(pOwner) {}
265 264
266 void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 265 void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
267 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); 266 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
268 } 267 }
269 268
270 void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} 269 void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {}
271 270
272 void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 271 void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
273 const CFX_Matrix* pMatrix) { 272 const CFX_Matrix* pMatrix) {
274 m_pOwner->DrawWidget(pGraphics, pMatrix); 273 m_pOwner->DrawWidget(pGraphics, pMatrix);
275 } 274 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_tooltip.h ('k') | xfa/fwl/core/ifwl_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698