moved 2.1-staging to trunk @ rev 1765
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / editable.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_EDITABLE_H
4 #define _GTKMM_EDITABLE_H
5
6
7 #include <glibmm.h>
8
9 /* $Id$ */
10
11 /* Copyright (C) 1998-2002 The gtkmm Development Team
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Library General Public
15  * License as published by the Free Software Foundation; either
16  * version 2 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21  * Library General Public License for more details.
22  *
23  * You should have received a copy of the GNU Library General Public
24  * License along with this library; if not, write to the Free
25  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26  */
27
28 #include <glibmm/interface.h>
29 #include <gtk/gtkeditable.h>
30
31
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 typedef struct _GtkEditable GtkEditable;
34 typedef struct _GtkEditableClass GtkEditableClass;
35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
36
37
38 namespace Gtk
39 { class Editable_Class; } // namespace Gtk
40 namespace Gtk
41 {
42
43 /** Base class for text-editing widgets.
44  *
45  * The Gtk::Editable class is a base class for widgets for editing text,
46  * such as Gtk::Entry. It cannot be instantiated by itself. The editable
47  * class contains functions for generically manipulating an editable widget,
48  * a large number of action signals used for key bindings, and several
49  * signals that an application can connect to to modify the behavior of a
50  * widget.
51  *
52  */
53
54 class Editable : public Glib::Interface
55 {
56   
57 #ifndef DOXYGEN_SHOULD_SKIP_THIS
58
59 public:
60   typedef Editable CppObjectType;
61   typedef Editable_Class CppClassType;
62   typedef GtkEditable BaseObjectType;
63   typedef GtkEditableClass BaseClassType;
64
65 private:
66   friend class Editable_Class;
67   static CppClassType editable_class_;
68
69   // noncopyable
70   Editable(const Editable&);
71   Editable& operator=(const Editable&);
72
73 protected:
74   Editable(); // you must derive from this class
75   explicit Editable(GtkEditable* castitem);
76
77 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
78
79 public:
80   virtual ~Editable();
81
82   static void add_interface(GType gtype_implementer);
83
84 #ifndef DOXYGEN_SHOULD_SKIP_THIS
85   static GType get_type()      G_GNUC_CONST;
86   static GType get_base_type() G_GNUC_CONST;
87 #endif
88
89   ///Provides access to the underlying C GObject.
90   GtkEditable*       gobj()       { return reinterpret_cast<GtkEditable*>(gobject_); }
91
92   ///Provides access to the underlying C GObject.  
93   const GtkEditable* gobj() const { return reinterpret_cast<GtkEditable*>(gobject_); }
94
95 private:
96
97
98 public:
99   
100   void cut_clipboard();
101   
102   void copy_clipboard();
103   
104   void paste_clipboard();
105   
106   void delete_selection();
107   
108   void set_editable(bool is_editable = true);
109   
110   /** Retrieves whether @a editable  is editable. See
111    * set_editable().
112    * @return <tt>true</tt> if @a editable  is editable.
113    */
114   bool get_editable() const;
115
116   
117   void insert_text(const Glib::ustring& text, int length, int& position);
118   
119   void delete_text(int start_pos, int end_pos);
120
121   
122   Glib::ustring get_chars(int start_pos, int end_pos) const;
123
124   
125   void select_region(int start_pos, int end_pos);
126   
127   bool get_selection_bounds(int& start_pos, int& end_pos) const;
128
129   
130   void set_position(int position);
131   
132   int get_position() const;
133
134   
135   Glib::SignalProxy2< void,const Glib::ustring&,int* > signal_insert_text();
136
137     
138 /**
139    * @par Prototype:
140    * <tt>void %delete_text(int start_pos, int end_pos)</tt>
141    */
142
143   Glib::SignalProxy2< void,int,int > signal_delete_text();
144
145   
146 /**
147    * @par Prototype:
148    * <tt>void %changed()</tt>
149    */
150
151   Glib::SignalProxy0< void > signal_changed();
152
153
154 protected:
155
156
157   #ifdef GLIBMM_VFUNCS_ENABLED
158   virtual void delete_text_vfunc(int start_pos, int end_pos);
159 #endif //GLIBMM_VFUNCS_ENABLED
160
161
162   #ifdef GLIBMM_VFUNCS_ENABLED
163   virtual Glib::ustring get_chars_vfunc(int start_pos, int end_pos) const;
164 #endif //GLIBMM_VFUNCS_ENABLED
165
166
167   #ifdef GLIBMM_VFUNCS_ENABLED
168   virtual void select_region_vfunc(int start_pos, int end_pos);
169 #endif //GLIBMM_VFUNCS_ENABLED
170
171   #ifdef GLIBMM_VFUNCS_ENABLED
172   virtual bool get_selection_bounds_vfunc(int& start_pos, int& end_pos) const;
173 #endif //GLIBMM_VFUNCS_ENABLED
174
175   #ifdef GLIBMM_VFUNCS_ENABLED
176   virtual void set_position_vfunc(int position);
177 #endif //GLIBMM_VFUNCS_ENABLED
178
179   #ifdef GLIBMM_VFUNCS_ENABLED
180   virtual int get_position_vfunc() const;
181 #endif //GLIBMM_VFUNCS_ENABLED
182
183
184 public:
185
186 public:
187   //C++ methods used to invoke GTK+ virtual functions:
188 #ifdef GLIBMM_VFUNCS_ENABLED
189 #endif //GLIBMM_VFUNCS_ENABLED
190
191 protected:
192   //GTK+ Virtual Functions (override these to change behaviour):
193 #ifdef GLIBMM_VFUNCS_ENABLED
194 virtual void insert_text_vfunc(const Glib::ustring& text, int& position);
195
196 #endif //GLIBMM_VFUNCS_ENABLED
197
198   //Default Signal Handlers::
199 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
200   virtual void on_insert_text(const Glib::ustring& text, int* position);
201   virtual void on_delete_text(int start_pos, int end_pos);
202   virtual void on_changed();
203 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
204
205
206 };
207
208 } // namespace Gtk
209
210
211 namespace Glib
212 {
213   /** @relates Gtk::Editable
214    * @param object The C instance
215    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
216    * @result A C++ instance that wraps this C instance.
217    */
218   Glib::RefPtr<Gtk::Editable> wrap(GtkEditable* object, bool take_copy = false);
219
220 } // namespace Glib
221
222
223 #endif /* _GTKMM_EDITABLE_H */
224