| 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_CFWL_CARET_H_ | 7 #ifndef XFA_FWL_CORE_CFWL_CARET_H_ |
| 8 #define XFA_FWL_CORE_CFWL_CARET_H_ | 8 #define XFA_FWL_CORE_CFWL_CARET_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "xfa/fwl/core/cfwl_timer.h" | 12 #include "xfa/fwl/core/cfwl_timer.h" |
| 13 #include "xfa/fwl/core/cfwl_widget.h" | 13 #include "xfa/fwl/core/cfwl_widget.h" |
| 14 #include "xfa/fxgraphics/cfx_color.h" | 14 #include "xfa/fxgraphics/cfx_color.h" |
| 15 | 15 |
| 16 class CFWL_WidgetProperties; | 16 class CFWL_WidgetProperties; |
| 17 class CFWL_Widget; | 17 class CFWL_Widget; |
| 18 | 18 |
| 19 #define FWL_STATE_CAT_HightLight 1 | 19 #define FWL_STATE_CAT_HightLight 1 |
| 20 | 20 |
| 21 class CFWL_Caret : public CFWL_Widget { | 21 class CFWL_Caret : public CFWL_Widget { |
| 22 public: | 22 public: |
| 23 CFWL_Caret(const CFWL_App* app, | 23 CFWL_Caret(const CFWL_App* app, |
| 24 std::unique_ptr<CFWL_WidgetProperties> properties, | 24 std::unique_ptr<CFWL_WidgetProperties> properties, |
| 25 CFWL_Widget* pOuter); | 25 CFWL_Widget* pOuter); |
| 26 ~CFWL_Caret() override; | 26 ~CFWL_Caret() override; |
| 27 | 27 |
| 28 // CFWL_Widget | 28 // CFWL_Widget |
| 29 FWL_Type GetClassID() const override; | 29 FWL_Type GetClassID() const override; |
| 30 void DrawWidget(CFX_Graphics* pGraphics, | 30 void DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; |
| 31 const CFX_Matrix* pMatrix = nullptr) override; | |
| 32 void OnProcessMessage(CFWL_Message* pMessage) override; | 31 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 33 void OnDrawWidget(CFX_Graphics* pGraphics, | 32 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 34 const CFX_Matrix* pMatrix) override; | 33 const CFX_Matrix* pMatrix) override; |
| 35 void Update() override; | 34 void Update() override; |
| 36 | 35 |
| 37 void ShowCaret(); | 36 void ShowCaret(); |
| 38 void HideCaret(); | 37 void HideCaret(); |
| 39 | 38 |
| 40 private: | 39 private: |
| 41 class Timer : public CFWL_Timer { | 40 class Timer : public CFWL_Timer { |
| 42 public: | 41 public: |
| 43 explicit Timer(CFWL_Caret* pCaret); | 42 explicit Timer(CFWL_Caret* pCaret); |
| 44 ~Timer() override {} | 43 ~Timer() override {} |
| 45 | 44 |
| 46 void Run(CFWL_TimerInfo* hTimer) override; | 45 void Run(CFWL_TimerInfo* hTimer) override; |
| 47 }; | 46 }; |
| 48 friend class CFWL_Caret::Timer; | 47 friend class CFWL_Caret::Timer; |
| 49 | 48 |
| 50 void DrawCaretBK(CFX_Graphics* pGraphics, | 49 void DrawCaretBK(CFX_Graphics* pGraphics, |
| 51 IFWL_ThemeProvider* pTheme, | 50 IFWL_ThemeProvider* pTheme, |
| 52 const CFX_Matrix* pMatrix); | 51 const CFX_Matrix* pMatrix); |
| 53 | 52 |
| 54 std::unique_ptr<CFWL_Caret::Timer> m_pTimer; | 53 std::unique_ptr<CFWL_Caret::Timer> m_pTimer; |
| 55 CFWL_TimerInfo* m_pTimerInfo; // not owned. | 54 CFWL_TimerInfo* m_pTimerInfo; // not owned. |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 #endif // XFA_FWL_CORE_CFWL_CARET_H_ | 57 #endif // XFA_FWL_CORE_CFWL_CARET_H_ |
| OLD | NEW |