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 FPDFSDK_INCLUDE_PDFWINDOW_PWL_EDITCTRL_H_ | 7 #ifndef FPDFSDK_INCLUDE_PDFWINDOW_PWL_EDITCTRL_H_ |
8 #define FPDFSDK_INCLUDE_PDFWINDOW_PWL_EDITCTRL_H_ | 8 #define FPDFSDK_INCLUDE_PDFWINDOW_PWL_EDITCTRL_H_ |
9 | 9 |
10 #include "../../../core/include/fxcrt/fx_string.h" | 10 #include "../../../core/include/fxcrt/fx_string.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 virtual void OnSetText(const CPVT_WordPlace& place, | 50 virtual void OnSetText(const CPVT_WordPlace& place, |
51 const CPVT_WordPlace& oldplace) {} | 51 const CPVT_WordPlace& oldplace) {} |
52 virtual void OnAddUndo(CPWL_Edit* pEdit) {} | 52 virtual void OnAddUndo(CPWL_Edit* pEdit) {} |
53 }; | 53 }; |
54 | 54 |
55 class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify { | 55 class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify { |
56 friend class CPWL_Edit_Notify; | 56 friend class CPWL_Edit_Notify; |
57 | 57 |
58 public: | 58 public: |
59 CPWL_EditCtrl(); | 59 CPWL_EditCtrl(); |
60 virtual ~CPWL_EditCtrl(); | 60 ~CPWL_EditCtrl() override; |
61 | |
62 public: | |
63 virtual void OnCreate(PWL_CREATEPARAM& cp); | |
64 virtual void OnCreated(); | |
65 | |
66 virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); | |
67 virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag); | |
68 virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag); | |
69 virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); | |
70 virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag); | |
71 virtual void OnNotify(CPWL_Wnd* pWnd, | |
72 FX_DWORD msg, | |
73 intptr_t wParam = 0, | |
74 intptr_t lParam = 0); | |
75 | |
76 virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); | |
77 virtual void RePosChildWnd(); | |
78 virtual void SetFontSize(FX_FLOAT fFontSize); | |
79 virtual FX_FLOAT GetFontSize() const; | |
80 | |
81 public: | |
82 virtual void SetText(const FX_WCHAR* csText); | |
83 | |
84 virtual void CopyText(); | |
85 virtual void PasteText(); | |
86 virtual void CutText(); | |
87 | 61 |
88 CPDF_Rect GetContentRect() const; | 62 CPDF_Rect GetContentRect() const; |
89 void GetCaretPos(int32_t& x, int32_t& y) const; | 63 void GetCaretPos(int32_t& x, int32_t& y) const; |
90 FX_BOOL IsModified() const; | |
91 | 64 |
92 CFX_WideString GetText() const; | 65 CFX_WideString GetText() const; |
93 void SetSel(int32_t nStartChar, int32_t nEndChar); | 66 void SetSel(int32_t nStartChar, int32_t nEndChar); |
94 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; | 67 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; |
95 void GetTextRange(const CPDF_Rect& rect, | 68 void GetTextRange(const CPDF_Rect& rect, |
96 int32_t& nStartChar, | 69 int32_t& nStartChar, |
97 int32_t& nEndChar) const; | 70 int32_t& nEndChar) const; |
98 CFX_WideString GetText(int32_t& nStartChar, int32_t& nEndChar) const; | 71 CFX_WideString GetText(int32_t& nStartChar, int32_t& nEndChar) const; |
99 void Clear(); | 72 void Clear(); |
100 void SelectAll(); | 73 void SelectAll(); |
(...skipping 19 matching lines...) Expand all Loading... |
120 CPDF_Font* GetCaretFont() const; | 93 CPDF_Font* GetCaretFont() const; |
121 FX_FLOAT GetCaretFontSize() const; | 94 FX_FLOAT GetCaretFontSize() const; |
122 | 95 |
123 FX_BOOL CanUndo() const; | 96 FX_BOOL CanUndo() const; |
124 FX_BOOL CanRedo() const; | 97 FX_BOOL CanRedo() const; |
125 void Redo(); | 98 void Redo(); |
126 void Undo(); | 99 void Undo(); |
127 | 100 |
128 void SetReadyToInput(); | 101 void SetReadyToInput(); |
129 | 102 |
| 103 // CPWL_Wnd |
| 104 void OnCreate(PWL_CREATEPARAM& cp) override; |
| 105 void OnCreated() override; |
| 106 FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) override; |
| 107 FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag) override; |
| 108 FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; |
| 109 FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; |
| 110 FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) override; |
| 111 void OnNotify(CPWL_Wnd* pWnd, |
| 112 FX_DWORD msg, |
| 113 intptr_t wParam = 0, |
| 114 intptr_t lParam = 0) override; |
| 115 void CreateChildWnd(const PWL_CREATEPARAM& cp) override; |
| 116 void RePosChildWnd() override; |
| 117 void SetFontSize(FX_FLOAT fFontSize) override; |
| 118 FX_FLOAT GetFontSize() const override; |
| 119 void SetCursor() override; |
| 120 FX_BOOL IsModified() const override; |
| 121 |
130 protected: | 122 protected: |
131 virtual void ShowVScrollBar(FX_BOOL bShow); | 123 // IFX_Edit_Notify |
| 124 void IOnSetScrollInfoX(FX_FLOAT fPlateMin, |
| 125 FX_FLOAT fPlateMax, |
| 126 FX_FLOAT fContentMin, |
| 127 FX_FLOAT fContentMax, |
| 128 FX_FLOAT fSmallStep, |
| 129 FX_FLOAT fBigStep) override {} |
| 130 void IOnSetScrollInfoY(FX_FLOAT fPlateMin, |
| 131 FX_FLOAT fPlateMax, |
| 132 FX_FLOAT fContentMin, |
| 133 FX_FLOAT fContentMax, |
| 134 FX_FLOAT fSmallStep, |
| 135 FX_FLOAT fBigStep) override; |
| 136 void IOnSetScrollPosX(FX_FLOAT fx) override {} |
| 137 void IOnSetScrollPosY(FX_FLOAT fy) override; |
| 138 void IOnSetCaret(FX_BOOL bVisible, |
| 139 const CPDF_Point& ptHead, |
| 140 const CPDF_Point& ptFoot, |
| 141 const CPVT_WordPlace& place) override; |
| 142 void IOnCaretChange(const CPVT_SecProps& secProps, |
| 143 const CPVT_WordProps& wordProps) override; |
| 144 void IOnContentChange(const CPDF_Rect& rcContent) override; |
| 145 void IOnInvalidateRect(CPDF_Rect* pRect) override; |
132 | 146 |
133 virtual void InsertWord(FX_WORD word, int32_t nCharset); | 147 void InsertText(const FX_WCHAR* csText); |
134 virtual void InsertReturn(); | 148 void SetText(const FX_WCHAR* csText); |
135 virtual void InsertText(const FX_WCHAR* csText); | 149 void CopyText(); |
| 150 void PasteText(); |
| 151 void CutText(); |
| 152 void ShowVScrollBar(FX_BOOL bShow); |
| 153 void InsertWord(FX_WORD word, int32_t nCharset); |
| 154 void InsertReturn(); |
136 | 155 |
137 virtual void SetCursor(); | |
138 FX_BOOL IsWndHorV(); | 156 FX_BOOL IsWndHorV(); |
139 | 157 |
140 void Delete(); | 158 void Delete(); |
141 void Backspace(); | 159 void Backspace(); |
142 | 160 |
143 protected: | |
144 void GetCaretInfo(CPDF_Point& ptHead, CPDF_Point& ptFoot) const; | 161 void GetCaretInfo(CPDF_Point& ptHead, CPDF_Point& ptFoot) const; |
145 void SetCaret(FX_BOOL bVisible, | 162 void SetCaret(FX_BOOL bVisible, |
146 const CPDF_Point& ptHead, | 163 const CPDF_Point& ptHead, |
147 const CPDF_Point& ptFoot); | 164 const CPDF_Point& ptFoot); |
148 | 165 |
149 void SetEditCaret(FX_BOOL bVisible); | 166 void SetEditCaret(FX_BOOL bVisible); |
150 | 167 |
151 protected: | |
152 virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, | |
153 FX_FLOAT fPlateMax, | |
154 FX_FLOAT fContentMin, | |
155 FX_FLOAT fContentMax, | |
156 FX_FLOAT fSmallStep, | |
157 FX_FLOAT fBigStep) {} | |
158 virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, | |
159 FX_FLOAT fPlateMax, | |
160 FX_FLOAT fContentMin, | |
161 FX_FLOAT fContentMax, | |
162 FX_FLOAT fSmallStep, | |
163 FX_FLOAT fBigStep); | |
164 virtual void IOnSetScrollPosX(FX_FLOAT fx) {} | |
165 virtual void IOnSetScrollPosY(FX_FLOAT fy); | |
166 virtual void IOnSetCaret(FX_BOOL bVisible, | |
167 const CPDF_Point& ptHead, | |
168 const CPDF_Point& ptFoot, | |
169 const CPVT_WordPlace& place); | |
170 virtual void IOnCaretChange(const CPVT_SecProps& secProps, | |
171 const CPVT_WordProps& wordProps); | |
172 virtual void IOnContentChange(const CPDF_Rect& rcContent); | |
173 virtual void IOnInvalidateRect(CPDF_Rect* pRect); | |
174 | |
175 private: | 168 private: |
176 void CreateEditCaret(const PWL_CREATEPARAM& cp); | 169 void CreateEditCaret(const PWL_CREATEPARAM& cp); |
177 | 170 |
178 protected: | 171 protected: |
179 IFX_Edit* m_pEdit; | 172 IFX_Edit* m_pEdit; |
180 CPWL_Caret* m_pEditCaret; | 173 CPWL_Caret* m_pEditCaret; |
181 FX_BOOL m_bMouseDown; | 174 FX_BOOL m_bMouseDown; |
182 IPWL_Edit_Notify* m_pEditNotify; | 175 IPWL_Edit_Notify* m_pEditNotify; |
183 | 176 |
184 private: | 177 private: |
185 int32_t m_nCharSet; | 178 int32_t m_nCharSet; |
186 int32_t m_nCodePage; | 179 int32_t m_nCodePage; |
187 }; | 180 }; |
188 | 181 |
189 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_EDITCTRL_H_ | 182 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_EDITCTRL_H_ |
OLD | NEW |