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