| 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/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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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 | |
| 36 SetDelegate(pdfium::MakeUnique<CFWL_ToolTipImpDelegate>(this)); | |
| 37 } | 35 } |
| 38 | 36 |
| 39 IFWL_ToolTip::~IFWL_ToolTip() {} | 37 IFWL_ToolTip::~IFWL_ToolTip() {} |
| 40 | 38 |
| 41 FWL_Type IFWL_ToolTip::GetClassID() const { | 39 FWL_Type IFWL_ToolTip::GetClassID() const { |
| 42 return FWL_Type::ToolTip; | 40 return FWL_Type::ToolTip; |
| 43 } | 41 } |
| 44 | 42 |
| 45 FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 43 FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
| 46 if (bAutoSize) { | 44 if (bAutoSize) { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 rtPopup.Offset(0 - rtPopup.left, 0); | 219 rtPopup.Offset(0 - rtPopup.left, 0); |
| 222 } | 220 } |
| 223 if (rtPopup.top < 0) { | 221 if (rtPopup.top < 0) { |
| 224 rtPopup.Offset(0, 0 - rtPopup.top); | 222 rtPopup.Offset(0, 0 - rtPopup.top); |
| 225 } | 223 } |
| 226 SetWidgetRect(rtPopup); | 224 SetWidgetRect(rtPopup); |
| 227 Update(); | 225 Update(); |
| 228 } | 226 } |
| 229 } | 227 } |
| 230 | 228 |
| 229 void IFWL_ToolTip::OnDrawWidget(CFX_Graphics* pGraphics, |
| 230 const CFX_Matrix* pMatrix) { |
| 231 DrawWidget(pGraphics, pMatrix); |
| 232 } |
| 233 |
| 231 IFWL_ToolTip::Timer::Timer(IFWL_ToolTip* pToolTip) : IFWL_Timer(pToolTip) {} | 234 IFWL_ToolTip::Timer::Timer(IFWL_ToolTip* pToolTip) : IFWL_Timer(pToolTip) {} |
| 232 | 235 |
| 233 void IFWL_ToolTip::Timer::Run(IFWL_TimerInfo* pTimerInfo) { | 236 void IFWL_ToolTip::Timer::Run(IFWL_TimerInfo* pTimerInfo) { |
| 234 IFWL_ToolTip* pToolTip = static_cast<IFWL_ToolTip*>(m_pWidget); | 237 IFWL_ToolTip* pToolTip = static_cast<IFWL_ToolTip*>(m_pWidget); |
| 235 | 238 |
| 236 if (pToolTip->m_pTimerInfoShow == pTimerInfo && pToolTip->m_pTimerInfoShow) { | 239 if (pToolTip->m_pTimerInfoShow == pTimerInfo && pToolTip->m_pTimerInfoShow) { |
| 237 if (pToolTip->GetStates() & FWL_WGTSTATE_Invisible) { | 240 if (pToolTip->GetStates() & FWL_WGTSTATE_Invisible) { |
| 238 pToolTip->SetStates(FWL_WGTSTATE_Invisible, FALSE); | 241 pToolTip->SetStates(FWL_WGTSTATE_Invisible, FALSE); |
| 239 pToolTip->RefreshToolTipPos(); | 242 pToolTip->RefreshToolTipPos(); |
| 240 pToolTip->m_pTimerInfoShow->StopTimer(); | 243 pToolTip->m_pTimerInfoShow->StopTimer(); |
| 241 pToolTip->m_pTimerInfoShow = nullptr; | 244 pToolTip->m_pTimerInfoShow = nullptr; |
| 242 return; | 245 return; |
| 243 } | 246 } |
| 244 } | 247 } |
| 245 if (pToolTip->m_pTimerInfoHide == pTimerInfo && pToolTip->m_pTimerInfoHide) { | 248 if (pToolTip->m_pTimerInfoHide == pTimerInfo && pToolTip->m_pTimerInfoHide) { |
| 246 pToolTip->SetStates(FWL_WGTSTATE_Invisible, TRUE); | 249 pToolTip->SetStates(FWL_WGTSTATE_Invisible, TRUE); |
| 247 pToolTip->m_pTimerInfoHide->StopTimer(); | 250 pToolTip->m_pTimerInfoHide->StopTimer(); |
| 248 pToolTip->m_pTimerInfoHide = nullptr; | 251 pToolTip->m_pTimerInfoHide = nullptr; |
| 249 } | 252 } |
| 250 } | 253 } |
| 251 | |
| 252 CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(IFWL_ToolTip* pOwner) | |
| 253 : m_pOwner(pOwner) {} | |
| 254 | |
| 255 void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | |
| 256 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | |
| 257 } | |
| 258 | |
| 259 void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} | |
| 260 | |
| 261 void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | |
| 262 const CFX_Matrix* pMatrix) { | |
| 263 m_pOwner->DrawWidget(pGraphics, pMatrix); | |
| 264 } | |
| OLD | NEW |