Implement minimal support for spell checking in wxOSX too
Reuse the existing CheckSpelling() function. Also deprecate wxTextCtrl::MacCheckSpelling() in favour of the new portable EnableProofCheck().
This commit is contained in:
@@ -128,6 +128,7 @@ public:
|
|||||||
virtual bool HasOwnContextMenu() const wxOVERRIDE { return true; }
|
virtual bool HasOwnContextMenu() const wxOVERRIDE { return true; }
|
||||||
|
|
||||||
virtual void CheckSpelling(bool check) wxOVERRIDE;
|
virtual void CheckSpelling(bool check) wxOVERRIDE;
|
||||||
|
virtual bool IsSpellingCheckEnabled() const wxOVERRIDE;
|
||||||
virtual void EnableAutomaticQuoteSubstitution(bool enable) wxOVERRIDE;
|
virtual void EnableAutomaticQuoteSubstitution(bool enable) wxOVERRIDE;
|
||||||
virtual void EnableAutomaticDashSubstitution(bool enable) wxOVERRIDE;
|
virtual void EnableAutomaticDashSubstitution(bool enable) wxOVERRIDE;
|
||||||
|
|
||||||
|
@@ -738,6 +738,7 @@ public :
|
|||||||
virtual int GetLineLength(long lineNo) const ;
|
virtual int GetLineLength(long lineNo) const ;
|
||||||
virtual wxString GetLineText(long lineNo) const ;
|
virtual wxString GetLineText(long lineNo) const ;
|
||||||
virtual void CheckSpelling(bool WXUNUSED(check)) { }
|
virtual void CheckSpelling(bool WXUNUSED(check)) { }
|
||||||
|
virtual bool IsSpellingCheckEnabled() const { return false; }
|
||||||
virtual void EnableAutomaticQuoteSubstitution(bool WXUNUSED(enable)) {}
|
virtual void EnableAutomaticQuoteSubstitution(bool WXUNUSED(enable)) {}
|
||||||
virtual void EnableAutomaticDashSubstitution(bool WXUNUSED(enable)) {}
|
virtual void EnableAutomaticDashSubstitution(bool WXUNUSED(enable)) {}
|
||||||
|
|
||||||
|
@@ -72,6 +72,8 @@ public:
|
|||||||
virtual bool HasOwnContextMenu() const { return true; }
|
virtual bool HasOwnContextMenu() const { return true; }
|
||||||
|
|
||||||
virtual void CheckSpelling(bool check);
|
virtual void CheckSpelling(bool check);
|
||||||
|
virtual bool IsSpellingCheckEnabled() const;
|
||||||
|
|
||||||
virtual wxSize GetBestSize() const;
|
virtual wxSize GetBestSize() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -97,6 +97,15 @@ public:
|
|||||||
virtual void Cut() wxOVERRIDE;
|
virtual void Cut() wxOVERRIDE;
|
||||||
virtual void Paste() 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
|
// Implementation
|
||||||
// --------------
|
// --------------
|
||||||
virtual void Command(wxCommandEvent& event) wxOVERRIDE;
|
virtual void Command(wxCommandEvent& event) wxOVERRIDE;
|
||||||
@@ -130,7 +139,11 @@ public:
|
|||||||
|
|
||||||
virtual void MacVisibilityChanged() wxOVERRIDE;
|
virtual void MacVisibilityChanged() wxOVERRIDE;
|
||||||
virtual void MacSuperChangedPosition() 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 OSXEnableAutomaticQuoteSubstitution(bool enable);
|
||||||
void OSXEnableAutomaticDashSubstitution(bool enable);
|
void OSXEnableAutomaticDashSubstitution(bool enable);
|
||||||
|
@@ -1398,9 +1398,9 @@ public:
|
|||||||
available on the current platform.
|
available on the current platform.
|
||||||
|
|
||||||
Currently this is supported in wxMSW (when running under Windows 8 or
|
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
|
later), wxGTK when using GTK 3 and wxOSX. In addition, wxMSW requires
|
||||||
text control has the wxTE_RICH2 style set. wxGTK3 requires that the
|
that the text control has the wxTE_RICH2 style set. wxGTK3 and wxOSX
|
||||||
control has the wxTE_MULTILINE style.
|
require that the control has the wxTE_MULTILINE style.
|
||||||
|
|
||||||
@param enable
|
@param enable
|
||||||
Enables native proof checking if true, disables it otherwise.
|
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
|
Returns @true if proof (spell) checking is currently active on this
|
||||||
control, @false otherwise.
|
control, @false otherwise.
|
||||||
|
|
||||||
@onlyfor{wxmsw,wxgtk}
|
This function is implemented for the same platforms as
|
||||||
|
EnableProofCheck() and returns @false for the other ones.
|
||||||
@see EnableProofCheck()
|
|
||||||
|
|
||||||
@since 3.1.6
|
@since 3.1.6
|
||||||
*/
|
*/
|
||||||
|
@@ -1283,6 +1283,11 @@ void wxNSTextViewControl::CheckSpelling(bool check)
|
|||||||
[m_textView setContinuousSpellCheckingEnabled: check];
|
[m_textView setContinuousSpellCheckingEnabled: check];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxNSTextViewControl::IsSpellingCheckEnabled() const
|
||||||
|
{
|
||||||
|
return m_textView && m_textView.continuousSpellCheckingEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
void wxNSTextViewControl::EnableAutomaticQuoteSubstitution(bool enable)
|
void wxNSTextViewControl::EnableAutomaticQuoteSubstitution(bool enable)
|
||||||
{
|
{
|
||||||
if (m_textView)
|
if (m_textView)
|
||||||
|
@@ -504,6 +504,11 @@ void wxUITextViewControl::CheckSpelling(bool check)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxUITextViewControl::IsSpellingCheckEnabled() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
wxSize wxUITextViewControl::GetBestSize() const
|
wxSize wxUITextViewControl::GetBestSize() const
|
||||||
{
|
{
|
||||||
wxRect r;
|
wxRect r;
|
||||||
|
@@ -124,10 +124,12 @@ void wxTextCtrl::MacVisibilityChanged()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_3_0
|
||||||
void wxTextCtrl::MacCheckSpelling(bool check)
|
void wxTextCtrl::MacCheckSpelling(bool check)
|
||||||
{
|
{
|
||||||
GetTextPeer()->CheckSpelling(check);
|
GetTextPeer()->CheckSpelling(check);
|
||||||
}
|
}
|
||||||
|
#endif // WXWIN_COMPATIBILITY_3_0
|
||||||
|
|
||||||
void wxTextCtrl::OSXEnableAutomaticQuoteSubstitution(bool enable)
|
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)
|
void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
|
||||||
{
|
{
|
||||||
// By default, load the first file into the text window.
|
// By default, load the first file into the text window.
|
||||||
|
Reference in New Issue
Block a user