1 /* $Id: editable.hg,v 1.3 2006/05/18 17:53:15 murrayc Exp $ */
3 /* Copyright (C) 1998-2002 The gtkmm Development Team
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <glibmm/interface.h>
21 #include <gtk/gtkeditable.h>
23 _PINCLUDE(glibmm/private/interface_p.h)
29 /** Base class for text-editing widgets.
31 * The Gtk::Editable class is a base class for widgets for editing text,
32 * such as Gtk::Entry. It cannot be instantiated by itself. The editable
33 * class contains functions for generically manipulating an editable widget,
34 * a large number of action signals used for key bindings, and several
35 * signals that an application can connect to to modify the behavior of a
39 class Editable : public Glib::Interface
41 _CLASS_INTERFACE(Editable,GtkEditable,GTK_EDITABLE,GtkEditableClass)
44 _WRAP_METHOD(void cut_clipboard(), gtk_editable_cut_clipboard)
45 _WRAP_METHOD(void copy_clipboard(), gtk_editable_copy_clipboard)
46 _WRAP_METHOD(void paste_clipboard(), gtk_editable_paste_clipboard)
47 _WRAP_METHOD(void delete_selection(), gtk_editable_delete_selection)
48 _WRAP_METHOD(void set_editable(bool is_editable = true), gtk_editable_set_editable)
49 _WRAP_METHOD(bool get_editable() const, gtk_editable_get_editable)
51 _WRAP_METHOD(void insert_text(const Glib::ustring& text, int length, int& position), gtk_editable_insert_text)
52 _WRAP_METHOD(void delete_text(int start_pos, int end_pos), gtk_editable_delete_text)
54 _WRAP_METHOD(Glib::ustring get_chars(int start_pos, int end_pos) const, gtk_editable_get_chars)
56 _WRAP_METHOD(void select_region(int start_pos, int end_pos), gtk_editable_select_region)
57 _WRAP_METHOD(bool get_selection_bounds(int& start_pos, int& end_pos) const, gtk_editable_get_selection_bounds)
59 _WRAP_METHOD(void set_position(int position), gtk_editable_set_position)
60 _WRAP_METHOD(int get_position() const, gtk_editable_get_position)
62 _IGNORE_SIGNAL(insert_text)
65 dnl // WRAP_SIGNAL "insert_text"
66 dnl // C++ prototype: void insert_text(const Glib::ustring& text, int* position)
67 dnl // C prototype: void insert_text(const gchar* text, gint length, gint* position)
70 insert_text, void, `const gchar* text, gint length, gint* position',
71 insert_text, void, `const Glib::ustring&, int*',dnl // C++ prototype
72 `Glib::ustring(text, text + length), position',`dnl // C -> C++ conversion
74 * @param const Glib::ustring& text
75 * @param int* position
79 _SIGNAL_H(insert_text, void, `const Glib::ustring& text, int* position')
80 _SIGNAL_PH(insert_text, void, `GtkEditable* self, const gchar* text, gint length, gint* position')
83 insert_text, insert_text, void, void,
84 `const Glib::ustring& text, int* position',dnl // C++ arguments
85 `text.data(), text.bytes(), position')dnl // C++ -> C conversion
88 insert_text, insert_text, void, void,
89 `GtkEditable* self, const gchar* text, gint length, gint* position',dnl // C arguments
90 `self, text, length, position',dnl // C argument names
91 `Glib::ustring(text, text + length), position',dnl // C -> C++ conversion
95 _WRAP_SIGNAL(void delete_text(int start_pos, int end_pos), "delete_text")
96 _WRAP_SIGNAL(void changed(), "changed")
101 dnl // WRAP_VFUNC "do_insert_text"
102 dnl // C++ prototype: void insert_text_vfunc(const Glib::ustring& text, int& position)
103 dnl // C prototype: void do_insert_text(const gchar* text, gint length, gint* position)
105 _VFUNC_H(insert_text_vfunc, void, `const Glib::ustring& text, int& position')
106 _VFUNC_PH(do_insert_text, void, `GtkEditable* self, const gchar* text, gint length, gint* position')
108 insert_text_vfunc, do_insert_text, void, void,
109 `const Glib::ustring& text, int& position',dnl // C++ arguments
110 `text.data(), text.bytes(), &position')dnl // C++ -> C conversion
112 insert_text_vfunc, do_insert_text, void, void,
113 `GtkEditable* self, const gchar* text, gint length, gint* position',dnl // C arguments
114 `self, text, length, position',dnl // C argument names
115 `Glib::ustring(text, text + length), *position',dnl // C -> C++ conversion
119 _WRAP_VFUNC(void delete_text(int start_pos, int end_pos), do_delete_text)
122 dnl // This special conversion is not in convert_gtk.m4, because allocating a new
123 dnl // string is rarely needed -- probably not a good idea to make this generic.
124 _CONVERSION(`Glib::ustring', `gchar*', `g_strdup(($3).c_str())')
126 _WRAP_VFUNC(Glib::ustring get_chars(int start_pos, int end_pos) const, get_chars)
128 _WRAP_VFUNC(void select_region(int start_pos, int end_pos), set_selection_bounds)
129 _WRAP_VFUNC(bool get_selection_bounds(int& start_pos, int& end_pos) const, get_selection_bounds)
130 _WRAP_VFUNC(void set_position(int position), set_position)
131 _WRAP_VFUNC(int get_position() const, get_position)