Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / range.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/range.h>
4 #include <gtkmm/private/range_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* Copyright 1998-2002 The gtkmm Development Team
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the Free
23  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25
26 #include <gtk/gtkrange.h>
27 #include <gtkmm/adjustment.h>
28
29 namespace Gtk
30 {
31
32 void Range::unset_adjustment()
33 {
34   gtk_range_set_adjustment(gobj(), 0);
35 }
36
37 } // namespace Gtk
38
39
40 namespace
41 {
42
43 const Glib::SignalProxyInfo Range_signal_value_changed_info =
44 {
45   "value_changed",
46   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
47   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
48 };
49
50
51 void Range_signal_adjust_bounds_callback(GtkRange* self, gdouble p0,void* data)
52 {
53   using namespace Gtk;
54   typedef sigc::slot< void,double > SlotType;
55
56   // Do not try to call a signal on a disassociated wrapper.
57   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
58   {
59     try
60     {
61       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
62         (*static_cast<SlotType*>(slot))(p0
63 );
64     }
65     catch(...)
66     {
67       Glib::exception_handlers_invoke();
68     }
69   }
70 }
71
72 const Glib::SignalProxyInfo Range_signal_adjust_bounds_info =
73 {
74   "adjust_bounds",
75   (GCallback) &Range_signal_adjust_bounds_callback,
76   (GCallback) &Range_signal_adjust_bounds_callback
77 };
78
79
80 void Range_signal_move_slider_callback(GtkRange* self, GtkScrollType p0,void* data)
81 {
82   using namespace Gtk;
83   typedef sigc::slot< void,ScrollType > SlotType;
84
85   // Do not try to call a signal on a disassociated wrapper.
86   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
87   {
88     try
89     {
90       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
91         (*static_cast<SlotType*>(slot))(((ScrollType)(p0))
92 );
93     }
94     catch(...)
95     {
96       Glib::exception_handlers_invoke();
97     }
98   }
99 }
100
101 const Glib::SignalProxyInfo Range_signal_move_slider_info =
102 {
103   "move_slider",
104   (GCallback) &Range_signal_move_slider_callback,
105   (GCallback) &Range_signal_move_slider_callback
106 };
107
108
109 gboolean Range_signal_change_value_callback(GtkRange* self, GtkScrollType p0,gdouble p1,void* data)
110 {
111   using namespace Gtk;
112   typedef sigc::slot< bool,ScrollType,double > SlotType;
113
114   // Do not try to call a signal on a disassociated wrapper.
115   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
116   {
117     try
118     {
119       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
120         return static_cast<int>((*static_cast<SlotType*>(slot))(((ScrollType)(p0))
121 , p1
122 ));
123     }
124     catch(...)
125     {
126       Glib::exception_handlers_invoke();
127     }
128   }
129
130   typedef gboolean RType;
131   return RType();
132 }
133
134 gboolean Range_signal_change_value_notify_callback(GtkRange* self, GtkScrollType p0,gdouble p1, void* data)
135 {
136   using namespace Gtk;
137   typedef sigc::slot< void,ScrollType,double > SlotType;
138
139   // Do not try to call a signal on a disassociated wrapper.
140   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
141   {
142     try
143     {
144       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
145         (*static_cast<SlotType*>(slot))(((ScrollType)(p0))
146 , p1
147 );
148     }
149     catch(...)
150     {
151       Glib::exception_handlers_invoke();
152     }
153   }
154
155   typedef gboolean RType;
156   return RType();
157 }
158
159 const Glib::SignalProxyInfo Range_signal_change_value_info =
160 {
161   "change_value",
162   (GCallback) &Range_signal_change_value_callback,
163   (GCallback) &Range_signal_change_value_notify_callback
164 };
165
166 } // anonymous namespace
167
168
169 namespace Glib
170 {
171
172 Gtk::Range* wrap(GtkRange* object, bool take_copy)
173 {
174   return dynamic_cast<Gtk::Range *> (Glib::wrap_auto ((GObject*)(object), take_copy));
175 }
176
177 } /* namespace Glib */
178
179 namespace Gtk
180 {
181
182
183 /* The *_Class implementation: */
184
185 const Glib::Class& Range_Class::init()
186 {
187   if(!gtype_) // create the GType if necessary
188   {
189     // Glib::Class has to know the class init function to clone custom types.
190     class_init_func_ = &Range_Class::class_init_function;
191
192     // This is actually just optimized away, apparently with no harm.
193     // Make sure that the parent type has been created.
194     //CppClassParent::CppObjectType::get_type();
195
196     // Create the wrapper type, with the same class/instance size as the base type.
197     register_derived_type(gtk_range_get_type());
198
199     // Add derived versions of interfaces, if the C type implements any interfaces:
200   }
201
202   return *this;
203 }
204
205 void Range_Class::class_init_function(void* g_class, void* class_data)
206 {
207   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
208   CppClassParent::class_init_function(klass, class_data);
209
210   klass->get_range_border = &get_range_border_vfunc_callback;
211   klass->value_changed = &value_changed_callback;
212   klass->adjust_bounds = &adjust_bounds_callback;
213   klass->move_slider = &move_slider_callback;
214 }
215
216 void Range_Class::get_range_border_vfunc_callback(GtkRange* self, GtkBorder* border)
217 {
218   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
219       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
220
221   // Non-gtkmmproc-generated custom classes implicitly call the default
222   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
223   // generated classes can use this optimisation, which avoids the unnecessary
224   // parameter conversions if there is no possibility of the virtual function
225   // being overridden:
226   if(obj && obj->is_derived_())
227   {
228     try // Trap C++ exceptions which would normally be lost because this is a C callback.
229     {
230       // Call the virtual member method, which derived classes might override.
231       obj->get_range_border_vfunc(border);
232     }
233     catch(...)
234     {
235       Glib::exception_handlers_invoke();
236     }
237   }
238   else
239   {
240     BaseClassType *const base = static_cast<BaseClassType*>(
241         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
242     );
243
244     // Call the original underlying C function:
245     if(base && base->get_range_border)
246       (*base->get_range_border)(self, border);
247   }
248 }
249
250
251 void Range_Class::value_changed_callback(GtkRange* self)
252 {
253   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
254       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
255
256   // Non-gtkmmproc-generated custom classes implicitly call the default
257   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
258   // generated classes can use this optimisation, which avoids the unnecessary
259   // parameter conversions if there is no possibility of the virtual function
260   // being overridden:
261   if(obj && obj->is_derived_())
262   {
263     try // Trap C++ exceptions which would normally be lost because this is a C callback.
264     {
265       // Call the virtual member method, which derived classes might override.
266       obj->on_value_changed();
267     }
268     catch(...)
269     {
270       Glib::exception_handlers_invoke();
271     }
272   }
273   else
274   {
275     BaseClassType *const base = static_cast<BaseClassType*>(
276         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
277     );
278
279     // Call the original underlying C function:
280     if(base && base->value_changed)
281       (*base->value_changed)(self);
282   }
283 }
284
285 void Range_Class::adjust_bounds_callback(GtkRange* self, gdouble p0)
286 {
287   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
288       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
289
290   // Non-gtkmmproc-generated custom classes implicitly call the default
291   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
292   // generated classes can use this optimisation, which avoids the unnecessary
293   // parameter conversions if there is no possibility of the virtual function
294   // being overridden:
295   if(obj && obj->is_derived_())
296   {
297     try // Trap C++ exceptions which would normally be lost because this is a C callback.
298     {
299       // Call the virtual member method, which derived classes might override.
300       obj->on_adjust_bounds(p0
301 );
302     }
303     catch(...)
304     {
305       Glib::exception_handlers_invoke();
306     }
307   }
308   else
309   {
310     BaseClassType *const base = static_cast<BaseClassType*>(
311         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
312     );
313
314     // Call the original underlying C function:
315     if(base && base->adjust_bounds)
316       (*base->adjust_bounds)(self, p0);
317   }
318 }
319
320 void Range_Class::move_slider_callback(GtkRange* self, GtkScrollType p0)
321 {
322   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
323       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
324
325   // Non-gtkmmproc-generated custom classes implicitly call the default
326   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
327   // generated classes can use this optimisation, which avoids the unnecessary
328   // parameter conversions if there is no possibility of the virtual function
329   // being overridden:
330   if(obj && obj->is_derived_())
331   {
332     try // Trap C++ exceptions which would normally be lost because this is a C callback.
333     {
334       // Call the virtual member method, which derived classes might override.
335       obj->on_move_slider(((ScrollType)(p0))
336 );
337     }
338     catch(...)
339     {
340       Glib::exception_handlers_invoke();
341     }
342   }
343   else
344   {
345     BaseClassType *const base = static_cast<BaseClassType*>(
346         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
347     );
348
349     // Call the original underlying C function:
350     if(base && base->move_slider)
351       (*base->move_slider)(self, p0);
352   }
353 }
354
355
356 Glib::ObjectBase* Range_Class::wrap_new(GObject* o)
357 {
358   return manage(new Range((GtkRange*)(o)));
359
360 }
361
362
363 /* The implementation: */
364
365 Range::Range(const Glib::ConstructParams& construct_params)
366 :
367   Gtk::Widget(construct_params)
368 {
369   }
370
371 Range::Range(GtkRange* castitem)
372 :
373   Gtk::Widget((GtkWidget*)(castitem))
374 {
375   }
376
377 Range::~Range()
378 {
379   destroy_();
380 }
381
382 Range::CppClassType Range::range_class_; // initialize static member
383
384 GType Range::get_type()
385 {
386   return range_class_.init().get_type();
387 }
388
389 GType Range::get_base_type()
390 {
391   return gtk_range_get_type();
392 }
393
394
395 Range::Range()
396 :
397   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
398   Gtk::Widget(Glib::ConstructParams(range_class_.init()))
399 {
400   }
401
402 void Range::set_update_policy(UpdateType policy)
403 {
404   gtk_range_set_update_policy(gobj(), ((GtkUpdateType)(policy)));
405 }
406
407 UpdateType Range::get_update_policy() const
408 {
409   return ((UpdateType)(gtk_range_get_update_policy(const_cast<GtkRange*>(gobj()))));
410 }
411
412 void Range::set_adjustment(Gtk::Adjustment& adjustment)
413 {
414   gtk_range_set_adjustment(gobj(), (adjustment).gobj());
415 }
416
417 Gtk::Adjustment* Range::get_adjustment()
418 {
419   return Glib::wrap(gtk_range_get_adjustment(gobj()));
420 }
421
422 const Gtk::Adjustment* Range::get_adjustment() const
423 {
424   return Glib::wrap(gtk_range_get_adjustment(const_cast<GtkRange*>(gobj())));
425 }
426
427 void Range::set_inverted(bool setting)
428 {
429   gtk_range_set_inverted(gobj(), static_cast<int>(setting));
430 }
431
432 bool Range::get_inverted() const
433 {
434   return gtk_range_get_inverted(const_cast<GtkRange*>(gobj()));
435 }
436
437 void Range::set_increments(double step, double page)
438 {
439   gtk_range_set_increments(gobj(), step, page);
440 }
441
442 void Range::set_range(double min, double max)
443 {
444   gtk_range_set_range(gobj(), min, max);
445 }
446
447 void Range::set_value(double value)
448 {
449   gtk_range_set_value(gobj(), value);
450 }
451
452 double Range::get_value() const
453 {
454   return gtk_range_get_value(const_cast<GtkRange*>(gobj()));
455 }
456
457
458 Glib::SignalProxy0< void > Range::signal_value_changed()
459 {
460   return Glib::SignalProxy0< void >(this, &Range_signal_value_changed_info);
461 }
462
463 Glib::SignalProxy1< void,double > Range::signal_adjust_bounds()
464 {
465   return Glib::SignalProxy1< void,double >(this, &Range_signal_adjust_bounds_info);
466 }
467
468 Glib::SignalProxy1< void,ScrollType > Range::signal_move_slider()
469 {
470   return Glib::SignalProxy1< void,ScrollType >(this, &Range_signal_move_slider_info);
471 }
472
473 Glib::SignalProxy2< bool,ScrollType,double > Range::signal_change_value()
474 {
475   return Glib::SignalProxy2< bool,ScrollType,double >(this, &Range_signal_change_value_info);
476 }
477
478
479 Glib::PropertyProxy<UpdateType> Range::property_update_policy() 
480 {
481   return Glib::PropertyProxy<UpdateType>(this, "update-policy");
482 }
483
484 Glib::PropertyProxy_ReadOnly<UpdateType> Range::property_update_policy() const
485 {
486   return Glib::PropertyProxy_ReadOnly<UpdateType>(this, "update-policy");
487 }
488
489 Glib::PropertyProxy<Adjustment*> Range::property_adjustment() 
490 {
491   return Glib::PropertyProxy<Adjustment*>(this, "adjustment");
492 }
493
494 Glib::PropertyProxy_ReadOnly<Adjustment*> Range::property_adjustment() const
495 {
496   return Glib::PropertyProxy_ReadOnly<Adjustment*>(this, "adjustment");
497 }
498
499 Glib::PropertyProxy<bool> Range::property_inverted() 
500 {
501   return Glib::PropertyProxy<bool>(this, "inverted");
502 }
503
504 Glib::PropertyProxy_ReadOnly<bool> Range::property_inverted() const
505 {
506   return Glib::PropertyProxy_ReadOnly<bool>(this, "inverted");
507 }
508
509
510 void Gtk::Range::on_value_changed()
511 {
512   BaseClassType *const base = static_cast<BaseClassType*>(
513       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
514   );
515
516   if(base && base->value_changed)
517     (*base->value_changed)(gobj());
518 }
519
520 void Gtk::Range::on_adjust_bounds(double new_value)
521 {
522   BaseClassType *const base = static_cast<BaseClassType*>(
523       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
524   );
525
526   if(base && base->adjust_bounds)
527     (*base->adjust_bounds)(gobj(),new_value);
528 }
529
530 void Gtk::Range::on_move_slider(ScrollType scroll)
531 {
532   BaseClassType *const base = static_cast<BaseClassType*>(
533       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
534   );
535
536   if(base && base->move_slider)
537     (*base->move_slider)(gobj(),((GtkScrollType)(scroll)));
538 }
539
540
541 void Gtk::Range::get_range_border_vfunc(GtkBorder* border) const
542 {
543   BaseClassType *const base = static_cast<BaseClassType*>(
544       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
545   );
546
547   if(base && base->get_range_border)
548     (*base->get_range_border)(const_cast<GtkRange*>(gobj()),border);
549 }
550
551
552 } // namespace Gtk
553
554