Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / colorbutton.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/colorbutton.h>
4 #include <gtkmm/private/colorbutton_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /*
10  *
11  * Copyright 2003 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/gtkcolorbutton.h>
29 #include <gdkmm/color.h>
30
31 namespace Gtk
32 {
33
34 Gdk::Color ColorButton::get_color() const
35 {
36   Gdk::Color color;
37   gtk_color_button_get_color(const_cast<GtkColorButton*>(gobj()), color.gobj());
38   return color;
39 }
40
41   
42 } // namespace Gtk
43
44
45 namespace
46 {
47
48 const Glib::SignalProxyInfo ColorButton_signal_color_set_info =
49 {
50   "color-set",
51   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
52   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
53 };
54
55 } // anonymous namespace
56
57
58 namespace Glib
59 {
60
61 Gtk::ColorButton* wrap(GtkColorButton* object, bool take_copy)
62 {
63   return dynamic_cast<Gtk::ColorButton *> (Glib::wrap_auto ((GObject*)(object), take_copy));
64 }
65
66 } /* namespace Glib */
67
68 namespace Gtk
69 {
70
71
72 /* The *_Class implementation: */
73
74 const Glib::Class& ColorButton_Class::init()
75 {
76   if(!gtype_) // create the GType if necessary
77   {
78     // Glib::Class has to know the class init function to clone custom types.
79     class_init_func_ = &ColorButton_Class::class_init_function;
80
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();
84
85     // Create the wrapper type, with the same class/instance size as the base type.
86     register_derived_type(gtk_color_button_get_type());
87
88     // Add derived versions of interfaces, if the C type implements any interfaces:
89   }
90
91   return *this;
92 }
93
94 void ColorButton_Class::class_init_function(void* g_class, void* class_data)
95 {
96   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
97   CppClassParent::class_init_function(klass, class_data);
98
99   klass->color_set = &color_set_callback;
100 }
101
102
103 void ColorButton_Class::color_set_callback(GtkColorButton* self)
104 {
105   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
106       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
107
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
112   // being overridden:
113   if(obj && obj->is_derived_())
114   {
115     try // Trap C++ exceptions which would normally be lost because this is a C callback.
116     {
117       // Call the virtual member method, which derived classes might override.
118       obj->on_color_set();
119     }
120     catch(...)
121     {
122       Glib::exception_handlers_invoke();
123     }
124   }
125   else
126   {
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).
129     );
130
131     // Call the original underlying C function:
132     if(base && base->color_set)
133       (*base->color_set)(self);
134   }
135 }
136
137
138 Glib::ObjectBase* ColorButton_Class::wrap_new(GObject* o)
139 {
140   return manage(new ColorButton((GtkColorButton*)(o)));
141
142 }
143
144
145 /* The implementation: */
146
147 ColorButton::ColorButton(const Glib::ConstructParams& construct_params)
148 :
149   Gtk::Button(construct_params)
150 {
151   }
152
153 ColorButton::ColorButton(GtkColorButton* castitem)
154 :
155   Gtk::Button((GtkButton*)(castitem))
156 {
157   }
158
159 ColorButton::~ColorButton()
160 {
161   destroy_();
162 }
163
164 ColorButton::CppClassType ColorButton::colorbutton_class_; // initialize static member
165
166 GType ColorButton::get_type()
167 {
168   return colorbutton_class_.init().get_type();
169 }
170
171 GType ColorButton::get_base_type()
172 {
173   return gtk_color_button_get_type();
174 }
175
176
177 ColorButton::ColorButton()
178 :
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()))
181 {
182   }
183
184 ColorButton::ColorButton(const Gdk::Color& color)
185 :
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))
188 {
189   }
190
191 void ColorButton::set_color(const Gdk::Color& color)
192 {
193   gtk_color_button_set_color(gobj(), (color).gobj());
194 }
195
196 void ColorButton::set_alpha(guint16 alpha)
197 {
198   gtk_color_button_set_alpha(gobj(), alpha);
199 }
200
201 guint16 ColorButton::get_alpha() const
202 {
203   return gtk_color_button_get_alpha(const_cast<GtkColorButton*>(gobj()));
204 }
205
206 void ColorButton::set_use_alpha(bool use_alpha)
207 {
208   gtk_color_button_set_use_alpha(gobj(), static_cast<int>(use_alpha));
209 }
210
211 bool ColorButton::get_use_alpha() const
212 {
213   return gtk_color_button_get_use_alpha(const_cast<GtkColorButton*>(gobj()));
214 }
215
216 void ColorButton::set_title(const Glib::ustring& title)
217 {
218   gtk_color_button_set_title(gobj(), title.c_str());
219 }
220
221 Glib::ustring ColorButton::get_title() const
222 {
223   return Glib::convert_const_gchar_ptr_to_ustring(gtk_color_button_get_title(const_cast<GtkColorButton*>(gobj())));
224 }
225
226
227 Glib::SignalProxy0< void > ColorButton::signal_color_set()
228 {
229   return Glib::SignalProxy0< void >(this, &ColorButton_signal_color_set_info);
230 }
231
232
233 Glib::PropertyProxy<bool> ColorButton::property_use_alpha() 
234 {
235   return Glib::PropertyProxy<bool>(this, "use-alpha");
236 }
237
238 Glib::PropertyProxy_ReadOnly<bool> ColorButton::property_use_alpha() const
239 {
240   return Glib::PropertyProxy_ReadOnly<bool>(this, "use-alpha");
241 }
242
243 Glib::PropertyProxy<Glib::ustring> ColorButton::property_title() 
244 {
245   return Glib::PropertyProxy<Glib::ustring>(this, "title");
246 }
247
248 Glib::PropertyProxy_ReadOnly<Glib::ustring> ColorButton::property_title() const
249 {
250   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "title");
251 }
252
253 Glib::PropertyProxy<Gdk::Color> ColorButton::property_color() 
254 {
255   return Glib::PropertyProxy<Gdk::Color>(this, "color");
256 }
257
258 Glib::PropertyProxy_ReadOnly<Gdk::Color> ColorButton::property_color() const
259 {
260   return Glib::PropertyProxy_ReadOnly<Gdk::Color>(this, "color");
261 }
262
263 Glib::PropertyProxy<guint16> ColorButton::property_alpha() 
264 {
265   return Glib::PropertyProxy<guint16>(this, "alpha");
266 }
267
268 Glib::PropertyProxy_ReadOnly<guint16> ColorButton::property_alpha() const
269 {
270   return Glib::PropertyProxy_ReadOnly<guint16>(this, "alpha");
271 }
272
273
274 void Gtk::ColorButton::on_color_set()
275 {
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).
278   );
279
280   if(base && base->color_set)
281     (*base->color_set)(gobj());
282 }
283
284
285 } // namespace Gtk
286
287