1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/togglebutton.h>
4 #include <gtkmm/private/togglebutton_p.h>
11 * Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
28 #include <gtk/gtktogglebutton.h>
33 ToggleButton::ToggleButton(const Glib::ustring& label, bool mnemonic)
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))
45 const Glib::SignalProxyInfo ToggleButton_signal_toggled_info =
48 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
49 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
52 } // anonymous namespace
58 Gtk::ToggleButton* wrap(GtkToggleButton* object, bool take_copy)
60 return dynamic_cast<Gtk::ToggleButton *> (Glib::wrap_auto ((GObject*)(object), take_copy));
63 } /* namespace Glib */
69 /* The *_Class implementation: */
71 const Glib::Class& ToggleButton_Class::init()
73 if(!gtype_) // create the GType if necessary
75 // Glib::Class has to know the class init function to clone custom types.
76 class_init_func_ = &ToggleButton_Class::class_init_function;
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();
82 // Create the wrapper type, with the same class/instance size as the base type.
83 register_derived_type(gtk_toggle_button_get_type());
85 // Add derived versions of interfaces, if the C type implements any interfaces:
91 void ToggleButton_Class::class_init_function(void* g_class, void* class_data)
93 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
94 CppClassParent::class_init_function(klass, class_data);
96 klass->toggled = &toggled_callback;
100 void ToggleButton_Class::toggled_callback(GtkToggleButton* self)
102 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
103 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
110 if(obj && obj->is_derived_())
112 try // Trap C++ exceptions which would normally be lost because this is a C callback.
114 // Call the virtual member method, which derived classes might override.
119 Glib::exception_handlers_invoke();
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).
128 // Call the original underlying C function:
129 if(base && base->toggled)
130 (*base->toggled)(self);
135 Glib::ObjectBase* ToggleButton_Class::wrap_new(GObject* o)
137 return manage(new ToggleButton((GtkToggleButton*)(o)));
142 /* The implementation: */
144 ToggleButton::ToggleButton(const Glib::ConstructParams& construct_params)
146 Gtk::Button(construct_params)
150 ToggleButton::ToggleButton(GtkToggleButton* castitem)
152 Gtk::Button((GtkButton*)(castitem))
156 ToggleButton::~ToggleButton()
161 ToggleButton::CppClassType ToggleButton::togglebutton_class_; // initialize static member
163 GType ToggleButton::get_type()
165 return togglebutton_class_.init().get_type();
168 GType ToggleButton::get_base_type()
170 return gtk_toggle_button_get_type();
174 ToggleButton::ToggleButton()
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()))
181 void ToggleButton::set_mode(bool draw_indicator)
183 gtk_toggle_button_set_mode(gobj(), static_cast<int>(draw_indicator));
186 bool ToggleButton::get_mode() const
188 return gtk_toggle_button_get_mode(const_cast<GtkToggleButton*>(gobj()));
191 void ToggleButton::set_active(bool is_active)
193 gtk_toggle_button_set_active(gobj(), static_cast<int>(is_active));
196 bool ToggleButton::get_active() const
198 return gtk_toggle_button_get_active(const_cast<GtkToggleButton*>(gobj()));
201 void ToggleButton::set_inconsistent(bool setting)
203 gtk_toggle_button_set_inconsistent(gobj(), static_cast<int>(setting));
206 bool ToggleButton::get_inconsistent() const
208 return gtk_toggle_button_get_inconsistent(const_cast<GtkToggleButton*>(gobj()));
211 void ToggleButton::toggled()
213 gtk_toggle_button_toggled(gobj());
217 Glib::SignalProxy0< void > ToggleButton::signal_toggled()
219 return Glib::SignalProxy0< void >(this, &ToggleButton_signal_toggled_info);
223 Glib::PropertyProxy<bool> ToggleButton::property_active()
225 return Glib::PropertyProxy<bool>(this, "active");
228 Glib::PropertyProxy_ReadOnly<bool> ToggleButton::property_active() const
230 return Glib::PropertyProxy_ReadOnly<bool>(this, "active");
233 Glib::PropertyProxy<bool> ToggleButton::property_inconsistent()
235 return Glib::PropertyProxy<bool>(this, "inconsistent");
238 Glib::PropertyProxy_ReadOnly<bool> ToggleButton::property_inconsistent() const
240 return Glib::PropertyProxy_ReadOnly<bool>(this, "inconsistent");
243 Glib::PropertyProxy<bool> ToggleButton::property_draw_indicator()
245 return Glib::PropertyProxy<bool>(this, "draw-indicator");
248 Glib::PropertyProxy_ReadOnly<bool> ToggleButton::property_draw_indicator() const
250 return Glib::PropertyProxy_ReadOnly<bool>(this, "draw-indicator");
254 void Gtk::ToggleButton::on_toggled()
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).
260 if(base && base->toggled)
261 (*base->toggled)(gobj());