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

@@ -1209,7 +1209,11 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
m_enter->SetClientData(const_cast<void*>(static_cast<const void*>(wxS("enter"))));
#if wxUSE_SPELLCHECK
if ( !m_enter->EnableProofCheck(true, wxTextProofOptions("en_US").SpellCheck()) )
// Enable grammar check just for demonstration purposes (note that it's
// only supported under Mac, but spell checking will be enabled under the
// other platforms too, if supported). If we didn't want to enable it, we
// could omit the EnableProofCheck() argument entirely.
if ( !m_enter->EnableProofCheck(wxTextProofOptions::Default().GrammarCheck()) )
{
wxMessageDialog error(this,
wxT("Spell checking is not available on this platform or control style."),