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