2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_PRINTER_H
4 #define _GTKMM_PRINTER_H
9 /* Copyright (C) 2006 The gtkmm Development Team
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free
23 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <gtkmm/pagesetup.h>
29 #ifndef DOXYGEN_SHOULD_SKIP_THIS
30 typedef struct _GtkPrinter GtkPrinter;
31 typedef struct _GtkPrinterClass GtkPrinterClass;
32 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
36 { class Printer_Class; } // namespace Gtk
40 /** @addtogroup gtkmmEnums Enums and Flags */
44 * @par Bitwise operators:
45 * <tt>%PrintCapabilities operator|(PrintCapabilities, PrintCapabilities)</tt><br>
46 * <tt>%PrintCapabilities operator&(PrintCapabilities, PrintCapabilities)</tt><br>
47 * <tt>%PrintCapabilities operator^(PrintCapabilities, PrintCapabilities)</tt><br>
48 * <tt>%PrintCapabilities operator~(PrintCapabilities)</tt><br>
49 * <tt>%PrintCapabilities& operator|=(PrintCapabilities&, PrintCapabilities)</tt><br>
50 * <tt>%PrintCapabilities& operator&=(PrintCapabilities&, PrintCapabilities)</tt><br>
51 * <tt>%PrintCapabilities& operator^=(PrintCapabilities&, PrintCapabilities)</tt><br>
53 enum PrintCapabilities
55 PRINT_CAPABILITY_PAGE_SET = 1 << 0,
56 PRINT_CAPABILITY_COPIES = 1 << 1,
57 PRINT_CAPABILITY_COLLATE = 1 << 2,
58 PRINT_CAPABILITY_REVERSE = 1 << 3,
59 PRINT_CAPABILITY_SCALE = 1 << 4,
60 PRINT_CAPABILITY_GENERATE_PDF = 1 << 5,
61 PRINT_CAPABILITY_GENERATE_PS = 1 << 6,
62 PRINT_CAPABILITY_PREVIEW = 1 << 7,
63 PRINT_CAPABILITY_NUMBER_UP = 1 << 8
66 /** @ingroup gtkmmEnums */
67 inline PrintCapabilities operator|(PrintCapabilities lhs, PrintCapabilities rhs)
68 { return static_cast<PrintCapabilities>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
70 /** @ingroup gtkmmEnums */
71 inline PrintCapabilities operator&(PrintCapabilities lhs, PrintCapabilities rhs)
72 { return static_cast<PrintCapabilities>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
74 /** @ingroup gtkmmEnums */
75 inline PrintCapabilities operator^(PrintCapabilities lhs, PrintCapabilities rhs)
76 { return static_cast<PrintCapabilities>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
78 /** @ingroup gtkmmEnums */
79 inline PrintCapabilities operator~(PrintCapabilities flags)
80 { return static_cast<PrintCapabilities>(~static_cast<unsigned>(flags)); }
82 /** @ingroup gtkmmEnums */
83 inline PrintCapabilities& operator|=(PrintCapabilities& lhs, PrintCapabilities rhs)
84 { return (lhs = static_cast<PrintCapabilities>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
86 /** @ingroup gtkmmEnums */
87 inline PrintCapabilities& operator&=(PrintCapabilities& lhs, PrintCapabilities rhs)
88 { return (lhs = static_cast<PrintCapabilities>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
90 /** @ingroup gtkmmEnums */
91 inline PrintCapabilities& operator^=(PrintCapabilities& lhs, PrintCapabilities rhs)
92 { return (lhs = static_cast<PrintCapabilities>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
97 #ifndef DOXYGEN_SHOULD_SKIP_THIS
102 class Value<Gtk::PrintCapabilities> : public Glib::Value_Flags<Gtk::PrintCapabilities>
105 static GType value_type() G_GNUC_CONST;
109 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
116 /** A Printer object represents a printer. You only need to deal directly with printers if you use the
117 * non-portable PrintUnixDialog API.
119 * A Printer object allows to get status information about the printer, such as its description, its location,
120 * the number of queued jobs, etc. Most importantly, a Printer object can be used to create a PrintJob object,
121 * which lets you print to the printer.
128 class Printer : public Glib::Object
131 #ifndef DOXYGEN_SHOULD_SKIP_THIS
134 typedef Printer CppObjectType;
135 typedef Printer_Class CppClassType;
136 typedef GtkPrinter BaseObjectType;
137 typedef GtkPrinterClass BaseClassType;
139 private: friend class Printer_Class;
140 static CppClassType printer_class_;
144 Printer(const Printer&);
145 Printer& operator=(const Printer&);
148 explicit Printer(const Glib::ConstructParams& construct_params);
149 explicit Printer(GtkPrinter* castitem);
151 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
156 #ifndef DOXYGEN_SHOULD_SKIP_THIS
157 static GType get_type() G_GNUC_CONST;
158 static GType get_base_type() G_GNUC_CONST;
161 ///Provides access to the underlying C GObject.
162 GtkPrinter* gobj() { return reinterpret_cast<GtkPrinter*>(gobject_); }
164 ///Provides access to the underlying C GObject.
165 const GtkPrinter* gobj() const { return reinterpret_cast<GtkPrinter*>(gobject_); }
167 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
168 GtkPrinter* gobj_copy();
172 //This is not available in on Win32.
173 //This source file will not be compiled,
174 //and the class will not be registered in wrap_init.h or wrap_init.cc
178 //TODO: _WRAP_CREATE() - probably not, it's only accessible through PrintUnixDialog + GtkPrintBackend should be ignored
179 //TODO: I think these are not needed as well, and that Printer should generally be read-only - marko.
182 bool equal(const Glib::RefPtr<Printer>& other) const;
184 //GtkPrintBackend is in a "semi-private" header.
185 //_WRAP_METHOD(Glib::RefPtr<PrintBackend> get_backend(), gtk_printer_get_backend, refreturn)
186 //_WRAP_METHOD(Glib::RefPtr<const PrintBackend> get_backend() const, gtk_printer_get_backend, refreturn, constversion)
189 /** Return value: the name of @a printer
190 * @return The name of @a printer
194 Glib::ustring get_name() const;
196 /** Return value: the state message of @a printer
197 * @return The state message of @a printer
201 Glib::ustring get_state_message() const;
203 /** Gets the description of the printer.
204 * @return The description of @a printer
208 Glib::ustring get_description() const;
210 /** Return value: the location of @a printer
211 * @return The location of @a printer
215 Glib::ustring get_location() const;
217 /** Gets the name of the icon to use for the printer.
218 * @return The icon name for @a printer
222 Glib::ustring get_icon_name() const;
224 /** Gets the number of jobs currently queued on the printer.
225 * @return The number of jobs on @a printer
229 int get_job_count() const;
231 /** Return value: <tt>true</tt> if @a printer is active
232 * @return <tt>true</tt> if @a printer is active
236 bool is_active() const;
238 /** Return value: <tt>true</tt> if @a printer is virtual
239 * @return <tt>true</tt> if @a printer is virtual
243 bool is_virtual() const;
245 /** Return value: <tt>true</tt> if @a printer is the default
246 * @return <tt>true</tt> if @a printer is the default
250 bool is_default() const;
252 /** Return value: <tt>true</tt> if @a printer accepts PDF
253 * @return <tt>true</tt> if @a printer accepts PDF
257 bool accepts_pdf() const;
259 /** Return value: <tt>true</tt> if @a printer accepts PostScript
260 * @return <tt>true</tt> if @a printer accepts PostScript
264 bool accepts_ps() const;
267 /** Lists all the paper sizes @a printer supports.
268 * This will return an empty list unless the printer's details are
269 * available. See has_details() and request_details().
270 * @return A newly allocated list of newly allocated Gtk::PageSetup s.
274 Glib::ListHandle< Glib::RefPtr<PageSetup> > list_papers();
277 /** Lists all the paper sizes @a printer supports.
278 * This will return an empty list unless the printer's details are
279 * available. See has_details() and request_details().
280 * @return A newly allocated list of newly allocated Gtk::PageSetup s.
284 Glib::ListHandle< Glib::RefPtr<const PageSetup> > list_papers() const;
287 /** Return value: <tt>true</tt> if @a printer details are available
288 * @return <tt>true</tt> if @a printer details are available
292 bool has_details() const;
294 /** Requests the printer details. When the details are available,
295 * the details_acquired signal will be emitted.
299 void request_details();
301 /** Return value: the printer's capabilities
302 * @return The printer's capabilities
306 PrintCapabilities get_capabilities() const;
311 * <tt>void on_my_%details_acquired(bool success)</tt>
314 Glib::SignalProxy1< void,bool > signal_details_acquired();
317 #ifdef GLIBMM_PROPERTIES_ENABLED
318 /** Name of the printer.
320 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
321 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
322 * the value of the property changes.
324 Glib::PropertyProxy_ReadOnly<Glib::ustring> property_name() const;
325 #endif //#GLIBMM_PROPERTIES_ENABLED
328 //GtkPrintBackend is in a "semi-private" header:
329 //_WRAP_PROPERTY("backend", Glib::RefPtr<PrintBackend>)
331 #ifdef GLIBMM_PROPERTIES_ENABLED
332 /** FALSE if this represents a real hardware printer.
334 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
335 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
336 * the value of the property changes.
338 Glib::PropertyProxy_ReadOnly<bool> property_is_virtual() const;
339 #endif //#GLIBMM_PROPERTIES_ENABLED
342 #ifdef GLIBMM_PROPERTIES_ENABLED
343 /** String giving the current state of the printer.
345 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
346 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
347 * the value of the property changes.
349 Glib::PropertyProxy_ReadOnly<Glib::ustring> property_state_message() const;
350 #endif //#GLIBMM_PROPERTIES_ENABLED
353 #ifdef GLIBMM_PROPERTIES_ENABLED
354 /** The location of the printer.
356 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
357 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
358 * the value of the property changes.
360 Glib::PropertyProxy_ReadOnly<Glib::ustring> property_location() const;
361 #endif //#GLIBMM_PROPERTIES_ENABLED
364 #ifdef GLIBMM_PROPERTIES_ENABLED
365 /** The icon name to use for the printer.
367 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
368 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
369 * the value of the property changes.
371 Glib::PropertyProxy_ReadOnly<Glib::ustring> property_icon_name() const;
372 #endif //#GLIBMM_PROPERTIES_ENABLED
375 #ifdef GLIBMM_PROPERTIES_ENABLED
376 /** Number of jobs queued in the printer.
378 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
379 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
380 * the value of the property changes.
382 Glib::PropertyProxy_ReadOnly<int> property_job_count() const;
383 #endif //#GLIBMM_PROPERTIES_ENABLED
386 #ifdef GLIBMM_PROPERTIES_ENABLED
387 /** TRUE if this printer can accept PDF.
389 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
390 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
391 * the value of the property changes.
393 Glib::PropertyProxy_ReadOnly<bool> property_accepts_pdf() const;
394 #endif //#GLIBMM_PROPERTIES_ENABLED
397 #ifdef GLIBMM_PROPERTIES_ENABLED
398 /** TRUE if this printer can accept PostScript.
400 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
401 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
402 * the value of the property changes.
404 Glib::PropertyProxy_ReadOnly<bool> property_accepts_ps() const;
405 #endif //#GLIBMM_PROPERTIES_ENABLED
411 //C++ methods used to invoke GTK+ virtual functions:
412 #ifdef GLIBMM_VFUNCS_ENABLED
413 #endif //GLIBMM_VFUNCS_ENABLED
416 //GTK+ Virtual Functions (override these to change behaviour):
417 #ifdef GLIBMM_VFUNCS_ENABLED
418 #endif //GLIBMM_VFUNCS_ENABLED
420 //Default Signal Handlers::
421 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
422 virtual void on_details_acquired(bool success);
423 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
428 /** @relates Gtk::Printer */
429 inline bool operator==(const Glib::RefPtr<Printer>& lhs, const Glib::RefPtr<Printer>& rhs)
430 { return lhs->equal(rhs); }
432 /** @relates Gtk::Printer */
433 inline bool operator!=(const Glib::RefPtr<Printer>& lhs, const Glib::RefPtr<Printer>& rhs)
434 { return !lhs->equal(rhs); }
437 * bool on_enumerate_printers(const Glib::RefPtr<Printer>& printer);
438 * @param printer A printer.
439 * @param result true to stop the enumeration, false to continue.
441 * @relates Gtk::Printer
443 typedef sigc::slot< bool, const Glib::RefPtr<Printer>& > SlotPrinterEnumerator;
445 /** Calls a function for all Printers. If the callback returns true, the enumeration is stopped.
446 * @slot A function to call for each printer
447 * @parm wait If true, wait in a recursive mainloop until all printers are enumerated; otherwise return early.
449 * @relates Gtk::Printer
451 void enumerate_printers(const SlotPrinterEnumerator& slot, bool wait = true);
458 /** A Glib::wrap() method for this object.
460 * @param object The C instance.
461 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
462 * @result A C++ instance that wraps this C instance.
464 * @relates Gtk::Printer
466 Glib::RefPtr<Gtk::Printer> wrap(GtkPrinter* object, bool take_copy = false);
470 #endif /* _GTKMM_PRINTER_H */