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_CARET_H_ 8 #define XFA_FWL_CFWL_CARET_H_ 9 10 #include <memory> 11 12 #include "xfa/fwl/cfwl_timer.h" 13 #include "xfa/fwl/cfwl_widget.h" 14 #include "xfa/fxgraphics/cxfa_gecolor.h" 15 16 class CFWL_WidgetProperties; 17 class CFWL_Widget; 18 19 class CFWL_Caret : public CFWL_Widget { 20 public: 21 CFWL_Caret(const CFWL_App* app, 22 std::unique_ptr<CFWL_WidgetProperties> properties, 23 CFWL_Widget* pOuter); 24 ~CFWL_Caret() override; 25 26 // CFWL_Widget 27 FWL_Type GetClassID() const override; 28 void DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) override; 29 void OnProcessMessage(CFWL_Message* pMessage) override; 30 void OnDrawWidget(CXFA_Graphics* pGraphics, 31 const CFX_Matrix& matrix) override; 32 void Update() override; 33 34 void ShowCaret(); 35 void HideCaret(); 36 37 private: 38 class Timer : public CFWL_Timer { 39 public: 40 explicit Timer(CFWL_Caret* pCaret); ~Timer()41 ~Timer() override {} 42 43 void Run(CFWL_TimerInfo* hTimer) override; 44 }; 45 friend class CFWL_Caret::Timer; 46 47 void DrawCaretBK(CXFA_Graphics* pGraphics, 48 IFWL_ThemeProvider* pTheme, 49 const CFX_Matrix* pMatrix); 50 51 std::unique_ptr<CFWL_Caret::Timer> m_pTimer; 52 UnownedPtr<CFWL_TimerInfo> m_pTimerInfo; 53 }; 54 55 #endif // XFA_FWL_CFWL_CARET_H_ 56