Use wxTextProofOptions itself to enable or disable the checks

Remove a separate "bool enable" argument of EnableProofCheck() and use
wxTextProofOptions::IsSpellCheckingEnabled() to decide whether the
checks should be enabled or disabled.

Also remove wxTextProofOptions ctor and provide named static factory
functions for creating the objects of this class with clearly defined
meaning.
This commit is contained in:
Vadim Zeitlin
2021-08-23 00:53:58 +02:00
parent 72ef834c70
commit 2bb3083a93
9 changed files with 91 additions and 66 deletions

View File

@@ -834,7 +834,7 @@ WXDWORD wxTextCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
#if wxUSE_RICHEDIT && wxUSE_SPELLCHECK
bool wxTextCtrl::EnableProofCheck(bool enable, const wxTextProofOptions& WXUNUSED(options))
bool wxTextCtrl::EnableProofCheck(const wxTextProofOptions& options)
{
wxCHECK_MSG((m_windowStyle & wxTE_RICH2), false,
"Unable to enable proof checking on a control "
@@ -846,7 +846,7 @@ bool wxTextCtrl::EnableProofCheck(bool enable, const wxTextProofOptions& WXUNUSE
LRESULT langOptions = ::SendMessage(GetHwnd(), EM_GETLANGOPTIONS, 0, 0);
if ( enable )
if ( options.IsSpellCheckingEnabled() )
langOptions |= IMF_SPELLCHECKING;
else
langOptions &= ~IMF_SPELLCHECKING;