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 <deque> | 10 #include <deque> |
(...skipping 24 matching lines...) Expand all Loading... |
35 FWL_Error GetClassName(CFX_WideString& wsClass) const override; | 35 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
36 FWL_Type GetClassID() const override; | 36 FWL_Type GetClassID() const override; |
37 FWL_Error Initialize() override; | 37 FWL_Error Initialize() override; |
38 FWL_Error Finalize() override; | 38 FWL_Error Finalize() override; |
39 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 39 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
40 FWL_Error SetWidgetRect(const CFX_RectF& rect) override; | 40 FWL_Error SetWidgetRect(const CFX_RectF& rect) override; |
41 FWL_Error Update() override; | 41 FWL_Error Update() override; |
42 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; | 42 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
43 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; | 43 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; |
44 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 44 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
45 const CFX_Matrix* pMatrix = NULL) override; | 45 const CFX_Matrix* pMatrix = nullptr) override; |
46 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; | 46 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; |
47 | 47 |
48 virtual FWL_Error SetText(const CFX_WideString& wsText); | 48 virtual FWL_Error SetText(const CFX_WideString& wsText); |
49 virtual int32_t GetTextLength() const; | 49 virtual int32_t GetTextLength() const; |
50 virtual FWL_Error GetText(CFX_WideString& wsText, | 50 virtual FWL_Error GetText(CFX_WideString& wsText, |
51 int32_t nStart = 0, | 51 int32_t nStart = 0, |
52 int32_t nCount = -1) const; | 52 int32_t nCount = -1) const; |
53 virtual FWL_Error ClearText(); | 53 virtual FWL_Error ClearText(); |
54 virtual int32_t GetCaretPos() const; | 54 virtual int32_t GetCaretPos() const; |
55 virtual int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); | 55 virtual int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 std::vector<CFX_ByteString>& sSuggest); | 104 std::vector<CFX_ByteString>& sSuggest); |
105 FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, | 105 FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, |
106 const CFX_ByteStringC& bsReplace); | 106 const CFX_ByteStringC& bsReplace); |
107 | 107 |
108 protected: | 108 protected: |
109 friend class CFWL_TxtEdtEventSink; | 109 friend class CFWL_TxtEdtEventSink; |
110 friend class CFWL_EditImpDelegate; | 110 friend class CFWL_EditImpDelegate; |
111 | 111 |
112 void DrawTextBk(CFX_Graphics* pGraphics, | 112 void DrawTextBk(CFX_Graphics* pGraphics, |
113 IFWL_ThemeProvider* pTheme, | 113 IFWL_ThemeProvider* pTheme, |
114 const CFX_Matrix* pMatrix = NULL); | 114 const CFX_Matrix* pMatrix = nullptr); |
115 void DrawContent(CFX_Graphics* pGraphics, | 115 void DrawContent(CFX_Graphics* pGraphics, |
116 IFWL_ThemeProvider* pTheme, | 116 IFWL_ThemeProvider* pTheme, |
117 const CFX_Matrix* pMatrix = NULL); | 117 const CFX_Matrix* pMatrix = nullptr); |
118 void UpdateEditEngine(); | 118 void UpdateEditEngine(); |
119 void UpdateEditParams(); | 119 void UpdateEditParams(); |
120 void UpdateEditLayout(); | 120 void UpdateEditLayout(); |
121 FX_BOOL UpdateOffset(); | 121 FX_BOOL UpdateOffset(); |
122 FX_BOOL UpdateOffset(IFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged); | 122 FX_BOOL UpdateOffset(IFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged); |
123 void UpdateVAlignment(); | 123 void UpdateVAlignment(); |
124 void UpdateCaret(); | 124 void UpdateCaret(); |
125 IFWL_ScrollBar* UpdateScroll(); | 125 IFWL_ScrollBar* UpdateScroll(); |
126 void Layout(); | 126 void Layout(); |
127 void LayoutScrollBar(); | 127 void LayoutScrollBar(); |
128 void DeviceToEngine(CFX_PointF& pt); | 128 void DeviceToEngine(CFX_PointF& pt); |
129 void InitScrollBar(FX_BOOL bVert = TRUE); | 129 void InitScrollBar(FX_BOOL bVert = TRUE); |
130 void InitEngine(); | 130 void InitEngine(); |
131 virtual void ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect = NULL); | 131 virtual void ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect = nullptr); |
132 FX_BOOL ValidateNumberChar(FX_WCHAR cNum); | 132 FX_BOOL ValidateNumberChar(FX_WCHAR cNum); |
133 void InitCaret(); | 133 void InitCaret(); |
134 void ClearRecord(); | 134 void ClearRecord(); |
135 FX_BOOL IsShowScrollBar(FX_BOOL bVert); | 135 FX_BOOL IsShowScrollBar(FX_BOOL bVert); |
136 FX_BOOL IsContentHeightOverflow(); | 136 FX_BOOL IsContentHeightOverflow(); |
137 int32_t AddDoRecord(IFDE_TxtEdtDoRecord* pRecord); | 137 int32_t AddDoRecord(IFDE_TxtEdtDoRecord* pRecord); |
138 void ProcessInsertError(int32_t iError); | 138 void ProcessInsertError(int32_t iError); |
139 | 139 |
140 void DrawSpellCheck(CFX_Graphics* pGraphics, | 140 void DrawSpellCheck(CFX_Graphics* pGraphics, |
141 const CFX_Matrix* pMatrix = NULL); | 141 const CFX_Matrix* pMatrix = nullptr); |
142 void AddSpellCheckObj(CFX_Path& PathData, | 142 void AddSpellCheckObj(CFX_Path& PathData, |
143 int32_t nStart, | 143 int32_t nStart, |
144 int32_t nCount, | 144 int32_t nCount, |
145 FX_FLOAT fOffSetX, | 145 FX_FLOAT fOffSetX, |
146 FX_FLOAT fOffSetY); | 146 FX_FLOAT fOffSetY); |
147 int32_t GetWordAtPoint(CFX_PointF pointf, int32_t& nCount); | 147 int32_t GetWordAtPoint(CFX_PointF pointf, int32_t& nCount); |
148 | 148 |
149 CFX_RectF m_rtClient; | 149 CFX_RectF m_rtClient; |
150 CFX_RectF m_rtEngine; | 150 CFX_RectF m_rtEngine; |
151 CFX_RectF m_rtStatic; | 151 CFX_RectF m_rtStatic; |
(...skipping 22 matching lines...) Expand all Loading... |
174 int32_t m_iCurRecord; | 174 int32_t m_iCurRecord; |
175 int32_t m_iMaxRecord; | 175 int32_t m_iMaxRecord; |
176 }; | 176 }; |
177 | 177 |
178 class CFWL_EditImpDelegate : public CFWL_WidgetImpDelegate { | 178 class CFWL_EditImpDelegate : public CFWL_WidgetImpDelegate { |
179 public: | 179 public: |
180 CFWL_EditImpDelegate(CFWL_EditImp* pOwner); | 180 CFWL_EditImpDelegate(CFWL_EditImp* pOwner); |
181 void OnProcessMessage(CFWL_Message* pMessage) override; | 181 void OnProcessMessage(CFWL_Message* pMessage) override; |
182 void OnProcessEvent(CFWL_Event* pEvent) override; | 182 void OnProcessEvent(CFWL_Event* pEvent) override; |
183 void OnDrawWidget(CFX_Graphics* pGraphics, | 183 void OnDrawWidget(CFX_Graphics* pGraphics, |
184 const CFX_Matrix* pMatrix = NULL) override; | 184 const CFX_Matrix* pMatrix = nullptr) override; |
185 | 185 |
186 protected: | 186 protected: |
187 void DoActivate(CFWL_MsgActivate* pMsg); | 187 void DoActivate(CFWL_MsgActivate* pMsg); |
188 void DoDeactivate(CFWL_MsgDeactivate* pMsg); | 188 void DoDeactivate(CFWL_MsgDeactivate* pMsg); |
189 void DoButtonDown(CFWL_MsgMouse* pMsg); | 189 void DoButtonDown(CFWL_MsgMouse* pMsg); |
190 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 190 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
191 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 191 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
192 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 192 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
193 void OnButtonDblClk(CFWL_MsgMouse* pMsg); | 193 void OnButtonDblClk(CFWL_MsgMouse* pMsg); |
194 void OnMouseMove(CFWL_MsgMouse* pMsg); | 194 void OnMouseMove(CFWL_MsgMouse* pMsg); |
195 void OnKeyDown(CFWL_MsgKey* pMsg); | 195 void OnKeyDown(CFWL_MsgKey* pMsg); |
196 void OnChar(CFWL_MsgKey* pMsg); | 196 void OnChar(CFWL_MsgKey* pMsg); |
197 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); | 197 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); |
198 void DoCursor(CFWL_MsgMouse* pMsg); | 198 void DoCursor(CFWL_MsgMouse* pMsg); |
199 CFWL_EditImp* m_pOwner; | 199 CFWL_EditImp* m_pOwner; |
200 }; | 200 }; |
201 | 201 |
202 #endif // XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ | 202 #endif // XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ |
OLD | NEW |