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 "core/fxcrt/cfx_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 final : public CFWL_Widget, public CFX_Timer::CallbackIface {
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   // CFX_Timer::CallbackIface:
35   void OnTimerFired() override;
36 
37   void ShowCaret();
38   void HideCaret();
39 
40  private:
41   void DrawCaretBK(CXFA_Graphics* pGraphics,
42                    IFWL_ThemeProvider* pTheme,
43                    const CFX_Matrix* pMatrix);
44 
45   std::unique_ptr<CFX_Timer> m_pTimer;
46 };
47 
48 #endif  // XFA_FWL_CFWL_CARET_H_
49