A gtkspellmm example program.
A gtkspellmm example program.
#include <gtkmm.h>
#include <gtkspellmm.h>
int main(int argc, char **argv)
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv,
"org.gtkmm.examples.gtkspell");
Gtk::ApplicationWindow window;
Gtk::TextView view;
view.set_wrap_mode(Gtk::WRAP_WORD);
Gtk::ScrolledWindow scroll;
scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
scroll.set_shadow_type(Gtk::SHADOW_IN);
scroll.add(view);
Gtk::Label label("Type some text into the text box.\n"
"Try misspelling some words. Then right-click on them.");
Gtk::Box box(Gtk::ORIENTATION_VERTICAL, 5);
box.pack_start(label, false, false, 0);
box.pack_start(scroll, true, true, 0);
try {
label.set_text(Glib::ustring("GtkSpell initialization failed.\n") + e.what());
}
window.set_default_size(400, 400);
window.set_title("Simple GtkSpell Demonstration");
window.set_border_width(10);
window.add(box);
box.show_all();
return app->run(window);
}
bool attach(Gtk::TextView &view)
Attach the GtkSpell::Checker to the specified Gtk::TextView.
void set_language(const Glib::ustring &lang)
Sets the language to be used for spelling, throws an exception on failure.
void init()
Initializes the GtkSpell library.