1
// Generated by gtkmmproc -- DO NOT MODIFY!
4
#include <gtkmm/checkbutton.h>
5
#include <gtkmm/private/checkbutton_p.h>
8
/* $Id: checkbutton.ccg,v 1.1 2003/01/21 13:38:44 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
CheckButton::CheckButton(const Glib::ustring& label, bool mnemonic)
36
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
38
Gtk::ToggleButton(Glib::ConstructParams(checkbutton_class_.init(), "label",label.c_str(),"use_underline",gboolean(mnemonic), static_cast<char*>(0)))
46
} // anonymous namespace
52
Gtk::CheckButton* wrap(GtkCheckButton* object, bool take_copy)
54
return dynamic_cast<Gtk::CheckButton *> (Glib::wrap_auto ((GObject*)(object), take_copy));
57
} /* namespace Glib */
63
/* The *_Class implementation: */
65
const Glib::Class& CheckButton_Class::init()
67
if(!gtype_) // create the GType if necessary
69
// Glib::Class has to know the class init function to clone custom types.
70
class_init_func_ = &CheckButton_Class::class_init_function;
72
// This is actually just optimized away, apparently with no harm.
73
// Make sure that the parent type has been created.
74
//CppClassParent::CppObjectType::get_type();
76
// Create the wrapper type, with the same class/instance size as the base type.
77
register_derived_type(gtk_check_button_get_type());
79
// Add derived versions of interfaces, if the C type implements any interfaces:
87
void CheckButton_Class::class_init_function(void* g_class, void* class_data)
89
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
90
CppClassParent::class_init_function(klass, class_data);
92
klass->draw_indicator = &draw_indicator_vfunc_callback;
96
void CheckButton_Class::draw_indicator_vfunc_callback(GtkCheckButton* self, cairo_t* cr)
98
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
99
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
101
// Non-gtkmmproc-generated custom classes implicitly call the default
102
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
103
// generated classes can use this optimisation, which avoids the unnecessary
104
// parameter conversions if there is no possibility of the virtual function
106
if(obj_base && obj_base->is_derived_())
108
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
109
if(obj) // This can be NULL during destruction.
111
#ifdef GLIBMM_EXCEPTIONS_ENABLED
112
try // Trap C++ exceptions which would normally be lost because this is a C callback.
114
#endif //GLIBMM_EXCEPTIONS_ENABLED
115
// Call the virtual member method, which derived classes might override.
116
obj->draw_indicator_vfunc(Cairo::RefPtr<Cairo::Context>(new Cairo::Context(cr, false /* has_reference */))
119
#ifdef GLIBMM_EXCEPTIONS_ENABLED
123
Glib::exception_handlers_invoke();
125
#endif //GLIBMM_EXCEPTIONS_ENABLED
129
BaseClassType *const base = static_cast<BaseClassType*>(
130
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
133
// Call the original underlying C function:
134
if(base && base->draw_indicator)
135
(*base->draw_indicator)(self, cr);
140
Glib::ObjectBase* CheckButton_Class::wrap_new(GObject* o)
142
return manage(new CheckButton((GtkCheckButton*)(o)));
147
/* The implementation: */
149
CheckButton::CheckButton(const Glib::ConstructParams& construct_params)
151
Gtk::ToggleButton(construct_params)
155
CheckButton::CheckButton(GtkCheckButton* castitem)
157
Gtk::ToggleButton((GtkToggleButton*)(castitem))
161
CheckButton::~CheckButton()
166
CheckButton::CppClassType CheckButton::checkbutton_class_; // initialize static member
168
GType CheckButton::get_type()
170
return checkbutton_class_.init().get_type();
174
GType CheckButton::get_base_type()
176
return gtk_check_button_get_type();
180
CheckButton::CheckButton()
182
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
184
Gtk::ToggleButton(Glib::ConstructParams(checkbutton_class_.init()))
191
void Gtk::CheckButton::draw_indicator_vfunc(const Cairo::RefPtr<Cairo::Context>& cr)
193
BaseClassType *const base = static_cast<BaseClassType*>(
194
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
197
if(base && base->draw_indicator)
198
(*base->draw_indicator)(gobj(),(cr)->cobj());