Home | History | Annotate | Download | only in pdfwindow
      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 FPDFSDK_PDFWINDOW_PWL_CARET_H_
      8 #define FPDFSDK_PDFWINDOW_PWL_CARET_H_
      9 
     10 #include "fpdfsdk/pdfwindow/PWL_Wnd.h"
     11 
     12 struct PWL_CARET_INFO {
     13  public:
     14   PWL_CARET_INFO();
     15 
     16   bool bVisible;
     17   CFX_PointF ptHead;
     18   CFX_PointF ptFoot;
     19 };
     20 
     21 class CPWL_Caret : public CPWL_Wnd {
     22  public:
     23   CPWL_Caret();
     24   ~CPWL_Caret() override;
     25 
     26   // CPWL_Wnd
     27   CFX_ByteString GetClassName() const override;
     28   void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override;
     29   void DrawThisAppearance(CFX_RenderDevice* pDevice,
     30                           CFX_Matrix* pUser2Device) override;
     31   void InvalidateRect(CFX_FloatRect* pRect = nullptr) override;
     32   void SetVisible(bool bVisible) override {}
     33   void TimerProc() override;
     34 
     35   void SetCaret(bool bVisible,
     36                 const CFX_PointF& ptHead,
     37                 const CFX_PointF& ptFoot);
     38   CFX_ByteString GetCaretAppearanceStream(const CFX_PointF& ptOffset);
     39   void SetInvalidRect(CFX_FloatRect rc) { m_rcInvalid = rc; }
     40 
     41  private:
     42   void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_PointF& ptOffset);
     43   CFX_FloatRect GetCaretRect() const;
     44 
     45   bool m_bFlash;
     46   CFX_PointF m_ptHead;
     47   CFX_PointF m_ptFoot;
     48   FX_FLOAT m_fWidth;
     49   int32_t m_nDelay;
     50   CFX_FloatRect m_rcInvalid;
     51 };
     52 
     53 #endif  // FPDFSDK_PDFWINDOW_PWL_CARET_H_
     54