Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / viewport.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/viewport.h>
4 #include <gtkmm/private/viewport_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* 
10  *
11  * Copyright 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 <gtkmm/viewport.h>
29 #include <gtkmm/adjustment.h>
30 #include <gtk/gtkviewport.h>
31
32
33 namespace
34 {
35
36 void Viewport_signal_set_scroll_adjustments_callback(GtkViewport* self, GtkAdjustment* p0,GtkAdjustment* p1,void* data)
37 {
38   using namespace Gtk;
39   typedef sigc::slot< void,Gtk::Adjustment*,Gtk::Adjustment* > SlotType;
40
41   // Do not try to call a signal on a disassociated wrapper.
42   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
43   {
44     try
45     {
46       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
47         (*static_cast<SlotType*>(slot))(Glib::wrap(p0)
48 , Glib::wrap(p1)
49 );
50     }
51     catch(...)
52     {
53       Glib::exception_handlers_invoke();
54     }
55   }
56 }
57
58 const Glib::SignalProxyInfo Viewport_signal_set_scroll_adjustments_info =
59 {
60   "set_scroll_adjustments",
61   (GCallback) &Viewport_signal_set_scroll_adjustments_callback,
62   (GCallback) &Viewport_signal_set_scroll_adjustments_callback
63 };
64
65 } // anonymous namespace
66
67
68 namespace Glib
69 {
70
71 Gtk::Viewport* wrap(GtkViewport* object, bool take_copy)
72 {
73   return dynamic_cast<Gtk::Viewport *> (Glib::wrap_auto ((GObject*)(object), take_copy));
74 }
75
76 } /* namespace Glib */
77
78 namespace Gtk
79 {
80
81
82 /* The *_Class implementation: */
83
84 const Glib::Class& Viewport_Class::init()
85 {
86   if(!gtype_) // create the GType if necessary
87   {
88     // Glib::Class has to know the class init function to clone custom types.
89     class_init_func_ = &Viewport_Class::class_init_function;
90
91     // This is actually just optimized away, apparently with no harm.
92     // Make sure that the parent type has been created.
93     //CppClassParent::CppObjectType::get_type();
94
95     // Create the wrapper type, with the same class/instance size as the base type.
96     register_derived_type(gtk_viewport_get_type());
97
98     // Add derived versions of interfaces, if the C type implements any interfaces:
99   }
100
101   return *this;
102 }
103
104 void Viewport_Class::class_init_function(void* g_class, void* class_data)
105 {
106   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
107   CppClassParent::class_init_function(klass, class_data);
108
109   klass->set_scroll_adjustments = &set_scroll_adjustments_callback;
110 }
111
112
113 void Viewport_Class::set_scroll_adjustments_callback(GtkViewport* self, GtkAdjustment* p0, GtkAdjustment* p1)
114 {
115   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
116       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
117
118   // Non-gtkmmproc-generated custom classes implicitly call the default
119   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
120   // generated classes can use this optimisation, which avoids the unnecessary
121   // parameter conversions if there is no possibility of the virtual function
122   // being overridden:
123   if(obj && obj->is_derived_())
124   {
125     try // Trap C++ exceptions which would normally be lost because this is a C callback.
126     {
127       // Call the virtual member method, which derived classes might override.
128       obj->on_set_scroll_adjustments(Glib::wrap(p0)
129 , Glib::wrap(p1)
130 );
131     }
132     catch(...)
133     {
134       Glib::exception_handlers_invoke();
135     }
136   }
137   else
138   {
139     BaseClassType *const base = static_cast<BaseClassType*>(
140         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
141     );
142
143     // Call the original underlying C function:
144     if(base && base->set_scroll_adjustments)
145       (*base->set_scroll_adjustments)(self, p0, p1);
146   }
147 }
148
149
150 Glib::ObjectBase* Viewport_Class::wrap_new(GObject* o)
151 {
152   return manage(new Viewport((GtkViewport*)(o)));
153
154 }
155
156
157 /* The implementation: */
158
159 Viewport::Viewport(const Glib::ConstructParams& construct_params)
160 :
161   Gtk::Bin(construct_params)
162 {
163   }
164
165 Viewport::Viewport(GtkViewport* castitem)
166 :
167   Gtk::Bin((GtkBin*)(castitem))
168 {
169   }
170
171 Viewport::~Viewport()
172 {
173   destroy_();
174 }
175
176 Viewport::CppClassType Viewport::viewport_class_; // initialize static member
177
178 GType Viewport::get_type()
179 {
180   return viewport_class_.init().get_type();
181 }
182
183 GType Viewport::get_base_type()
184 {
185   return gtk_viewport_get_type();
186 }
187
188
189 Viewport::Viewport(Adjustment& hadjustment, Adjustment& vadjustment)
190 :
191   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
192   Gtk::Bin(Glib::ConstructParams(viewport_class_.init(), "hadjustment", (hadjustment).gobj(), "vadjustment", (vadjustment).gobj(), (char*) 0))
193 {
194   }
195
196 Gtk::Adjustment* Viewport::get_hadjustment()
197 {
198   return Glib::wrap(gtk_viewport_get_hadjustment(gobj()));
199 }
200
201 const Gtk::Adjustment* Viewport::get_hadjustment() const
202 {
203   return Glib::wrap(gtk_viewport_get_hadjustment(const_cast<GtkViewport*>(gobj())));
204 }
205
206 Gtk::Adjustment* Viewport::get_vadjustment()
207 {
208   return Glib::wrap(gtk_viewport_get_vadjustment(gobj()));
209 }
210
211 const Gtk::Adjustment* Viewport::get_vadjustment() const
212 {
213   return Glib::wrap(gtk_viewport_get_vadjustment(const_cast<GtkViewport*>(gobj())));
214 }
215
216 void Viewport::set_hadjustment(Gtk::Adjustment* adjustment)
217 {
218   gtk_viewport_set_hadjustment(gobj(), (GtkAdjustment*)Glib::unwrap(adjustment));
219 }
220
221 void Viewport::set_hadjustment(Gtk::Adjustment& adjustment)
222 {
223   gtk_viewport_set_hadjustment(gobj(), (adjustment).gobj());
224 }
225
226 void Viewport::set_vadjustment(Gtk::Adjustment* adjustment)
227 {
228   gtk_viewport_set_vadjustment(gobj(), (GtkAdjustment*)Glib::unwrap(adjustment));
229 }
230
231 void Viewport::set_vadjustment(Gtk::Adjustment& adjustment)
232 {
233   gtk_viewport_set_vadjustment(gobj(), (adjustment).gobj());
234 }
235
236 void Viewport::set_shadow_type(ShadowType type)
237 {
238   gtk_viewport_set_shadow_type(gobj(), ((GtkShadowType)(type)));
239 }
240
241 ShadowType Viewport::get_shadow_type() const
242 {
243   return ((ShadowType)(gtk_viewport_get_shadow_type(const_cast<GtkViewport*>(gobj()))));
244 }
245
246
247 Glib::SignalProxy2< void,Gtk::Adjustment*,Gtk::Adjustment* > Viewport::signal_set_scroll_adjustments()
248 {
249   return Glib::SignalProxy2< void,Gtk::Adjustment*,Gtk::Adjustment* >(this, &Viewport_signal_set_scroll_adjustments_info);
250 }
251
252
253 Glib::PropertyProxy<Gtk::Adjustment*> Viewport::property_hadjustment() 
254 {
255   return Glib::PropertyProxy<Gtk::Adjustment*>(this, "hadjustment");
256 }
257
258 Glib::PropertyProxy_ReadOnly<Gtk::Adjustment*> Viewport::property_hadjustment() const
259 {
260   return Glib::PropertyProxy_ReadOnly<Gtk::Adjustment*>(this, "hadjustment");
261 }
262
263 Glib::PropertyProxy<Gtk::Adjustment*> Viewport::property_vadjustment() 
264 {
265   return Glib::PropertyProxy<Gtk::Adjustment*>(this, "vadjustment");
266 }
267
268 Glib::PropertyProxy_ReadOnly<Gtk::Adjustment*> Viewport::property_vadjustment() const
269 {
270   return Glib::PropertyProxy_ReadOnly<Gtk::Adjustment*>(this, "vadjustment");
271 }
272
273 Glib::PropertyProxy<ShadowType> Viewport::property_shadow_type() 
274 {
275   return Glib::PropertyProxy<ShadowType>(this, "shadow-type");
276 }
277
278 Glib::PropertyProxy_ReadOnly<ShadowType> Viewport::property_shadow_type() const
279 {
280   return Glib::PropertyProxy_ReadOnly<ShadowType>(this, "shadow-type");
281 }
282
283
284 void Gtk::Viewport::on_set_scroll_adjustments(Gtk::Adjustment* hadjustment, Gtk::Adjustment* vadjustment)
285 {
286   BaseClassType *const base = static_cast<BaseClassType*>(
287       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
288   );
289
290   if(base && base->set_scroll_adjustments)
291     (*base->set_scroll_adjustments)(gobj(),(GtkAdjustment*)Glib::unwrap(hadjustment),(GtkAdjustment*)Glib::unwrap(vadjustment));
292 }
293
294
295 } // namespace Gtk
296
297