rollback to 3428, before the mysterious removal of libs/* at 3431/3432
[ardour.git] / libs / gtkmm2 / gtk / src / editable.hg
1 /* $Id: editable.hg,v 1.3 2006/05/18 17:53:15 murrayc Exp $ */
2
3 /* Copyright (C) 1998-2002 The gtkmm Development Team
4  *
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.
9  *
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.
14  *
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.
18  */
19
20 #include <glibmm/interface.h>
21 #include <gtk/gtkeditable.h>
22 _DEFS(gtkmm,gtk)
23 _PINCLUDE(glibmm/private/interface_p.h)
24
25
26 namespace Gtk
27 {
28
29 /** Base class for text-editing widgets.
30  *
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
36  * widget.
37  *
38  */
39 class Editable : public Glib::Interface
40 {
41   _CLASS_INTERFACE(Editable,GtkEditable,GTK_EDITABLE,GtkEditableClass)
42
43 public:
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)
50
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)
53
54   _WRAP_METHOD(Glib::ustring get_chars(int start_pos, int end_pos) const, gtk_editable_get_chars)
55
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)
58
59   _WRAP_METHOD(void set_position(int position), gtk_editable_set_position)
60   _WRAP_METHOD(int get_position() const, gtk_editable_get_position)
61
62   _IGNORE_SIGNAL(insert_text)
63
64 #m4begin
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)
68
69   _SIGNAL_PROXY(
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
73       /**
74        * @param const Glib::ustring& text
75        * @param int* position
76        * @return void
77        */')
78
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')
81
82   _SIGNAL_CC(
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
86
87   _SIGNAL_PCC(
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
92       self)
93 #m4end
94
95   _WRAP_SIGNAL(void delete_text(int start_pos, int end_pos), "delete_text")
96   _WRAP_SIGNAL(void changed(), "changed")
97
98 protected:
99
100 #m4begin
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)
104
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')
107   _VFUNC_CC(
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
111   _VFUNC_PCC(
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
116       self)
117 #m4end
118
119   _WRAP_VFUNC(void delete_text(int start_pos, int end_pos), do_delete_text)
120
121 #m4begin
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())')
125 #m4end
126   _WRAP_VFUNC(Glib::ustring get_chars(int start_pos, int end_pos) const, get_chars)
127
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)
132 };
133
134 } // namespace Gtk
135