1// Copyright 2014 PDFium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7#ifndef XFA_FWL_CFWL_PUSHBUTTON_H_ 8#define XFA_FWL_CFWL_PUSHBUTTON_H_ 9 10#include <memory> 11 12#include "xfa/fwl/cfwl_widget.h" 13#include "xfa/fwl/cfwl_widgetproperties.h" 14 15#define FWL_STATE_PSB_Hovered (1 << FWL_WGTSTATE_MAX) 16#define FWL_STATE_PSB_Pressed (1 << (FWL_WGTSTATE_MAX + 1)) 17 18class CFWL_MessageMouse; 19class CFX_DIBitmap; 20class CFWL_Widget; 21 22class CFWL_PushButton : public CFWL_Widget { 23 public: 24 explicit CFWL_PushButton(const CFWL_App*); 25 ~CFWL_PushButton() override; 26 27 // CFWL_Widget 28 FWL_Type GetClassID() const override; 29 void SetStates(uint32_t dwStates) override; 30 void Update() override; 31 void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; 32 void OnProcessMessage(CFWL_Message* pMessage) override; 33 void OnDrawWidget(CFX_Graphics* pGraphics, 34 const CFX_Matrix* pMatrix) override; 35 36 private: 37 void DrawBkground(CFX_Graphics* pGraphics, 38 IFWL_ThemeProvider* pTheme, 39 const CFX_Matrix* pMatrix); 40 uint32_t GetPartStates(); 41 void UpdateTextOutStyles(); 42 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); 43 void OnLButtonDown(CFWL_MessageMouse* pMsg); 44 void OnLButtonUp(CFWL_MessageMouse* pMsg); 45 void OnMouseMove(CFWL_MessageMouse* pMsg); 46 void OnMouseLeave(CFWL_MessageMouse* pMsg); 47 void OnKeyDown(CFWL_MessageKey* pMsg); 48 49 CFX_RectF m_rtClient; 50 CFX_RectF m_rtCaption; 51 bool m_bBtnDown; 52 uint32_t m_dwTTOStyles; 53 int32_t m_iTTOAlign; 54}; 55 56#endif // XFA_FWL_CFWL_PUSHBUTTON_H_ 57