| 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; | 18 class CFWL_CaretImpDelegate; |
| 19 | 19 |
| 20 #define FWL_STATE_CAT_HightLight 1 | 20 #define FWL_STATE_CAT_HightLight 1 |
| 21 | 21 |
| 22 class IFWL_Caret : public IFWL_Widget { | 22 class IFWL_Caret : public IFWL_Widget { |
| 23 public: | 23 public: |
| 24 IFWL_Caret(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); | 24 IFWL_Caret(const IFWL_App* app, |
| 25 const CFWL_WidgetImpProperties& properties, |
| 26 IFWL_Widget* pOuter); |
| 25 ~IFWL_Caret() override; | 27 ~IFWL_Caret() override; |
| 26 | 28 |
| 27 // IFWL_Widget | 29 // IFWL_Widget |
| 30 void Initialize() override; |
| 31 void Finalize() override; |
| 28 FWL_Type GetClassID() const override; | 32 FWL_Type GetClassID() const override; |
| 29 FWL_Error Initialize() override; | |
| 30 void Finalize() override; | |
| 31 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 33 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 32 const CFX_Matrix* pMatrix = nullptr) override; | 34 const CFX_Matrix* pMatrix = nullptr) 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; | 42 friend class CFWL_CaretImpDelegate; |
| 41 friend class CFWL_CaretTimer; | |
| 42 | 43 |
| 43 class CFWL_CaretTimer : public IFWL_Timer { | 44 class Timer : public IFWL_Timer { |
| 44 public: | 45 public: |
| 45 explicit CFWL_CaretTimer(IFWL_Caret* pCaret); | 46 explicit Timer(IFWL_Caret* pCaret); |
| 46 ~CFWL_CaretTimer() override {} | 47 ~Timer() override {} |
| 48 |
| 47 void Run(IFWL_TimerInfo* hTimer) override; | 49 void Run(IFWL_TimerInfo* hTimer) override; |
| 48 IFWL_Caret* const m_pCaret; | |
| 49 }; | 50 }; |
| 51 friend class IFWL_Caret::Timer; |
| 50 | 52 |
| 51 void DrawCaretBK(CFX_Graphics* pGraphics, | 53 void DrawCaretBK(CFX_Graphics* pGraphics, |
| 52 IFWL_ThemeProvider* pTheme, | 54 IFWL_ThemeProvider* pTheme, |
| 53 const CFX_Matrix* pMatrix); | 55 const CFX_Matrix* pMatrix); |
| 54 | 56 |
| 55 std::unique_ptr<CFWL_CaretTimer> m_pTimer; | 57 std::unique_ptr<IFWL_Caret::Timer> m_pTimer; |
| 56 IFWL_TimerInfo* m_pTimerInfo; // not owned. | 58 IFWL_TimerInfo* m_pTimerInfo; // not owned. |
| 57 uint32_t m_dwElapse; | 59 uint32_t m_dwElapse; |
| 58 CFX_Color m_crFill; | 60 CFX_Color m_crFill; |
| 59 FX_BOOL m_bSetColor; | 61 FX_BOOL m_bSetColor; |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate { | 64 class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate { |
| 63 public: | 65 public: |
| 64 CFWL_CaretImpDelegate(IFWL_Caret* pOwner); | 66 CFWL_CaretImpDelegate(IFWL_Caret* pOwner); |
| 65 void OnProcessMessage(CFWL_Message* pMessage) override; | 67 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 66 void OnDrawWidget(CFX_Graphics* pGraphics, | 68 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 67 const CFX_Matrix* pMatrix = nullptr) override; | 69 const CFX_Matrix* pMatrix = nullptr) override; |
| 68 | 70 |
| 69 protected: | 71 protected: |
| 70 IFWL_Caret* m_pOwner; | 72 IFWL_Caret* m_pOwner; |
| 71 }; | 73 }; |
| 72 | 74 |
| 73 #endif // XFA_FWL_CORE_IFWL_CARET_H_ | 75 #endif // XFA_FWL_CORE_IFWL_CARET_H_ |
| OLD | NEW |