1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/adjustment.h>
4 #include <gtkmm/private/adjustment_p.h>
11 * Copyright 1998-2002 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.
27 #include <gtk/gtkadjustment.h>
32 Adjustment::Adjustment(double value,
33 double lower, double upper,
34 double step_increment, double page_increment,
37 Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
38 Gtk::Object(Glib::ConstructParams(adjustment_class_.init(), (char*) 0))
40 gobj()->lower = lower;
41 gobj()->upper = upper;
42 gobj()->step_increment = step_increment;
43 gobj()->page_increment = page_increment;
44 gobj()->page_size = page_size;
50 void Adjustment::set_lower(double lower)
52 gobj()->lower = lower;
56 void Adjustment::set_upper(double upper)
58 gobj()->upper = upper;
62 void Adjustment::set_step_increment(double incr)
64 gobj()->step_increment = incr;
68 void Adjustment::set_page_increment(double incr)
70 gobj()->page_increment = incr;
74 void Adjustment::set_page_size(double size)
76 gobj()->page_size = size;
86 const Glib::SignalProxyInfo Adjustment_signal_changed_info =
89 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
90 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
94 const Glib::SignalProxyInfo Adjustment_signal_value_changed_info =
97 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
98 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
101 } // anonymous namespace
107 Gtk::Adjustment* wrap(GtkAdjustment* object, bool take_copy)
109 return dynamic_cast<Gtk::Adjustment *> (Glib::wrap_auto ((GObject*)(object), take_copy));
112 } /* namespace Glib */
118 /* The *_Class implementation: */
120 const Glib::Class& Adjustment_Class::init()
122 if(!gtype_) // create the GType if necessary
124 // Glib::Class has to know the class init function to clone custom types.
125 class_init_func_ = &Adjustment_Class::class_init_function;
127 // This is actually just optimized away, apparently with no harm.
128 // Make sure that the parent type has been created.
129 //CppClassParent::CppObjectType::get_type();
131 // Create the wrapper type, with the same class/instance size as the base type.
132 register_derived_type(gtk_adjustment_get_type());
134 // Add derived versions of interfaces, if the C type implements any interfaces:
140 void Adjustment_Class::class_init_function(void* g_class, void* class_data)
142 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
143 CppClassParent::class_init_function(klass, class_data);
145 klass->changed = &changed_callback;
146 klass->value_changed = &value_changed_callback;
150 void Adjustment_Class::changed_callback(GtkAdjustment* self)
152 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
153 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
155 // Non-gtkmmproc-generated custom classes implicitly call the default
156 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
157 // generated classes can use this optimisation, which avoids the unnecessary
158 // parameter conversions if there is no possibility of the virtual function
160 if(obj && obj->is_derived_())
162 try // Trap C++ exceptions which would normally be lost because this is a C callback.
164 // Call the virtual member method, which derived classes might override.
169 Glib::exception_handlers_invoke();
174 BaseClassType *const base = static_cast<BaseClassType*>(
175 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
178 // Call the original underlying C function:
179 if(base && base->changed)
180 (*base->changed)(self);
184 void Adjustment_Class::value_changed_callback(GtkAdjustment* self)
186 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
187 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
189 // Non-gtkmmproc-generated custom classes implicitly call the default
190 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
191 // generated classes can use this optimisation, which avoids the unnecessary
192 // parameter conversions if there is no possibility of the virtual function
194 if(obj && obj->is_derived_())
196 try // Trap C++ exceptions which would normally be lost because this is a C callback.
198 // Call the virtual member method, which derived classes might override.
199 obj->on_value_changed();
203 Glib::exception_handlers_invoke();
208 BaseClassType *const base = static_cast<BaseClassType*>(
209 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
212 // Call the original underlying C function:
213 if(base && base->value_changed)
214 (*base->value_changed)(self);
219 Glib::ObjectBase* Adjustment_Class::wrap_new(GObject* o)
221 return manage(new Adjustment((GtkAdjustment*)(o)));
226 /* The implementation: */
228 Adjustment::Adjustment(const Glib::ConstructParams& construct_params)
230 Gtk::Object(construct_params)
234 Adjustment::Adjustment(GtkAdjustment* castitem)
236 Gtk::Object((GtkObject*)(castitem))
240 Adjustment::~Adjustment()
245 Adjustment::CppClassType Adjustment::adjustment_class_; // initialize static member
247 GType Adjustment::get_type()
249 return adjustment_class_.init().get_type();
252 GType Adjustment::get_base_type()
254 return gtk_adjustment_get_type();
258 void Adjustment::changed()
260 gtk_adjustment_changed(gobj());
263 void Adjustment::value_changed()
265 gtk_adjustment_value_changed(gobj());
268 void Adjustment::clamp_page(double lower, double upper)
270 gtk_adjustment_clamp_page(gobj(), lower, upper);
273 void Adjustment::set_value(double value)
275 gtk_adjustment_set_value(gobj(), value);
278 double Adjustment::get_value() const
280 return gtk_adjustment_get_value(const_cast<GtkAdjustment*>(gobj()));
283 double Adjustment::get_lower() const
285 return gobj()->lower;
288 double Adjustment::get_upper() const
290 return gobj()->upper;
293 double Adjustment::get_step_increment() const
295 return gobj()->step_increment;
298 double Adjustment::get_page_increment() const
300 return gobj()->page_increment;
303 double Adjustment::get_page_size() const
305 return gobj()->page_size;
309 Glib::SignalProxy0< void > Adjustment::signal_changed()
311 return Glib::SignalProxy0< void >(this, &Adjustment_signal_changed_info);
314 Glib::SignalProxy0< void > Adjustment::signal_value_changed()
316 return Glib::SignalProxy0< void >(this, &Adjustment_signal_value_changed_info);
320 void Gtk::Adjustment::on_changed()
322 BaseClassType *const base = static_cast<BaseClassType*>(
323 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
326 if(base && base->changed)
327 (*base->changed)(gobj());
330 void Gtk::Adjustment::on_value_changed()
332 BaseClassType *const base = static_cast<BaseClassType*>(
333 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
336 if(base && base->value_changed)
337 (*base->value_changed)(gobj());