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_BASEWIDGET_FWL_CHECKBOXIMP_H_ 8 #define XFA_FWL_BASEWIDGET_FWL_CHECKBOXIMP_H_ 9 10 #include "xfa/fwl/core/fwl_widgetimp.h" 11 #include "xfa/fwl/core/ifwl_widget.h" 12 13 class CFWL_CheckBoxImpDelegate; 14 class CFWL_MsgMouse; 15 class CFWL_WidgetImpProperties; 16 class IFWL_Widget; 17 18 class CFWL_CheckBoxImp : public CFWL_WidgetImp { 19 public: 20 CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties, 21 IFWL_Widget* pOuter); 22 ~CFWL_CheckBoxImp() override; 23 24 // CFWL_WidgetImp 25 FWL_Error GetClassName(CFX_WideString& wsClass) const override; 26 FWL_Type GetClassID() const override; 27 FWL_Error Initialize() override; 28 FWL_Error Finalize() override; 29 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; 30 FWL_Error Update() override; 31 FWL_Error DrawWidget(CFX_Graphics* pGraphics, 32 const CFX_Matrix* pMatrix = nullptr) override; 33 int32_t GetCheckState(); 34 FWL_Error SetCheckState(int32_t iCheck); 35 36 protected: 37 friend class CFWL_CheckBoxImpDelegate; 38 39 void Layout(); 40 uint32_t GetPartStates(); 41 void UpdateTextOutStyles(); 42 void NextStates(); 43 44 CFX_RectF m_rtClient; 45 CFX_RectF m_rtBox; 46 CFX_RectF m_rtCaption; 47 CFX_RectF m_rtFocus; 48 uint32_t m_dwTTOStyles; 49 int32_t m_iTTOAlign; 50 FX_BOOL m_bBtnDown; 51 }; 52 53 class CFWL_CheckBoxImpDelegate : public CFWL_WidgetImpDelegate { 54 public: 55 CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner); 56 57 void OnProcessMessage(CFWL_Message* pMessage) override; 58 void OnDrawWidget(CFX_Graphics* pGraphics, 59 const CFX_Matrix* pMatrix = nullptr) override; 60 61 protected: 62 void OnActivate(CFWL_Message* pMsg); 63 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); 64 void OnLButtonDown(CFWL_MsgMouse* pMsg); 65 void OnLButtonUp(CFWL_MsgMouse* pMsg); 66 void OnMouseMove(CFWL_MsgMouse* pMsg); 67 void OnMouseLeave(CFWL_MsgMouse* pMsg); 68 void OnKeyDown(CFWL_MsgKey* pMsg); 69 70 CFWL_CheckBoxImp* m_pOwner; 71 }; 72 73 #endif // XFA_FWL_BASEWIDGET_FWL_CHECKBOXIMP_H_ 74