Top | ![]() |
![]() |
![]() |
![]() |
GtkEntry * | entry | Read / Write / Construct Only |
gboolean | inline-spell-checking | Read / Write |
GspellEntry extends the GtkEntry class with inline spell checking.
Misspelled words are highlighted with a red PANGO_UNDERLINE_SINGLE
.
Right-clicking a misspelled word pops up a context menu of suggested
replacements. The context menu also contains an “Ignore All” item to add the
misspelled word to the session dictionary. And an “Add” item to add the word
to the personal dictionary.
For a basic use-case, there is the gspell_entry_basic_setup()
convenience
function.
If you don't use the gspell_entry_basic_setup()
function, you need to call
gspell_entry_buffer_set_spell_checker()
to associate a GspellChecker to the
GtkEntryBuffer.
Note that GspellEntry extends the GtkEntry class but without subclassing it, because GtkEntry is already subclassed by GtkSearchEntry for example.
PANGO_UNDERLINE_SINGLE
is used for consistency with GspellTextView.
If you want a PANGO_UNDERLINE_ERROR
instead (a wavy underline), please fix
this bug first.
GspellEntry *
gspell_entry_get_from_gtk_entry (GtkEntry *gtk_entry
);
Returns the GspellEntry of gtk_entry
. The returned object is guaranteed
to be the same for the lifetime of gtk_entry
.
Since: 1.4
void
gspell_entry_basic_setup (GspellEntry *gspell_entry
);
This function is a convenience function that does the following:
Set a spell checker. The language chosen is the one returned by
gspell_language_get_default()
.
Set the “inline-spell-checking” property to TRUE
.
Example:
1 2 3 4 5 |
GtkEntry *gtk_entry; GspellEntry *gspell_entry; gspell_entry = gspell_entry_get_from_gtk_entry (gtk_entry); gspell_entry_basic_setup (gspell_entry); |
This is equivalent to:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
GtkEntry *gtk_entry; GspellEntry *gspell_entry; GspellChecker *checker; GtkEntryBuffer *gtk_buffer; GspellEntryBuffer *gspell_buffer; checker = gspell_checker_new (NULL); gtk_buffer = gtk_entry_get_buffer (gtk_entry); gspell_buffer = gspell_entry_buffer_get_from_gtk_entry_buffer (gtk_buffer); gspell_entry_buffer_set_spell_checker (gspell_buffer, checker); g_object_unref (checker); gspell_entry = gspell_entry_get_from_gtk_entry (gtk_entry); gspell_entry_set_inline_spell_checking (gspell_entry, TRUE); |
Since: 1.4
gboolean
gspell_entry_get_inline_spell_checking
(GspellEntry *gspell_entry
);
Since: 1.4
void gspell_entry_set_inline_spell_checking (GspellEntry *gspell_entry
,gboolean enable
);
Sets the “inline-spell-checking” property.
Since: 1.4
“entry”
property“entry” GtkEntry *
The GtkEntry.
Owner: GspellEntry
Flags: Read / Write / Construct Only
Since: 1.4
“inline-spell-checking”
property“inline-spell-checking” gboolean
Whether the inline spell checking is enabled.
Even if this property is TRUE
, GspellEntry disables internally the
inline spell checking in case the “visibility” property is
FALSE
.
Owner: GspellEntry
Flags: Read / Write
Default value: FALSE
Since: 1.4