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

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

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: 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 "third_party/base/ptr_util.h" 9 #include "third_party/base/ptr_util.h"
10 #include "xfa/fde/tto/fde_textout.h" 10 #include "xfa/fde/tto/fde_textout.h"
11 #include "xfa/fwl/core/cfwl_themebackground.h" 11 #include "xfa/fwl/core/cfwl_themebackground.h"
12 #include "xfa/fwl/core/cfwl_themepart.h" 12 #include "xfa/fwl/core/cfwl_themepart.h"
13 #include "xfa/fwl/core/cfwl_themetext.h" 13 #include "xfa/fwl/core/cfwl_themetext.h"
14 #include "xfa/fwl/core/fwl_noteimp.h" 14 #include "xfa/fwl/core/fwl_noteimp.h"
15 #include "xfa/fwl/core/ifwl_themeprovider.h" 15 #include "xfa/fwl/core/ifwl_themeprovider.h"
16 #include "xfa/fwl/core/ifwl_tooltip.h" 16 #include "xfa/fwl/core/ifwl_tooltip.h"
17 #include "xfa/fwl/theme/cfwl_widgettp.h" 17 #include "xfa/fwl/theme/cfwl_widgettp.h"
18 18
19 IFWL_ToolTip::IFWL_ToolTip(const IFWL_App* app, 19 IFWL_ToolTip::IFWL_ToolTip(const IFWL_App* app,
20 const CFWL_WidgetImpProperties& properties, 20 const CFWL_WidgetImpProperties& properties,
21 IFWL_Widget* pOuter) 21 IFWL_Widget* pOuter)
22 : IFWL_Form(app, properties, pOuter), 22 : IFWL_Form(app, properties, pOuter),
23 m_bBtnDown(FALSE), 23 m_bBtnDown(false),
24 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), 24 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
25 m_iTTOAlign(FDE_TTOALIGNMENT_Center), 25 m_iTTOAlign(FDE_TTOALIGNMENT_Center),
26 m_pTimerInfoShow(nullptr), 26 m_pTimerInfoShow(nullptr),
27 m_pTimerInfoHide(nullptr), 27 m_pTimerInfoHide(nullptr),
28 m_TimerShow(this), 28 m_TimerShow(this),
29 m_TimerHide(this) { 29 m_TimerHide(this) {
30 m_rtClient.Set(0, 0, 0, 0); 30 m_rtClient.Set(0, 0, 0, 0);
31 m_rtCaption.Set(0, 0, 0, 0); 31 m_rtCaption.Set(0, 0, 0, 0);
32 m_rtAnchor.Set(0, 0, 0, 0); 32 m_rtAnchor.Set(0, 0, 0, 0);
33 m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child; 33 m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child;
34 m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup; 34 m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup;
35 } 35 }
36 36
37 IFWL_ToolTip::~IFWL_ToolTip() {} 37 IFWL_ToolTip::~IFWL_ToolTip() {}
38 38
39 FWL_Type IFWL_ToolTip::GetClassID() const { 39 FWL_Type IFWL_ToolTip::GetClassID() const {
40 return FWL_Type::ToolTip; 40 return FWL_Type::ToolTip;
41 } 41 }
42 42
43 FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { 43 FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
44 if (bAutoSize) { 44 if (bAutoSize) {
45 rect.Set(0, 0, 0, 0); 45 rect.Set(0, 0, 0, 0);
46 if (!m_pProperties->m_pThemeProvider) { 46 if (!m_pProperties->m_pThemeProvider) {
47 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 47 m_pProperties->m_pThemeProvider = GetAvailableTheme();
48 } 48 }
49 CFX_WideString wsCaption; 49 CFX_WideString wsCaption;
50 IFWL_ToolTipDP* pData = 50 IFWL_ToolTipDP* pData =
51 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); 51 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
52 if (pData) { 52 if (pData) {
53 pData->GetCaption(this, wsCaption); 53 pData->GetCaption(this, wsCaption);
54 } 54 }
55 int32_t iLen = wsCaption.GetLength(); 55 int32_t iLen = wsCaption.GetLength();
56 if (iLen > 0) { 56 if (iLen > 0) {
57 CFX_SizeF sz = CalcTextSize(wsCaption, m_pProperties->m_pThemeProvider); 57 CFX_SizeF sz = CalcTextSize(wsCaption, m_pProperties->m_pThemeProvider);
58 rect.Set(0, 0, sz.x, sz.y); 58 rect.Set(0, 0, sz.x, sz.y);
59 rect.width += 25; 59 rect.width += 25;
60 rect.height += 16; 60 rect.height += 16;
61 } 61 }
62 IFWL_Widget::GetWidgetRect(rect, TRUE); 62 IFWL_Widget::GetWidgetRect(rect, true);
63 } else { 63 } else {
64 rect = m_pProperties->m_rtWidget; 64 rect = m_pProperties->m_rtWidget;
65 } 65 }
66 return FWL_Error::Succeeded; 66 return FWL_Error::Succeeded;
67 } 67 }
68 68
69 FWL_Error IFWL_ToolTip::Update() { 69 FWL_Error IFWL_ToolTip::Update() {
70 if (IsLocked()) { 70 if (IsLocked()) {
71 return FWL_Error::Indefinite; 71 return FWL_Error::Indefinite;
72 } 72 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 void IFWL_ToolTip::Show() { 170 void IFWL_ToolTip::Show() {
171 IFWL_ToolTipDP* pData = 171 IFWL_ToolTipDP* pData =
172 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); 172 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
173 int32_t nInitDelay = pData->GetInitialDelay(this); 173 int32_t nInitDelay = pData->GetInitialDelay(this);
174 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible)) 174 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible))
175 m_pTimerInfoShow = m_TimerShow.StartTimer(nInitDelay, false); 175 m_pTimerInfoShow = m_TimerShow.StartTimer(nInitDelay, false);
176 } 176 }
177 177
178 void IFWL_ToolTip::Hide() { 178 void IFWL_ToolTip::Hide() {
179 SetStates(FWL_WGTSTATE_Invisible, TRUE); 179 SetStates(FWL_WGTSTATE_Invisible, true);
180 if (m_pTimerInfoHide) { 180 if (m_pTimerInfoHide) {
181 m_pTimerInfoHide->StopTimer(); 181 m_pTimerInfoHide->StopTimer();
182 m_pTimerInfoHide = nullptr; 182 m_pTimerInfoHide = nullptr;
183 } 183 }
184 if (m_pTimerInfoShow) { 184 if (m_pTimerInfoShow) {
185 m_pTimerInfoShow->StopTimer(); 185 m_pTimerInfoShow->StopTimer();
186 m_pTimerInfoShow = nullptr; 186 m_pTimerInfoShow = nullptr;
187 } 187 }
188 } 188 }
189 189
190 void IFWL_ToolTip::SetStates(uint32_t dwStates, FX_BOOL bSet) { 190 void IFWL_ToolTip::SetStates(uint32_t dwStates, bool bSet) {
191 if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) { 191 if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) {
192 IFWL_ToolTipDP* pData = 192 IFWL_ToolTipDP* pData =
193 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); 193 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
194 int32_t nAutoPopDelay = pData->GetAutoPopDelay(this); 194 int32_t nAutoPopDelay = pData->GetAutoPopDelay(this);
195 m_pTimerInfoHide = m_TimerHide.StartTimer(nAutoPopDelay, false); 195 m_pTimerInfoHide = m_TimerHide.StartTimer(nAutoPopDelay, false);
196 } 196 }
197 IFWL_Widget::SetStates(dwStates, bSet); 197 IFWL_Widget::SetStates(dwStates, bSet);
198 } 198 }
199 199
200 void IFWL_ToolTip::RefreshToolTipPos() { 200 void IFWL_ToolTip::RefreshToolTipPos() {
(...skipping 30 matching lines...) Expand all
231 DrawWidget(pGraphics, pMatrix); 231 DrawWidget(pGraphics, pMatrix);
232 } 232 }
233 233
234 IFWL_ToolTip::Timer::Timer(IFWL_ToolTip* pToolTip) : IFWL_Timer(pToolTip) {} 234 IFWL_ToolTip::Timer::Timer(IFWL_ToolTip* pToolTip) : IFWL_Timer(pToolTip) {}
235 235
236 void IFWL_ToolTip::Timer::Run(IFWL_TimerInfo* pTimerInfo) { 236 void IFWL_ToolTip::Timer::Run(IFWL_TimerInfo* pTimerInfo) {
237 IFWL_ToolTip* pToolTip = static_cast<IFWL_ToolTip*>(m_pWidget); 237 IFWL_ToolTip* pToolTip = static_cast<IFWL_ToolTip*>(m_pWidget);
238 238
239 if (pToolTip->m_pTimerInfoShow == pTimerInfo && pToolTip->m_pTimerInfoShow) { 239 if (pToolTip->m_pTimerInfoShow == pTimerInfo && pToolTip->m_pTimerInfoShow) {
240 if (pToolTip->GetStates() & FWL_WGTSTATE_Invisible) { 240 if (pToolTip->GetStates() & FWL_WGTSTATE_Invisible) {
241 pToolTip->SetStates(FWL_WGTSTATE_Invisible, FALSE); 241 pToolTip->SetStates(FWL_WGTSTATE_Invisible, false);
242 pToolTip->RefreshToolTipPos(); 242 pToolTip->RefreshToolTipPos();
243 pToolTip->m_pTimerInfoShow->StopTimer(); 243 pToolTip->m_pTimerInfoShow->StopTimer();
244 pToolTip->m_pTimerInfoShow = nullptr; 244 pToolTip->m_pTimerInfoShow = nullptr;
245 return; 245 return;
246 } 246 }
247 } 247 }
248 if (pToolTip->m_pTimerInfoHide == pTimerInfo && pToolTip->m_pTimerInfoHide) { 248 if (pToolTip->m_pTimerInfoHide == pTimerInfo && pToolTip->m_pTimerInfoHide) {
249 pToolTip->SetStates(FWL_WGTSTATE_Invisible, TRUE); 249 pToolTip->SetStates(FWL_WGTSTATE_Invisible, true);
250 pToolTip->m_pTimerInfoHide->StopTimer(); 250 pToolTip->m_pTimerInfoHide->StopTimer();
251 pToolTip->m_pTimerInfoHide = nullptr; 251 pToolTip->m_pTimerInfoHide = nullptr;
252 } 252 }
253 } 253 }
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