Index: xfa/fxfa/app/xfa_ffpushbutton.cpp |
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp |
index e64858101117f21861ad3e2a87218a3867398825..d5ad72cf3ba18910798ad7f2db955f6dae4ca0d8 100644 |
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp |
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp |
@@ -6,9 +6,11 @@ |
#include "xfa/fxfa/app/xfa_ffpushbutton.h" |
+#include "third_party/base/ptr_util.h" |
#include "xfa/fwl/core/cfwl_pushbutton.h" |
#include "xfa/fwl/core/cfwl_widgetmgr.h" |
#include "xfa/fwl/core/fwl_noteimp.h" |
+#include "xfa/fxfa/app/cxfa_ffpushbuttondelegate.h" |
#include "xfa/fxfa/app/xfa_fffield.h" |
#include "xfa/fxfa/app/xfa_ffwidgetacc.h" |
#include "xfa/fxfa/app/xfa_textlayout.h" |
@@ -24,11 +26,12 @@ CXFA_FFPushButton::CXFA_FFPushButton(CXFA_FFPageView* pPageView, |
m_pRolloverTextLayout(nullptr), |
m_pDownTextLayout(nullptr), |
m_pDownProvider(nullptr), |
- m_pRollProvider(nullptr), |
- m_pOldDelegate(nullptr) {} |
+ m_pRollProvider(nullptr) {} |
+ |
CXFA_FFPushButton::~CXFA_FFPushButton() { |
CXFA_FFPushButton::UnloadWidget(); |
} |
+ |
void CXFA_FFPushButton::RenderWidget(CFX_Graphics* pGS, |
CFX_Matrix* pMatrix, |
uint32_t dwStatus) { |
@@ -55,8 +58,8 @@ FX_BOOL CXFA_FFPushButton::LoadWidget() { |
CFWL_PushButton* pPushButton = new CFWL_PushButton(GetFWLApp()); |
pPushButton->Initialize(); |
- m_pOldDelegate = pPushButton->GetCurrentDelegate(); |
- pPushButton->SetCurrentDelegate(this); |
+ pPushButton->SetDelegate(pdfium::MakeUnique<CXFA_FFPushButtonDelegate>( |
+ pPushButton->ReleaseDelegate(), this)); |
m_pNormalWidget = pPushButton; |
m_pNormalWidget->SetLayoutItem(this); |
@@ -201,47 +204,3 @@ void CXFA_FFPushButton::RenderHighlightCaption(CFX_Graphics* pGS, |
} |
} |
} |
- |
-void CXFA_FFPushButton::OnProcessMessage(CFWL_Message* pMessage) { |
- m_pOldDelegate->OnProcessMessage(pMessage); |
-} |
- |
-void CXFA_FFPushButton::OnProcessEvent(CFWL_Event* pEvent) { |
- m_pOldDelegate->OnProcessEvent(pEvent); |
- CXFA_FFField::OnProcessEvent(pEvent); |
-} |
- |
-void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, |
- const CFX_Matrix* pMatrix) { |
- if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteInverted) { |
- if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && |
- (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { |
- CFX_RectF rtFill; |
- m_pNormalWidget->GetWidgetRect(rtFill); |
- rtFill.left = rtFill.top = 0; |
- FX_FLOAT fLineWith = GetLineWidth(); |
- rtFill.Deflate(fLineWith, fLineWith); |
- CFX_Color cr(FXARGB_MAKE(128, 128, 255, 255)); |
- pGraphics->SetFillColor(&cr); |
- CFX_Path path; |
- path.Create(); |
- path.AddRectangle(rtFill.left, rtFill.top, rtFill.width, rtFill.height); |
- pGraphics->FillPath(&path, FXFILL_WINDING, (CFX_Matrix*)pMatrix); |
- } |
- } else if (m_pNormalWidget->GetStylesEx() & |
- XFA_FWL_PSBSTYLEEXT_HiliteOutLine) { |
- if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && |
- (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { |
- FX_FLOAT fLineWidth = GetLineWidth(); |
- CFX_Color cr(FXARGB_MAKE(255, 128, 255, 255)); |
- pGraphics->SetStrokeColor(&cr); |
- pGraphics->SetLineWidth(fLineWidth); |
- CFX_Path path; |
- path.Create(); |
- CFX_RectF rect; |
- m_pNormalWidget->GetWidgetRect(rect); |
- path.AddRectangle(0, 0, rect.width, rect.height); |
- pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); |
- } |
- } |
-} |