| 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> |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 FWL_EVENT_DEF(CFWL_EvtEdtGetSuggestWords, | 88 FWL_EVENT_DEF(CFWL_EvtEdtGetSuggestWords, |
| 89 CFWL_EventType::GetSuggestedWords, | 89 CFWL_EventType::GetSuggestedWords, |
| 90 FX_BOOL bSuggestWords; | 90 FX_BOOL bSuggestWords; |
| 91 CFX_ByteString bsWord; | 91 CFX_ByteString bsWord; |
| 92 std::vector<CFX_ByteString> bsArraySuggestWords;) | 92 std::vector<CFX_ByteString> bsArraySuggestWords;) |
| 93 | 93 |
| 94 class CFWL_WidgetImpProperties; | 94 class CFWL_WidgetImpProperties; |
| 95 class IFDE_TxtEdtDoRecord; | 95 class IFDE_TxtEdtDoRecord; |
| 96 class IFWL_Edit; | 96 class IFWL_Edit; |
| 97 class CFWL_EditImpDelegate; | |
| 98 class CFWL_MsgActivate; | 97 class CFWL_MsgActivate; |
| 99 class CFWL_MsgDeactivate; | 98 class CFWL_MsgDeactivate; |
| 100 class CFWL_MsgMouse; | 99 class CFWL_MsgMouse; |
| 101 class CFWL_WidgetImpDelegate; | |
| 102 class CFWL_WidgetImpProperties; | 100 class CFWL_WidgetImpProperties; |
| 103 class IFWL_Caret; | 101 class IFWL_Caret; |
| 104 | 102 |
| 105 class IFWL_EditDP : public IFWL_DataProvider {}; | 103 class IFWL_EditDP : public IFWL_DataProvider {}; |
| 106 | 104 |
| 107 class IFWL_Edit : public IFWL_Widget { | 105 class IFWL_Edit : public IFWL_Widget { |
| 108 public: | 106 public: |
| 109 IFWL_Edit(const IFWL_App* app, | 107 IFWL_Edit(const IFWL_App* app, |
| 110 const CFWL_WidgetImpProperties& properties, | 108 const CFWL_WidgetImpProperties& properties, |
| 111 IFWL_Widget* pOuter); | 109 IFWL_Widget* pOuter); |
| 112 ~IFWL_Edit() override; | 110 ~IFWL_Edit() override; |
| 113 | 111 |
| 114 // IFWL_Widget: | 112 // IFWL_Widget: |
| 115 FWL_Type GetClassID() const override; | 113 FWL_Type GetClassID() const override; |
| 116 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 114 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
| 117 FWL_Error SetWidgetRect(const CFX_RectF& rect) override; | 115 FWL_Error SetWidgetRect(const CFX_RectF& rect) override; |
| 118 FWL_Error Update() override; | 116 FWL_Error Update() override; |
| 119 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; | 117 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; |
| 120 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; | 118 void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; |
| 121 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 119 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 122 const CFX_Matrix* pMatrix = nullptr) override; | 120 const CFX_Matrix* pMatrix = nullptr) override; |
| 123 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; | 121 FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; |
| 122 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 123 void OnProcessEvent(CFWL_Event* pEvent) override; |
| 124 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 125 const CFX_Matrix* pMatrix) override; |
| 124 | 126 |
| 125 virtual FWL_Error SetText(const CFX_WideString& wsText); | 127 virtual FWL_Error SetText(const CFX_WideString& wsText); |
| 126 virtual int32_t GetTextLength() const; | 128 virtual int32_t GetTextLength() const; |
| 127 virtual FWL_Error GetText(CFX_WideString& wsText, | 129 virtual FWL_Error GetText(CFX_WideString& wsText, |
| 128 int32_t nStart = 0, | 130 int32_t nStart = 0, |
| 129 int32_t nCount = -1) const; | 131 int32_t nCount = -1) const; |
| 130 virtual FWL_Error ClearText(); | 132 virtual FWL_Error ClearText(); |
| 131 virtual int32_t GetCaretPos() const; | 133 virtual int32_t GetCaretPos() const; |
| 132 virtual int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); | 134 virtual int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); |
| 133 virtual FWL_Error AddSelRange(int32_t nStart, int32_t nCount = -1); | 135 virtual FWL_Error AddSelRange(int32_t nStart, int32_t nCount = -1); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 void On_AddDoRecord(CFDE_TxtEdtEngine* pEdit, IFDE_TxtEdtDoRecord* pRecord); | 179 void On_AddDoRecord(CFDE_TxtEdtEngine* pEdit, IFDE_TxtEdtDoRecord* pRecord); |
| 178 FX_BOOL On_Validate(CFDE_TxtEdtEngine* pEdit, CFX_WideString& wsText); | 180 FX_BOOL On_Validate(CFDE_TxtEdtEngine* pEdit, CFX_WideString& wsText); |
| 179 void SetScrollOffset(FX_FLOAT fScrollOffset); | 181 void SetScrollOffset(FX_FLOAT fScrollOffset); |
| 180 FX_BOOL GetSuggestWords(CFX_PointF pointf, | 182 FX_BOOL GetSuggestWords(CFX_PointF pointf, |
| 181 std::vector<CFX_ByteString>& sSuggest); | 183 std::vector<CFX_ByteString>& sSuggest); |
| 182 FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, | 184 FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, |
| 183 const CFX_ByteStringC& bsReplace); | 185 const CFX_ByteStringC& bsReplace); |
| 184 | 186 |
| 185 protected: | 187 protected: |
| 186 friend class CFWL_TxtEdtEventSink; | 188 friend class CFWL_TxtEdtEventSink; |
| 187 friend class CFWL_EditImpDelegate; | |
| 188 | 189 |
| 189 void DrawTextBk(CFX_Graphics* pGraphics, | 190 void DrawTextBk(CFX_Graphics* pGraphics, |
| 190 IFWL_ThemeProvider* pTheme, | 191 IFWL_ThemeProvider* pTheme, |
| 191 const CFX_Matrix* pMatrix = nullptr); | 192 const CFX_Matrix* pMatrix = nullptr); |
| 192 void DrawContent(CFX_Graphics* pGraphics, | 193 void DrawContent(CFX_Graphics* pGraphics, |
| 193 IFWL_ThemeProvider* pTheme, | 194 IFWL_ThemeProvider* pTheme, |
| 194 const CFX_Matrix* pMatrix = nullptr); | 195 const CFX_Matrix* pMatrix = nullptr); |
| 195 void UpdateEditEngine(); | 196 void UpdateEditEngine(); |
| 196 void UpdateEditParams(); | 197 void UpdateEditParams(); |
| 197 void UpdateEditLayout(); | 198 void UpdateEditLayout(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; | 244 std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar; |
| 244 std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar; | 245 std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar; |
| 245 std::unique_ptr<IFWL_Caret> m_pCaret; | 246 std::unique_ptr<IFWL_Caret> m_pCaret; |
| 246 CFX_WideString m_wsCache; | 247 CFX_WideString m_wsCache; |
| 247 uint32_t m_backColor; | 248 uint32_t m_backColor; |
| 248 FX_BOOL m_updateBackColor; | 249 FX_BOOL m_updateBackColor; |
| 249 CFX_WideString m_wsFont; | 250 CFX_WideString m_wsFont; |
| 250 std::deque<std::unique_ptr<IFDE_TxtEdtDoRecord>> m_DoRecords; | 251 std::deque<std::unique_ptr<IFDE_TxtEdtDoRecord>> m_DoRecords; |
| 251 int32_t m_iCurRecord; | 252 int32_t m_iCurRecord; |
| 252 int32_t m_iMaxRecord; | 253 int32_t m_iMaxRecord; |
| 253 }; | |
| 254 | 254 |
| 255 class CFWL_EditImpDelegate : public CFWL_WidgetImpDelegate { | 255 private: |
| 256 public: | |
| 257 CFWL_EditImpDelegate(IFWL_Edit* pOwner); | |
| 258 void OnProcessMessage(CFWL_Message* pMessage) override; | |
| 259 void OnProcessEvent(CFWL_Event* pEvent) override; | |
| 260 void OnDrawWidget(CFX_Graphics* pGraphics, | |
| 261 const CFX_Matrix* pMatrix = nullptr) override; | |
| 262 | |
| 263 protected: | |
| 264 void DoActivate(CFWL_MsgActivate* pMsg); | 256 void DoActivate(CFWL_MsgActivate* pMsg); |
| 265 void DoDeactivate(CFWL_MsgDeactivate* pMsg); | 257 void DoDeactivate(CFWL_MsgDeactivate* pMsg); |
| 266 void DoButtonDown(CFWL_MsgMouse* pMsg); | 258 void DoButtonDown(CFWL_MsgMouse* pMsg); |
| 267 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 259 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet); |
| 268 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 260 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
| 269 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 261 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
| 270 void OnButtonDblClk(CFWL_MsgMouse* pMsg); | 262 void OnButtonDblClk(CFWL_MsgMouse* pMsg); |
| 271 void OnMouseMove(CFWL_MsgMouse* pMsg); | 263 void OnMouseMove(CFWL_MsgMouse* pMsg); |
| 272 void OnKeyDown(CFWL_MsgKey* pMsg); | 264 void OnKeyDown(CFWL_MsgKey* pMsg); |
| 273 void OnChar(CFWL_MsgKey* pMsg); | 265 void OnChar(CFWL_MsgKey* pMsg); |
| 274 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); | 266 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); |
| 275 void DoCursor(CFWL_MsgMouse* pMsg); | |
| 276 IFWL_Edit* m_pOwner; | |
| 277 }; | 267 }; |
| 278 | 268 |
| 279 #endif // XFA_FWL_CORE_IFWL_EDIT_H_ | 269 #endif // XFA_FWL_CORE_IFWL_EDIT_H_ |
| OLD | NEW |