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_CARET_H_ 8 #define XFA_FWL_CFWL_CARET_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/cfx_timer.h" 13 #include "xfa/fgas/graphics/cfgas_gecolor.h" 14 #include "xfa/fwl/cfwl_widget.h" 15 16 class CFWL_Caret final : public CFWL_Widget, public CFX_Timer::CallbackIface { 17 public: 18 CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED; 19 ~CFWL_Caret() override; 20 21 // CFWL_Widget: 22 FWL_Type GetClassID() const override; 23 void DrawWidget(CFGAS_GEGraphics* pGraphics, 24 const CFX_Matrix& matrix) override; 25 void OnProcessMessage(CFWL_Message* pMessage) override; 26 void OnDrawWidget(CFGAS_GEGraphics* pGraphics, 27 const CFX_Matrix& matrix) override; 28 void Update() override; 29 30 // CFX_Timer::CallbackIface: 31 void OnTimerFired() override; 32 33 void ShowCaret(); 34 void HideCaret(); 35 36 private: 37 CFWL_Caret(CFWL_App* app, const Properties& properties, CFWL_Widget* pOuter); 38 39 void DrawCaretBK(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix); 40 41 std::unique_ptr<CFX_Timer> m_pTimer; 42 }; 43 44 #endif // XFA_FWL_CFWL_CARET_H_ 45