summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-06-24 13:23:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-24 13:23:35 -0700
commit88b56f4dec7df76884f87fbc7eed44898a8ddd34 (patch)
treed8102b61c0c79bba7f213954ddae3e010326cf61 /xfa
parent29d447ae35101675a2a2d8bc1dcfca65de7f3929 (diff)
downloadpdfium-88b56f4dec7df76884f87fbc7eed44898a8ddd34.tar.xz
Remove IFWL_ToolTipTarget.
It does not have an implementation. BUG=623135 Review-Url: https://codereview.chromium.org/2094013002
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp13
-rw-r--r--xfa/fwl/core/fwl_noteimp.cpp113
-rw-r--r--xfa/fwl/core/fwl_noteimp.h16
-rw-r--r--xfa/fwl/core/ifwl_tooltiptarget.h36
4 files changed, 8 insertions, 170 deletions
diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
index e09113e19e..85af738555 100644
--- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
+++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
@@ -15,7 +15,6 @@
#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_tooltiptarget.h"
#include "xfa/fwl/theme/cfwl_widgettp.h"
// static
@@ -142,22 +141,18 @@ FWL_Error CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) {
rect.Deflate(x, t, x, y);
return FWL_Error::Succeeded;
}
+
FWL_Error CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- IFWL_ToolTipTarget* toolTipTarget =
- CFWL_ToolTipContainer::getInstance()->GetCurrentToolTipTarget();
- if (toolTipTarget && !toolTipTarget->UseDefaultTheme()) {
- return toolTipTarget->DrawToolTip(pGraphics, pMatrix, m_pInterface);
- }
- if (!pGraphics)
- return FWL_Error::Indefinite;
- if (!m_pProperties->m_pThemeProvider)
+ if (!pGraphics || !m_pProperties->m_pThemeProvider)
return FWL_Error::Indefinite;
+
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
DrawBkground(pGraphics, pTheme, pMatrix);
DrawText(pGraphics, pTheme, pMatrix);
return FWL_Error::Succeeded;
}
+
void CFWL_ToolTipImp::DrawBkground(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index cc5ff8d432..f115e2fd1b 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -16,7 +16,6 @@
#include "xfa/fwl/core/fwl_formimp.h"
#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_app.h"
-#include "xfa/fwl/core/ifwl_tooltiptarget.h"
CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm)
: m_pForm(pForm), m_bContinueModal(TRUE) {}
@@ -81,20 +80,7 @@ CFWL_NoteDriver::~CFWL_NoteDriver() {
void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) {
if (m_eventTargets.empty())
return;
- if (CFWL_EventType::Mouse == pNote->GetClassID()) {
- CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote);
- if (FWL_MouseCommand::Hover == pMouse->m_dwCmd) {
- if (m_pNoteLoop->GetForm()) {
- CFWL_ToolTipContainer::getInstance()->ProcessEnter(
- pMouse, m_pNoteLoop->GetForm()->GetInterface());
- }
- } else if (FWL_MouseCommand::Leave == pMouse->m_dwCmd) {
- CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse);
- } else if ((FWL_MouseCommand::LeftButtonDown <= pMouse->m_dwCmd) &&
- (FWL_MouseCommand::MiddleButtonDblClk >= pMouse->m_dwCmd)) {
- CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse);
- }
- }
+
for (const auto& pair : m_eventTargets) {
CFWL_EventTarget* pEventTarget = pair.second;
if (pEventTarget && !pEventTarget->IsInvalid())
@@ -787,8 +773,7 @@ FX_BOOL CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) {
CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr;
-CFWL_ToolTipContainer::CFWL_ToolTipContainer()
- : pCurTarget(nullptr), m_pToolTipImp(nullptr) {
+CFWL_ToolTipContainer::CFWL_ToolTipContainer() : m_pToolTipImp(nullptr) {
m_ToolTipDp = new CFWL_CoreToolTipDP;
m_ToolTipDp->m_nInitDelayTime = 0;
m_ToolTipDp->m_nAutoPopDelayTime = 2000;
@@ -815,97 +800,3 @@ void CFWL_ToolTipContainer::DeleteInstance() {
delete s_pInstance;
s_pInstance = nullptr;
}
-
-FWL_Error CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) {
- if (m_arrWidget.Find(pTarget) < 0) {
- m_arrWidget.Add(pTarget);
- return FWL_Error::Succeeded;
- }
- return FWL_Error::Indefinite;
-}
-FWL_Error CFWL_ToolTipContainer::RemoveToolTipTarget(
- IFWL_ToolTipTarget* pTarget) {
- int index = m_arrWidget.Find(pTarget);
- if (index >= 0) {
- m_arrWidget.RemoveAt(index);
- return FWL_Error::Succeeded;
- }
- return FWL_Error::Indefinite;
-}
-FX_BOOL CFWL_ToolTipContainer::HasToolTip(IFWL_Widget* pWedget) {
- int32_t iCount = m_arrWidget.GetSize();
- for (int32_t i = 0; i < iCount; i++) {
- IFWL_ToolTipTarget* p = m_arrWidget[i];
- if (p->GetWidget() == pWedget) {
- pCurTarget = p;
- return TRUE;
- }
- }
- return FALSE;
-}
-FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt,
- IFWL_Widget* pOwner) {
- if (HasToolTip(pEvt->m_pDstTarget)) {
- if (!m_pToolTipImp) {
- CFWL_WidgetImpProperties prop;
- prop.m_pDataProvider = m_ToolTipDp;
- prop.m_pOwner = pOwner;
- CFX_RectF rtTooltip;
- rtTooltip.Set(150, 150, 100, 50);
- prop.m_rtWidget = rtTooltip;
- IFWL_ToolTip* pToolTip = IFWL_ToolTip::Create(prop, nullptr);
- pToolTip->Initialize();
- m_pToolTipImp = static_cast<CFWL_ToolTipImp*>(pToolTip->GetImpl());
- m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_Multiline, 0);
- m_pToolTipImp->SetStates(FWL_WGTSTATE_Invisible, TRUE);
- }
- if (pCurTarget->IsShowed()) {
- CFX_WideString wsCaption;
- pCurTarget->GetCaption(wsCaption);
- if (!wsCaption.IsEmpty()) {
- m_ToolTipDp->m_wsCaption = wsCaption;
- }
- CFX_RectF rt;
- CFX_SizeF sz;
- pCurTarget->GetToolTipSize(sz);
- if (sz.x > 0 && sz.y > 0) {
- rt.width = sz.x;
- rt.height = sz.y;
- } else {
- CFX_RectF r;
- m_pToolTipImp->GetWidgetRect(r, TRUE);
- rt.width = r.width;
- rt.height = r.height;
- }
- CFX_PointF pt(pEvt->m_fx, pEvt->m_fy);
- if (pCurTarget->GetToolTipPos(pt) == FWL_Error::Succeeded) {
- rt.left = pt.x;
- rt.top = pt.y;
- m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_NoAnchor, 0);
- } else {
- CFX_RectF rtAnchor;
- pCurTarget->GetWidget()->GetClientRect(rtAnchor);
- pCurTarget->GetWidget()->TransformTo(nullptr, rtAnchor.left,
- rtAnchor.top);
- m_pToolTipImp->SetAnchor(rtAnchor);
- m_pToolTipImp->ModifyStylesEx(0, FWL_STYLEEXT_TTP_NoAnchor);
- }
- m_pToolTipImp->SetWidgetRect(rt);
- m_pToolTipImp->Update();
- m_pToolTipImp->Show();
- }
- return TRUE;
- }
- return FALSE;
-}
-FX_BOOL CFWL_ToolTipContainer::ProcessLeave(CFWL_EvtMouse* pEvt) {
- if (HasToolTip(pEvt->m_pDstTarget) && m_pToolTipImp) {
- m_pToolTipImp->Hide();
- pCurTarget = nullptr;
- return TRUE;
- }
- return FALSE;
-}
-IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() {
- return pCurTarget;
-}
diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h
index eb922f916c..c92395a13a 100644
--- a/xfa/fwl/core/fwl_noteimp.h
+++ b/xfa/fwl/core/fwl_noteimp.h
@@ -40,7 +40,6 @@ class CFWL_MsgWindowMove;
class CFWL_TargetImp;
class CFWL_ToolTipImp;
class CFWL_WidgetImp;
-class IFWL_ToolTipTarget;
class CFWL_NoteLoop {
public:
@@ -138,28 +137,17 @@ class CFWL_EventTarget {
FX_BOOL m_bInvalid;
};
-class CFWL_ToolTipContainer {
+class CFWL_ToolTipContainer final {
public:
static CFWL_ToolTipContainer* getInstance();
static void DeleteInstance();
- FWL_Error AddToolTipTarget(IFWL_ToolTipTarget* pTarget);
- FWL_Error RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget);
- IFWL_ToolTipTarget* GetCurrentToolTipTarget();
-
- FX_BOOL HasToolTip(IFWL_Widget* pWidget);
-
- FX_BOOL ProcessEnter(CFWL_EvtMouse* pEvt, IFWL_Widget* pOwner);
- FX_BOOL ProcessLeave(CFWL_EvtMouse* pEvt);
-
protected:
CFWL_ToolTipContainer();
- virtual ~CFWL_ToolTipContainer();
+ ~CFWL_ToolTipContainer();
- IFWL_ToolTipTarget* pCurTarget;
CFWL_ToolTipImp* m_pToolTipImp;
CFWL_CoreToolTipDP* m_ToolTipDp;
- CFX_ArrayTemplate<IFWL_ToolTipTarget*> m_arrWidget;
private:
static CFWL_ToolTipContainer* s_pInstance;
diff --git a/xfa/fwl/core/ifwl_tooltiptarget.h b/xfa/fwl/core/ifwl_tooltiptarget.h
deleted file mode 100644
index c6a47d0e09..0000000000
--- a/xfa/fwl/core/ifwl_tooltiptarget.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_CORE_IFWL_TOOLTIPTARGET_H_
-#define XFA_FWL_CORE_IFWL_TOOLTIPTARGET_H_
-
-#include "core/fxcrt/include/fx_coordinates.h"
-#include "core/fxcrt/include/fx_string.h"
-#include "core/fxcrt/include/fx_system.h"
-#include "xfa/fwl/core/fwl_error.h"
-
-class CFX_Graphics;
-class IFWL_Widget;
-
-class IFWL_ToolTipTarget {
- public:
- virtual ~IFWL_ToolTipTarget() {}
- virtual IFWL_Widget* GetWidget() = 0;
- virtual FX_BOOL IsShowed() = 0;
- virtual FWL_Error DrawToolTip(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix,
- IFWL_Widget* pToolTip) = 0;
- virtual FX_BOOL UseDefaultTheme() = 0;
- virtual FWL_Error GetCaption(CFX_WideString& wsCaption) = 0;
- virtual FWL_Error GetToolTipSize(CFX_SizeF& sz) = 0;
- virtual FWL_Error GetToolTipPos(CFX_PointF& pt);
-};
-
-inline FWL_Error GetToolTipPos(CFX_PointF& pt) {
- return FWL_Error::Indefinite;
-}
-
-#endif // XFA_FWL_CORE_IFWL_TOOLTIPTARGET_H_