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_IFWL_EDIT_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_EDIT_H_ |
8 #define XFA_FWL_CORE_IFWL_EDIT_H_ | 8 #define XFA_FWL_CORE_IFWL_EDIT_H_ |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
11 #include <memory> | 11 #include <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "xfa/fde/cfde_txtedtengine.h" | 14 #include "xfa/fde/cfde_txtedtengine.h" |
15 #include "xfa/fde/ifde_txtedtdorecord.h" | 15 #include "xfa/fde/ifde_txtedtdorecord.h" |
16 #include "xfa/fwl/core/cfwl_event.h" | 16 #include "xfa/fwl/core/cfwl_event.h" |
| 17 #include "xfa/fwl/core/cfwl_scrollbar.h" |
17 #include "xfa/fwl/core/cfwl_widget.h" | 18 #include "xfa/fwl/core/cfwl_widget.h" |
18 #include "xfa/fwl/core/ifwl_scrollbar.h" | |
19 #include "xfa/fwl/core/ifwl_widget.h" | 19 #include "xfa/fwl/core/ifwl_widget.h" |
20 #include "xfa/fxgraphics/cfx_path.h" | 20 #include "xfa/fxgraphics/cfx_path.h" |
21 | 21 |
22 #define FWL_STYLEEXT_EDT_ReadOnly (1L << 0) | 22 #define FWL_STYLEEXT_EDT_ReadOnly (1L << 0) |
23 #define FWL_STYLEEXT_EDT_MultiLine (1L << 1) | 23 #define FWL_STYLEEXT_EDT_MultiLine (1L << 1) |
24 #define FWL_STYLEEXT_EDT_WantReturn (1L << 2) | 24 #define FWL_STYLEEXT_EDT_WantReturn (1L << 2) |
25 #define FWL_STYLEEXT_EDT_NoHideSel (1L << 3) | 25 #define FWL_STYLEEXT_EDT_NoHideSel (1L << 3) |
26 #define FWL_STYLEEXT_EDT_AutoHScroll (1L << 4) | 26 #define FWL_STYLEEXT_EDT_AutoHScroll (1L << 4) |
27 #define FWL_STYLEEXT_EDT_AutoVScroll (1L << 5) | 27 #define FWL_STYLEEXT_EDT_AutoVScroll (1L << 5) |
28 #define FWL_STYLEEXT_EDT_NoRedoUndo (1L << 6) | 28 #define FWL_STYLEEXT_EDT_NoRedoUndo (1L << 6) |
(...skipping 19 matching lines...) Expand all Loading... |
48 #define FWL_STYLEEXT_EDT_HAlignModeMask (3L << 22) | 48 #define FWL_STYLEEXT_EDT_HAlignModeMask (3L << 22) |
49 #define FWL_STYLEEXT_EDT_InnerCaret (1L << 24) | 49 #define FWL_STYLEEXT_EDT_InnerCaret (1L << 24) |
50 #define FWL_STYLEEXT_EDT_ShowScrollbarFocus (1L << 25) | 50 #define FWL_STYLEEXT_EDT_ShowScrollbarFocus (1L << 25) |
51 #define FWL_STYLEEXT_EDT_OuterScrollbar (1L << 26) | 51 #define FWL_STYLEEXT_EDT_OuterScrollbar (1L << 26) |
52 #define FWL_STYLEEXT_EDT_LastLineHeight (1L << 27) | 52 #define FWL_STYLEEXT_EDT_LastLineHeight (1L << 27) |
53 | 53 |
54 class IFDE_TxtEdtDoRecord; | 54 class IFDE_TxtEdtDoRecord; |
55 class IFWL_Edit; | 55 class IFWL_Edit; |
56 class CFWL_MsgMouse; | 56 class CFWL_MsgMouse; |
57 class CFWL_WidgetProperties; | 57 class CFWL_WidgetProperties; |
58 class IFWL_Caret; | 58 class CFWL_Caret; |
59 | 59 |
60 class IFWL_Edit : public IFWL_Widget { | 60 class IFWL_Edit : public IFWL_Widget { |
61 public: | 61 public: |
62 IFWL_Edit(const CFWL_App* app, | 62 IFWL_Edit(const CFWL_App* app, |
63 std::unique_ptr<CFWL_WidgetProperties> properties, | 63 std::unique_ptr<CFWL_WidgetProperties> properties, |
64 IFWL_Widget* pOuter); | 64 IFWL_Widget* pOuter); |
65 ~IFWL_Edit() override; | 65 ~IFWL_Edit() override; |
66 | 66 |
67 // IFWL_Widget: | 67 // IFWL_Widget: |
68 FWL_Type GetClassID() const override; | 68 FWL_Type GetClassID() const override; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 void DrawTextBk(CFX_Graphics* pGraphics, | 130 void DrawTextBk(CFX_Graphics* pGraphics, |
131 IFWL_ThemeProvider* pTheme, | 131 IFWL_ThemeProvider* pTheme, |
132 const CFX_Matrix* pMatrix = nullptr); | 132 const CFX_Matrix* pMatrix = nullptr); |
133 void DrawContent(CFX_Graphics* pGraphics, | 133 void DrawContent(CFX_Graphics* pGraphics, |
134 IFWL_ThemeProvider* pTheme, | 134 IFWL_ThemeProvider* pTheme, |
135 const CFX_Matrix* pMatrix = nullptr); | 135 const CFX_Matrix* pMatrix = nullptr); |
136 void UpdateEditEngine(); | 136 void UpdateEditEngine(); |
137 void UpdateEditParams(); | 137 void UpdateEditParams(); |
138 void UpdateEditLayout(); | 138 void UpdateEditLayout(); |
139 bool UpdateOffset(); | 139 bool UpdateOffset(); |
140 bool UpdateOffset(IFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged); | 140 bool UpdateOffset(CFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged); |
141 void UpdateVAlignment(); | 141 void UpdateVAlignment(); |
142 void UpdateCaret(); | 142 void UpdateCaret(); |
143 IFWL_ScrollBar* UpdateScroll(); | 143 CFWL_ScrollBar* UpdateScroll(); |
144 void Layout(); | 144 void Layout(); |
145 void LayoutScrollBar(); | 145 void LayoutScrollBar(); |
146 void DeviceToEngine(CFX_PointF& pt); | 146 void DeviceToEngine(CFX_PointF& pt); |
147 void InitScrollBar(bool bVert = true); | 147 void InitScrollBar(bool bVert = true); |
148 void InitEngine(); | 148 void InitEngine(); |
149 bool ValidateNumberChar(FX_WCHAR cNum); | 149 bool ValidateNumberChar(FX_WCHAR cNum); |
150 void InitCaret(); | 150 void InitCaret(); |
151 void ClearRecord(); | 151 void ClearRecord(); |
152 bool IsShowScrollBar(bool bVert); | 152 bool IsShowScrollBar(bool bVert); |
153 bool IsContentHeightOverflow(); | 153 bool IsContentHeightOverflow(); |
154 int32_t AddDoRecord(IFDE_TxtEdtDoRecord* pRecord); | 154 int32_t AddDoRecord(IFDE_TxtEdtDoRecord* pRecord); |
155 void ProcessInsertError(int32_t iError); | 155 void ProcessInsertError(int32_t iError); |
156 | 156 |
157 void DrawSpellCheck(CFX_Graphics* pGraphics, | 157 void DrawSpellCheck(CFX_Graphics* pGraphics, |
158 const CFX_Matrix* pMatrix = nullptr); | 158 const CFX_Matrix* pMatrix = nullptr); |
159 void AddSpellCheckObj(CFX_Path& PathData, | 159 void AddSpellCheckObj(CFX_Path& PathData, |
160 int32_t nStart, | 160 int32_t nStart, |
161 int32_t nCount, | 161 int32_t nCount, |
162 FX_FLOAT fOffSetX, | 162 FX_FLOAT fOffSetX, |
163 FX_FLOAT fOffSetY); | 163 FX_FLOAT fOffSetY); |
164 void DoButtonDown(CFWL_MsgMouse* pMsg); | 164 void DoButtonDown(CFWL_MsgMouse* pMsg); |
165 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); | 165 void OnFocusChanged(CFWL_Message* pMsg, bool bSet); |
166 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 166 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
167 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 167 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
168 void OnButtonDblClk(CFWL_MsgMouse* pMsg); | 168 void OnButtonDblClk(CFWL_MsgMouse* pMsg); |
169 void OnMouseMove(CFWL_MsgMouse* pMsg); | 169 void OnMouseMove(CFWL_MsgMouse* pMsg); |
170 void OnKeyDown(CFWL_MsgKey* pMsg); | 170 void OnKeyDown(CFWL_MsgKey* pMsg); |
171 void OnChar(CFWL_MsgKey* pMsg); | 171 void OnChar(CFWL_MsgKey* pMsg); |
172 bool OnScroll(IFWL_ScrollBar* pScrollBar, FWL_SCBCODE dwCode, FX_FLOAT fPos); | 172 bool OnScroll(CFWL_ScrollBar* pScrollBar, FWL_SCBCODE dwCode, FX_FLOAT fPos); |
173 | 173 |
174 CFX_RectF m_rtClient; | 174 CFX_RectF m_rtClient; |
175 CFX_RectF m_rtEngine; | 175 CFX_RectF m_rtEngine; |
176 CFX_RectF m_rtStatic; | 176 CFX_RectF m_rtStatic; |
177 FX_FLOAT m_fVAlignOffset; | 177 FX_FLOAT m_fVAlignOffset; |
178 FX_FLOAT m_fScrollOffsetX; | 178 FX_FLOAT m_fScrollOffsetX; |
179 FX_FLOAT m_fScrollOffsetY; | 179 FX_FLOAT m_fScrollOffsetY; |
180 CFDE_TxtEdtEngine m_EdtEngine; | 180 CFDE_TxtEdtEngine m_EdtEngine; |
181 bool m_bLButtonDown; | 181 bool m_bLButtonDown; |
182 int32_t m_nSelStart; | 182 int32_t m_nSelStart; |
183 int32_t m_nLimit; | 183 int32_t m_nLimit; |
184 FX_FLOAT m_fFontSize; | 184 FX_FLOAT m_fFontSize; |
185 bool m_bSetRange; | 185 bool m_bSetRange; |
186 int32_t m_iMax; | 186 int32_t m_iMax; |
187 std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; | 187 std::unique_ptr<CFWL_ScrollBar> m_pVertScrollBar; |
188 std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar; | 188 std::unique_ptr<CFWL_ScrollBar> m_pHorzScrollBar; |
189 std::unique_ptr<IFWL_Caret> m_pCaret; | 189 std::unique_ptr<CFWL_Caret> m_pCaret; |
190 CFX_WideString m_wsCache; | 190 CFX_WideString m_wsCache; |
191 CFX_WideString m_wsFont; | 191 CFX_WideString m_wsFont; |
192 std::deque<std::unique_ptr<IFDE_TxtEdtDoRecord>> m_DoRecords; | 192 std::deque<std::unique_ptr<IFDE_TxtEdtDoRecord>> m_DoRecords; |
193 int32_t m_iCurRecord; | 193 int32_t m_iCurRecord; |
194 int32_t m_iMaxRecord; | 194 int32_t m_iMaxRecord; |
195 }; | 195 }; |
196 | 196 |
197 #endif // XFA_FWL_CORE_IFWL_EDIT_H_ | 197 #endif // XFA_FWL_CORE_IFWL_EDIT_H_ |
OLD | NEW |