John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 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. |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
dan sinclair | 89e904b | 2016-03-23 19:29:15 -0400 | [diff] [blame] | 7 | #ifndef FPDFSDK_PDFWINDOW_PWL_CARET_H_ |
| 8 | #define FPDFSDK_PDFWINDOW_PWL_CARET_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
dan sinclair | 89e904b | 2016-03-23 19:29:15 -0400 | [diff] [blame] | 10 | #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
Tom Sepez | 870292c | 2015-04-07 16:12:46 -0700 | [diff] [blame] | 11 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 12 | struct PWL_CARET_INFO { |
| 13 | public: |
| 14 | PWL_CARET_INFO() : bVisible(FALSE), ptHead(0, 0), ptFoot(0, 0) {} |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 15 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 16 | FX_BOOL bVisible; |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 17 | CFX_FloatPoint ptHead; |
| 18 | CFX_FloatPoint ptFoot; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 19 | }; |
| 20 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 21 | class CPWL_Caret : public CPWL_Wnd { |
| 22 | public: |
| 23 | CPWL_Caret(); |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 24 | ~CPWL_Caret() override; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 25 | |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 26 | // CPWL_Wnd |
| 27 | CFX_ByteString GetClassName() const override; |
| 28 | void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; |
| 29 | void DrawThisAppearance(CFX_RenderDevice* pDevice, |
Tom Sepez | 60d909e | 2015-12-10 15:34:55 -0800 | [diff] [blame] | 30 | CFX_Matrix* pUser2Device) override; |
thestig | 1cd352e | 2016-06-07 17:53:06 -0700 | [diff] [blame] | 31 | void InvalidateRect(CFX_FloatRect* pRect = nullptr) override; |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 32 | void SetVisible(FX_BOOL bVisible) override {} |
| 33 | void TimerProc() override; |
| 34 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 35 | void SetCaret(FX_BOOL bVisible, |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 36 | const CFX_FloatPoint& ptHead, |
| 37 | const CFX_FloatPoint& ptFoot); |
| 38 | CFX_ByteString GetCaretAppearanceStream(const CFX_FloatPoint& ptOffset); |
| 39 | void SetInvalidRect(CFX_FloatRect rc) { m_rcInvalid = rc; } |
Tom Sepez | 870292c | 2015-04-07 16:12:46 -0700 | [diff] [blame] | 40 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 41 | private: |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 42 | void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CFX_FloatPoint& ptOffset); |
| 43 | CFX_FloatRect GetCaretRect() const; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 44 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 45 | FX_BOOL m_bFlash; |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 46 | CFX_FloatPoint m_ptHead; |
| 47 | CFX_FloatPoint m_ptFoot; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 48 | FX_FLOAT m_fWidth; |
| 49 | int32_t m_nDelay; |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 50 | CFX_FloatRect m_rcInvalid; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 51 | }; |
| 52 | |
dan sinclair | 89e904b | 2016-03-23 19:29:15 -0400 | [diff] [blame] | 53 | #endif // FPDFSDK_PDFWINDOW_PWL_CARET_H_ |