add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / printer.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <gtkmm/printer.h>
5 #include <gtkmm/private/printer_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/gtkprinter.h>
26
27 // This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function.
28
29 static gboolean SignalProxy_Custom_gtk_callback(GtkPrinter* gtk_printer, gpointer data)
30 {
31   const Gtk::SlotPrinterEnumerator* the_slot = static_cast<Gtk::SlotPrinterEnumerator*>(data);
32
33   #ifdef GLIBMM_EXCEPTIONS_ENABLED
34   try
35   {
36   #endif //GLIBMM_EXCEPTIONS_ENABLED
37     // Create a suitable C++ instance to pass to the C++ method;
38     Glib::RefPtr<Gtk::Printer> printer = Glib::wrap(gtk_printer);
39
40     return (*the_slot)(printer);
41   #ifdef GLIBMM_EXCEPTIONS_ENABLED
42   }
43   catch(...)
44   {
45     Glib::exception_handlers_invoke();
46     return false; // arbitrary default;
47   }
48   #endif //GLIBMM_EXCEPTIONS_ENABLED
49 }
50
51 static void SignalProxy_Custom_gtk_callback_destroy(void* data)
52 {
53   delete static_cast<Gtk::SlotPrinterEnumerator*>(data);
54 }
55
56 namespace Gtk
57 {
58
59 bool Printer::equal(const Glib::RefPtr<Printer>& other) const
60 {
61   return (static_cast<bool>(gtk_printer_compare(const_cast<GtkPrinter*>(this->gobj()),
62                                                 const_cast<GtkPrinter*>(other->gobj()))));
63 }
64
65 void enumerate_printers(const SlotPrinterEnumerator& slot, bool wait)
66 {
67   // Create a copy of the slot. A pointer to this will be passed through the callback's data parameter.
68   // It will be deleted when SignalProxy_Custom_gtk_callback_destroy() is called.
69   SlotPrinterEnumerator* slot_copy = new SlotPrinterEnumerator(slot);
70       
71   gtk_enumerate_printers(&SignalProxy_Custom_gtk_callback,
72                          slot_copy,
73                          &SignalProxy_Custom_gtk_callback_destroy,
74                          static_cast<int>(wait));
75 }
76
77 } // namespace Gtk
78
79 namespace
80 {
81
82
83 static void Printer_signal_details_acquired_callback(GtkPrinter* self, gboolean p0,void* data)
84 {
85   using namespace Gtk;
86   typedef sigc::slot< void,bool > SlotType;
87
88   // Do not try to call a signal on a disassociated wrapper.
89   if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
90   {
91     #ifdef GLIBMM_EXCEPTIONS_ENABLED
92     try
93     {
94     #endif //GLIBMM_EXCEPTIONS_ENABLED
95       if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
96         (*static_cast<SlotType*>(slot))(p0
97 );
98     #ifdef GLIBMM_EXCEPTIONS_ENABLED
99     }
100     catch(...)
101     {
102       Glib::exception_handlers_invoke();
103     }
104     #endif //GLIBMM_EXCEPTIONS_ENABLED
105   }
106 }
107
108 static const Glib::SignalProxyInfo Printer_signal_details_acquired_info =
109 {
110   "details_acquired",
111   (GCallback) &Printer_signal_details_acquired_callback,
112   (GCallback) &Printer_signal_details_acquired_callback
113 };
114
115
116 } // anonymous namespace
117
118 // static
119 GType Glib::Value<Gtk::PrintCapabilities>::value_type()
120 {
121   return gtk_print_capabilities_get_type();
122 }
123
124
125 namespace Glib
126 {
127
128 Glib::RefPtr<Gtk::Printer> wrap(GtkPrinter* object, bool take_copy)
129 {
130   return Glib::RefPtr<Gtk::Printer>( dynamic_cast<Gtk::Printer*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
131   //We use dynamic_cast<> in case of multiple inheritance.
132 }
133
134 } /* namespace Glib */
135
136
137 namespace Gtk
138 {
139
140
141 /* The *_Class implementation: */
142
143 const Glib::Class& Printer_Class::init()
144 {
145   if(!gtype_) // create the GType if necessary
146   {
147     // Glib::Class has to know the class init function to clone custom types.
148     class_init_func_ = &Printer_Class::class_init_function;
149
150     // This is actually just optimized away, apparently with no harm.
151     // Make sure that the parent type has been created.
152     //CppClassParent::CppObjectType::get_type();
153
154     // Create the wrapper type, with the same class/instance size as the base type.
155     register_derived_type(gtk_printer_get_type());
156
157     // Add derived versions of interfaces, if the C type implements any interfaces:
158   }
159
160   return *this;
161 }
162
163 void Printer_Class::class_init_function(void* g_class, void* class_data)
164 {
165   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
166   CppClassParent::class_init_function(klass, class_data);
167
168 #ifdef GLIBMM_VFUNCS_ENABLED
169 #endif //GLIBMM_VFUNCS_ENABLED
170
171 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
172   klass->details_acquired = &details_acquired_callback;
173 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
174 }
175
176 #ifdef GLIBMM_VFUNCS_ENABLED
177 #endif //GLIBMM_VFUNCS_ENABLED
178
179 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
180 void Printer_Class::details_acquired_callback(GtkPrinter* self, gboolean p0)
181 {
182   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
183       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
184
185   // Non-gtkmmproc-generated custom classes implicitly call the default
186   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
187   // generated classes can use this optimisation, which avoids the unnecessary
188   // parameter conversions if there is no possibility of the virtual function
189   // being overridden:
190   if(obj_base && obj_base->is_derived_())
191   {
192     CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
193     if(obj) // This can be NULL during destruction.
194     {
195       #ifdef GLIBMM_EXCEPTIONS_ENABLED
196       try // Trap C++ exceptions which would normally be lost because this is a C callback.
197       {
198       #endif //GLIBMM_EXCEPTIONS_ENABLED
199         // Call the virtual member method, which derived classes might override.
200         obj->on_details_acquired(p0
201 );
202         return;
203       #ifdef GLIBMM_EXCEPTIONS_ENABLED
204       }
205       catch(...)
206       {
207         Glib::exception_handlers_invoke();
208       }
209       #endif //GLIBMM_EXCEPTIONS_ENABLED
210     }
211   }
212   
213   BaseClassType *const base = static_cast<BaseClassType*>(
214         g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
215     );
216
217   // Call the original underlying C function:
218   if(base && base->details_acquired)
219     (*base->details_acquired)(self, p0);
220 }
221 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
222
223
224 Glib::ObjectBase* Printer_Class::wrap_new(GObject* object)
225 {
226   return new Printer((GtkPrinter*)object);
227 }
228
229
230 /* The implementation: */
231
232 GtkPrinter* Printer::gobj_copy()
233 {
234   reference();
235   return gobj();
236 }
237
238 Printer::Printer(const Glib::ConstructParams& construct_params)
239 :
240   Glib::Object(construct_params)
241 {}
242
243 Printer::Printer(GtkPrinter* castitem)
244 :
245   Glib::Object((GObject*)(castitem))
246 {}
247
248 Printer::~Printer()
249 {}
250
251
252 Printer::CppClassType Printer::printer_class_; // initialize static member
253
254 GType Printer::get_type()
255 {
256   return printer_class_.init().get_type();
257 }
258
259 GType Printer::get_base_type()
260 {
261   return gtk_printer_get_type();
262 }
263
264
265 Glib::ustring Printer::get_name() const
266 {
267   return Glib::convert_const_gchar_ptr_to_ustring(gtk_printer_get_name(const_cast<GtkPrinter*>(gobj())));
268 }
269
270 Glib::ustring Printer::get_state_message() const
271 {
272   return Glib::convert_const_gchar_ptr_to_ustring(gtk_printer_get_state_message(const_cast<GtkPrinter*>(gobj())));
273 }
274
275 Glib::ustring Printer::get_description() const
276 {
277   return Glib::convert_const_gchar_ptr_to_ustring(gtk_printer_get_description(const_cast<GtkPrinter*>(gobj())));
278 }
279
280 Glib::ustring Printer::get_location() const
281 {
282   return Glib::convert_const_gchar_ptr_to_ustring(gtk_printer_get_location(const_cast<GtkPrinter*>(gobj())));
283 }
284
285 Glib::ustring Printer::get_icon_name() const
286 {
287   return Glib::convert_const_gchar_ptr_to_ustring(gtk_printer_get_icon_name(const_cast<GtkPrinter*>(gobj())));
288 }
289
290 int Printer::get_job_count() const
291 {
292   return gtk_printer_get_job_count(const_cast<GtkPrinter*>(gobj()));
293 }
294
295 bool Printer::is_active() const
296 {
297   return gtk_printer_is_active(const_cast<GtkPrinter*>(gobj()));
298 }
299
300 bool Printer::is_virtual() const
301 {
302   return gtk_printer_is_virtual(const_cast<GtkPrinter*>(gobj()));
303 }
304
305 bool Printer::is_default() const
306 {
307   return gtk_printer_is_default(const_cast<GtkPrinter*>(gobj()));
308 }
309
310 bool Printer::accepts_pdf() const
311 {
312   return gtk_printer_accepts_pdf(const_cast<GtkPrinter*>(gobj()));
313 }
314
315 bool Printer::accepts_ps() const
316 {
317   return gtk_printer_accepts_ps(const_cast<GtkPrinter*>(gobj()));
318 }
319
320 Glib::ListHandle< Glib::RefPtr<PageSetup> > Printer::list_papers()
321 {
322   return Glib::ListHandle< Glib::RefPtr<PageSetup> >(gtk_printer_list_papers(gobj()), Glib::OWNERSHIP_DEEP);
323 }
324
325 Glib::ListHandle< Glib::RefPtr<const PageSetup> > Printer::list_papers() const
326 {
327   return Glib::ListHandle< Glib::RefPtr<const PageSetup> >(gtk_printer_list_papers(const_cast<GtkPrinter*>(gobj())), Glib::OWNERSHIP_DEEP);
328 }
329
330 bool Printer::has_details() const
331 {
332   return gtk_printer_has_details(const_cast<GtkPrinter*>(gobj()));
333 }
334
335 void Printer::request_details()
336 {
337 gtk_printer_request_details(gobj()); 
338 }
339
340 PrintCapabilities Printer::get_capabilities() const
341 {
342   return (PrintCapabilities)gtk_printer_get_capabilities(const_cast<GtkPrinter*>(gobj()));
343 }
344
345
346 Glib::SignalProxy1< void,bool > Printer::signal_details_acquired()
347 {
348   return Glib::SignalProxy1< void,bool >(this, &Printer_signal_details_acquired_info);
349 }
350
351
352 #ifdef GLIBMM_PROPERTIES_ENABLED
353 Glib::PropertyProxy_ReadOnly<Glib::ustring> Printer::property_name() const
354 {
355   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "name");
356 }
357 #endif //GLIBMM_PROPERTIES_ENABLED
358
359 #ifdef GLIBMM_PROPERTIES_ENABLED
360 Glib::PropertyProxy_ReadOnly<bool> Printer::property_is_virtual() const
361 {
362   return Glib::PropertyProxy_ReadOnly<bool>(this, "is-virtual");
363 }
364 #endif //GLIBMM_PROPERTIES_ENABLED
365
366 #ifdef GLIBMM_PROPERTIES_ENABLED
367 Glib::PropertyProxy_ReadOnly<Glib::ustring> Printer::property_state_message() const
368 {
369   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "state-message");
370 }
371 #endif //GLIBMM_PROPERTIES_ENABLED
372
373 #ifdef GLIBMM_PROPERTIES_ENABLED
374 Glib::PropertyProxy_ReadOnly<Glib::ustring> Printer::property_location() const
375 {
376   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "location");
377 }
378 #endif //GLIBMM_PROPERTIES_ENABLED
379
380 #ifdef GLIBMM_PROPERTIES_ENABLED
381 Glib::PropertyProxy_ReadOnly<Glib::ustring> Printer::property_icon_name() const
382 {
383   return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "icon-name");
384 }
385 #endif //GLIBMM_PROPERTIES_ENABLED
386
387 #ifdef GLIBMM_PROPERTIES_ENABLED
388 Glib::PropertyProxy_ReadOnly<int> Printer::property_job_count() const
389 {
390   return Glib::PropertyProxy_ReadOnly<int>(this, "job-count");
391 }
392 #endif //GLIBMM_PROPERTIES_ENABLED
393
394 #ifdef GLIBMM_PROPERTIES_ENABLED
395 Glib::PropertyProxy_ReadOnly<bool> Printer::property_accepts_pdf() const
396 {
397   return Glib::PropertyProxy_ReadOnly<bool>(this, "accepts-pdf");
398 }
399 #endif //GLIBMM_PROPERTIES_ENABLED
400
401 #ifdef GLIBMM_PROPERTIES_ENABLED
402 Glib::PropertyProxy_ReadOnly<bool> Printer::property_accepts_ps() const
403 {
404   return Glib::PropertyProxy_ReadOnly<bool>(this, "accepts-ps");
405 }
406 #endif //GLIBMM_PROPERTIES_ENABLED
407
408
409 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
410 void Gtk::Printer::on_details_acquired(bool success)
411 {
412   BaseClassType *const base = static_cast<BaseClassType*>(
413       g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
414   );
415
416   if(base && base->details_acquired)
417     (*base->details_acquired)(gobj(),static_cast<int>(success));
418 }
419 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
420
421 #ifdef GLIBMM_VFUNCS_ENABLED
422 #endif //GLIBMM_VFUNCS_ENABLED
423
424
425 } // namespace Gtk
426
427