| Index: xfa/fwl/core/ifwl_tooltip.cpp
|
| diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/core/ifwl_tooltip.cpp
|
| similarity index 72%
|
| rename from xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
|
| rename to xfa/fwl/core/ifwl_tooltip.cpp
|
| index cf89483a9dc06c5c6e4523ce3b172ab708bd33a4..f0c46555a038ba93d5311df255186e3ecd111858 100644
|
| --- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
|
| +++ b/xfa/fwl/core/ifwl_tooltip.cpp
|
| @@ -4,46 +4,26 @@
|
|
|
| // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
|
|
|
| -#include "xfa/fwl/basewidget/fwl_tooltipctrlimp.h"
|
| +#include "xfa/fwl/core/ifwl_tooltip.h"
|
|
|
| #include "xfa/fde/tto/fde_textout.h"
|
| -#include "xfa/fwl/basewidget/ifwl_tooltip.h"
|
| #include "xfa/fwl/core/cfwl_themebackground.h"
|
| #include "xfa/fwl/core/cfwl_themepart.h"
|
| #include "xfa/fwl/core/cfwl_themetext.h"
|
| -#include "xfa/fwl/core/fwl_formimp.h"
|
| #include "xfa/fwl/core/fwl_noteimp.h"
|
| -#include "xfa/fwl/core/fwl_widgetimp.h"
|
| #include "xfa/fwl/core/ifwl_themeprovider.h"
|
| +#include "xfa/fwl/core/ifwl_tooltip.h"
|
| #include "xfa/fwl/theme/cfwl_widgettp.h"
|
|
|
| // static
|
| IFWL_ToolTip* IFWL_ToolTip::Create(const CFWL_WidgetImpProperties& properties,
|
| IFWL_Widget* pOuter) {
|
| - IFWL_ToolTip* pToolTip = new IFWL_ToolTip;
|
| - CFWL_ToolTipImp* pToolTipImpl = new CFWL_ToolTipImp(properties, pOuter);
|
| - pToolTip->SetImpl(pToolTipImpl);
|
| - pToolTipImpl->SetInterface(pToolTip);
|
| - return pToolTip;
|
| + return new IFWL_ToolTip(properties, pOuter);
|
| }
|
|
|
| -void IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) {
|
| - static_cast<CFWL_ToolTipImp*>(GetImpl())->SetAnchor(rtAnchor);
|
| -}
|
| -
|
| -void IFWL_ToolTip::Show() {
|
| - static_cast<CFWL_ToolTipImp*>(GetImpl())->Show();
|
| -}
|
| -
|
| -void IFWL_ToolTip::Hide() {
|
| - static_cast<CFWL_ToolTipImp*>(GetImpl())->Hide();
|
| -}
|
| -
|
| -IFWL_ToolTip::IFWL_ToolTip() {}
|
| -
|
| -CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties,
|
| - IFWL_Widget* pOuter)
|
| - : CFWL_FormImp(properties, pOuter),
|
| +IFWL_ToolTip::IFWL_ToolTip(const CFWL_WidgetImpProperties& properties,
|
| + IFWL_Widget* pOuter)
|
| + : IFWL_Form(properties, pOuter),
|
| m_bBtnDown(FALSE),
|
| m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
|
| m_iTTOAlign(FDE_TTOALIGNMENT_Center),
|
| @@ -56,33 +36,34 @@ CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties,
|
| m_TimerHide.m_pToolTip = this;
|
| }
|
|
|
| -CFWL_ToolTipImp::~CFWL_ToolTipImp() {}
|
| +IFWL_ToolTip::~IFWL_ToolTip() {}
|
|
|
| -FWL_Error CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const {
|
| +FWL_Error IFWL_ToolTip::GetClassName(CFX_WideString& wsClass) const {
|
| wsClass = FWL_CLASS_ToolTip;
|
| return FWL_Error::Succeeded;
|
| }
|
|
|
| -FWL_Type CFWL_ToolTipImp::GetClassID() const {
|
| +FWL_Type IFWL_ToolTip::GetClassID() const {
|
| return FWL_Type::ToolTip;
|
| }
|
|
|
| -FWL_Error CFWL_ToolTipImp::Initialize() {
|
| +FWL_Error IFWL_ToolTip::Initialize() {
|
| m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup;
|
| m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child;
|
| - if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
|
| + if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
|
| return FWL_Error::Indefinite;
|
|
|
| m_pDelegate = new CFWL_ToolTipImpDelegate(this);
|
| return FWL_Error::Succeeded;
|
| }
|
|
|
| -FWL_Error CFWL_ToolTipImp::Finalize() {
|
| +FWL_Error IFWL_ToolTip::Finalize() {
|
| delete m_pDelegate;
|
| m_pDelegate = nullptr;
|
| - return CFWL_WidgetImp::Finalize();
|
| + return IFWL_Widget::Finalize();
|
| }
|
| -FWL_Error CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
|
| +
|
| +FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
|
| if (bAutoSize) {
|
| rect.Set(0, 0, 0, 0);
|
| if (!m_pProperties->m_pThemeProvider) {
|
| @@ -92,7 +73,7 @@ FWL_Error CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
|
| IFWL_ToolTipDP* pData =
|
| static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
|
| if (pData) {
|
| - pData->GetCaption(m_pInterface, wsCaption);
|
| + pData->GetCaption(this, wsCaption);
|
| }
|
| int32_t iLen = wsCaption.GetLength();
|
| if (iLen > 0) {
|
| @@ -101,13 +82,14 @@ FWL_Error CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
|
| rect.width += 25;
|
| rect.height += 16;
|
| }
|
| - CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
|
| + IFWL_Widget::GetWidgetRect(rect, TRUE);
|
| } else {
|
| rect = m_pProperties->m_rtWidget;
|
| }
|
| return FWL_Error::Succeeded;
|
| }
|
| -FWL_Error CFWL_ToolTipImp::Update() {
|
| +
|
| +FWL_Error IFWL_ToolTip::Update() {
|
| if (IsLocked()) {
|
| return FWL_Error::Indefinite;
|
| }
|
| @@ -119,14 +101,15 @@ FWL_Error CFWL_ToolTipImp::Update() {
|
| m_rtCaption = m_rtClient;
|
| return FWL_Error::Succeeded;
|
| }
|
| -FWL_Error CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) {
|
| +
|
| +FWL_Error IFWL_ToolTip::GetClientRect(CFX_RectF& rect) {
|
| FX_FLOAT x = 0;
|
| FX_FLOAT y = 0;
|
| FX_FLOAT t = 0;
|
| IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
|
| if (pTheme) {
|
| CFWL_ThemePart part;
|
| - part.m_pWidget = m_pInterface;
|
| + part.m_pWidget = this;
|
| x = *static_cast<FX_FLOAT*>(
|
| pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder));
|
| y = *static_cast<FX_FLOAT*>(
|
| @@ -138,8 +121,8 @@ FWL_Error CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) {
|
| return FWL_Error::Succeeded;
|
| }
|
|
|
| -FWL_Error CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics,
|
| - const CFX_Matrix* pMatrix) {
|
| +FWL_Error IFWL_ToolTip::DrawWidget(CFX_Graphics* pGraphics,
|
| + const CFX_Matrix* pMatrix) {
|
| if (!pGraphics || !m_pProperties->m_pThemeProvider)
|
| return FWL_Error::Indefinite;
|
|
|
| @@ -149,11 +132,11 @@ FWL_Error CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics,
|
| return FWL_Error::Succeeded;
|
| }
|
|
|
| -void CFWL_ToolTipImp::DrawBkground(CFX_Graphics* pGraphics,
|
| - IFWL_ThemeProvider* pTheme,
|
| - const CFX_Matrix* pMatrix) {
|
| +void IFWL_ToolTip::DrawBkground(CFX_Graphics* pGraphics,
|
| + IFWL_ThemeProvider* pTheme,
|
| + const CFX_Matrix* pMatrix) {
|
| CFWL_ThemeBackground param;
|
| - param.m_pWidget = m_pInterface;
|
| + param.m_pWidget = this;
|
| param.m_iPart = CFWL_Part::Background;
|
| param.m_dwStates = m_pProperties->m_dwStates;
|
| param.m_pGraphics = pGraphics;
|
| @@ -166,18 +149,19 @@ void CFWL_ToolTipImp::DrawBkground(CFX_Graphics* pGraphics,
|
| }
|
| pTheme->DrawBackground(¶m);
|
| }
|
| -void CFWL_ToolTipImp::DrawText(CFX_Graphics* pGraphics,
|
| - IFWL_ThemeProvider* pTheme,
|
| - const CFX_Matrix* pMatrix) {
|
| +
|
| +void IFWL_ToolTip::DrawText(CFX_Graphics* pGraphics,
|
| + IFWL_ThemeProvider* pTheme,
|
| + const CFX_Matrix* pMatrix) {
|
| if (!m_pProperties->m_pDataProvider)
|
| return;
|
| CFX_WideString wsCaption;
|
| - m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption);
|
| + m_pProperties->m_pDataProvider->GetCaption(this, wsCaption);
|
| if (wsCaption.IsEmpty()) {
|
| return;
|
| }
|
| CFWL_ThemeText param;
|
| - param.m_pWidget = m_pInterface;
|
| + param.m_pWidget = this;
|
| param.m_iPart = CFWL_Part::Caption;
|
| param.m_dwStates = m_pProperties->m_dwStates;
|
| param.m_pGraphics = pGraphics;
|
| @@ -190,7 +174,8 @@ void CFWL_ToolTipImp::DrawText(CFX_Graphics* pGraphics,
|
| param.m_iTTOAlign = m_iTTOAlign;
|
| pTheme->DrawText(¶m);
|
| }
|
| -void CFWL_ToolTipImp::UpdateTextOutStyles() {
|
| +
|
| +void IFWL_ToolTip::UpdateTextOutStyles() {
|
| m_iTTOAlign = FDE_TTOALIGNMENT_Center;
|
| m_dwTTOStyles = FDE_TTOSTYLE_SingleLine;
|
| if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) {
|
| @@ -201,19 +186,19 @@ void CFWL_ToolTipImp::UpdateTextOutStyles() {
|
| }
|
| }
|
|
|
| -void CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) {
|
| +void IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) {
|
| m_rtAnchor = rtAnchor;
|
| }
|
|
|
| -void CFWL_ToolTipImp::Show() {
|
| +void IFWL_ToolTip::Show() {
|
| IFWL_ToolTipDP* pData =
|
| static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
|
| - int32_t nInitDelay = pData->GetInitialDelay(m_pInterface);
|
| + int32_t nInitDelay = pData->GetInitialDelay(this);
|
| if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible))
|
| m_pTimerInfoShow = m_TimerShow.StartTimer(nInitDelay, false);
|
| }
|
|
|
| -void CFWL_ToolTipImp::Hide() {
|
| +void IFWL_ToolTip::Hide() {
|
| SetStates(FWL_WGTSTATE_Invisible, TRUE);
|
| if (m_pTimerInfoHide) {
|
| m_pTimerInfoHide->StopTimer();
|
| @@ -225,17 +210,17 @@ void CFWL_ToolTipImp::Hide() {
|
| }
|
| }
|
|
|
| -void CFWL_ToolTipImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
|
| +void IFWL_ToolTip::SetStates(uint32_t dwStates, FX_BOOL bSet) {
|
| if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) {
|
| IFWL_ToolTipDP* pData =
|
| static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
|
| - int32_t nAutoPopDelay = pData->GetAutoPopDelay(m_pInterface);
|
| + int32_t nAutoPopDelay = pData->GetAutoPopDelay(this);
|
| m_pTimerInfoHide = m_TimerHide.StartTimer(nAutoPopDelay, false);
|
| }
|
| - CFWL_WidgetImp::SetStates(dwStates, bSet);
|
| + IFWL_Widget::SetStates(dwStates, bSet);
|
| }
|
|
|
| -void CFWL_ToolTipImp::RefreshToolTipPos() {
|
| +void IFWL_ToolTip::RefreshToolTipPos() {
|
| if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_NoAnchor) == 0) {
|
| CFX_RectF rtPopup;
|
| CFX_RectF rtWidget(m_pProperties->m_rtWidget);
|
| @@ -263,10 +248,11 @@ void CFWL_ToolTipImp::RefreshToolTipPos() {
|
| Update();
|
| }
|
| }
|
| -CFWL_ToolTipImp::CFWL_ToolTipTimer::CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip)
|
| +
|
| +IFWL_ToolTip::CFWL_ToolTipTimer::CFWL_ToolTipTimer(IFWL_ToolTip* pToolTip)
|
| : m_pToolTip(pToolTip) {}
|
|
|
| -void CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(IFWL_TimerInfo* pTimerInfo) {
|
| +void IFWL_ToolTip::CFWL_ToolTipTimer::Run(IFWL_TimerInfo* pTimerInfo) {
|
| if (m_pToolTip->m_pTimerInfoShow == pTimerInfo &&
|
| m_pToolTip->m_pTimerInfoShow) {
|
| if (m_pToolTip->GetStates() & FWL_WGTSTATE_Invisible) {
|
| @@ -285,7 +271,7 @@ void CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(IFWL_TimerInfo* pTimerInfo) {
|
| }
|
| }
|
|
|
| -CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner)
|
| +CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(IFWL_ToolTip* pOwner)
|
| : m_pOwner(pOwner) {}
|
|
|
| void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
|
|
|