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 PANGO_UNDERLINE_ERROR
, usually a red
wavy underline. 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.
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
);
Enables or disables the inline spell checking.
Since: 1.4