1 // Copyright 2014 The PDFium Authors 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 "xfa/fwl/cfwl_widget.h" 11 12 namespace pdfium { 13 14 #define FWL_STATE_PSB_Hovered (1 << FWL_STATE_WGT_MAX) 15 #define FWL_STATE_PSB_Pressed (1 << (FWL_STATE_WGT_MAX + 1)) 16 #define FWL_STATE_PSB_Default (1 << (FWL_STATE_WGT_MAX + 2)) 17 18 class CFWL_MessageKey; 19 class CFWL_MessageMouse; 20 21 class CFWL_PushButton final : public CFWL_Widget { 22 public: 23 CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED; 24 ~CFWL_PushButton() override; 25 26 // CFWL_Widget 27 FWL_Type GetClassID() const override; 28 void SetStates(uint32_t dwStates) override; 29 void Update() override; 30 void DrawWidget(CFGAS_GEGraphics* pGraphics, 31 const CFX_Matrix& matrix) override; 32 void OnProcessMessage(CFWL_Message* pMessage) override; 33 void OnDrawWidget(CFGAS_GEGraphics* pGraphics, 34 const CFX_Matrix& matrix) override; 35 36 private: 37 explicit CFWL_PushButton(CFWL_App* pApp); 38 39 void DrawBkground(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix); 40 Mask<CFWL_PartState> GetPartStates(); 41 void UpdateTextOutStyles(); 42 void OnFocusGained(); 43 void OnFocusLost(); 44 void OnLButtonDown(CFWL_MessageMouse* pMsg); 45 void OnLButtonUp(CFWL_MessageMouse* pMsg); 46 void OnMouseMove(CFWL_MessageMouse* pMsg); 47 void OnMouseLeave(CFWL_MessageMouse* pMsg); 48 void OnKeyDown(CFWL_MessageKey* pMsg); 49 50 bool m_bBtnDown = false; 51 CFX_RectF m_ClientRect; 52 CFX_RectF m_CaptionRect; 53 }; 54 55 } // namespace pdfium 56 57 // TODO(crbug.com/42271761): Remove. 58 using pdfium::CFWL_PushButton; 59 60 #endif // XFA_FWL_CFWL_PUSHBUTTON_H_ 61