| 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 "xfa/fde/tto/fde_textout.h" | 10 #include "xfa/fde/tto/fde_textout.h" |
| 10 #include "xfa/fwl/core/cfwl_themebackground.h" | 11 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 11 #include "xfa/fwl/core/cfwl_themepart.h" | 12 #include "xfa/fwl/core/cfwl_themepart.h" |
| 12 #include "xfa/fwl/core/cfwl_themetext.h" | 13 #include "xfa/fwl/core/cfwl_themetext.h" |
| 13 #include "xfa/fwl/core/fwl_noteimp.h" | 14 #include "xfa/fwl/core/fwl_noteimp.h" |
| 14 #include "xfa/fwl/core/ifwl_themeprovider.h" | 15 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 15 #include "xfa/fwl/core/ifwl_tooltip.h" | 16 #include "xfa/fwl/core/ifwl_tooltip.h" |
| 16 #include "xfa/fwl/theme/cfwl_widgettp.h" | 17 #include "xfa/fwl/theme/cfwl_widgettp.h" |
| 17 | 18 |
| 18 IFWL_ToolTip::IFWL_ToolTip(const IFWL_App* app, | 19 IFWL_ToolTip::IFWL_ToolTip(const IFWL_App* app, |
| 19 const CFWL_WidgetImpProperties& properties, | 20 const CFWL_WidgetImpProperties& properties, |
| 20 IFWL_Widget* pOuter) | 21 IFWL_Widget* pOuter) |
| 21 : IFWL_Form(app, properties, pOuter), | 22 : IFWL_Form(app, properties, pOuter), |
| 22 m_bBtnDown(FALSE), | 23 m_bBtnDown(FALSE), |
| 23 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), | 24 m_dwTTOStyles(FDE_TTOSTYLE_SingleLine), |
| 24 m_iTTOAlign(FDE_TTOALIGNMENT_Center), | 25 m_iTTOAlign(FDE_TTOALIGNMENT_Center), |
| 25 m_pTimerInfoShow(nullptr), | 26 m_pTimerInfoShow(nullptr), |
| 26 m_pTimerInfoHide(nullptr), | 27 m_pTimerInfoHide(nullptr), |
| 27 m_TimerShow(this), | 28 m_TimerShow(this), |
| 28 m_TimerHide(this) { | 29 m_TimerHide(this) { |
| 29 m_rtClient.Set(0, 0, 0, 0); | 30 m_rtClient.Set(0, 0, 0, 0); |
| 30 m_rtCaption.Set(0, 0, 0, 0); | 31 m_rtCaption.Set(0, 0, 0, 0); |
| 31 m_rtAnchor.Set(0, 0, 0, 0); | 32 m_rtAnchor.Set(0, 0, 0, 0); |
| 33 m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child; |
| 34 m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup; |
| 35 |
| 36 SetDelegate(pdfium::MakeUnique<CFWL_ToolTipImpDelegate>(this)); |
| 32 } | 37 } |
| 33 | 38 |
| 34 IFWL_ToolTip::~IFWL_ToolTip() {} | 39 IFWL_ToolTip::~IFWL_ToolTip() {} |
| 35 | 40 |
| 36 void IFWL_ToolTip::Initialize() { | |
| 37 IFWL_Widget::Initialize(); | |
| 38 | |
| 39 m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup; | |
| 40 m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child; | |
| 41 | |
| 42 m_pDelegate = new CFWL_ToolTipImpDelegate(this); | |
| 43 } | |
| 44 | |
| 45 void IFWL_ToolTip::Finalize() { | |
| 46 delete m_pDelegate; | |
| 47 m_pDelegate = nullptr; | |
| 48 IFWL_Widget::Finalize(); | |
| 49 } | |
| 50 | |
| 51 FWL_Type IFWL_ToolTip::GetClassID() const { | 41 FWL_Type IFWL_ToolTip::GetClassID() const { |
| 52 return FWL_Type::ToolTip; | 42 return FWL_Type::ToolTip; |
| 53 } | 43 } |
| 54 | 44 |
| 55 FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { | 45 FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { |
| 56 if (bAutoSize) { | 46 if (bAutoSize) { |
| 57 rect.Set(0, 0, 0, 0); | 47 rect.Set(0, 0, 0, 0); |
| 58 if (!m_pProperties->m_pThemeProvider) { | 48 if (!m_pProperties->m_pThemeProvider) { |
| 59 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 49 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
| 60 } | 50 } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 255 void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 266 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 256 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| 267 } | 257 } |
| 268 | 258 |
| 269 void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} | 259 void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} |
| 270 | 260 |
| 271 void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 261 void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 272 const CFX_Matrix* pMatrix) { | 262 const CFX_Matrix* pMatrix) { |
| 273 m_pOwner->DrawWidget(pGraphics, pMatrix); | 263 m_pOwner->DrawWidget(pGraphics, pMatrix); |
| 274 } | 264 } |
| OLD | NEW |