Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / togglebutton.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/togglebutton.h>
4 #include <gtkmm/private/togglebutton_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* 
10  *
11  * Copyright 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 <gtk/gtktogglebutton.h>
29
30 namespace Gtk
31 {
32
33 ToggleButton::ToggleButton(const Glib::ustring& label, bool mnemonic)
34 :
35   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
36   Gtk::Button(Glib::ConstructParams(togglebutton_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), (char*) 0))
37 {}
38
39 } // namespace Gtk
40
41
42 namespace
43 {
44
45 const Glib::SignalProxyInfo ToggleButton_signal_toggled_info =
46 {
47   "toggled",
48   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
49   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
50 };
51
52 } // anonymous namespace
53
54
55 namespace Glib
56 {
57
58 Gtk::ToggleButton* wrap(GtkToggleButton* object, bool take_copy)
59 {
60   return dynamic_cast<Gtk::ToggleButton *> (Glib::wrap_auto ((GObject*)(object), take_copy));
61 }
62
63 } /* namespace Glib */
64
65 namespace Gtk
66 {
67
68
69 /* The *_Class implementation: */
70
71 const Glib::Class& ToggleButton_Class::init()
72 {
73   if(!gtype_) // create the GType if necessary
74   {
75     // Glib::Class has to know the class init function to clone custom types.
76     class_init_func_ = &ToggleButton_Class::class_init_function;
77
78     // This is actually just optimized away, apparently with no harm.
79     // Make sure that the parent type has been created.
80     //CppClassParent::CppObjectType::get_type();
81
82     // Create the wrapper type, with the same class/instance size as the base type.
83     register_derived_type(gtk_toggle_button_get_type());
84
85     // Add derived versions of interfaces, if the C type implements any interfaces:
86   }
87
88   return *this;
89 }
90
91 void ToggleButton_Class::class_init_function(void* g_class, void* class_data)
92 {
93   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
94   CppClassParent::class_init_function(klass, class_data);
95
96   klass->toggled = &toggled_callback;
97 }
98
99
100 void ToggleButton_Class::toggled_callback(GtkToggleButton* self)
101 {
102   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
103       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
104
105   // Non-gtkmmproc-generated custom classes implicitly call the default
106   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
107   // generated classes can use this optimisation, which avoids the unnecessary
108   // parameter conversions if there is no possibility of the virtual function
109   // being overridden:
110   if(obj && obj->is_derived_())
111   {
112     try // Trap C++ exceptions which would normally be lost because this is a C callback.
113     {
114       // Call the virtual member method, which derived classes might override.
115       obj->on_toggled();
116     }
117     catch(...)
118     {
119       Glib::exception_handlers_invoke();
120     }
121   }
122   else
123   {
124     BaseClassType *const base = static_cast<BaseClassType*>(
125         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
126     );
127
128     // Call the original underlying C function:
129     if(base && base->toggled)
130       (*base->toggled)(self);
131   }
132 }
133
134
135 Glib::ObjectBase* ToggleButton_Class::wrap_new(GObject* o)
136 {
137   return manage(new ToggleButton((GtkToggleButton*)(o)));
138
139 }
140
141
142 /* The implementation: */
143
144 ToggleButton::ToggleButton(const Glib::ConstructParams& construct_params)
145 :
146   Gtk::Button(construct_params)
147 {
148   }
149
150 ToggleButton::ToggleButton(GtkToggleButton* castitem)
151 :
152   Gtk::Button((GtkButton*)(castitem))
153 {
154   }
155
156 ToggleButton::~ToggleButton()
157 {
158   destroy_();
159 }
160
161 ToggleButton::CppClassType ToggleButton::togglebutton_class_; // initialize static member
162
163 GType ToggleButton::get_type()
164 {
165   return togglebutton_class_.init().get_type();
166 }
167
168 GType ToggleButton::get_base_type()
169 {
170   return gtk_toggle_button_get_type();
171 }
172
173
174 ToggleButton::ToggleButton()
175 :
176   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
177   Gtk::Button(Glib::ConstructParams(togglebutton_class_.init()))
178 {
179   }
180
181 void ToggleButton::set_mode(bool draw_indicator)
182 {
183   gtk_toggle_button_set_mode(gobj(), static_cast<int>(draw_indicator));
184 }
185
186 bool ToggleButton::get_mode() const
187 {
188   return gtk_toggle_button_get_mode(const_cast<GtkToggleButton*>(gobj()));
189 }
190
191 void ToggleButton::set_active(bool is_active)
192 {
193   gtk_toggle_button_set_active(gobj(), static_cast<int>(is_active));
194 }
195
196 bool ToggleButton::get_active() const
197 {
198   return gtk_toggle_button_get_active(const_cast<GtkToggleButton*>(gobj()));
199 }
200
201 void ToggleButton::set_inconsistent(bool setting)
202 {
203   gtk_toggle_button_set_inconsistent(gobj(), static_cast<int>(setting));
204 }
205
206 bool ToggleButton::get_inconsistent() const
207 {
208   return gtk_toggle_button_get_inconsistent(const_cast<GtkToggleButton*>(gobj()));
209 }
210
211 void ToggleButton::toggled()
212 {
213   gtk_toggle_button_toggled(gobj());
214 }
215
216
217 Glib::SignalProxy0< void > ToggleButton::signal_toggled()
218 {
219   return Glib::SignalProxy0< void >(this, &ToggleButton_signal_toggled_info);
220 }
221
222
223 Glib::PropertyProxy<bool> ToggleButton::property_active() 
224 {
225   return Glib::PropertyProxy<bool>(this, "active");
226 }
227
228 Glib::PropertyProxy_ReadOnly<bool> ToggleButton::property_active() const
229 {
230   return Glib::PropertyProxy_ReadOnly<bool>(this, "active");
231 }
232
233 Glib::PropertyProxy<bool> ToggleButton::property_inconsistent() 
234 {
235   return Glib::PropertyProxy<bool>(this, "inconsistent");
236 }
237
238 Glib::PropertyProxy_ReadOnly<bool> ToggleButton::property_inconsistent() const
239 {
240   return Glib::PropertyProxy_ReadOnly<bool>(this, "inconsistent");
241 }
242
243 Glib::PropertyProxy<bool> ToggleButton::property_draw_indicator() 
244 {
245   return Glib::PropertyProxy<bool>(this, "draw-indicator");
246 }
247
248 Glib::PropertyProxy_ReadOnly<bool> ToggleButton::property_draw_indicator() const
249 {
250   return Glib::PropertyProxy_ReadOnly<bool>(this, "draw-indicator");
251 }
252
253
254 void Gtk::ToggleButton::on_toggled()
255 {
256   BaseClassType *const base = static_cast<BaseClassType*>(
257       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
258   );
259
260   if(base && base->toggled)
261     (*base->toggled)(gobj());
262 }
263
264
265 } // namespace Gtk
266
267