• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 namespace pdfium {
17 
18 class CFWL_Caret final : public CFWL_Widget, public CFX_Timer::CallbackIface {
19  public:
20   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
21   ~CFWL_Caret() override;
22 
23   // CFWL_Widget:
24   FWL_Type GetClassID() const override;
25   void DrawWidget(CFGAS_GEGraphics* pGraphics,
26                   const CFX_Matrix& matrix) override;
27   void OnProcessMessage(CFWL_Message* pMessage) override;
28   void OnDrawWidget(CFGAS_GEGraphics* pGraphics,
29                     const CFX_Matrix& matrix) override;
30   void Update() override;
31 
32   // CFX_Timer::CallbackIface:
33   void OnTimerFired() override;
34 
35   void ShowCaret();
36   void HideCaret();
37 
38  private:
39   CFWL_Caret(CFWL_App* app, const Properties& properties, CFWL_Widget* pOuter);
40 
41   void DrawCaretBK(CFGAS_GEGraphics* pGraphics, const CFX_Matrix& mtMatrix);
42 
43   std::unique_ptr<CFX_Timer> m_pTimer;
44 };
45 
46 }  // namespace pdfium
47 
48 // TODO(crbug.com/42271761): Remove.
49 using pdfium::CFWL_Caret;
50 
51 #endif  // XFA_FWL_CFWL_CARET_H_
52