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_BASEWIDGET_FWL_EDITIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 12 matching lines...) Expand all Loading... |
23 class IFWL_Caret; | 23 class IFWL_Caret; |
24 class CFWL_EditImp; | 24 class CFWL_EditImp; |
25 class CFWL_EditImpDelegate; | 25 class CFWL_EditImpDelegate; |
26 | 26 |
27 class CFWL_EditImp : public CFWL_WidgetImp { | 27 class CFWL_EditImp : public CFWL_WidgetImp { |
28 public: | 28 public: |
29 CFWL_EditImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); | 29 CFWL_EditImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); |
30 ~CFWL_EditImp() override; | 30 ~CFWL_EditImp() override; |
31 | 31 |
32 // CFWL_WidgetImp: | 32 // CFWL_WidgetImp: |
33 FWL_ERR GetClassName(CFX_WideString& wsClass) const override; | 33 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
34 uint32_t GetClassID() const override; | 34 uint32_t GetClassID() const override; |
35 FWL_ERR Initialize() override; | 35 FWL_Error Initialize() override; |
36 FWL_ERR Finalize() override; | 36 FWL_Error Finalize() override; |
37 FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 37 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
38 FWL_ERR SetWidgetRect(const CFX_RectF& rect) override; | 38 FWL_Error SetWidgetRect(const CFX_RectF& rect) override; |
39 FWL_ERR Update() override; | 39 FWL_Error Update() override; |
40 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; | 40 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
41 FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; | 41 FWL_Error SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; |
42 FWL_ERR DrawWidget(CFX_Graphics* pGraphics, | 42 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
43 const CFX_Matrix* pMatrix = NULL) override; | 43 const CFX_Matrix* pMatrix = NULL) override; |
44 FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; | 44 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; |
45 | 45 |
46 virtual FWL_ERR SetText(const CFX_WideString& wsText); | 46 virtual FWL_Error SetText(const CFX_WideString& wsText); |
47 virtual int32_t GetTextLength() const; | 47 virtual int32_t GetTextLength() const; |
48 virtual FWL_ERR GetText(CFX_WideString& wsText, | 48 virtual FWL_Error GetText(CFX_WideString& wsText, |
49 int32_t nStart = 0, | 49 int32_t nStart = 0, |
50 int32_t nCount = -1) const; | 50 int32_t nCount = -1) const; |
51 virtual FWL_ERR ClearText(); | 51 virtual FWL_Error ClearText(); |
52 virtual int32_t GetCaretPos() const; | 52 virtual int32_t GetCaretPos() const; |
53 virtual int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); | 53 virtual int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); |
54 virtual FWL_ERR AddSelRange(int32_t nStart, int32_t nCount = -1); | 54 virtual FWL_Error AddSelRange(int32_t nStart, int32_t nCount = -1); |
55 virtual int32_t CountSelRanges(); | 55 virtual int32_t CountSelRanges(); |
56 virtual int32_t GetSelRange(int32_t nIndex, int32_t& nStart); | 56 virtual int32_t GetSelRange(int32_t nIndex, int32_t& nStart); |
57 virtual FWL_ERR ClearSelections(); | 57 virtual FWL_Error ClearSelections(); |
58 virtual int32_t GetLimit(); | 58 virtual int32_t GetLimit(); |
59 virtual FWL_ERR SetLimit(int32_t nLimit); | 59 virtual FWL_Error SetLimit(int32_t nLimit); |
60 virtual FWL_ERR SetAliasChar(FX_WCHAR wAlias); | 60 virtual FWL_Error SetAliasChar(FX_WCHAR wAlias); |
61 virtual FWL_ERR Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen); | 61 virtual FWL_Error Insert(int32_t nStart, |
62 virtual FWL_ERR DeleteSelections(); | 62 const FX_WCHAR* lpText, |
63 virtual FWL_ERR DeleteRange(int32_t nStart, int32_t nCount = -1); | 63 int32_t nLen); |
64 virtual FWL_ERR ReplaceSelections(const CFX_WideStringC& wsReplace); | 64 virtual FWL_Error DeleteSelections(); |
65 virtual FWL_ERR Replace(int32_t nStart, | 65 virtual FWL_Error DeleteRange(int32_t nStart, int32_t nCount = -1); |
66 int32_t nLen, | 66 virtual FWL_Error ReplaceSelections(const CFX_WideStringC& wsReplace); |
67 const CFX_WideStringC& wsReplace); | 67 virtual FWL_Error Replace(int32_t nStart, |
68 virtual FWL_ERR DoClipboard(int32_t iCmd); | 68 int32_t nLen, |
| 69 const CFX_WideStringC& wsReplace); |
| 70 virtual FWL_Error DoClipboard(int32_t iCmd); |
69 virtual FX_BOOL Copy(CFX_WideString& wsCopy); | 71 virtual FX_BOOL Copy(CFX_WideString& wsCopy); |
70 virtual FX_BOOL Cut(CFX_WideString& wsCut); | 72 virtual FX_BOOL Cut(CFX_WideString& wsCut); |
71 virtual FX_BOOL Paste(const CFX_WideString& wsPaste); | 73 virtual FX_BOOL Paste(const CFX_WideString& wsPaste); |
72 virtual FX_BOOL Delete(); | 74 virtual FX_BOOL Delete(); |
73 virtual FX_BOOL Redo(const CFX_ByteStringC& bsRecord); | 75 virtual FX_BOOL Redo(const CFX_ByteStringC& bsRecord); |
74 virtual FX_BOOL Undo(const CFX_ByteStringC& bsRecord); | 76 virtual FX_BOOL Undo(const CFX_ByteStringC& bsRecord); |
75 virtual FX_BOOL Undo(); | 77 virtual FX_BOOL Undo(); |
76 virtual FX_BOOL Redo(); | 78 virtual FX_BOOL Redo(); |
77 virtual FX_BOOL CanUndo(); | 79 virtual FX_BOOL CanUndo(); |
78 virtual FX_BOOL CanRedo(); | 80 virtual FX_BOOL CanRedo(); |
79 virtual FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); | 81 virtual FWL_Error SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); |
80 virtual FWL_ERR SetOuter(IFWL_Widget* pOuter); | 82 virtual FWL_Error SetOuter(IFWL_Widget* pOuter); |
81 virtual FWL_ERR SetNumberRange(int32_t iMin, int32_t iMax); | 83 virtual FWL_Error SetNumberRange(int32_t iMin, int32_t iMax); |
82 virtual FWL_ERR SetBackgroundColor(uint32_t color); | 84 virtual FWL_Error SetBackgroundColor(uint32_t color); |
83 virtual FWL_ERR SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); | 85 virtual FWL_Error SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); |
84 | 86 |
85 void On_CaretChanged(CFDE_TxtEdtEngine* pEdit, | 87 void On_CaretChanged(CFDE_TxtEdtEngine* pEdit, |
86 int32_t nPage, | 88 int32_t nPage, |
87 FX_BOOL bVisible = true); | 89 FX_BOOL bVisible = true); |
88 void On_TextChanged(CFDE_TxtEdtEngine* pEdit, | 90 void On_TextChanged(CFDE_TxtEdtEngine* pEdit, |
89 FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo); | 91 FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo); |
90 void On_SelChanged(CFDE_TxtEdtEngine* pEdit); | 92 void On_SelChanged(CFDE_TxtEdtEngine* pEdit); |
91 FX_BOOL On_PageLoad(CFDE_TxtEdtEngine* pEdit, | 93 FX_BOOL On_PageLoad(CFDE_TxtEdtEngine* pEdit, |
92 int32_t nPageIndex, | 94 int32_t nPageIndex, |
93 int32_t nPurpose); | 95 int32_t nPurpose); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 FX_BOOL m_updateBackColor; | 169 FX_BOOL m_updateBackColor; |
168 CFX_WideString m_wsFont; | 170 CFX_WideString m_wsFont; |
169 CFX_ByteStringArray m_RecordArr; | 171 CFX_ByteStringArray m_RecordArr; |
170 int32_t m_iCurRecord; | 172 int32_t m_iCurRecord; |
171 int32_t m_iMaxRecord; | 173 int32_t m_iMaxRecord; |
172 }; | 174 }; |
173 | 175 |
174 class CFWL_EditImpDelegate : public CFWL_WidgetImpDelegate { | 176 class CFWL_EditImpDelegate : public CFWL_WidgetImpDelegate { |
175 public: | 177 public: |
176 CFWL_EditImpDelegate(CFWL_EditImp* pOwner); | 178 CFWL_EditImpDelegate(CFWL_EditImp* pOwner); |
177 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 179 void OnProcessMessage(CFWL_Message* pMessage) override; |
178 FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; | 180 void OnProcessEvent(CFWL_Event* pEvent) override; |
179 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | 181 void OnDrawWidget(CFX_Graphics* pGraphics, |
180 const CFX_Matrix* pMatrix = NULL) override; | 182 const CFX_Matrix* pMatrix = NULL) override; |
181 | 183 |
182 protected: | 184 protected: |
183 void DoActivate(CFWL_MsgActivate* pMsg); | 185 void DoActivate(CFWL_MsgActivate* pMsg); |
184 void DoDeactivate(CFWL_MsgDeactivate* pMsg); | 186 void DoDeactivate(CFWL_MsgDeactivate* pMsg); |
185 void DoButtonDown(CFWL_MsgMouse* pMsg); | 187 void DoButtonDown(CFWL_MsgMouse* pMsg); |
186 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 188 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
187 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 189 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
188 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 190 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
189 void OnButtonDblClk(CFWL_MsgMouse* pMsg); | 191 void OnButtonDblClk(CFWL_MsgMouse* pMsg); |
190 void OnMouseMove(CFWL_MsgMouse* pMsg); | 192 void OnMouseMove(CFWL_MsgMouse* pMsg); |
191 void OnKeyDown(CFWL_MsgKey* pMsg); | 193 void OnKeyDown(CFWL_MsgKey* pMsg); |
192 void OnChar(CFWL_MsgKey* pMsg); | 194 void OnChar(CFWL_MsgKey* pMsg); |
193 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); | 195 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); |
194 void DoCursor(CFWL_MsgMouse* pMsg); | 196 void DoCursor(CFWL_MsgMouse* pMsg); |
195 CFWL_EditImp* m_pOwner; | 197 CFWL_EditImp* m_pOwner; |
196 }; | 198 }; |
197 | 199 |
198 #endif // XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ | 200 #endif // XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ |
OLD | NEW |