Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / adjustment.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/adjustment.h>
4 #include <gtkmm/private/adjustment_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 #include <gtk/gtkadjustment.h>
28
29 namespace Gtk
30 {
31
32 Adjustment::Adjustment(double value,
33                        double lower, double upper,
34                        double step_increment, double page_increment,
35                        double page_size)
36 :
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))
39 {
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;
45   changed();
46
47   set_value(value);
48 }
49
50 void Adjustment::set_lower(double lower)
51 {
52   gobj()->lower = lower;
53   changed();
54 }
55
56 void Adjustment::set_upper(double upper)
57 {
58   gobj()->upper = upper;
59   changed();
60 }
61
62 void Adjustment::set_step_increment(double incr)
63 {
64   gobj()->step_increment = incr;
65   changed();
66 }
67
68 void Adjustment::set_page_increment(double incr)
69 {
70   gobj()->page_increment = incr;
71   changed();
72 }
73
74 void Adjustment::set_page_size(double size)
75 {
76   gobj()->page_size = size;
77   changed();
78 }
79
80 } // namespace Gtk
81
82
83 namespace
84 {
85
86 const Glib::SignalProxyInfo Adjustment_signal_changed_info =
87 {
88   "changed",
89   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
90   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
91 };
92
93
94 const Glib::SignalProxyInfo Adjustment_signal_value_changed_info =
95 {
96   "value_changed",
97   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
98   (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
99 };
100
101 } // anonymous namespace
102
103
104 namespace Glib
105 {
106
107 Gtk::Adjustment* wrap(GtkAdjustment* object, bool take_copy)
108 {
109   return dynamic_cast<Gtk::Adjustment *> (Glib::wrap_auto ((GObject*)(object), take_copy));
110 }
111
112 } /* namespace Glib */
113
114 namespace Gtk
115 {
116
117
118 /* The *_Class implementation: */
119
120 const Glib::Class& Adjustment_Class::init()
121 {
122   if(!gtype_) // create the GType if necessary
123   {
124     // Glib::Class has to know the class init function to clone custom types.
125     class_init_func_ = &Adjustment_Class::class_init_function;
126
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();
130
131     // Create the wrapper type, with the same class/instance size as the base type.
132     register_derived_type(gtk_adjustment_get_type());
133
134     // Add derived versions of interfaces, if the C type implements any interfaces:
135   }
136
137   return *this;
138 }
139
140 void Adjustment_Class::class_init_function(void* g_class, void* class_data)
141 {
142   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
143   CppClassParent::class_init_function(klass, class_data);
144
145   klass->changed = &changed_callback;
146   klass->value_changed = &value_changed_callback;
147 }
148
149
150 void Adjustment_Class::changed_callback(GtkAdjustment* self)
151 {
152   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
153       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
154
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
159   // being overridden:
160   if(obj && obj->is_derived_())
161   {
162     try // Trap C++ exceptions which would normally be lost because this is a C callback.
163     {
164       // Call the virtual member method, which derived classes might override.
165       obj->on_changed();
166     }
167     catch(...)
168     {
169       Glib::exception_handlers_invoke();
170     }
171   }
172   else
173   {
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).
176     );
177
178     // Call the original underlying C function:
179     if(base && base->changed)
180       (*base->changed)(self);
181   }
182 }
183
184 void Adjustment_Class::value_changed_callback(GtkAdjustment* self)
185 {
186   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
187       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
188
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
193   // being overridden:
194   if(obj && obj->is_derived_())
195   {
196     try // Trap C++ exceptions which would normally be lost because this is a C callback.
197     {
198       // Call the virtual member method, which derived classes might override.
199       obj->on_value_changed();
200     }
201     catch(...)
202     {
203       Glib::exception_handlers_invoke();
204     }
205   }
206   else
207   {
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).
210     );
211
212     // Call the original underlying C function:
213     if(base && base->value_changed)
214       (*base->value_changed)(self);
215   }
216 }
217
218
219 Glib::ObjectBase* Adjustment_Class::wrap_new(GObject* o)
220 {
221   return manage(new Adjustment((GtkAdjustment*)(o)));
222
223 }
224
225
226 /* The implementation: */
227
228 Adjustment::Adjustment(const Glib::ConstructParams& construct_params)
229 :
230   Gtk::Object(construct_params)
231 {
232   }
233
234 Adjustment::Adjustment(GtkAdjustment* castitem)
235 :
236   Gtk::Object((GtkObject*)(castitem))
237 {
238   }
239
240 Adjustment::~Adjustment()
241 {
242   destroy_();
243 }
244
245 Adjustment::CppClassType Adjustment::adjustment_class_; // initialize static member
246
247 GType Adjustment::get_type()
248 {
249   return adjustment_class_.init().get_type();
250 }
251
252 GType Adjustment::get_base_type()
253 {
254   return gtk_adjustment_get_type();
255 }
256
257
258 void Adjustment::changed()
259 {
260   gtk_adjustment_changed(gobj());
261 }
262
263 void Adjustment::value_changed()
264 {
265   gtk_adjustment_value_changed(gobj());
266 }
267
268 void Adjustment::clamp_page(double lower, double upper)
269 {
270   gtk_adjustment_clamp_page(gobj(), lower, upper);
271 }
272
273 void Adjustment::set_value(double value)
274 {
275   gtk_adjustment_set_value(gobj(), value);
276 }
277
278 double Adjustment::get_value() const
279 {
280   return gtk_adjustment_get_value(const_cast<GtkAdjustment*>(gobj()));
281 }
282
283 double Adjustment::get_lower() const
284 {
285   return gobj()->lower;
286 }
287
288 double Adjustment::get_upper() const
289 {
290   return gobj()->upper;
291 }
292
293 double Adjustment::get_step_increment() const
294 {
295   return gobj()->step_increment;
296 }
297
298 double Adjustment::get_page_increment() const
299 {
300   return gobj()->page_increment;
301 }
302
303 double Adjustment::get_page_size() const
304 {
305   return gobj()->page_size;
306 }
307
308
309 Glib::SignalProxy0< void > Adjustment::signal_changed()
310 {
311   return Glib::SignalProxy0< void >(this, &Adjustment_signal_changed_info);
312 }
313
314 Glib::SignalProxy0< void > Adjustment::signal_value_changed()
315 {
316   return Glib::SignalProxy0< void >(this, &Adjustment_signal_value_changed_info);
317 }
318
319
320 void Gtk::Adjustment::on_changed()
321 {
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).
324   );
325
326   if(base && base->changed)
327     (*base->changed)(gobj());
328 }
329
330 void Gtk::Adjustment::on_value_changed()
331 {
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).
334   );
335
336   if(base && base->value_changed)
337     (*base->value_changed)(gobj());
338 }
339
340
341 } // namespace Gtk
342
343