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_CARET_IMP_H 8 #define _FWL_CARET_IMP_H 9 10 #include "xfa/include/fwl/core/fwl_timer.h" 11 12 class CFWL_WidgetImp; 13 class CFWL_WidgetImpProperties; 14 class CFWL_WidgetImpDelegate; 15 class IFWL_Widget; 16 class CFWL_CaretImp; 17 class CFWL_CaretImpDelegate; 18 class CFWL_CaretImp : public CFWL_WidgetImp { 19 public: 20 CFWL_CaretImp(const CFWL_WidgetImpProperties& properties, 21 IFWL_Widget* pOuter); 22 virtual ~CFWL_CaretImp(); 23 24 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; 25 virtual FX_DWORD GetClassID() const; 26 27 virtual FWL_ERR Initialize(); 28 virtual FWL_ERR Finalize(); 29 30 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, 31 const CFX_Matrix* pMatrix = NULL); 32 33 virtual FWL_ERR ShowCaret(FX_BOOL bFlag = TRUE); 34 virtual FWL_ERR GetFrequency(FX_DWORD& elapse); 35 virtual FWL_ERR SetFrequency(FX_DWORD elapse); 36 virtual FWL_ERR SetColor(CFX_Color crFill); 37 38 protected: 39 FX_BOOL DrawCaretBK(CFX_Graphics* pGraphics, 40 IFWL_ThemeProvider* pTheme, 41 const CFX_Matrix* pMatrix); 42 class CFWL_CaretTimer : public IFWL_Timer { 43 public: 44 CFWL_CaretTimer(CFWL_CaretImp* m_pCaret); ~CFWL_CaretTimer()45 ~CFWL_CaretTimer() override {} 46 int32_t Run(FWL_HTIMER hTimer) override; 47 CFWL_CaretImp* m_pCaret; 48 }; 49 CFWL_CaretTimer* m_pTimer; 50 FWL_HTIMER m_hTimer; 51 FX_DWORD m_dwElapse; 52 CFX_Color m_crFill; 53 FX_BOOL m_bSetColor; 54 friend class CFWL_CaretImpDelegate; 55 friend class CFWL_CaretTimer; 56 }; 57 class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate { 58 public: 59 CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner); 60 int32_t OnProcessMessage(CFWL_Message* pMessage) override; 61 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, 62 const CFX_Matrix* pMatrix = NULL) override; 63 64 protected: 65 CFWL_CaretImp* m_pOwner; 66 }; 67 #endif 68