gtkspellmm 3.0.5
example/example.cc

A gtkspellmm example program.

A gtkspellmm example program.

/* Copyright (c) 2013-2014 Sandro Mani <manisandro@gmail.com>
*
* This file is part of gtkspellmm.
*
* gtkspellmm is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* gtkspellmm is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gtkmm.h>
#include <gtkspellmm.h>
#include <iostream>
int main(int argc, char **argv)
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv,
"org.gtkmm.examples.gtkspell");
scroll.add(view);
Gtk::Label label("Type some text into the text box.\n"
"Try misspelling some words. Then right-click on them.");
box.pack_start(label, false, false, 0);
box.pack_start(scroll, true, true, 0);
try {
spell.set_language("en_US");
} catch(const GtkSpell::Error& e) {
label.set_text(Glib::ustring("GtkSpell initialization failed.\n") + e.what());
}
spell.attach(view);
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);
}
Definition gtkspell.h:97
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.
Definition gtkspell.h:48
static Glib::RefPtr< Application > create(const Glib::ustring &application_id=Glib::ustring(), Gio::ApplicationFlags flags=Gio::APPLICATION_FLAGS_NONE)
void pack_start(Widget &child, bool expand, bool fill, guint padding=0)
void set_border_width(guint border_width)
virtual void add(Widget &widget)
void set_text(const Glib::ustring &str)
void set_policy(PolicyType hscrollbar_policy, PolicyType vscrollbar_policy)
void add(Gtk::Widget &widget) override
void set_shadow_type(ShadowType type)
void set_wrap_mode(WrapMode wrap_mode)
void show_all()
void set_title(const Glib::ustring &title)
void set_default_size(int width, int height)
void init()
Initializes the GtkSpell library.
ORIENTATION_VERTICAL
POLICY_AUTOMATIC