add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / printer.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_PRINTER_H
4 #define _GTKMM_PRINTER_H
5
6
7 #include <glibmm.h>
8
9 /* Copyright (C) 2006 The gtkmm Development Team
10  *
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.
15  *
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.
20  *
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.
24  */
25
26 #include <gtkmm/pagesetup.h>
27
28
29 #ifndef DOXYGEN_SHOULD_SKIP_THIS
30 typedef struct _GtkPrinter GtkPrinter;
31 typedef struct _GtkPrinterClass GtkPrinterClass;
32 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
33
34
35 namespace Gtk
36 { class Printer_Class; } // namespace Gtk
37 namespace Gtk
38 {
39
40 /** @addtogroup gtkmmEnums Enums and Flags */
41
42 /**
43  * @ingroup gtkmmEnums
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>
52  */
53 enum PrintCapabilities
54 {
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
64 };
65
66 /** @ingroup gtkmmEnums */
67 inline PrintCapabilities operator|(PrintCapabilities lhs, PrintCapabilities rhs)
68   { return static_cast<PrintCapabilities>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
69
70 /** @ingroup gtkmmEnums */
71 inline PrintCapabilities operator&(PrintCapabilities lhs, PrintCapabilities rhs)
72   { return static_cast<PrintCapabilities>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
73
74 /** @ingroup gtkmmEnums */
75 inline PrintCapabilities operator^(PrintCapabilities lhs, PrintCapabilities rhs)
76   { return static_cast<PrintCapabilities>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
77
78 /** @ingroup gtkmmEnums */
79 inline PrintCapabilities operator~(PrintCapabilities flags)
80   { return static_cast<PrintCapabilities>(~static_cast<unsigned>(flags)); }
81
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))); }
85
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))); }
89
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))); }
93
94 } // namespace Gtk
95
96
97 #ifndef DOXYGEN_SHOULD_SKIP_THIS
98 namespace Glib
99 {
100
101 template <>
102 class Value<Gtk::PrintCapabilities> : public Glib::Value_Flags<Gtk::PrintCapabilities>
103 {
104 public:
105   static GType value_type() G_GNUC_CONST;
106 };
107
108 } // namespace Glib
109 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
110
111
112 namespace Gtk
113 {
114
115
116 /** A Printer object represents a printer. You only need to deal directly with printers if you use the 
117  * non-portable PrintUnixDialog API.
118  *
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.
122  *
123  * @newin2p10
124  *
125  * @ingroup Printing
126  */
127
128 class Printer : public Glib::Object
129 {
130   
131 #ifndef DOXYGEN_SHOULD_SKIP_THIS
132
133 public:
134   typedef Printer CppObjectType;
135   typedef Printer_Class CppClassType;
136   typedef GtkPrinter BaseObjectType;
137   typedef GtkPrinterClass BaseClassType;
138
139 private:  friend class Printer_Class;
140   static CppClassType printer_class_;
141
142 private:
143   // noncopyable
144   Printer(const Printer&);
145   Printer& operator=(const Printer&);
146
147 protected:
148   explicit Printer(const Glib::ConstructParams& construct_params);
149   explicit Printer(GtkPrinter* castitem);
150
151 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
152
153 public:
154   virtual ~Printer();
155
156 #ifndef DOXYGEN_SHOULD_SKIP_THIS
157   static GType get_type()      G_GNUC_CONST;
158   static GType get_base_type() G_GNUC_CONST;
159 #endif
160
161   ///Provides access to the underlying C GObject.
162   GtkPrinter*       gobj()       { return reinterpret_cast<GtkPrinter*>(gobject_); }
163
164   ///Provides access to the underlying C GObject.
165   const GtkPrinter* gobj() const { return reinterpret_cast<GtkPrinter*>(gobject_); }
166
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();
169
170 private:
171
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
175
176
177 public:
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.
180   
181   
182   bool equal(const Glib::RefPtr<Printer>& other) const;
183
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)
187   
188
189   /** Return value: the name of @a printer 
190    * @return The name of @a printer 
191    * 
192    * @newin2p10.
193    */
194   Glib::ustring get_name() const;
195   
196   /** Return value: the state message of @a printer 
197    * @return The state message of @a printer 
198    * 
199    * @newin2p10.
200    */
201   Glib::ustring get_state_message() const;
202   
203   /** Gets the description of the printer.
204    * @return The description of @a printer 
205    * 
206    * @newin2p10.
207    */
208   Glib::ustring get_description() const;
209   
210   /** Return value: the location of @a printer 
211    * @return The location of @a printer 
212    * 
213    * @newin2p10.
214    */
215   Glib::ustring get_location() const;
216   
217   /** Gets the name of the icon to use for the printer.
218    * @return The icon name for @a printer 
219    * 
220    * @newin2p10.
221    */
222   Glib::ustring get_icon_name() const;
223   
224   /** Gets the number of jobs currently queued on the printer.
225    * @return The number of jobs on @a printer 
226    * 
227    * @newin2p10.
228    */
229   int get_job_count() const;
230   
231   /** Return value: <tt>true</tt> if @a printer  is active
232    * @return <tt>true</tt> if @a printer  is active
233    * 
234    * @newin2p10.
235    */
236   bool is_active() const;
237   
238   /** Return value: <tt>true</tt> if @a printer  is virtual
239    * @return <tt>true</tt> if @a printer  is virtual
240    * 
241    * @newin2p10.
242    */
243   bool is_virtual() const;
244   
245   /** Return value: <tt>true</tt> if @a printer  is the default
246    * @return <tt>true</tt> if @a printer  is the default
247    * 
248    * @newin2p10.
249    */
250   bool is_default() const;
251   
252   /** Return value: <tt>true</tt> if @a printer  accepts PDF
253    * @return <tt>true</tt> if @a printer  accepts PDF
254    * 
255    * @newin2p10.
256    */
257   bool accepts_pdf() const;
258   
259   /** Return value: <tt>true</tt> if @a printer  accepts PostScript
260    * @return <tt>true</tt> if @a printer  accepts PostScript
261    * 
262    * @newin2p10.
263    */
264   bool accepts_ps() const;
265
266  
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.
271    * 
272    * @newin2p12.
273    */
274   Glib::ListHandle< Glib::RefPtr<PageSetup> > list_papers();
275
276  
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.
281    * 
282    * @newin2p12.
283    */
284   Glib::ListHandle< Glib::RefPtr<const PageSetup> > list_papers() const;
285
286   
287   /** Return value: <tt>true</tt> if @a printer  details are available
288    * @return <tt>true</tt> if @a printer  details are available
289    * 
290    * @newin2p12.
291    */
292   bool has_details() const;
293   
294   /** Requests the printer details. When the details are available,
295    * the details_acquired signal will be emitted.
296    * 
297    * @newin2p12
298    */
299   void request_details();
300   
301   /** Return value: the printer's capabilities
302    * @return The printer's capabilities
303    * 
304    * @newin2p12.
305    */
306   PrintCapabilities get_capabilities() const;
307
308
309   /**
310    * @par Prototype:
311    * <tt>void on_my_%details_acquired(bool success)</tt>
312    */
313
314   Glib::SignalProxy1< void,bool > signal_details_acquired();
315
316   
317   #ifdef GLIBMM_PROPERTIES_ENABLED
318 /** Name of the printer.
319    *
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.
323    */
324   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_name() const;
325 #endif //#GLIBMM_PROPERTIES_ENABLED
326
327
328   //GtkPrintBackend is in a "semi-private" header:
329   //_WRAP_PROPERTY("backend", Glib::RefPtr<PrintBackend>)
330
331   #ifdef GLIBMM_PROPERTIES_ENABLED
332 /** FALSE if this represents a real hardware printer.
333    *
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.
337    */
338   Glib::PropertyProxy_ReadOnly<bool> property_is_virtual() const;
339 #endif //#GLIBMM_PROPERTIES_ENABLED
340
341
342   #ifdef GLIBMM_PROPERTIES_ENABLED
343 /** String giving the current state of the printer.
344    *
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.
348    */
349   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_state_message() const;
350 #endif //#GLIBMM_PROPERTIES_ENABLED
351
352
353   #ifdef GLIBMM_PROPERTIES_ENABLED
354 /** The location of the printer.
355    *
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.
359    */
360   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_location() const;
361 #endif //#GLIBMM_PROPERTIES_ENABLED
362
363
364   #ifdef GLIBMM_PROPERTIES_ENABLED
365 /** The icon name to use for the printer.
366    *
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.
370    */
371   Glib::PropertyProxy_ReadOnly<Glib::ustring> property_icon_name() const;
372 #endif //#GLIBMM_PROPERTIES_ENABLED
373
374
375   #ifdef GLIBMM_PROPERTIES_ENABLED
376 /** Number of jobs queued in the printer.
377    *
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.
381    */
382   Glib::PropertyProxy_ReadOnly<int> property_job_count() const;
383 #endif //#GLIBMM_PROPERTIES_ENABLED
384
385
386   #ifdef GLIBMM_PROPERTIES_ENABLED
387 /** TRUE if this printer can accept PDF.
388    *
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.
392    */
393   Glib::PropertyProxy_ReadOnly<bool> property_accepts_pdf() const;
394 #endif //#GLIBMM_PROPERTIES_ENABLED
395
396
397   #ifdef GLIBMM_PROPERTIES_ENABLED
398 /** TRUE if this printer can accept PostScript.
399    *
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.
403    */
404   Glib::PropertyProxy_ReadOnly<bool> property_accepts_ps() const;
405 #endif //#GLIBMM_PROPERTIES_ENABLED
406
407
408 public:
409
410 public:
411   //C++ methods used to invoke GTK+ virtual functions:
412 #ifdef GLIBMM_VFUNCS_ENABLED
413 #endif //GLIBMM_VFUNCS_ENABLED
414
415 protected:
416   //GTK+ Virtual Functions (override these to change behaviour):
417 #ifdef GLIBMM_VFUNCS_ENABLED
418 #endif //GLIBMM_VFUNCS_ENABLED
419
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
424
425
426 };
427
428 /** @relates Gtk::Printer */
429 inline bool operator==(const Glib::RefPtr<Printer>& lhs, const Glib::RefPtr<Printer>& rhs)
430   { return lhs->equal(rhs); }
431
432 /** @relates Gtk::Printer */
433 inline bool operator!=(const Glib::RefPtr<Printer>& lhs, const Glib::RefPtr<Printer>& rhs)
434   { return !lhs->equal(rhs); }
435
436 /** For example, 
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. 
440  *
441  * @relates Gtk::Printer
442  */
443 typedef sigc::slot< bool, const Glib::RefPtr<Printer>& > SlotPrinterEnumerator;
444
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.
448  *
449  * @relates Gtk::Printer
450  */
451 void enumerate_printers(const SlotPrinterEnumerator& slot, bool wait = true);
452
453 } // namespace Gtk
454
455
456 namespace Glib
457 {
458   /** A Glib::wrap() method for this object.
459    * 
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.
463    *
464    * @relates Gtk::Printer
465    */
466   Glib::RefPtr<Gtk::Printer> wrap(GtkPrinter* object, bool take_copy = false);
467 }
468
469
470 #endif /* _GTKMM_PRINTER_H */
471