Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / curve.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/curve.h>
4 #include <gtkmm/private/curve_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* 
10  *
11  * Copyright 1998-2002 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/gtkcurve.h>
29 #include <gtk/gtkgamma.h>
30
31 namespace Gtk
32 {
33
34 Glib::ArrayHandle<float> Curve::get_vector(int veclen) const
35 {
36   float *const pdata = static_cast<float*>(g_malloc(veclen * sizeof(float)));
37   gtk_curve_get_vector(const_cast<GtkCurve*>(gobj()), veclen, pdata);
38
39   return Glib::ArrayHandle<float>(pdata, veclen, Glib::OWNERSHIP_SHALLOW);
40 }
41
42 void Curve::set_vector(const Glib::ArrayHandle<float>& array)
43 {
44   gtk_curve_set_vector(gobj(), array.size(), const_cast<float*>(array.data()));
45 }
46
47 } /* namespace Gtk */
48
49
50 namespace
51 {
52
53 const Glib::SignalProxyInfo Curve_signal_curve_type_changed_info =
54 {
55   "curve_type_changed",
56   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
57   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
58 };
59
60 } // anonymous namespace
61
62
63 namespace Glib
64 {
65
66 Gtk::Curve* wrap(GtkCurve* object, bool take_copy)
67 {
68   return dynamic_cast<Gtk::Curve *> (Glib::wrap_auto ((GObject*)(object), take_copy));
69 }
70
71 } /* namespace Glib */
72
73 namespace Gtk
74 {
75
76
77 /* The *_Class implementation: */
78
79 const Glib::Class& Curve_Class::init()
80 {
81   if(!gtype_) // create the GType if necessary
82   {
83     // Glib::Class has to know the class init function to clone custom types.
84     class_init_func_ = &Curve_Class::class_init_function;
85
86     // This is actually just optimized away, apparently with no harm.
87     // Make sure that the parent type has been created.
88     //CppClassParent::CppObjectType::get_type();
89
90     // Create the wrapper type, with the same class/instance size as the base type.
91     register_derived_type(gtk_curve_get_type());
92
93     // Add derived versions of interfaces, if the C type implements any interfaces:
94   }
95
96   return *this;
97 }
98
99 void Curve_Class::class_init_function(void* g_class, void* class_data)
100 {
101   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
102   CppClassParent::class_init_function(klass, class_data);
103
104   klass->curve_type_changed = &curve_type_changed_callback;
105 }
106
107
108 void Curve_Class::curve_type_changed_callback(GtkCurve* self)
109 {
110   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
111       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
112
113   // Non-gtkmmproc-generated custom classes implicitly call the default
114   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
115   // generated classes can use this optimisation, which avoids the unnecessary
116   // parameter conversions if there is no possibility of the virtual function
117   // being overridden:
118   if(obj && obj->is_derived_())
119   {
120     try // Trap C++ exceptions which would normally be lost because this is a C callback.
121     {
122       // Call the virtual member method, which derived classes might override.
123       obj->on_curve_type_changed();
124     }
125     catch(...)
126     {
127       Glib::exception_handlers_invoke();
128     }
129   }
130   else
131   {
132     BaseClassType *const base = static_cast<BaseClassType*>(
133         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
134     );
135
136     // Call the original underlying C function:
137     if(base && base->curve_type_changed)
138       (*base->curve_type_changed)(self);
139   }
140 }
141
142
143 Glib::ObjectBase* Curve_Class::wrap_new(GObject* o)
144 {
145   return manage(new Curve((GtkCurve*)(o)));
146
147 }
148
149
150 /* The implementation: */
151
152 Curve::Curve(const Glib::ConstructParams& construct_params)
153 :
154   Gtk::DrawingArea(construct_params)
155 {
156   }
157
158 Curve::Curve(GtkCurve* castitem)
159 :
160   Gtk::DrawingArea((GtkDrawingArea*)(castitem))
161 {
162   }
163
164 Curve::~Curve()
165 {
166   destroy_();
167 }
168
169 Curve::CppClassType Curve::curve_class_; // initialize static member
170
171 GType Curve::get_type()
172 {
173   return curve_class_.init().get_type();
174 }
175
176 GType Curve::get_base_type()
177 {
178   return gtk_curve_get_type();
179 }
180
181
182 Curve::Curve()
183 :
184   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
185   Gtk::DrawingArea(Glib::ConstructParams(curve_class_.init()))
186 {
187   }
188
189 void Curve::reset()
190 {
191   gtk_curve_reset(gobj());
192 }
193
194 void Curve::set_gamma(float gamma)
195 {
196   gtk_curve_set_gamma(gobj(), gamma);
197 }
198
199 void Curve::set_range(float min_x, float max_x, float min_y, float max_y)
200 {
201   gtk_curve_set_range(gobj(), min_x, max_x, min_y, max_y);
202 }
203
204 void Curve::get_vector(int veclen, float* data) const
205 {
206   gtk_curve_get_vector(const_cast<GtkCurve*>(gobj()), veclen, data);
207 }
208
209 void Curve::set_curve_type(CurveType type)
210 {
211   gtk_curve_set_curve_type(gobj(), ((GtkCurveType)(type)));
212 }
213
214
215 Glib::SignalProxy0< void > Curve::signal_curve_type_changed()
216 {
217   return Glib::SignalProxy0< void >(this, &Curve_signal_curve_type_changed_info);
218 }
219
220
221 Glib::PropertyProxy<CurveType> Curve::property_curve_type() 
222 {
223   return Glib::PropertyProxy<CurveType>(this, "curve-type");
224 }
225
226 Glib::PropertyProxy_ReadOnly<CurveType> Curve::property_curve_type() const
227 {
228   return Glib::PropertyProxy_ReadOnly<CurveType>(this, "curve-type");
229 }
230
231 Glib::PropertyProxy<float> Curve::property_min_x() 
232 {
233   return Glib::PropertyProxy<float>(this, "min-x");
234 }
235
236 Glib::PropertyProxy_ReadOnly<float> Curve::property_min_x() const
237 {
238   return Glib::PropertyProxy_ReadOnly<float>(this, "min-x");
239 }
240
241 Glib::PropertyProxy<float> Curve::property_max_x() 
242 {
243   return Glib::PropertyProxy<float>(this, "max-x");
244 }
245
246 Glib::PropertyProxy_ReadOnly<float> Curve::property_max_x() const
247 {
248   return Glib::PropertyProxy_ReadOnly<float>(this, "max-x");
249 }
250
251 Glib::PropertyProxy<float> Curve::property_min_y() 
252 {
253   return Glib::PropertyProxy<float>(this, "min-y");
254 }
255
256 Glib::PropertyProxy_ReadOnly<float> Curve::property_min_y() const
257 {
258   return Glib::PropertyProxy_ReadOnly<float>(this, "min-y");
259 }
260
261 Glib::PropertyProxy<float> Curve::property_max_y() 
262 {
263   return Glib::PropertyProxy<float>(this, "max-y");
264 }
265
266 Glib::PropertyProxy_ReadOnly<float> Curve::property_max_y() const
267 {
268   return Glib::PropertyProxy_ReadOnly<float>(this, "max-y");
269 }
270
271
272 void Gtk::Curve::on_curve_type_changed()
273 {
274   BaseClassType *const base = static_cast<BaseClassType*>(
275       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
276   );
277
278   if(base && base->curve_type_changed)
279     (*base->curve_type_changed)(gobj());
280 }
281
282
283 } // namespace Gtk
284
285
286 namespace Glib
287 {
288
289 Gtk::GammaCurve* wrap(GtkGammaCurve* object, bool take_copy)
290 {
291   return dynamic_cast<Gtk::GammaCurve *> (Glib::wrap_auto ((GObject*)(object), take_copy));
292 }
293
294 } /* namespace Glib */
295
296 namespace Gtk
297 {
298
299
300 /* The *_Class implementation: */
301
302 const Glib::Class& GammaCurve_Class::init()
303 {
304   if(!gtype_) // create the GType if necessary
305   {
306     // Glib::Class has to know the class init function to clone custom types.
307     class_init_func_ = &GammaCurve_Class::class_init_function;
308
309     // This is actually just optimized away, apparently with no harm.
310     // Make sure that the parent type has been created.
311     //CppClassParent::CppObjectType::get_type();
312
313     // Create the wrapper type, with the same class/instance size as the base type.
314     register_derived_type(gtk_gamma_curve_get_type());
315
316     // Add derived versions of interfaces, if the C type implements any interfaces:
317   }
318
319   return *this;
320 }
321
322 void GammaCurve_Class::class_init_function(void* g_class, void* class_data)
323 {
324   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
325   CppClassParent::class_init_function(klass, class_data);
326
327 }
328
329
330 Glib::ObjectBase* GammaCurve_Class::wrap_new(GObject* o)
331 {
332   return manage(new GammaCurve((GtkGammaCurve*)(o)));
333
334 }
335
336
337 /* The implementation: */
338
339 GammaCurve::GammaCurve(const Glib::ConstructParams& construct_params)
340 :
341   Gtk::VBox(construct_params)
342 {
343   }
344
345 GammaCurve::GammaCurve(GtkGammaCurve* castitem)
346 :
347   Gtk::VBox((GtkVBox*)(castitem))
348 {
349   }
350
351 GammaCurve::~GammaCurve()
352 {
353   destroy_();
354 }
355
356 GammaCurve::CppClassType GammaCurve::gammacurve_class_; // initialize static member
357
358 GType GammaCurve::get_type()
359 {
360   return gammacurve_class_.init().get_type();
361 }
362
363 GType GammaCurve::get_base_type()
364 {
365   return gtk_gamma_curve_get_type();
366 }
367
368 GammaCurve::GammaCurve()
369 :
370   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
371   Gtk::VBox(Glib::ConstructParams(gammacurve_class_.init()))
372 {
373   }
374
375
376 } // namespace Gtk
377
378