summaryrefslogtreecommitdiff
path: root/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-04 17:57:03 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-04 17:57:03 -0700
commitc777f486f84611d2fdd2d03af661b14955f9efb6 (patch)
tree679012454d82e885f749d17f75fd12735efec29a /xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
parent41aad19ba366540bd4efa20a9009ac1c70a81403 (diff)
downloadpdfium-c777f486f84611d2fdd2d03af661b14955f9efb6.tar.xz
Convert FWL_ERR into an enum class.
This Cl updates FWL_ERR to be an FWL_Error enum class. It removes FX_ERR and replaces it with FWL_Error as well as the values were the same. There were many places where we either returned other values for FWL_ERR results. This Cl is the same as: https://codereview.chromium.org/1943413002/ but I seem to have messed up the base URL in that one. TBR=tsepez@chromium.org Review-Url: https://codereview.chromium.org/1952693003
Diffstat (limited to 'xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp')
-rw-r--r--xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp92
1 files changed, 49 insertions, 43 deletions
diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
index 0a8d343cef..f1878edee8 100644
--- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
+++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
@@ -27,16 +27,21 @@ IFWL_ToolTip* IFWL_ToolTip::Create(const CFWL_WidgetImpProperties& properties,
pToolTipImpl->SetInterface(pToolTip);
return pToolTip;
}
-FWL_ERR IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) {
- return static_cast<CFWL_ToolTipImp*>(GetImpl())->SetAnchor(rtAnchor);
+
+void IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) {
+ static_cast<CFWL_ToolTipImp*>(GetImpl())->SetAnchor(rtAnchor);
}
-FWL_ERR IFWL_ToolTip::Show() {
- return static_cast<CFWL_ToolTipImp*>(GetImpl())->Show();
+
+void IFWL_ToolTip::Show() {
+ static_cast<CFWL_ToolTipImp*>(GetImpl())->Show();
}
-FWL_ERR IFWL_ToolTip::Hide() {
- return static_cast<CFWL_ToolTipImp*>(GetImpl())->Hide();
+
+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),
@@ -58,27 +63,27 @@ CFWL_ToolTipImp::~CFWL_ToolTipImp() {
m_pTimer = NULL;
}
}
-FWL_ERR CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_ToolTip;
- return FWL_ERR_Succeeded;
+ return FWL_Error::Succeeded;
}
uint32_t CFWL_ToolTipImp::GetClassID() const {
return FWL_CLASSHASH_ToolTip;
}
-FWL_ERR CFWL_ToolTipImp::Initialize() {
+FWL_Error CFWL_ToolTipImp::Initialize() {
m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup;
m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child;
- if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
- return FWL_ERR_Indefinite;
+ if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+ return FWL_Error::Indefinite;
m_pDelegate = new CFWL_ToolTipImpDelegate(this);
- return FWL_ERR_Succeeded;
+ return FWL_Error::Succeeded;
}
-FWL_ERR CFWL_ToolTipImp::Finalize() {
+FWL_Error CFWL_ToolTipImp::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
return CFWL_WidgetImp::Finalize();
}
-FWL_ERR CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
+FWL_Error CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
if (m_pProperties->m_pThemeProvider == NULL) {
@@ -101,11 +106,11 @@ FWL_ERR CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
} else {
rect = m_pProperties->m_rtWidget;
}
- return FWL_ERR_Succeeded;
+ return FWL_Error::Succeeded;
}
-FWL_ERR CFWL_ToolTipImp::Update() {
+FWL_Error CFWL_ToolTipImp::Update() {
if (IsLocked()) {
- return FWL_ERR_Indefinite;
+ return FWL_Error::Indefinite;
}
if (!m_pProperties->m_pThemeProvider) {
m_pProperties->m_pThemeProvider = GetAvailableTheme();
@@ -113,9 +118,9 @@ FWL_ERR CFWL_ToolTipImp::Update() {
UpdateTextOutStyles();
GetClientRect(m_rtClient);
m_rtCaption = m_rtClient;
- return FWL_ERR_Succeeded;
+ return FWL_Error::Succeeded;
}
-FWL_ERR CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) {
+FWL_Error CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) {
FX_FLOAT x = 0;
FX_FLOAT y = 0;
FX_FLOAT t = 0;
@@ -131,23 +136,23 @@ FWL_ERR CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) {
rect = m_pProperties->m_rtWidget;
rect.Offset(-rect.left, -rect.top);
rect.Deflate(x, t, x, y);
- return FWL_ERR_Succeeded;
+ return FWL_Error::Succeeded;
}
-FWL_ERR CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+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_ERR_Indefinite;
+ return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
- return FWL_ERR_Indefinite;
+ return FWL_Error::Indefinite;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
DrawBkground(pGraphics, pTheme, pMatrix);
DrawText(pGraphics, pTheme, pMatrix);
- return FWL_ERR_Succeeded;
+ return FWL_Error::Succeeded;
}
void CFWL_ToolTipImp::DrawBkground(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
@@ -200,30 +205,29 @@ void CFWL_ToolTipImp::UpdateTextOutStyles() {
m_dwTTOStyles &= ~FDE_TTOSTYLE_SingleLine;
}
}
-FWL_ERR CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) {
+
+void CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) {
m_rtAnchor = rtAnchor;
- return TRUE;
}
-FWL_ERR CFWL_ToolTipImp::Show() {
+
+void CFWL_ToolTipImp::Show() {
IFWL_ToolTipDP* pData =
static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
int32_t nInitDelay = pData->GetInitialDelay(m_pInterface);
- if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible)) {
+ if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible))
m_hTimerShow = FWL_StartTimer(&m_TimerShow, nInitDelay, FALSE);
- }
- return TRUE;
}
-FWL_ERR CFWL_ToolTipImp::Hide() {
+
+void CFWL_ToolTipImp::Hide() {
SetStates(FWL_WGTSTATE_Invisible, TRUE);
if (m_hTimerHide) {
FWL_StopTimer(m_hTimerHide);
- m_hTimerHide = NULL;
+ m_hTimerHide = nullptr;
}
if (m_hTimerShow) {
FWL_StopTimer(m_hTimerShow);
- m_hTimerShow = NULL;
+ m_hTimerShow = nullptr;
}
- return TRUE;
}
void CFWL_ToolTipImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
@@ -284,15 +288,17 @@ int32_t CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(FWL_HTIMER hTimer) {
}
return TRUE;
}
+
CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner)
: m_pOwner(pOwner) {}
-int32_t CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
-}
-FWL_ERR CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
- return FWL_ERR_Succeeded;
+
+void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
+ CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
}
-FWL_ERR CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
- return m_pOwner->DrawWidget(pGraphics, pMatrix);
+
+void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {}
+
+void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
+ m_pOwner->DrawWidget(pGraphics, pMatrix);
}