1
// Generated by gtkmmproc -- DO NOT MODIFY!
4
#include <gtkmm/togglebutton.h>
5
#include <gtkmm/private/togglebutton_p.h>
8
/* $Id: togglebutton.ccg,v 1.2 2006/07/16 19:18:49 murrayc Exp $ */
12
* Copyright 1998-2002 The gtkmm Development Team
14
* This library is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU Lesser General Public
16
* License as published by the Free Software Foundation; either
17
* version 2.1 of the License, or (at your option) any later version.
19
* This library is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
* Lesser General Public License for more details.
24
* You should have received a copy of the GNU Lesser General Public
25
* License along with this library; if not, write to the Free
26
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
34
ToggleButton::ToggleButton(const Glib::ustring& label, bool mnemonic)
36
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
38
Gtk::Button(Glib::ConstructParams(togglebutton_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), static_cast<char*>(0)))
41
ToggleButton::ToggleButton(const StockID& stock_id)
43
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
45
Gtk::Button(Glib::ConstructParams(togglebutton_class_.init(), "use_stock",1,"label",stock_id.get_c_str(), static_cast<char*>(0)))
55
static const Glib::SignalProxyInfo ToggleButton_signal_toggled_info =
58
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
59
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback
63
} // anonymous namespace
69
Gtk::ToggleButton* wrap(GtkToggleButton* object, bool take_copy)
71
return dynamic_cast<Gtk::ToggleButton *> (Glib::wrap_auto ((GObject*)(object), take_copy));
74
} /* namespace Glib */
80
/* The *_Class implementation: */
82
const Glib::Class& ToggleButton_Class::init()
84
if(!gtype_) // create the GType if necessary
86
// Glib::Class has to know the class init function to clone custom types.
87
class_init_func_ = &ToggleButton_Class::class_init_function;
89
// This is actually just optimized away, apparently with no harm.
90
// Make sure that the parent type has been created.
91
//CppClassParent::CppObjectType::get_type();
93
// Create the wrapper type, with the same class/instance size as the base type.
94
register_derived_type(gtk_toggle_button_get_type());
96
// Add derived versions of interfaces, if the C type implements any interfaces:
104
void ToggleButton_Class::class_init_function(void* g_class, void* class_data)
106
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
107
CppClassParent::class_init_function(klass, class_data);
110
klass->toggled = &toggled_callback;
114
void ToggleButton_Class::toggled_callback(GtkToggleButton* self)
116
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
117
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
119
// Non-gtkmmproc-generated custom classes implicitly call the default
120
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
121
// generated classes can use this optimisation, which avoids the unnecessary
122
// parameter conversions if there is no possibility of the virtual function
124
if(obj_base && obj_base->is_derived_())
126
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
127
if(obj) // This can be NULL during destruction.
129
#ifdef GLIBMM_EXCEPTIONS_ENABLED
130
try // Trap C++ exceptions which would normally be lost because this is a C callback.
132
#endif //GLIBMM_EXCEPTIONS_ENABLED
133
// Call the virtual member method, which derived classes might override.
136
#ifdef GLIBMM_EXCEPTIONS_ENABLED
140
Glib::exception_handlers_invoke();
142
#endif //GLIBMM_EXCEPTIONS_ENABLED
146
BaseClassType *const base = static_cast<BaseClassType*>(
147
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
150
// Call the original underlying C function:
151
if(base && base->toggled)
152
(*base->toggled)(self);
156
Glib::ObjectBase* ToggleButton_Class::wrap_new(GObject* o)
158
return manage(new ToggleButton((GtkToggleButton*)(o)));
163
/* The implementation: */
165
ToggleButton::ToggleButton(const Glib::ConstructParams& construct_params)
167
Gtk::Button(construct_params)
171
ToggleButton::ToggleButton(GtkToggleButton* castitem)
173
Gtk::Button((GtkButton*)(castitem))
177
ToggleButton::~ToggleButton()
182
ToggleButton::CppClassType ToggleButton::togglebutton_class_; // initialize static member
184
GType ToggleButton::get_type()
186
return togglebutton_class_.init().get_type();
190
GType ToggleButton::get_base_type()
192
return gtk_toggle_button_get_type();
196
ToggleButton::ToggleButton()
198
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
200
Gtk::Button(Glib::ConstructParams(togglebutton_class_.init()))
206
void ToggleButton::set_mode(bool draw_indicator)
208
gtk_toggle_button_set_mode(gobj(), static_cast<int>(draw_indicator));
211
bool ToggleButton::get_mode() const
213
return gtk_toggle_button_get_mode(const_cast<GtkToggleButton*>(gobj()));
216
void ToggleButton::set_active(bool is_active)
218
gtk_toggle_button_set_active(gobj(), static_cast<int>(is_active));
221
bool ToggleButton::get_active() const
223
return gtk_toggle_button_get_active(const_cast<GtkToggleButton*>(gobj()));
226
void ToggleButton::set_inconsistent(bool setting)
228
gtk_toggle_button_set_inconsistent(gobj(), static_cast<int>(setting));
231
bool ToggleButton::get_inconsistent() const
233
return gtk_toggle_button_get_inconsistent(const_cast<GtkToggleButton*>(gobj()));
236
void ToggleButton::toggled()
238
gtk_toggle_button_toggled(gobj());
242
Glib::SignalProxy0< void > ToggleButton::signal_toggled()
244
return Glib::SignalProxy0< void >(this, &ToggleButton_signal_toggled_info);
248
#ifdef GLIBMM_PROPERTIES_ENABLED
249
Glib::PropertyProxy<bool> ToggleButton::property_active()
251
return Glib::PropertyProxy<bool>(this, "active");
253
#endif //GLIBMM_PROPERTIES_ENABLED
255
#ifdef GLIBMM_PROPERTIES_ENABLED
256
Glib::PropertyProxy_ReadOnly<bool> ToggleButton::property_active() const
258
return Glib::PropertyProxy_ReadOnly<bool>(this, "active");
260
#endif //GLIBMM_PROPERTIES_ENABLED
262
#ifdef GLIBMM_PROPERTIES_ENABLED
263
Glib::PropertyProxy<bool> ToggleButton::property_inconsistent()
265
return Glib::PropertyProxy<bool>(this, "inconsistent");
267
#endif //GLIBMM_PROPERTIES_ENABLED
269
#ifdef GLIBMM_PROPERTIES_ENABLED
270
Glib::PropertyProxy_ReadOnly<bool> ToggleButton::property_inconsistent() const
272
return Glib::PropertyProxy_ReadOnly<bool>(this, "inconsistent");
274
#endif //GLIBMM_PROPERTIES_ENABLED
276
#ifdef GLIBMM_PROPERTIES_ENABLED
277
Glib::PropertyProxy<bool> ToggleButton::property_draw_indicator()
279
return Glib::PropertyProxy<bool>(this, "draw-indicator");
281
#endif //GLIBMM_PROPERTIES_ENABLED
283
#ifdef GLIBMM_PROPERTIES_ENABLED
284
Glib::PropertyProxy_ReadOnly<bool> ToggleButton::property_draw_indicator() const
286
return Glib::PropertyProxy_ReadOnly<bool>(this, "draw-indicator");
288
#endif //GLIBMM_PROPERTIES_ENABLED
291
void Gtk::ToggleButton::on_toggled()
293
BaseClassType *const base = static_cast<BaseClassType*>(
294
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
297
if(base && base->toggled)
298
(*base->toggled)(gobj());