1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/colorbutton.h>
4 #include <gtkmm/private/colorbutton_p.h>
11 * Copyright 2003 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/gtkcolorbutton.h>
29 #include <gdkmm/color.h>
34 Gdk::Color ColorButton::get_color() const
37 gtk_color_button_get_color(const_cast<GtkColorButton*>(gobj()), color.gobj());
48 const Glib::SignalProxyInfo ColorButton_signal_color_set_info =
51 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
52 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
55 } // anonymous namespace
61 Gtk::ColorButton* wrap(GtkColorButton* object, bool take_copy)
63 return dynamic_cast<Gtk::ColorButton *> (Glib::wrap_auto ((GObject*)(object), take_copy));
66 } /* namespace Glib */
72 /* The *_Class implementation: */
74 const Glib::Class& ColorButton_Class::init()
76 if(!gtype_) // create the GType if necessary
78 // Glib::Class has to know the class init function to clone custom types.
79 class_init_func_ = &ColorButton_Class::class_init_function;
81 // This is actually just optimized away, apparently with no harm.
82 // Make sure that the parent type has been created.
83 //CppClassParent::CppObjectType::get_type();
85 // Create the wrapper type, with the same class/instance size as the base type.
86 register_derived_type(gtk_color_button_get_type());
88 // Add derived versions of interfaces, if the C type implements any interfaces:
94 void ColorButton_Class::class_init_function(void* g_class, void* class_data)
96 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
97 CppClassParent::class_init_function(klass, class_data);
99 klass->color_set = &color_set_callback;
103 void ColorButton_Class::color_set_callback(GtkColorButton* self)
105 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
106 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
108 // Non-gtkmmproc-generated custom classes implicitly call the default
109 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
110 // generated classes can use this optimisation, which avoids the unnecessary
111 // parameter conversions if there is no possibility of the virtual function
113 if(obj && obj->is_derived_())
115 try // Trap C++ exceptions which would normally be lost because this is a C callback.
117 // Call the virtual member method, which derived classes might override.
122 Glib::exception_handlers_invoke();
127 BaseClassType *const base = static_cast<BaseClassType*>(
128 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
131 // Call the original underlying C function:
132 if(base && base->color_set)
133 (*base->color_set)(self);
138 Glib::ObjectBase* ColorButton_Class::wrap_new(GObject* o)
140 return manage(new ColorButton((GtkColorButton*)(o)));
145 /* The implementation: */
147 ColorButton::ColorButton(const Glib::ConstructParams& construct_params)
149 Gtk::Button(construct_params)
153 ColorButton::ColorButton(GtkColorButton* castitem)
155 Gtk::Button((GtkButton*)(castitem))
159 ColorButton::~ColorButton()
164 ColorButton::CppClassType ColorButton::colorbutton_class_; // initialize static member
166 GType ColorButton::get_type()
168 return colorbutton_class_.init().get_type();
171 GType ColorButton::get_base_type()
173 return gtk_color_button_get_type();
177 ColorButton::ColorButton()
179 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
180 Gtk::Button(Glib::ConstructParams(colorbutton_class_.init()))
184 ColorButton::ColorButton(const Gdk::Color& color)
186 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
187 Gtk::Button(Glib::ConstructParams(colorbutton_class_.init(), "color", (color).gobj(), (char*) 0))
191 void ColorButton::set_color(const Gdk::Color& color)
193 gtk_color_button_set_color(gobj(), (color).gobj());
196 void ColorButton::set_alpha(guint16 alpha)
198 gtk_color_button_set_alpha(gobj(), alpha);
201 guint16 ColorButton::get_alpha() const
203 return gtk_color_button_get_alpha(const_cast<GtkColorButton*>(gobj()));
206 void ColorButton::set_use_alpha(bool use_alpha)
208 gtk_color_button_set_use_alpha(gobj(), static_cast<int>(use_alpha));
211 bool ColorButton::get_use_alpha() const
213 return gtk_color_button_get_use_alpha(const_cast<GtkColorButton*>(gobj()));
216 void ColorButton::set_title(const Glib::ustring& title)
218 gtk_color_button_set_title(gobj(), title.c_str());
221 Glib::ustring ColorButton::get_title() const
223 return Glib::convert_const_gchar_ptr_to_ustring(gtk_color_button_get_title(const_cast<GtkColorButton*>(gobj())));
227 Glib::SignalProxy0< void > ColorButton::signal_color_set()
229 return Glib::SignalProxy0< void >(this, &ColorButton_signal_color_set_info);
233 Glib::PropertyProxy<bool> ColorButton::property_use_alpha()
235 return Glib::PropertyProxy<bool>(this, "use-alpha");
238 Glib::PropertyProxy_ReadOnly<bool> ColorButton::property_use_alpha() const
240 return Glib::PropertyProxy_ReadOnly<bool>(this, "use-alpha");
243 Glib::PropertyProxy<Glib::ustring> ColorButton::property_title()
245 return Glib::PropertyProxy<Glib::ustring>(this, "title");
248 Glib::PropertyProxy_ReadOnly<Glib::ustring> ColorButton::property_title() const
250 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "title");
253 Glib::PropertyProxy<Gdk::Color> ColorButton::property_color()
255 return Glib::PropertyProxy<Gdk::Color>(this, "color");
258 Glib::PropertyProxy_ReadOnly<Gdk::Color> ColorButton::property_color() const
260 return Glib::PropertyProxy_ReadOnly<Gdk::Color>(this, "color");
263 Glib::PropertyProxy<guint16> ColorButton::property_alpha()
265 return Glib::PropertyProxy<guint16>(this, "alpha");
268 Glib::PropertyProxy_ReadOnly<guint16> ColorButton::property_alpha() const
270 return Glib::PropertyProxy_ReadOnly<guint16>(this, "alpha");
274 void Gtk::ColorButton::on_color_set()
276 BaseClassType *const base = static_cast<BaseClassType*>(
277 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
280 if(base && base->color_set)
281 (*base->color_set)(gobj());