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