OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FWL_CORE_IFWL_CARET_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_CARET_H_ |
8 #define XFA_FWL_CORE_IFWL_CARET_H_ | 8 #define XFA_FWL_CORE_IFWL_CARET_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "xfa/fwl/core/ifwl_timer.h" | 12 #include "xfa/fwl/core/ifwl_timer.h" |
13 #include "xfa/fwl/core/ifwl_widget.h" | 13 #include "xfa/fwl/core/ifwl_widget.h" |
14 #include "xfa/fxgraphics/cfx_color.h" | 14 #include "xfa/fxgraphics/cfx_color.h" |
15 | 15 |
16 class CFWL_WidgetImpProperties; | 16 class CFWL_WidgetImpProperties; |
17 class IFWL_Widget; | 17 class IFWL_Widget; |
18 class CFWL_CaretImpDelegate; | |
19 | 18 |
20 #define FWL_STATE_CAT_HightLight 1 | 19 #define FWL_STATE_CAT_HightLight 1 |
21 | 20 |
22 class IFWL_Caret : public IFWL_Widget { | 21 class IFWL_Caret : public IFWL_Widget { |
23 public: | 22 public: |
24 IFWL_Caret(const IFWL_App* app, | 23 IFWL_Caret(const IFWL_App* app, |
25 const CFWL_WidgetImpProperties& properties, | 24 const CFWL_WidgetImpProperties& properties, |
26 IFWL_Widget* pOuter); | 25 IFWL_Widget* pOuter); |
27 ~IFWL_Caret() override; | 26 ~IFWL_Caret() override; |
28 | 27 |
29 // IFWL_Widget | 28 // IFWL_Widget |
30 FWL_Type GetClassID() const override; | 29 FWL_Type GetClassID() const override; |
31 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 30 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
32 const CFX_Matrix* pMatrix = nullptr) override; | 31 const CFX_Matrix* pMatrix = nullptr) override; |
| 32 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 33 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 34 const CFX_Matrix* pMatrix) override; |
33 | 35 |
34 void ShowCaret(FX_BOOL bFlag = TRUE); | 36 void ShowCaret(FX_BOOL bFlag = TRUE); |
35 FWL_Error GetFrequency(uint32_t& elapse); | 37 FWL_Error GetFrequency(uint32_t& elapse); |
36 FWL_Error SetFrequency(uint32_t elapse); | 38 FWL_Error SetFrequency(uint32_t elapse); |
37 FWL_Error SetColor(CFX_Color crFill); | 39 FWL_Error SetColor(CFX_Color crFill); |
38 | 40 |
39 protected: | 41 protected: |
40 friend class CFWL_CaretImpDelegate; | |
41 | |
42 class Timer : public IFWL_Timer { | 42 class Timer : public IFWL_Timer { |
43 public: | 43 public: |
44 explicit Timer(IFWL_Caret* pCaret); | 44 explicit Timer(IFWL_Caret* pCaret); |
45 ~Timer() override {} | 45 ~Timer() override {} |
46 | 46 |
47 void Run(IFWL_TimerInfo* hTimer) override; | 47 void Run(IFWL_TimerInfo* hTimer) override; |
48 }; | 48 }; |
49 friend class IFWL_Caret::Timer; | 49 friend class IFWL_Caret::Timer; |
50 | 50 |
51 void DrawCaretBK(CFX_Graphics* pGraphics, | 51 void DrawCaretBK(CFX_Graphics* pGraphics, |
52 IFWL_ThemeProvider* pTheme, | 52 IFWL_ThemeProvider* pTheme, |
53 const CFX_Matrix* pMatrix); | 53 const CFX_Matrix* pMatrix); |
54 | 54 |
55 std::unique_ptr<IFWL_Caret::Timer> m_pTimer; | 55 std::unique_ptr<IFWL_Caret::Timer> m_pTimer; |
56 IFWL_TimerInfo* m_pTimerInfo; // not owned. | 56 IFWL_TimerInfo* m_pTimerInfo; // not owned. |
57 uint32_t m_dwElapse; | 57 uint32_t m_dwElapse; |
58 CFX_Color m_crFill; | 58 CFX_Color m_crFill; |
59 FX_BOOL m_bSetColor; | 59 FX_BOOL m_bSetColor; |
60 }; | 60 }; |
61 | 61 |
62 class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate { | |
63 public: | |
64 CFWL_CaretImpDelegate(IFWL_Caret* pOwner); | |
65 void OnProcessMessage(CFWL_Message* pMessage) override; | |
66 void OnDrawWidget(CFX_Graphics* pGraphics, | |
67 const CFX_Matrix* pMatrix = nullptr) override; | |
68 | |
69 protected: | |
70 IFWL_Caret* m_pOwner; | |
71 }; | |
72 | |
73 #endif // XFA_FWL_CORE_IFWL_CARET_H_ | 62 #endif // XFA_FWL_CORE_IFWL_CARET_H_ |
OLD | NEW |