1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/range.h>
4 #include <gtkmm/private/range_p.h>
9 /* Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
26 #include <gtk/gtkrange.h>
27 #include <gtkmm/adjustment.h>
32 void Range::unset_adjustment()
34 gtk_range_set_adjustment(gobj(), 0);
43 const Glib::SignalProxyInfo Range_signal_value_changed_info =
46 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
47 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
51 void Range_signal_adjust_bounds_callback(GtkRange* self, gdouble p0,void* data)
54 typedef sigc::slot< void,double > SlotType;
56 // Do not try to call a signal on a disassociated wrapper.
57 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
61 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
62 (*static_cast<SlotType*>(slot))(p0
67 Glib::exception_handlers_invoke();
72 const Glib::SignalProxyInfo Range_signal_adjust_bounds_info =
75 (GCallback) &Range_signal_adjust_bounds_callback,
76 (GCallback) &Range_signal_adjust_bounds_callback
80 void Range_signal_move_slider_callback(GtkRange* self, GtkScrollType p0,void* data)
83 typedef sigc::slot< void,ScrollType > SlotType;
85 // Do not try to call a signal on a disassociated wrapper.
86 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
90 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
91 (*static_cast<SlotType*>(slot))(((ScrollType)(p0))
96 Glib::exception_handlers_invoke();
101 const Glib::SignalProxyInfo Range_signal_move_slider_info =
104 (GCallback) &Range_signal_move_slider_callback,
105 (GCallback) &Range_signal_move_slider_callback
109 gboolean Range_signal_change_value_callback(GtkRange* self, GtkScrollType p0,gdouble p1,void* data)
112 typedef sigc::slot< bool,ScrollType,double > SlotType;
114 // Do not try to call a signal on a disassociated wrapper.
115 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
119 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
120 return static_cast<int>((*static_cast<SlotType*>(slot))(((ScrollType)(p0))
126 Glib::exception_handlers_invoke();
130 typedef gboolean RType;
134 gboolean Range_signal_change_value_notify_callback(GtkRange* self, GtkScrollType p0,gdouble p1, void* data)
137 typedef sigc::slot< void,ScrollType,double > SlotType;
139 // Do not try to call a signal on a disassociated wrapper.
140 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
144 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
145 (*static_cast<SlotType*>(slot))(((ScrollType)(p0))
151 Glib::exception_handlers_invoke();
155 typedef gboolean RType;
159 const Glib::SignalProxyInfo Range_signal_change_value_info =
162 (GCallback) &Range_signal_change_value_callback,
163 (GCallback) &Range_signal_change_value_notify_callback
166 } // anonymous namespace
172 Gtk::Range* wrap(GtkRange* object, bool take_copy)
174 return dynamic_cast<Gtk::Range *> (Glib::wrap_auto ((GObject*)(object), take_copy));
177 } /* namespace Glib */
183 /* The *_Class implementation: */
185 const Glib::Class& Range_Class::init()
187 if(!gtype_) // create the GType if necessary
189 // Glib::Class has to know the class init function to clone custom types.
190 class_init_func_ = &Range_Class::class_init_function;
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();
196 // Create the wrapper type, with the same class/instance size as the base type.
197 register_derived_type(gtk_range_get_type());
199 // Add derived versions of interfaces, if the C type implements any interfaces:
205 void Range_Class::class_init_function(void* g_class, void* class_data)
207 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
208 CppClassParent::class_init_function(klass, class_data);
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;
216 void Range_Class::get_range_border_vfunc_callback(GtkRange* self, GtkBorder* border)
218 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
219 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
226 if(obj && obj->is_derived_())
228 try // Trap C++ exceptions which would normally be lost because this is a C callback.
230 // Call the virtual member method, which derived classes might override.
231 obj->get_range_border_vfunc(border);
235 Glib::exception_handlers_invoke();
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).
244 // Call the original underlying C function:
245 if(base && base->get_range_border)
246 (*base->get_range_border)(self, border);
251 void Range_Class::value_changed_callback(GtkRange* self)
253 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
254 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
261 if(obj && obj->is_derived_())
263 try // Trap C++ exceptions which would normally be lost because this is a C callback.
265 // Call the virtual member method, which derived classes might override.
266 obj->on_value_changed();
270 Glib::exception_handlers_invoke();
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).
279 // Call the original underlying C function:
280 if(base && base->value_changed)
281 (*base->value_changed)(self);
285 void Range_Class::adjust_bounds_callback(GtkRange* self, gdouble p0)
287 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
288 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
295 if(obj && obj->is_derived_())
297 try // Trap C++ exceptions which would normally be lost because this is a C callback.
299 // Call the virtual member method, which derived classes might override.
300 obj->on_adjust_bounds(p0
305 Glib::exception_handlers_invoke();
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).
314 // Call the original underlying C function:
315 if(base && base->adjust_bounds)
316 (*base->adjust_bounds)(self, p0);
320 void Range_Class::move_slider_callback(GtkRange* self, GtkScrollType p0)
322 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
323 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
330 if(obj && obj->is_derived_())
332 try // Trap C++ exceptions which would normally be lost because this is a C callback.
334 // Call the virtual member method, which derived classes might override.
335 obj->on_move_slider(((ScrollType)(p0))
340 Glib::exception_handlers_invoke();
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).
349 // Call the original underlying C function:
350 if(base && base->move_slider)
351 (*base->move_slider)(self, p0);
356 Glib::ObjectBase* Range_Class::wrap_new(GObject* o)
358 return manage(new Range((GtkRange*)(o)));
363 /* The implementation: */
365 Range::Range(const Glib::ConstructParams& construct_params)
367 Gtk::Widget(construct_params)
371 Range::Range(GtkRange* castitem)
373 Gtk::Widget((GtkWidget*)(castitem))
382 Range::CppClassType Range::range_class_; // initialize static member
384 GType Range::get_type()
386 return range_class_.init().get_type();
389 GType Range::get_base_type()
391 return gtk_range_get_type();
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()))
402 void Range::set_update_policy(UpdateType policy)
404 gtk_range_set_update_policy(gobj(), ((GtkUpdateType)(policy)));
407 UpdateType Range::get_update_policy() const
409 return ((UpdateType)(gtk_range_get_update_policy(const_cast<GtkRange*>(gobj()))));
412 void Range::set_adjustment(Gtk::Adjustment& adjustment)
414 gtk_range_set_adjustment(gobj(), (adjustment).gobj());
417 Gtk::Adjustment* Range::get_adjustment()
419 return Glib::wrap(gtk_range_get_adjustment(gobj()));
422 const Gtk::Adjustment* Range::get_adjustment() const
424 return Glib::wrap(gtk_range_get_adjustment(const_cast<GtkRange*>(gobj())));
427 void Range::set_inverted(bool setting)
429 gtk_range_set_inverted(gobj(), static_cast<int>(setting));
432 bool Range::get_inverted() const
434 return gtk_range_get_inverted(const_cast<GtkRange*>(gobj()));
437 void Range::set_increments(double step, double page)
439 gtk_range_set_increments(gobj(), step, page);
442 void Range::set_range(double min, double max)
444 gtk_range_set_range(gobj(), min, max);
447 void Range::set_value(double value)
449 gtk_range_set_value(gobj(), value);
452 double Range::get_value() const
454 return gtk_range_get_value(const_cast<GtkRange*>(gobj()));
458 Glib::SignalProxy0< void > Range::signal_value_changed()
460 return Glib::SignalProxy0< void >(this, &Range_signal_value_changed_info);
463 Glib::SignalProxy1< void,double > Range::signal_adjust_bounds()
465 return Glib::SignalProxy1< void,double >(this, &Range_signal_adjust_bounds_info);
468 Glib::SignalProxy1< void,ScrollType > Range::signal_move_slider()
470 return Glib::SignalProxy1< void,ScrollType >(this, &Range_signal_move_slider_info);
473 Glib::SignalProxy2< bool,ScrollType,double > Range::signal_change_value()
475 return Glib::SignalProxy2< bool,ScrollType,double >(this, &Range_signal_change_value_info);
479 Glib::PropertyProxy<UpdateType> Range::property_update_policy()
481 return Glib::PropertyProxy<UpdateType>(this, "update-policy");
484 Glib::PropertyProxy_ReadOnly<UpdateType> Range::property_update_policy() const
486 return Glib::PropertyProxy_ReadOnly<UpdateType>(this, "update-policy");
489 Glib::PropertyProxy<Adjustment*> Range::property_adjustment()
491 return Glib::PropertyProxy<Adjustment*>(this, "adjustment");
494 Glib::PropertyProxy_ReadOnly<Adjustment*> Range::property_adjustment() const
496 return Glib::PropertyProxy_ReadOnly<Adjustment*>(this, "adjustment");
499 Glib::PropertyProxy<bool> Range::property_inverted()
501 return Glib::PropertyProxy<bool>(this, "inverted");
504 Glib::PropertyProxy_ReadOnly<bool> Range::property_inverted() const
506 return Glib::PropertyProxy_ReadOnly<bool>(this, "inverted");
510 void Gtk::Range::on_value_changed()
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).
516 if(base && base->value_changed)
517 (*base->value_changed)(gobj());
520 void Gtk::Range::on_adjust_bounds(double new_value)
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).
526 if(base && base->adjust_bounds)
527 (*base->adjust_bounds)(gobj(),new_value);
530 void Gtk::Range::on_move_slider(ScrollType scroll)
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).
536 if(base && base->move_slider)
537 (*base->move_slider)(gobj(),((GtkScrollType)(scroll)));
541 void Gtk::Range::get_range_border_vfunc(GtkBorder* border) const
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).
547 if(base && base->get_range_border)
548 (*base->get_range_border)(const_cast<GtkRange*>(gobj()),border);