Add stuff missing from yesterday's library commit.
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / papersize.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_PAPERSIZE_H
4 #define _GTKMM_PAPERSIZE_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
27 #ifndef DOXYGEN_SHOULD_SKIP_THIS
28 extern "C" { typedef struct _GtkPaperSize GtkPaperSize; }
29 #endif
30
31 namespace Gtk
32 {
33
34 /** Common paper names, from PWG 5101.1-2002 PWG: Standard for Media Standardized Names
35  *
36  */
37 const Glib::ustring PAPER_NAME_A3 = "iso_a3";
38 const Glib::ustring PAPER_NAME_A4 = "iso_a4";
39 const Glib::ustring PAPER_NAME_A5 = "iso_a5";
40 const Glib::ustring PAPER_NAME_B5 = "iso_b5";
41 const Glib::ustring PAPER_NAME_LETTER = "na_letter";
42 const Glib::ustring PAPER_NAME_EXECUTIVE = "na_executive";
43 const Glib::ustring PAPER_NAME_LEGAL = "na_legal";
44
45 /** @addtogroup gtkmmEnums Enums and Flags */
46
47 /**
48  * @ingroup gtkmmEnums
49  */
50 enum Unit
51 {
52   UNIT_PIXEL,
53   UNIT_POINTS,
54   UNIT_INCH,
55   UNIT_MM
56 };
57
58 } // namespace Gtk
59
60
61 #ifndef DOXYGEN_SHOULD_SKIP_THIS
62 namespace Glib
63 {
64
65 template <>
66 class Value<Gtk::Unit> : public Glib::Value_Enum<Gtk::Unit>
67 {
68 public:
69   static GType value_type() G_GNUC_CONST;
70 };
71
72 } // namespace Glib
73 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
74
75
76 namespace Gtk
77 {
78
79
80 /** PaperSize handles paper sizes. It uses the standard called "PWG 5101.1-2002 PWG: Standard for Media Standardized Names" 
81  * to name the paper sizes (and to get the data for the page sizes). In addition to standard paper sizes, PaperSize allows 
82  * to construct custom paper sizes with arbitrary dimensions.
83  *
84  * The PaperSize object stores not only the dimensions (width and height) of a paper size and its name, it also provides 
85  * default print margins. 
86  *
87  * @newin2p10
88  *
89  * @ingroup Printing
90  */
91 class PaperSize
92 {
93   // Cannot pass the _new function here, it must accept the 'name' argument.
94   public:
95 #ifndef DOXYGEN_SHOULD_SKIP_THIS
96   typedef PaperSize CppObjectType;
97   typedef GtkPaperSize BaseObjectType;
98
99   static GType get_type() G_GNUC_CONST;
100 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
101
102   PaperSize();
103
104   explicit PaperSize(GtkPaperSize* gobject, bool make_a_copy = true);
105
106   PaperSize(const PaperSize& other);
107   PaperSize& operator=(const PaperSize& other);
108
109   ~PaperSize();
110
111   void swap(PaperSize& other);
112
113   ///Provides access to the underlying C instance.
114   GtkPaperSize*       gobj()       { return gobject_; }
115
116   ///Provides access to the underlying C instance.
117   const GtkPaperSize* gobj() const { return gobject_; }
118
119   ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
120   GtkPaperSize* gobj_copy() const;
121
122 protected:
123   GtkPaperSize* gobject_;
124
125 private:
126
127 public:
128   // Allowing no argument works because gtk_paper_size_new() will call
129   // gtk_paper_size_get_default() in case of NULL.
130   /// If a name is not specified, a default value will be used.
131   explicit PaperSize(const Glib::ustring& name = "");
132   explicit PaperSize(const Glib::ustring& ppd_name, const Glib::ustring& ppd_display_name, double width, double height);
133   explicit PaperSize(const Glib::ustring& name, const Glib::ustring& display_name, double width, double height, Unit unit);
134
135   
136   bool equal(const PaperSize& other) const;
137
138   
139   Glib::ustring get_name() const;
140   
141   Glib::ustring get_display_name() const;
142   
143   Glib::ustring get_ppd_name() const;
144
145   
146   double get_width(Unit unit) const;
147   
148   double get_height(Unit unit) const;
149   
150   bool is_custom() const;
151
152   
153   void set_size(double width, double height, Unit unit);
154   
155   double get_default_top_margin(Unit unit) const;
156   
157   double get_default_bottom_margin(Unit unit) const;
158   
159   double get_default_left_margin(Unit unit) const;
160   
161   double get_default_right_margin(Unit unit) const;
162
163   
164   static Glib::ustring get_default();
165
166
167 };
168
169 /** @relates Gtk::PaperSize */
170 inline bool operator==(const PaperSize& lhs, const PaperSize& rhs)
171   { return lhs.equal(rhs); }
172
173 /** @relates Gtk::PaperSize */
174 inline bool operator!=(const PaperSize& lhs, const PaperSize& rhs)
175   { return !lhs.equal(rhs); }
176
177 } // namespace Gtk
178
179
180 namespace Gtk
181 {
182
183 /** @relates Gtk::PaperSize
184  * @param lhs The left-hand side
185  * @param rhs The right-hand side
186  */
187 inline void swap(PaperSize& lhs, PaperSize& rhs)
188   { lhs.swap(rhs); }
189
190 } // namespace Gtk
191
192 namespace Glib
193 {
194
195 /** @relates Gtk::PaperSize
196  * @param object The C instance
197  * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
198  * @result A C++ instance that wraps this C instance.
199  */
200 Gtk::PaperSize wrap(GtkPaperSize* object, bool take_copy = false);
201
202 #ifndef DOXYGEN_SHOULD_SKIP_THIS
203 template <>
204 class Value<Gtk::PaperSize> : public Glib::Value_Boxed<Gtk::PaperSize>
205 {};
206 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
207
208 } // namespace Glib
209
210
211 #endif /* _GTKMM_PAPERSIZE_H */
212