| Index: xfa/fxfa/app/cxfa_ffpushbuttondelegate.cpp
|
| diff --git a/xfa/fxfa/app/cxfa_ffpushbuttondelegate.cpp b/xfa/fxfa/app/cxfa_ffpushbuttondelegate.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..496fd7b1fbdafab195da348ca11eb7776b03fca9
|
| --- /dev/null
|
| +++ b/xfa/fxfa/app/cxfa_ffpushbuttondelegate.cpp
|
| @@ -0,0 +1,68 @@
|
| +// 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
|
| +
|
| +#include "xfa/fxfa/app/cxfa_ffpushbuttondelegate.h"
|
| +
|
| +#include "xfa/fwl/core/cfwl_widget.h"
|
| +#include "xfa/fwl/core/ifwl_pushbutton.h"
|
| +#include "xfa/fxfa/app/xfa_fffield.h"
|
| +#include "xfa/fxfa/app/xfa_ffpushbutton.h"
|
| +#include "xfa/fxgraphics/cfx_color.h"
|
| +#include "xfa/fxgraphics/cfx_path.h"
|
| +
|
| +CXFA_FFPushButtonDelegate::CXFA_FFPushButtonDelegate(
|
| + std::unique_ptr<IFWL_WidgetDelegate> pDelegate,
|
| + CXFA_FFPushButton* const pWidget)
|
| + : CXFA_FFFieldDelegate(std::move(pDelegate), pWidget) {}
|
| +
|
| +CXFA_FFPushButtonDelegate::~CXFA_FFPushButtonDelegate() {}
|
| +
|
| +void CXFA_FFPushButtonDelegate::OnProcessMessage(CFWL_Message* pMessage) {
|
| + m_pDelegate->OnProcessMessage(pMessage);
|
| +}
|
| +
|
| +void CXFA_FFPushButtonDelegate::OnProcessEvent(CFWL_Event* pEvent) {
|
| + m_pDelegate->OnProcessEvent(pEvent);
|
| + CXFA_FFFieldDelegate::OnProcessEvent(pEvent);
|
| +}
|
| +
|
| +void CXFA_FFPushButtonDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
|
| + const CFX_Matrix* pMatrix) {
|
| + CFWL_Widget* pNormalWidget =
|
| + static_cast<CXFA_FFField*>(m_pWidget)->GetNormalWidget();
|
| + CXFA_FFPushButton* widget = static_cast<CXFA_FFPushButton*>(m_pWidget);
|
| +
|
| + if (pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteInverted) {
|
| + if ((pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) &&
|
| + (pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) {
|
| + CFX_RectF rtFill;
|
| + pNormalWidget->GetWidgetRect(rtFill);
|
| + rtFill.left = rtFill.top = 0;
|
| + FX_FLOAT fLineWith = widget->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 (pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteOutLine) {
|
| + if ((pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) &&
|
| + (pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) {
|
| + FX_FLOAT fLineWidth = widget->GetLineWidth();
|
| + CFX_Color cr(FXARGB_MAKE(255, 128, 255, 255));
|
| + pGraphics->SetStrokeColor(&cr);
|
| + pGraphics->SetLineWidth(fLineWidth);
|
| + CFX_Path path;
|
| + path.Create();
|
| + CFX_RectF rect;
|
| + pNormalWidget->GetWidgetRect(rect);
|
| + path.AddRectangle(0, 0, rect.width, rect.height);
|
| + pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix);
|
| + }
|
| + }
|
| +}
|
|
|