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

Side by Side Diff: xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp

Issue 2037573003: Remove FWL_HTIMER in favor of IWFL_TimerInfo (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Remove unused return value. Created 4 years, 6 months 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
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/basewidget/fwl_tooltipctrlimp.h" 7 #include "xfa/fwl/basewidget/fwl_tooltipctrlimp.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" 10 #include "xfa/fwl/basewidget/ifwl_tooltip.h"
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 IFWL_ToolTip::IFWL_ToolTip() {} 43 IFWL_ToolTip::IFWL_ToolTip() {}
44 44
45 CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, 45 CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties,
46 IFWL_Widget* pOuter) 46 IFWL_Widget* pOuter)
47 : CFWL_FormImp(properties, pOuter), 47 : CFWL_FormImp(properties, pOuter),
48 m_bBtnDown(FALSE), 48 m_bBtnDown(FALSE),
49 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), 49 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
50 m_iTTOAlign(FDE_TTOALIGNMENT_Center), 50 m_iTTOAlign(FDE_TTOALIGNMENT_Center),
51 m_hTimerShow(NULL), 51 m_pTimerInfoShow(NULL),
52 m_hTimerHide(NULL), 52 m_pTimerInfoHide(NULL),
dsinclair 2016/06/06 19:52:23 nit: nullptr
Tom Sepez 2016/06/06 20:08:33 Done.
53 m_pTimer(NULL) { 53 m_pTimer(NULL) {
54 m_rtClient.Set(0, 0, 0, 0); 54 m_rtClient.Set(0, 0, 0, 0);
55 m_rtCaption.Set(0, 0, 0, 0); 55 m_rtCaption.Set(0, 0, 0, 0);
56 m_rtAnchor.Set(0, 0, 0, 0); 56 m_rtAnchor.Set(0, 0, 0, 0);
57 m_TimerShow.m_pToolTip = this; 57 m_TimerShow.m_pToolTip = this;
58 m_TimerHide.m_pToolTip = this; 58 m_TimerHide.m_pToolTip = this;
59 } 59 }
60 60
61 CFWL_ToolTipImp::~CFWL_ToolTipImp() { 61 CFWL_ToolTipImp::~CFWL_ToolTipImp() {
62 if (m_pTimer) { 62 if (m_pTimer) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 void CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) { 215 void CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) {
216 m_rtAnchor = rtAnchor; 216 m_rtAnchor = rtAnchor;
217 } 217 }
218 218
219 void CFWL_ToolTipImp::Show() { 219 void CFWL_ToolTipImp::Show() {
220 IFWL_ToolTipDP* pData = 220 IFWL_ToolTipDP* pData =
221 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); 221 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
222 int32_t nInitDelay = pData->GetInitialDelay(m_pInterface); 222 int32_t nInitDelay = pData->GetInitialDelay(m_pInterface);
223 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible)) 223 if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible))
224 m_hTimerShow = FWL_StartTimer(&m_TimerShow, nInitDelay, FALSE); 224 m_pTimerInfoShow = m_TimerShow.StartTimer(nInitDelay, false);
225 } 225 }
226 226
227 void CFWL_ToolTipImp::Hide() { 227 void CFWL_ToolTipImp::Hide() {
228 SetStates(FWL_WGTSTATE_Invisible, TRUE); 228 SetStates(FWL_WGTSTATE_Invisible, TRUE);
229 if (m_hTimerHide) { 229 if (m_pTimerInfoHide) {
230 FWL_StopTimer(m_hTimerHide); 230 m_pTimerInfoHide->StopTimer();
231 m_hTimerHide = nullptr; 231 m_pTimerInfoHide = nullptr;
232 } 232 }
233 if (m_hTimerShow) { 233 if (m_pTimerInfoShow) {
234 FWL_StopTimer(m_hTimerShow); 234 m_pTimerInfoShow->StopTimer();
235 m_hTimerShow = nullptr; 235 m_pTimerInfoShow = nullptr;
236 } 236 }
237 } 237 }
238 238
239 void CFWL_ToolTipImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { 239 void CFWL_ToolTipImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
240 if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) { 240 if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) {
241 IFWL_ToolTipDP* pData = 241 IFWL_ToolTipDP* pData =
242 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); 242 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
243 int32_t nAutoPopDelay = pData->GetAutoPopDelay(m_pInterface); 243 int32_t nAutoPopDelay = pData->GetAutoPopDelay(m_pInterface);
244 m_hTimerHide = FWL_StartTimer(&m_TimerHide, nAutoPopDelay, FALSE); 244 m_pTimerInfoHide = m_TimerHide.StartTimer(nAutoPopDelay, false);
245 } 245 }
246 CFWL_WidgetImp::SetStates(dwStates, bSet); 246 CFWL_WidgetImp::SetStates(dwStates, bSet);
247 } 247 }
248 248
249 void CFWL_ToolTipImp::RefreshToolTipPos() { 249 void CFWL_ToolTipImp::RefreshToolTipPos() {
250 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_NoAnchor) == 0) { 250 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_NoAnchor) == 0) {
251 CFX_RectF rtPopup; 251 CFX_RectF rtPopup;
252 CFX_RectF rtWidget(m_pProperties->m_rtWidget); 252 CFX_RectF rtWidget(m_pProperties->m_rtWidget);
253 CFX_RectF rtAnchor(m_rtAnchor); 253 CFX_RectF rtAnchor(m_rtAnchor);
254 rtPopup.Set(0, 0, 0, 0); 254 rtPopup.Set(0, 0, 0, 0);
(...skipping 14 matching lines...) Expand all
269 } 269 }
270 if (rtPopup.top < 0) { 270 if (rtPopup.top < 0) {
271 rtPopup.Offset(0, 0 - rtPopup.top); 271 rtPopup.Offset(0, 0 - rtPopup.top);
272 } 272 }
273 SetWidgetRect(rtPopup); 273 SetWidgetRect(rtPopup);
274 Update(); 274 Update();
275 } 275 }
276 } 276 }
277 CFWL_ToolTipImp::CFWL_ToolTipTimer::CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip) 277 CFWL_ToolTipImp::CFWL_ToolTipTimer::CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip)
278 : m_pToolTip(pToolTip) {} 278 : m_pToolTip(pToolTip) {}
279 int32_t CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(FWL_HTIMER hTimer) { 279
280 if (m_pToolTip->m_hTimerShow == hTimer && m_pToolTip->m_hTimerShow) { 280 void CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(IFWL_TimerInfo* pTimerInfo) {
281 if (m_pToolTip->m_pTimerInfoShow == pTimerInfo &&
282 m_pToolTip->m_pTimerInfoShow) {
281 if (m_pToolTip->GetStates() & FWL_WGTSTATE_Invisible) { 283 if (m_pToolTip->GetStates() & FWL_WGTSTATE_Invisible) {
282 m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, FALSE); 284 m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, FALSE);
283 m_pToolTip->RefreshToolTipPos(); 285 m_pToolTip->RefreshToolTipPos();
284 FWL_StopTimer(m_pToolTip->m_hTimerShow); 286 m_pToolTip->m_pTimerInfoShow->StopTimer();
285 m_pToolTip->m_hTimerShow = NULL; 287 m_pToolTip->m_pTimerInfoShow = nullptr;
286 return TRUE; 288 return;
287 } 289 }
288 } 290 }
289 if (m_pToolTip->m_hTimerHide == hTimer && m_pToolTip->m_hTimerHide) { 291 if (m_pToolTip->m_pTimerInfoHide == pTimerInfo &&
292 m_pToolTip->m_pTimerInfoHide) {
290 m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, TRUE); 293 m_pToolTip->SetStates(FWL_WGTSTATE_Invisible, TRUE);
291 FWL_StopTimer(m_pToolTip->m_hTimerHide); 294 m_pToolTip->m_pTimerInfoHide->StopTimer();
292 m_pToolTip->m_hTimerHide = NULL; 295 m_pToolTip->m_pTimerInfoHide = nullptr;
293 return TRUE;
294 } 296 }
295 return TRUE;
296 } 297 }
297 298
298 CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner) 299 CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner)
299 : m_pOwner(pOwner) {} 300 : m_pOwner(pOwner) {}
300 301
301 void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { 302 void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
302 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); 303 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
303 } 304 }
304 305
305 void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} 306 void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {}
306 307
307 void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, 308 void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
308 const CFX_Matrix* pMatrix) { 309 const CFX_Matrix* pMatrix) {
309 m_pOwner->DrawWidget(pGraphics, pMatrix); 310 m_pOwner->DrawWidget(pGraphics, pMatrix);
310 } 311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698