1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/printer.h>
5 #include <gtkmm/private/printer_p.h>
8 /* Copyright (C) 2006 The gtkmm Development Team
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.
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.
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.
25 #include <gtk/gtkprinter.h>
27 // This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function.
29 static gboolean SignalProxy_Custom_gtk_callback(GtkPrinter* gtk_printer, gpointer data)
31 const Gtk::SlotPrinterEnumerator* the_slot = static_cast<Gtk::SlotPrinterEnumerator*>(data);
33 #ifdef GLIBMM_EXCEPTIONS_ENABLED
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);
40 return (*the_slot)(printer);
41 #ifdef GLIBMM_EXCEPTIONS_ENABLED
45 Glib::exception_handlers_invoke();
46 return false; // arbitrary default;
48 #endif //GLIBMM_EXCEPTIONS_ENABLED
51 static void SignalProxy_Custom_gtk_callback_destroy(void* data)
53 delete static_cast<Gtk::SlotPrinterEnumerator*>(data);
59 bool Printer::equal(const Glib::RefPtr<Printer>& other) const
61 return (static_cast<bool>(gtk_printer_compare(const_cast<GtkPrinter*>(this->gobj()),
62 const_cast<GtkPrinter*>(other->gobj()))));
65 void enumerate_printers(const SlotPrinterEnumerator& slot, bool wait)
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);
71 gtk_enumerate_printers(&SignalProxy_Custom_gtk_callback,
73 &SignalProxy_Custom_gtk_callback_destroy,
74 static_cast<int>(wait));
83 static void Printer_signal_details_acquired_callback(GtkPrinter* self, gboolean p0,void* data)
86 typedef sigc::slot< void,bool > SlotType;
88 // Do not try to call a signal on a disassociated wrapper.
89 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
91 #ifdef GLIBMM_EXCEPTIONS_ENABLED
94 #endif //GLIBMM_EXCEPTIONS_ENABLED
95 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
96 (*static_cast<SlotType*>(slot))(p0
98 #ifdef GLIBMM_EXCEPTIONS_ENABLED
102 Glib::exception_handlers_invoke();
104 #endif //GLIBMM_EXCEPTIONS_ENABLED
108 static const Glib::SignalProxyInfo Printer_signal_details_acquired_info =
111 (GCallback) &Printer_signal_details_acquired_callback,
112 (GCallback) &Printer_signal_details_acquired_callback
116 } // anonymous namespace
119 GType Glib::Value<Gtk::PrintCapabilities>::value_type()
121 return gtk_print_capabilities_get_type();
128 Glib::RefPtr<Gtk::Printer> wrap(GtkPrinter* object, bool take_copy)
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.
134 } /* namespace Glib */
141 /* The *_Class implementation: */
143 const Glib::Class& Printer_Class::init()
145 if(!gtype_) // create the GType if necessary
147 // Glib::Class has to know the class init function to clone custom types.
148 class_init_func_ = &Printer_Class::class_init_function;
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();
154 // Create the wrapper type, with the same class/instance size as the base type.
155 register_derived_type(gtk_printer_get_type());
157 // Add derived versions of interfaces, if the C type implements any interfaces:
163 void Printer_Class::class_init_function(void* g_class, void* class_data)
165 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
166 CppClassParent::class_init_function(klass, class_data);
168 #ifdef GLIBMM_VFUNCS_ENABLED
169 #endif //GLIBMM_VFUNCS_ENABLED
171 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
172 klass->details_acquired = &details_acquired_callback;
173 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
176 #ifdef GLIBMM_VFUNCS_ENABLED
177 #endif //GLIBMM_VFUNCS_ENABLED
179 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
180 void Printer_Class::details_acquired_callback(GtkPrinter* self, gboolean p0)
182 Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
183 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
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
190 if(obj_base && obj_base->is_derived_())
192 CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
193 if(obj) // This can be NULL during destruction.
195 #ifdef GLIBMM_EXCEPTIONS_ENABLED
196 try // Trap C++ exceptions which would normally be lost because this is a C callback.
198 #endif //GLIBMM_EXCEPTIONS_ENABLED
199 // Call the virtual member method, which derived classes might override.
200 obj->on_details_acquired(p0
203 #ifdef GLIBMM_EXCEPTIONS_ENABLED
207 Glib::exception_handlers_invoke();
209 #endif //GLIBMM_EXCEPTIONS_ENABLED
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).
217 // Call the original underlying C function:
218 if(base && base->details_acquired)
219 (*base->details_acquired)(self, p0);
221 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
224 Glib::ObjectBase* Printer_Class::wrap_new(GObject* object)
226 return new Printer((GtkPrinter*)object);
230 /* The implementation: */
232 GtkPrinter* Printer::gobj_copy()
238 Printer::Printer(const Glib::ConstructParams& construct_params)
240 Glib::Object(construct_params)
243 Printer::Printer(GtkPrinter* castitem)
245 Glib::Object((GObject*)(castitem))
252 Printer::CppClassType Printer::printer_class_; // initialize static member
254 GType Printer::get_type()
256 return printer_class_.init().get_type();
259 GType Printer::get_base_type()
261 return gtk_printer_get_type();
265 Glib::ustring Printer::get_name() const
267 return Glib::convert_const_gchar_ptr_to_ustring(gtk_printer_get_name(const_cast<GtkPrinter*>(gobj())));
270 Glib::ustring Printer::get_state_message() const
272 return Glib::convert_const_gchar_ptr_to_ustring(gtk_printer_get_state_message(const_cast<GtkPrinter*>(gobj())));
275 Glib::ustring Printer::get_description() const
277 return Glib::convert_const_gchar_ptr_to_ustring(gtk_printer_get_description(const_cast<GtkPrinter*>(gobj())));
280 Glib::ustring Printer::get_location() const
282 return Glib::convert_const_gchar_ptr_to_ustring(gtk_printer_get_location(const_cast<GtkPrinter*>(gobj())));
285 Glib::ustring Printer::get_icon_name() const
287 return Glib::convert_const_gchar_ptr_to_ustring(gtk_printer_get_icon_name(const_cast<GtkPrinter*>(gobj())));
290 int Printer::get_job_count() const
292 return gtk_printer_get_job_count(const_cast<GtkPrinter*>(gobj()));
295 bool Printer::is_active() const
297 return gtk_printer_is_active(const_cast<GtkPrinter*>(gobj()));
300 bool Printer::is_virtual() const
302 return gtk_printer_is_virtual(const_cast<GtkPrinter*>(gobj()));
305 bool Printer::is_default() const
307 return gtk_printer_is_default(const_cast<GtkPrinter*>(gobj()));
310 bool Printer::accepts_pdf() const
312 return gtk_printer_accepts_pdf(const_cast<GtkPrinter*>(gobj()));
315 bool Printer::accepts_ps() const
317 return gtk_printer_accepts_ps(const_cast<GtkPrinter*>(gobj()));
320 Glib::ListHandle< Glib::RefPtr<PageSetup> > Printer::list_papers()
322 return Glib::ListHandle< Glib::RefPtr<PageSetup> >(gtk_printer_list_papers(gobj()), Glib::OWNERSHIP_DEEP);
325 Glib::ListHandle< Glib::RefPtr<const PageSetup> > Printer::list_papers() const
327 return Glib::ListHandle< Glib::RefPtr<const PageSetup> >(gtk_printer_list_papers(const_cast<GtkPrinter*>(gobj())), Glib::OWNERSHIP_DEEP);
330 bool Printer::has_details() const
332 return gtk_printer_has_details(const_cast<GtkPrinter*>(gobj()));
335 void Printer::request_details()
337 gtk_printer_request_details(gobj());
340 PrintCapabilities Printer::get_capabilities() const
342 return (PrintCapabilities)gtk_printer_get_capabilities(const_cast<GtkPrinter*>(gobj()));
346 Glib::SignalProxy1< void,bool > Printer::signal_details_acquired()
348 return Glib::SignalProxy1< void,bool >(this, &Printer_signal_details_acquired_info);
352 #ifdef GLIBMM_PROPERTIES_ENABLED
353 Glib::PropertyProxy_ReadOnly<Glib::ustring> Printer::property_name() const
355 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "name");
357 #endif //GLIBMM_PROPERTIES_ENABLED
359 #ifdef GLIBMM_PROPERTIES_ENABLED
360 Glib::PropertyProxy_ReadOnly<bool> Printer::property_is_virtual() const
362 return Glib::PropertyProxy_ReadOnly<bool>(this, "is-virtual");
364 #endif //GLIBMM_PROPERTIES_ENABLED
366 #ifdef GLIBMM_PROPERTIES_ENABLED
367 Glib::PropertyProxy_ReadOnly<Glib::ustring> Printer::property_state_message() const
369 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "state-message");
371 #endif //GLIBMM_PROPERTIES_ENABLED
373 #ifdef GLIBMM_PROPERTIES_ENABLED
374 Glib::PropertyProxy_ReadOnly<Glib::ustring> Printer::property_location() const
376 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "location");
378 #endif //GLIBMM_PROPERTIES_ENABLED
380 #ifdef GLIBMM_PROPERTIES_ENABLED
381 Glib::PropertyProxy_ReadOnly<Glib::ustring> Printer::property_icon_name() const
383 return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "icon-name");
385 #endif //GLIBMM_PROPERTIES_ENABLED
387 #ifdef GLIBMM_PROPERTIES_ENABLED
388 Glib::PropertyProxy_ReadOnly<int> Printer::property_job_count() const
390 return Glib::PropertyProxy_ReadOnly<int>(this, "job-count");
392 #endif //GLIBMM_PROPERTIES_ENABLED
394 #ifdef GLIBMM_PROPERTIES_ENABLED
395 Glib::PropertyProxy_ReadOnly<bool> Printer::property_accepts_pdf() const
397 return Glib::PropertyProxy_ReadOnly<bool>(this, "accepts-pdf");
399 #endif //GLIBMM_PROPERTIES_ENABLED
401 #ifdef GLIBMM_PROPERTIES_ENABLED
402 Glib::PropertyProxy_ReadOnly<bool> Printer::property_accepts_ps() const
404 return Glib::PropertyProxy_ReadOnly<bool>(this, "accepts-ps");
406 #endif //GLIBMM_PROPERTIES_ENABLED
409 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
410 void Gtk::Printer::on_details_acquired(bool success)
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).
416 if(base && base->details_acquired)
417 (*base->details_acquired)(gobj(),static_cast<int>(success));
419 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
421 #ifdef GLIBMM_VFUNCS_ENABLED
422 #endif //GLIBMM_VFUNCS_ENABLED