diff --git a/include/wx/osx/cocoa/private/textimpl.h b/include/wx/osx/cocoa/private/textimpl.h index c96cb52944..9c6b5f884a 100644 --- a/include/wx/osx/cocoa/private/textimpl.h +++ b/include/wx/osx/cocoa/private/textimpl.h @@ -128,6 +128,7 @@ public: virtual bool HasOwnContextMenu() const wxOVERRIDE { return true; } virtual void CheckSpelling(bool check) wxOVERRIDE; + virtual bool IsSpellingCheckEnabled() const wxOVERRIDE; virtual void EnableAutomaticQuoteSubstitution(bool enable) wxOVERRIDE; virtual void EnableAutomaticDashSubstitution(bool enable) wxOVERRIDE; diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h index d32434c800..326e6e963f 100644 --- a/include/wx/osx/core/private.h +++ b/include/wx/osx/core/private.h @@ -738,6 +738,7 @@ public : virtual int GetLineLength(long lineNo) const ; virtual wxString GetLineText(long lineNo) const ; virtual void CheckSpelling(bool WXUNUSED(check)) { } + virtual bool IsSpellingCheckEnabled() const { return false; } virtual void EnableAutomaticQuoteSubstitution(bool WXUNUSED(enable)) {} virtual void EnableAutomaticDashSubstitution(bool WXUNUSED(enable)) {} diff --git a/include/wx/osx/iphone/private/textimpl.h b/include/wx/osx/iphone/private/textimpl.h index 96b52e6d05..c9beb7818a 100644 --- a/include/wx/osx/iphone/private/textimpl.h +++ b/include/wx/osx/iphone/private/textimpl.h @@ -72,6 +72,8 @@ public: virtual bool HasOwnContextMenu() const { return true; } virtual void CheckSpelling(bool check); + virtual bool IsSpellingCheckEnabled() const; + virtual wxSize GetBestSize() const; protected: diff --git a/include/wx/osx/textctrl.h b/include/wx/osx/textctrl.h index a784e39ac6..6adba7f4bb 100644 --- a/include/wx/osx/textctrl.h +++ b/include/wx/osx/textctrl.h @@ -97,6 +97,15 @@ public: virtual void Cut() wxOVERRIDE; virtual void Paste() wxOVERRIDE; +#if wxUSE_SPELLCHECK + // Use native spelling and grammar checking functions (multiline only). + virtual bool EnableProofCheck( + bool enable = true, + const wxTextProofOptions& options = wxTextProofOptions() + ) wxOVERRIDE; + virtual bool IsProofCheckEnabled() const wxOVERRIDE; +#endif // wxUSE_SPELLCHECK + // Implementation // -------------- virtual void Command(wxCommandEvent& event) wxOVERRIDE; @@ -130,7 +139,11 @@ public: virtual void MacVisibilityChanged() wxOVERRIDE; virtual void MacSuperChangedPosition() wxOVERRIDE; - virtual void MacCheckSpelling(bool check); + + // Use portable EnableProofCheck() instead now. +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED( virtual void MacCheckSpelling(bool check) ); +#endif // WXWIN_COMPATIBILITY_3_0 void OSXEnableAutomaticQuoteSubstitution(bool enable); void OSXEnableAutomaticDashSubstitution(bool enable); diff --git a/interface/wx/textctrl.h b/interface/wx/textctrl.h index df08b15921..5e6378f6c4 100644 --- a/interface/wx/textctrl.h +++ b/interface/wx/textctrl.h @@ -1398,9 +1398,9 @@ public: available on the current platform. Currently this is supported in wxMSW (when running under Windows 8 or - later) and wxGTK when using GTK 3. In addition, wxMSW requires that the - text control has the wxTE_RICH2 style set. wxGTK3 requires that the - control has the wxTE_MULTILINE style. + later), wxGTK when using GTK 3 and wxOSX. In addition, wxMSW requires + that the text control has the wxTE_RICH2 style set. wxGTK3 and wxOSX + require that the control has the wxTE_MULTILINE style. @param enable Enables native proof checking if true, disables it otherwise. @@ -1566,9 +1566,8 @@ public: Returns @true if proof (spell) checking is currently active on this control, @false otherwise. - @onlyfor{wxmsw,wxgtk} - - @see EnableProofCheck() + This function is implemented for the same platforms as + EnableProofCheck() and returns @false for the other ones. @since 3.1.6 */ diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index b8bab36b96..91e62092b2 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -1283,6 +1283,11 @@ void wxNSTextViewControl::CheckSpelling(bool check) [m_textView setContinuousSpellCheckingEnabled: check]; } +bool wxNSTextViewControl::IsSpellingCheckEnabled() const +{ + return m_textView && m_textView.continuousSpellCheckingEnabled; +} + void wxNSTextViewControl::EnableAutomaticQuoteSubstitution(bool enable) { if (m_textView) diff --git a/src/osx/iphone/textctrl.mm b/src/osx/iphone/textctrl.mm index 7a1d785c64..9be4a74c09 100644 --- a/src/osx/iphone/textctrl.mm +++ b/src/osx/iphone/textctrl.mm @@ -504,6 +504,11 @@ void wxUITextViewControl::CheckSpelling(bool check) { } +bool wxUITextViewControl::IsSpellingCheckEnabled() const +{ + return false; +} + wxSize wxUITextViewControl::GetBestSize() const { wxRect r; diff --git a/src/osx/textctrl_osx.cpp b/src/osx/textctrl_osx.cpp index 31a3bcebcb..ba21007e46 100644 --- a/src/osx/textctrl_osx.cpp +++ b/src/osx/textctrl_osx.cpp @@ -124,10 +124,12 @@ void wxTextCtrl::MacVisibilityChanged() { } +#if WXWIN_COMPATIBILITY_3_0 void wxTextCtrl::MacCheckSpelling(bool check) { GetTextPeer()->CheckSpelling(check); } +#endif // WXWIN_COMPATIBILITY_3_0 void wxTextCtrl::OSXEnableAutomaticQuoteSubstitution(bool enable) { @@ -340,6 +342,25 @@ void wxTextCtrl::Paste() } } +#if wxUSE_SPELLCHECK + +bool wxTextCtrl::EnableProofCheck( + bool enable, + const wxTextProofOptions& WXUNUSED(options) + ) +{ + GetTextPeer()->CheckSpelling(enable); + + return true; +} + +bool wxTextCtrl::IsProofCheckEnabled() const +{ + return GetTextPeer()->IsSpellingCheckEnabled(); +} + +#endif // wxUSE_SPELLCHECK + void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event) { // By default, load the first file into the text window.