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_BASEWIDGET_FWL_CARETIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_CARETIMP_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_CARETIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_CARETIMP_H_ |
9 | 9 |
10 #include "xfa/fwl/core/fwl_widgetimp.h" | 10 #include "xfa/fwl/core/fwl_widgetimp.h" |
11 #include "xfa/fwl/core/ifwl_timer.h" | 11 #include "xfa/fwl/core/ifwl_timer.h" |
| 12 #include "xfa/fwl/core/ifwl_widget.h" |
12 #include "xfa/fxgraphics/cfx_color.h" | 13 #include "xfa/fxgraphics/cfx_color.h" |
13 | 14 |
14 class CFWL_WidgetImpProperties; | 15 class CFWL_WidgetImpProperties; |
15 class IFWL_Widget; | 16 class IFWL_Widget; |
16 class CFWL_CaretImpDelegate; | 17 class CFWL_CaretImpDelegate; |
17 | 18 |
18 class CFWL_CaretImp : public CFWL_WidgetImp { | 19 class CFWL_CaretImp : public CFWL_WidgetImp { |
19 public: | 20 public: |
20 CFWL_CaretImp(const CFWL_WidgetImpProperties& properties, | 21 CFWL_CaretImp(const CFWL_WidgetImpProperties& properties, |
21 IFWL_Widget* pOuter); | 22 IFWL_Widget* pOuter); |
22 virtual ~CFWL_CaretImp(); | 23 ~CFWL_CaretImp() override; |
23 | 24 |
24 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; | 25 // CFWL_WidgetImp |
25 virtual uint32_t GetClassID() const; | 26 FWL_ERR GetClassName(CFX_WideString& wsClass) const override; |
| 27 FWL_Type GetClassID() const override { return FWL_Type::Caret; } |
| 28 FWL_ERR Initialize() override; |
| 29 FWL_ERR Finalize() override; |
| 30 FWL_ERR DrawWidget(CFX_Graphics* pGraphics, |
| 31 const CFX_Matrix* pMatrix = nullptr) override; |
26 | 32 |
27 virtual FWL_ERR Initialize(); | 33 FWL_ERR ShowCaret(FX_BOOL bFlag = TRUE); |
28 virtual FWL_ERR Finalize(); | 34 FWL_ERR GetFrequency(uint32_t& elapse); |
29 | 35 FWL_ERR SetFrequency(uint32_t elapse); |
30 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, | 36 FWL_ERR SetColor(CFX_Color crFill); |
31 const CFX_Matrix* pMatrix = NULL); | |
32 | |
33 virtual FWL_ERR ShowCaret(FX_BOOL bFlag = TRUE); | |
34 virtual FWL_ERR GetFrequency(uint32_t& elapse); | |
35 virtual FWL_ERR SetFrequency(uint32_t elapse); | |
36 virtual FWL_ERR SetColor(CFX_Color crFill); | |
37 | 37 |
38 protected: | 38 protected: |
39 FX_BOOL DrawCaretBK(CFX_Graphics* pGraphics, | 39 friend class CFWL_CaretImpDelegate; |
40 IFWL_ThemeProvider* pTheme, | 40 friend class CFWL_CaretTimer; |
41 const CFX_Matrix* pMatrix); | 41 |
42 class CFWL_CaretTimer : public IFWL_Timer { | 42 class CFWL_CaretTimer : public IFWL_Timer { |
43 public: | 43 public: |
44 explicit CFWL_CaretTimer(CFWL_CaretImp* pCaret); | 44 explicit CFWL_CaretTimer(CFWL_CaretImp* pCaret); |
45 ~CFWL_CaretTimer() override {} | 45 ~CFWL_CaretTimer() override {} |
46 int32_t Run(FWL_HTIMER hTimer) override; | 46 int32_t Run(FWL_HTIMER hTimer) override; |
47 CFWL_CaretImp* const m_pCaret; | 47 CFWL_CaretImp* const m_pCaret; |
48 }; | 48 }; |
| 49 |
| 50 FX_BOOL DrawCaretBK(CFX_Graphics* pGraphics, |
| 51 IFWL_ThemeProvider* pTheme, |
| 52 const CFX_Matrix* pMatrix); |
| 53 |
49 CFWL_CaretTimer* m_pTimer; | 54 CFWL_CaretTimer* m_pTimer; |
50 FWL_HTIMER m_hTimer; | 55 FWL_HTIMER m_hTimer; |
51 uint32_t m_dwElapse; | 56 uint32_t m_dwElapse; |
52 CFX_Color m_crFill; | 57 CFX_Color m_crFill; |
53 FX_BOOL m_bSetColor; | 58 FX_BOOL m_bSetColor; |
54 friend class CFWL_CaretImpDelegate; | |
55 friend class CFWL_CaretTimer; | |
56 }; | 59 }; |
| 60 |
57 class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate { | 61 class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate { |
58 public: | 62 public: |
59 CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner); | 63 CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner); |
60 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 64 int32_t OnProcessMessage(CFWL_Message* pMessage) override; |
61 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | 65 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, |
62 const CFX_Matrix* pMatrix = NULL) override; | 66 const CFX_Matrix* pMatrix = NULL) override; |
63 | 67 |
64 protected: | 68 protected: |
65 CFWL_CaretImp* m_pOwner; | 69 CFWL_CaretImp* m_pOwner; |
66 }; | 70 }; |
67 | 71 |
68 #endif // XFA_FWL_BASEWIDGET_FWL_CARETIMP_H_ | 72 #endif // XFA_FWL_BASEWIDGET_FWL_CARETIMP_H_ |
OLD | NEW |