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