Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Unified Diff: xfa/fwl/core/ifwl_spinbutton.cpp

Issue 2432423002: Merge the CFWL_*Imp classes into the IFWL_* classes. (Closed)
Patch Set: Review feedback Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_spinbutton.h ('k') | xfa/fwl/core/ifwl_timer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/core/ifwl_spinbutton.cpp
diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/core/ifwl_spinbutton.cpp
similarity index 83%
rename from xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
rename to xfa/fwl/core/ifwl_spinbutton.cpp
index 4eddce7439cfb37f627703895dcfae1529ad0cc2..dbba2f67f4c4195275c29cc210bf29b209a34840 100644
--- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
+++ b/xfa/fwl/core/ifwl_spinbutton.cpp
@@ -4,14 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_spinbuttonimp.h"
+#include "xfa/fwl/core/ifwl_spinbutton.h"
-#include "xfa/fwl/basewidget/ifwl_spinbutton.h"
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_spinbutton.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/core/ifwl_timer.h"
@@ -28,26 +27,12 @@ const int kElapseTime = 200;
IFWL_SpinButton* IFWL_SpinButton::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_SpinButton* pSpinButton = new IFWL_SpinButton;
- CFWL_SpinButtonImp* pSpinButtonImpl =
- new CFWL_SpinButtonImp(properties, nullptr);
- pSpinButton->SetImpl(pSpinButtonImpl);
- pSpinButtonImpl->SetInterface(pSpinButton);
- return pSpinButton;
-}
-IFWL_SpinButton::IFWL_SpinButton() {}
-FWL_Error IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) {
- return static_cast<CFWL_SpinButtonImp*>(GetImpl())
- ->EnableButton(bEnable, bUp);
-}
-FX_BOOL IFWL_SpinButton::IsButtonEnable(FX_BOOL bUp) {
- return static_cast<CFWL_SpinButtonImp*>(GetImpl())->IsButtonEnable(bUp);
+ return new IFWL_SpinButton(properties, nullptr);
}
-CFWL_SpinButtonImp::CFWL_SpinButtonImp(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+IFWL_SpinButton::IFWL_SpinButton(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_dwUpState(CFWL_PartState_Normal),
m_dwDnState(CFWL_PartState_Normal),
m_iButtonIndex(0),
@@ -59,41 +44,42 @@ CFWL_SpinButtonImp::CFWL_SpinButtonImp(
m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert;
}
-CFWL_SpinButtonImp::~CFWL_SpinButtonImp() {}
+IFWL_SpinButton::~IFWL_SpinButton() {}
-FWL_Error CFWL_SpinButtonImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_SpinButton::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_SpinButton;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_SpinButtonImp::GetClassID() const {
+FWL_Type IFWL_SpinButton::GetClassID() const {
return FWL_Type::SpinButton;
}
-FWL_Error CFWL_SpinButtonImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_SpinButton::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_SpinButtonImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_SpinButtonImp::Finalize() {
+FWL_Error IFWL_SpinButton::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_SpinButtonImp::GetWidgetRect(CFX_RectF& rect,
- FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, kMinWidth, kMinHeight);
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_SpinButtonImp::Update() {
+
+FWL_Error IFWL_SpinButton::Update() {
if (IsLocked()) {
return FWL_Error::Indefinite;
}
@@ -111,7 +97,8 @@ FWL_Error CFWL_SpinButtonImp::Update() {
}
return FWL_Error::Succeeded;
}
-FWL_WidgetHit CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+
+FWL_WidgetHit IFWL_SpinButton::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_rtClient.Contains(fx, fy))
return FWL_WidgetHit::Client;
if (HasBorder() && (m_rtClient.Contains(fx, fy)))
@@ -128,8 +115,9 @@ FWL_WidgetHit CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
return FWL_WidgetHit::DownButton;
return FWL_WidgetHit::Unknown;
}
-FWL_Error CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_SpinButton::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
CFX_RectF rtClip(m_rtClient);
@@ -148,17 +136,17 @@ FWL_Error CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics,
return FWL_Error::Succeeded;
}
-void CFWL_SpinButtonImp::Run(IFWL_TimerInfo* pTimerInfo) {
+void IFWL_SpinButton::Run(IFWL_TimerInfo* pTimerInfo) {
if (!m_pTimerInfo)
return;
CFWL_EvtSpbClick wmPosChanged;
- wmPosChanged.m_pSrcTarget = m_pInterface;
+ wmPosChanged.m_pSrcTarget = this;
wmPosChanged.m_bUp = m_iButtonIndex == 0;
DispatchEvent(&wmPosChanged);
}
-FWL_Error CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) {
+FWL_Error IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) {
if (bUp) {
if (bEnable) {
m_dwUpState = CFWL_PartState_Normal;
@@ -174,17 +162,19 @@ FWL_Error CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) {
}
return FWL_Error::Succeeded;
}
-FX_BOOL CFWL_SpinButtonImp::IsButtonEnable(FX_BOOL bUp) {
+
+FX_BOOL IFWL_SpinButton::IsButtonEnable(FX_BOOL bUp) {
if (bUp) {
return (m_dwUpState != CFWL_PartState_Disabled);
}
return (m_dwDnState != CFWL_PartState_Disabled);
}
-void CFWL_SpinButtonImp::DrawUpButton(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_SpinButton::DrawUpButton(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::UpButton;
params.m_pGraphics = pGraphics;
params.m_dwStates = m_dwUpState + 1;
@@ -194,11 +184,12 @@ void CFWL_SpinButtonImp::DrawUpButton(CFX_Graphics* pGraphics,
params.m_rtPart = m_rtUpButton;
pTheme->DrawBackground(&params);
}
-void CFWL_SpinButtonImp::DrawDownButton(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_SpinButton::DrawDownButton(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::DownButton;
params.m_pGraphics = pGraphics;
params.m_dwStates = m_dwDnState + 1;
@@ -209,8 +200,7 @@ void CFWL_SpinButtonImp::DrawDownButton(CFX_Graphics* pGraphics,
pTheme->DrawBackground(&params);
}
-CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate(
- CFWL_SpinButtonImp* pOwner)
+CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate(IFWL_SpinButton* pOwner)
: m_pOwner(pOwner) {}
void CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -257,9 +247,7 @@ void CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
OnKeyDown(pKey);
break;
}
- default: {
- break;
- }
+ default: { break; }
}
CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
}
@@ -280,6 +268,7 @@ void CFWL_SpinButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
}
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_SpinButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->m_bLButtonDwn = TRUE;
m_pOwner->SetGrab(TRUE);
@@ -302,7 +291,7 @@ void CFWL_SpinButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->m_dwDnState = CFWL_PartState_Pressed;
}
CFWL_EvtSpbClick wmPosChanged;
- wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface;
+ wmPosChanged.m_pSrcTarget = m_pOwner;
wmPosChanged.m_bUp = bUpPress;
m_pOwner->DispatchEvent(&wmPosChanged);
m_pOwner->Repaint(bUpPress ? &m_pOwner->m_rtUpButton
@@ -338,6 +327,7 @@ void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&rtInvalidate);
}
}
+
void CFWL_SpinButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
if (!m_pOwner->m_pProperties->m_pDataProvider)
return;
@@ -407,6 +397,7 @@ void CFWL_SpinButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&rtInvlidate);
}
}
+
void CFWL_SpinButtonImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
if (!pMsg)
return;
@@ -420,6 +411,7 @@ void CFWL_SpinButtonImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
}
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_SpinButtonImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
if (!m_pOwner->m_pProperties->m_pDataProvider)
return;
@@ -436,7 +428,7 @@ void CFWL_SpinButtonImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
return;
}
CFWL_EvtSpbClick wmPosChanged;
- wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface;
+ wmPosChanged.m_pSrcTarget = m_pOwner;
wmPosChanged.m_bUp = bUpEnable;
m_pOwner->DispatchEvent(&wmPosChanged);
m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton
« no previous file with comments | « xfa/fwl/core/ifwl_spinbutton.h ('k') | xfa/fwl/core/ifwl_timer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698