Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / papersize.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <gtkmm/papersize.h>
5 #include <gtkmm/private/papersize_p.h>
6
7 /* Copyright (C) 2006 The gtkmm Development Team
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the Free
21  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  */
23
24 #include <gtk/gtkpapersize.h>
25 #include <gtk/gtktypebuiltins.h>
26
27 namespace Gtk
28 {
29
30 //PaperSize::PaperSize()
31 //:
32 //  gobject_(gtk_paper_size_new(gtk_paper_size_get_default()))
33 //{}
34
35 PaperSize::PaperSize(const Glib::ustring& name)
36 :
37   gobject_(gtk_paper_size_new(name.c_str()))
38 {}
39
40 PaperSize::PaperSize(const Glib::ustring& ppd_name, const Glib::ustring& ppd_display_name, double width, double height)
41 :
42   gobject_(gtk_paper_size_new_from_ppd(ppd_name.c_str(),
43                                        ppd_display_name.c_str(),
44                                        gdouble(width),
45                                        gdouble(height)))
46 {}
47
48 PaperSize::PaperSize(const Glib::ustring& name, const Glib::ustring& display_name, double width, double height, Unit unit)
49 :
50   gobject_(gtk_paper_size_new_custom(name.c_str(),
51                                      display_name.c_str(),
52                                      gdouble(width),
53                                      gdouble(height),
54                                      GtkUnit(unit)))
55 {}
56
57 //TODO: Add an operator bool() so we can detect if this succeeded:
58 PaperSize::PaperSize(const Glib::KeyFile& key_file, const Glib::ustring& group_name)
59 :
60   gobject_(gtk_paper_size_new_from_key_file(const_cast<GKeyFile*>(key_file.gobj()), (group_name.empty() ? NULL : group_name.c_str()) , NULL /* GError */))
61 {}
62
63 bool PaperSize::equal(const PaperSize& other) const
64 {
65   return (static_cast<bool>(gtk_paper_size_is_equal(const_cast<GtkPaperSize*>(this->gobj()),
66                                                     const_cast<GtkPaperSize*>(other.gobj()))));
67 }
68
69 PaperSize::operator bool() const
70 {
71   return (gobj() != NULL);
72 }
73
74 void PaperSize::save_to_key_file(Glib::KeyFile& key_file)
75 {
76   gtk_paper_size_to_key_file( gobj(), (key_file).gobj(), 0); 
77 }
78
79
80 } // namespace Gtk
81
82 namespace
83 {
84 } // anonymous namespace
85
86 // static
87 GType Glib::Value<Gtk::Unit>::value_type()
88 {
89   return gtk_unit_get_type();
90 }
91
92
93 namespace Glib
94 {
95
96 Gtk::PaperSize wrap(GtkPaperSize* object, bool take_copy)
97 {
98   return Gtk::PaperSize(object, take_copy);
99 }
100
101 } // namespace Glib
102
103
104 namespace Gtk
105 {
106
107
108 // static
109 GType PaperSize::get_type()
110 {
111   return gtk_paper_size_get_type();
112 }
113
114 PaperSize::PaperSize()
115 :
116   gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
117 {}
118
119 PaperSize::PaperSize(const PaperSize& other)
120 :
121   gobject_ ((other.gobject_) ? gtk_paper_size_copy(other.gobject_) : 0)
122 {}
123
124 PaperSize::PaperSize(GtkPaperSize* gobject, bool make_a_copy)
125 :
126   // For BoxedType wrappers, make_a_copy is true by default.  The static
127   // BoxedType wrappers must always take a copy, thus make_a_copy = true
128   // ensures identical behaviour if the default argument is used.
129   gobject_ ((make_a_copy && gobject) ? gtk_paper_size_copy(gobject) : gobject)
130 {}
131
132 PaperSize& PaperSize::operator=(const PaperSize& other)
133 {
134   PaperSize temp (other);
135   swap(temp);
136   return *this;
137 }
138
139 PaperSize::~PaperSize()
140 {
141   if(gobject_)
142     gtk_paper_size_free(gobject_);
143 }
144
145 void PaperSize::swap(PaperSize& other)
146 {
147   GtkPaperSize *const temp = gobject_;
148   gobject_ = other.gobject_;
149   other.gobject_ = temp;
150 }
151
152 GtkPaperSize* PaperSize::gobj_copy() const
153 {
154   return gtk_paper_size_copy(gobject_);
155 }
156
157
158 Glib::ustring PaperSize::get_name() const
159 {
160   return Glib::convert_const_gchar_ptr_to_ustring(gtk_paper_size_get_name(const_cast<GtkPaperSize*>(gobj())));
161 }
162
163 Glib::ustring PaperSize::get_display_name() const
164 {
165   return Glib::convert_const_gchar_ptr_to_ustring(gtk_paper_size_get_display_name(const_cast<GtkPaperSize*>(gobj())));
166 }
167
168 Glib::ustring PaperSize::get_ppd_name() const
169 {
170   return Glib::convert_const_gchar_ptr_to_ustring(gtk_paper_size_get_ppd_name(const_cast<GtkPaperSize*>(gobj())));
171 }
172
173 double PaperSize::get_width(Unit unit) const
174 {
175   return gtk_paper_size_get_width(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
176 }
177
178 double PaperSize::get_height(Unit unit) const
179 {
180   return gtk_paper_size_get_height(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
181 }
182
183 bool PaperSize::is_custom() const
184 {
185   return gtk_paper_size_is_custom(const_cast<GtkPaperSize*>(gobj()));
186 }
187
188 void PaperSize::set_size(double width, double height, Unit unit)
189 {
190 gtk_paper_size_set_size(gobj(), width, height, ((GtkUnit)(unit))); 
191 }
192
193 double PaperSize::get_default_top_margin(Unit unit) const
194 {
195   return gtk_paper_size_get_default_top_margin(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
196 }
197
198 double PaperSize::get_default_bottom_margin(Unit unit) const
199 {
200   return gtk_paper_size_get_default_bottom_margin(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
201 }
202
203 double PaperSize::get_default_left_margin(Unit unit) const
204 {
205   return gtk_paper_size_get_default_left_margin(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
206 }
207
208 double PaperSize::get_default_right_margin(Unit unit) const
209 {
210   return gtk_paper_size_get_default_right_margin(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
211 }
212
213 Glib::ustring PaperSize::get_default()
214 {
215   return Glib::convert_const_gchar_ptr_to_ustring(gtk_paper_size_get_default());
216 }
217
218
219 void PaperSize::save_to_key_file(Glib::KeyFile& key_file, const Glib::ustring& group_name)
220 {
221 gtk_paper_size_to_key_file(gobj(), (key_file).gobj(), group_name.c_str()); 
222 }
223
224
225 } // namespace Gtk
226
227