Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / printoperationpreview.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <gtkmm/printoperationpreview.h>
5 #include <gtkmm/private/printoperationpreview_p.h>
6
7 // -*- c++ -*-
8 /* Copyright (C) 2006 The gtkmm Development Team
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the Free
22  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  */
24
25 #include <gtk/gtkprintoperationpreview.h>
26
27 namespace
28 {
29
30
31 static void PrintOperationPreview_signal_ready_callback(GtkPrintOperationPreview* self, GtkPrintContext* p0,void* data)
32 {
33   using namespace Gtk;
34   typedef sigc::slot< void,const Glib::RefPtr<PrintContext>& > SlotType;
35
36   // Do not try to call a signal on a disassociated wrapper.
37   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
38   {
39     #ifdef GLIBMM_EXCEPTIONS_ENABLED
40     try
41     {
42     #endif //GLIBMM_EXCEPTIONS_ENABLED
43       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
44         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
45 );
46     #ifdef GLIBMM_EXCEPTIONS_ENABLED
47     }
48     catch(...)
49     {
50       Glib::exception_handlers_invoke();
51     }
52     #endif //GLIBMM_EXCEPTIONS_ENABLED
53   }
54 }
55
56 static const Glib::SignalProxyInfo PrintOperationPreview_signal_ready_info =
57 {
58   "ready",
59   (GCallback) &PrintOperationPreview_signal_ready_callback,
60   (GCallback) &PrintOperationPreview_signal_ready_callback
61 };
62
63
64 static void PrintOperationPreview_signal_got_page_size_callback(GtkPrintOperationPreview* self, GtkPrintContext* p0,GtkPageSetup* p1,void* data)
65 {
66   using namespace Gtk;
67   typedef sigc::slot< void,const Glib::RefPtr<PrintContext>&,const Glib::RefPtr<PageSetup>& > SlotType;
68
69   // Do not try to call a signal on a disassociated wrapper.
70   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
71   {
72     #ifdef GLIBMM_EXCEPTIONS_ENABLED
73     try
74     {
75     #endif //GLIBMM_EXCEPTIONS_ENABLED
76       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
77         (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
78 , Glib::wrap(p1, true)
79 );
80     #ifdef GLIBMM_EXCEPTIONS_ENABLED
81     }
82     catch(...)
83     {
84       Glib::exception_handlers_invoke();
85     }
86     #endif //GLIBMM_EXCEPTIONS_ENABLED
87   }
88 }
89
90 static const Glib::SignalProxyInfo PrintOperationPreview_signal_got_page_size_info =
91 {
92   "got_page_size",
93   (GCallback) &PrintOperationPreview_signal_got_page_size_callback,
94   (GCallback) &PrintOperationPreview_signal_got_page_size_callback
95 };
96
97
98 } // anonymous namespace
99
100
101 namespace Glib
102 {
103
104 Glib::RefPtr<Gtk::PrintOperationPreview> wrap(GtkPrintOperationPreview* object, bool take_copy)
105 {
106   return Glib::RefPtr<Gtk::PrintOperationPreview>( dynamic_cast<Gtk::PrintOperationPreview*> (Glib::wrap_auto_interface<Gtk::PrintOperationPreview> ((GObject*)(object), take_copy)) );
107   //We use dynamic_cast<> in case of multiple inheritance.
108 }
109
110 } // namespace Glib
111
112
113 namespace Gtk
114 {
115
116
117 /* The *_Class implementation: */
118
119 const Glib::Interface_Class& PrintOperationPreview_Class::init()
120 {
121   if(!gtype_) // create the GType if necessary
122   {
123     // Glib::Interface_Class has to know the interface init function
124     // in order to add interfaces to implementing types.
125     class_init_func_ = &PrintOperationPreview_Class::iface_init_function;
126
127     // We can not derive from another interface, and it is not necessary anyway.
128     gtype_ = gtk_print_operation_preview_get_type();
129   }
130
131   return *this;
132 }
133
134 void PrintOperationPreview_Class::iface_init_function(void* g_iface, void*)
135 {
136   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
137
138   //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
139   //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
140   g_assert(klass != 0); 
141
142 #ifdef GLIBMM_VFUNCS_ENABLED
143   klass->render_page = &render_page_vfunc_callback;
144   klass->end_preview = &end_preview_vfunc_callback;
145   klass->is_selected = &is_selected_vfunc_callback;
146 #endif //GLIBMM_VFUNCS_ENABLED
147
148 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
149   klass->ready = &ready_callback;
150   klass->got_page_size = &got_page_size_callback;
151 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
152 }
153
154 #ifdef GLIBMM_VFUNCS_ENABLED
155 void PrintOperationPreview_Class::render_page_vfunc_callback(GtkPrintOperationPreview* self, gint page_nr)
156 {
157   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
158       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
159
160   // Non-gtkmmproc-generated custom classes implicitly call the default
161   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
162   // generated classes can use this optimisation, which avoids the unnecessary
163   // parameter conversions if there is no possibility of the virtual function
164   // being overridden:
165   if(obj_base && obj_base->is_derived_())
166   {
167     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
168     if(obj) // This can be NULL during destruction.
169     {
170       #ifdef GLIBMM_EXCEPTIONS_ENABLED
171       try // Trap C++ exceptions which would normally be lost because this is a C callback.
172       {
173       #endif //GLIBMM_EXCEPTIONS_ENABLED
174         // Call the virtual member method, which derived classes might override.
175         obj->render_page_vfunc(page_nr
176 );
177         return;
178       #ifdef GLIBMM_EXCEPTIONS_ENABLED
179       }
180       catch(...)
181       {
182         Glib::exception_handlers_invoke();
183       }
184       #endif //GLIBMM_EXCEPTIONS_ENABLED
185     }
186   }
187   
188   BaseClassType *const base = static_cast<BaseClassType*>(
189       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
190 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
191 )  );
192
193   // Call the original underlying C function:
194   if(base && base->render_page)
195     (*base->render_page)(self, page_nr);
196
197 }
198 void PrintOperationPreview_Class::end_preview_vfunc_callback(GtkPrintOperationPreview* self)
199 {
200   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
201       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
202
203   // Non-gtkmmproc-generated custom classes implicitly call the default
204   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
205   // generated classes can use this optimisation, which avoids the unnecessary
206   // parameter conversions if there is no possibility of the virtual function
207   // being overridden:
208   if(obj_base && obj_base->is_derived_())
209   {
210     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
211     if(obj) // This can be NULL during destruction.
212     {
213       #ifdef GLIBMM_EXCEPTIONS_ENABLED
214       try // Trap C++ exceptions which would normally be lost because this is a C callback.
215       {
216       #endif //GLIBMM_EXCEPTIONS_ENABLED
217         // Call the virtual member method, which derived classes might override.
218         obj->end_preview_vfunc();
219         return;
220       #ifdef GLIBMM_EXCEPTIONS_ENABLED
221       }
222       catch(...)
223       {
224         Glib::exception_handlers_invoke();
225       }
226       #endif //GLIBMM_EXCEPTIONS_ENABLED
227     }
228   }
229   
230   BaseClassType *const base = static_cast<BaseClassType*>(
231       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
232 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
233 )  );
234
235   // Call the original underlying C function:
236   if(base && base->end_preview)
237     (*base->end_preview)(self);
238
239 }
240 gboolean PrintOperationPreview_Class::is_selected_vfunc_callback(GtkPrintOperationPreview* self, gint page_nr)
241 {
242   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
243       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
244
245   // Non-gtkmmproc-generated custom classes implicitly call the default
246   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
247   // generated classes can use this optimisation, which avoids the unnecessary
248   // parameter conversions if there is no possibility of the virtual function
249   // being overridden:
250   if(obj_base && obj_base->is_derived_())
251   {
252     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
253     if(obj) // This can be NULL during destruction.
254     {
255       #ifdef GLIBMM_EXCEPTIONS_ENABLED
256       try // Trap C++ exceptions which would normally be lost because this is a C callback.
257       {
258       #endif //GLIBMM_EXCEPTIONS_ENABLED
259         // Call the virtual member method, which derived classes might override.
260         return static_cast<int>(obj->is_selected_vfunc(page_nr
261 ));
262       #ifdef GLIBMM_EXCEPTIONS_ENABLED
263       }
264       catch(...)
265       {
266         Glib::exception_handlers_invoke();
267       }
268       #endif //GLIBMM_EXCEPTIONS_ENABLED
269     }
270   }
271   
272   BaseClassType *const base = static_cast<BaseClassType*>(
273       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
274 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
275 )  );
276
277   // Call the original underlying C function:
278   if(base && base->is_selected)
279     return (*base->is_selected)(self, page_nr);
280
281
282   typedef gboolean RType;
283   return RType();
284 }
285 #endif //GLIBMM_VFUNCS_ENABLED
286
287 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
288 void PrintOperationPreview_Class::ready_callback(GtkPrintOperationPreview* self, GtkPrintContext* p0)
289 {
290   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
291       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
292
293   // Non-gtkmmproc-generated custom classes implicitly call the default
294   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
295   // generated classes can use this optimisation, which avoids the unnecessary
296   // parameter conversions if there is no possibility of the virtual function
297   // being overridden:
298   if(obj_base && obj_base->is_derived_())
299   {
300     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
301     if(obj) // This can be NULL during destruction.
302     {
303       #ifdef GLIBMM_EXCEPTIONS_ENABLED
304       try // Trap C++ exceptions which would normally be lost because this is a C callback.
305       {
306       #endif //GLIBMM_EXCEPTIONS_ENABLED
307         // Call the virtual member method, which derived classes might override.
308         obj->on_ready(Glib::wrap(p0, true)
309 );
310         return;
311       #ifdef GLIBMM_EXCEPTIONS_ENABLED
312       }
313       catch(...)
314       {
315         Glib::exception_handlers_invoke();
316       }
317       #endif //GLIBMM_EXCEPTIONS_ENABLED
318     }
319   }
320   
321   BaseClassType *const base = static_cast<BaseClassType*>(
322         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
323 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
324 )    );
325
326   // Call the original underlying C function:
327   if(base && base->ready)
328     (*base->ready)(self, p0);
329 }
330 void PrintOperationPreview_Class::got_page_size_callback(GtkPrintOperationPreview* self, GtkPrintContext* p0, GtkPageSetup* p1)
331 {
332   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
333       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
334
335   // Non-gtkmmproc-generated custom classes implicitly call the default
336   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
337   // generated classes can use this optimisation, which avoids the unnecessary
338   // parameter conversions if there is no possibility of the virtual function
339   // being overridden:
340   if(obj_base && obj_base->is_derived_())
341   {
342     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
343     if(obj) // This can be NULL during destruction.
344     {
345       #ifdef GLIBMM_EXCEPTIONS_ENABLED
346       try // Trap C++ exceptions which would normally be lost because this is a C callback.
347       {
348       #endif //GLIBMM_EXCEPTIONS_ENABLED
349         // Call the virtual member method, which derived classes might override.
350         obj->on_got_page_size(Glib::wrap(p0, true)
351 , Glib::wrap(p1, true)
352 );
353         return;
354       #ifdef GLIBMM_EXCEPTIONS_ENABLED
355       }
356       catch(...)
357       {
358         Glib::exception_handlers_invoke();
359       }
360       #endif //GLIBMM_EXCEPTIONS_ENABLED
361     }
362   }
363   
364   BaseClassType *const base = static_cast<BaseClassType*>(
365         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
366 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
367 )    );
368
369   // Call the original underlying C function:
370   if(base && base->got_page_size)
371     (*base->got_page_size)(self, p0, p1);
372 }
373 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
374
375
376 Glib::ObjectBase* PrintOperationPreview_Class::wrap_new(GObject* object)
377 {
378   return new PrintOperationPreview((GtkPrintOperationPreview*)(object));
379 }
380
381
382 /* The implementation: */
383
384 PrintOperationPreview::PrintOperationPreview()
385 :
386   Glib::Interface(printoperationpreview_class_.init())
387 {}
388
389 PrintOperationPreview::PrintOperationPreview(GtkPrintOperationPreview* castitem)
390 :
391   Glib::Interface((GObject*)(castitem))
392 {}
393
394 PrintOperationPreview::~PrintOperationPreview()
395 {}
396
397 // static
398 void PrintOperationPreview::add_interface(GType gtype_implementer)
399 {
400   printoperationpreview_class_.init().add_interface(gtype_implementer);
401 }
402
403 PrintOperationPreview::CppClassType PrintOperationPreview::printoperationpreview_class_; // initialize static member
404
405 GType PrintOperationPreview::get_type()
406 {
407   return printoperationpreview_class_.init().get_type();
408 }
409
410 GType PrintOperationPreview::get_base_type()
411 {
412   return gtk_print_operation_preview_get_type();
413 }
414
415
416 void PrintOperationPreview::render_page(int page_nr)
417 {
418 gtk_print_operation_preview_render_page(gobj(), page_nr); 
419 }
420
421 void PrintOperationPreview::end_preview()
422 {
423 gtk_print_operation_preview_end_preview(gobj()); 
424 }
425
426 bool PrintOperationPreview::is_selected(int page_nr) const
427 {
428   return gtk_print_operation_preview_is_selected(const_cast<GtkPrintOperationPreview*>(gobj()), page_nr);
429 }
430
431
432 Glib::SignalProxy1< void,const Glib::RefPtr<PrintContext>& > PrintOperationPreview::signal_ready()
433 {
434   return Glib::SignalProxy1< void,const Glib::RefPtr<PrintContext>& >(this, &PrintOperationPreview_signal_ready_info);
435 }
436
437
438 Glib::SignalProxy2< void,const Glib::RefPtr<PrintContext>&,const Glib::RefPtr<PageSetup>& > PrintOperationPreview::signal_got_page_size()
439 {
440   return Glib::SignalProxy2< void,const Glib::RefPtr<PrintContext>&,const Glib::RefPtr<PageSetup>& >(this, &PrintOperationPreview_signal_got_page_size_info);
441 }
442
443
444 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
445 void Gtk::PrintOperationPreview::on_ready(const Glib::RefPtr<PrintContext>& context)
446 {
447   BaseClassType *const base = static_cast<BaseClassType*>(
448       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
449 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
450 )  );
451
452   if(base && base->ready)
453     (*base->ready)(gobj(),Glib::unwrap(context));
454 }
455 void Gtk::PrintOperationPreview::on_got_page_size(const Glib::RefPtr<PrintContext>& context, const Glib::RefPtr<PageSetup>& page_setup)
456 {
457   BaseClassType *const base = static_cast<BaseClassType*>(
458       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
459 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
460 )  );
461
462   if(base && base->got_page_size)
463     (*base->got_page_size)(gobj(),Glib::unwrap(context),Glib::unwrap(page_setup));
464 }
465 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
466
467 #ifdef GLIBMM_VFUNCS_ENABLED
468 void Gtk::PrintOperationPreview::render_page_vfunc(int page_nr) 
469 {
470   BaseClassType *const base = static_cast<BaseClassType*>(
471       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
472 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
473 )  );
474
475   if(base && base->render_page)
476     (*base->render_page)(gobj(),page_nr);
477 }
478 void Gtk::PrintOperationPreview::end_preview_vfunc() 
479 {
480   BaseClassType *const base = static_cast<BaseClassType*>(
481       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
482 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
483 )  );
484
485   if(base && base->end_preview)
486     (*base->end_preview)(gobj());
487 }
488 bool Gtk::PrintOperationPreview::is_selected_vfunc(int page_nr) const
489 {
490   BaseClassType *const base = static_cast<BaseClassType*>(
491       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
492 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
493 )  );
494
495   if(base && base->is_selected)
496     return (*base->is_selected)(const_cast<GtkPrintOperationPreview*>(gobj()),page_nr);
497
498   typedef bool RType;
499   return RType();
500 }
501 #endif //GLIBMM_VFUNCS_ENABLED
502
503
504 } // namespace Gtk
505
506