Merge branch 'textctrl-spellcheck'

Add wxTextCtrl::EnableProofCheck() to use native spell checking support.

See https://github.com/wxWidgets/wxWidgets/pull/2473
This commit is contained in:
Vadim Zeitlin
2021-08-27 21:58:32 +02:00
27 changed files with 650 additions and 16 deletions

View File

@@ -1205,9 +1205,29 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
m_tab->SetClientData(const_cast<void*>(static_cast<const void*>(wxS("tab"))));
m_enter = new MyTextCtrl( this, 100, "Multiline, allow <ENTER> processing.",
wxPoint(180,170), wxSize(200,70), wxTE_MULTILINE | wxTE_PROCESS_ENTER );
wxPoint(180,170), wxSize(200,70), wxTE_MULTILINE | wxTE_PROCESS_ENTER | wxTE_RICH2 );
m_enter->SetClientData(const_cast<void*>(static_cast<const void*>(wxS("enter"))));
#if wxUSE_SPELLCHECK
(*m_enter) << "\n";
// 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()) )
{
(*m_enter) << "Spell checking is not available on this platform, sorry.";
}
else
{
// Break the string in several parts to avoid misspellings in the sources.
(*m_enter) << "Spell checking is enabled, mis"
"s"
"spelled words should be highlighted.";
}
#endif
m_textrich = new MyTextCtrl(this, wxID_ANY, "Allows more than 30Kb of text\n"
"(on all Windows versions)\n"
"and a very very very very very "