1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/papersize.h>
5 #include <gtkmm/private/papersize_p.h>
7 /* Copyright (C) 2006 The gtkmm Development Team
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.
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.
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.
24 #include <gtk/gtkpapersize.h>
25 #include <gtk/gtktypebuiltins.h>
30 //PaperSize::PaperSize()
32 // gobject_(gtk_paper_size_new(gtk_paper_size_get_default()))
35 PaperSize::PaperSize(const Glib::ustring& name)
37 gobject_(gtk_paper_size_new(name.c_str()))
40 PaperSize::PaperSize(const Glib::ustring& ppd_name, const Glib::ustring& ppd_display_name, double width, double height)
42 gobject_(gtk_paper_size_new_from_ppd(ppd_name.c_str(),
43 ppd_display_name.c_str(),
48 PaperSize::PaperSize(const Glib::ustring& name, const Glib::ustring& display_name, double width, double height, Unit unit)
50 gobject_(gtk_paper_size_new_custom(name.c_str(),
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)
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 */))
63 bool PaperSize::equal(const PaperSize& other) const
65 return (static_cast<bool>(gtk_paper_size_is_equal(const_cast<GtkPaperSize*>(this->gobj()),
66 const_cast<GtkPaperSize*>(other.gobj()))));
69 PaperSize::operator bool() const
71 return (gobj() != NULL);
74 void PaperSize::save_to_key_file(Glib::KeyFile& key_file)
76 gtk_paper_size_to_key_file( gobj(), (key_file).gobj(), 0);
84 } // anonymous namespace
87 GType Glib::Value<Gtk::Unit>::value_type()
89 return gtk_unit_get_type();
96 Gtk::PaperSize wrap(GtkPaperSize* object, bool take_copy)
98 return Gtk::PaperSize(object, take_copy);
109 GType PaperSize::get_type()
111 return gtk_paper_size_get_type();
114 PaperSize::PaperSize()
116 gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
119 PaperSize::PaperSize(const PaperSize& other)
121 gobject_ ((other.gobject_) ? gtk_paper_size_copy(other.gobject_) : 0)
124 PaperSize::PaperSize(GtkPaperSize* gobject, bool make_a_copy)
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)
132 PaperSize& PaperSize::operator=(const PaperSize& other)
134 PaperSize temp (other);
139 PaperSize::~PaperSize()
142 gtk_paper_size_free(gobject_);
145 void PaperSize::swap(PaperSize& other)
147 GtkPaperSize *const temp = gobject_;
148 gobject_ = other.gobject_;
149 other.gobject_ = temp;
152 GtkPaperSize* PaperSize::gobj_copy() const
154 return gtk_paper_size_copy(gobject_);
158 Glib::ustring PaperSize::get_name() const
160 return Glib::convert_const_gchar_ptr_to_ustring(gtk_paper_size_get_name(const_cast<GtkPaperSize*>(gobj())));
163 Glib::ustring PaperSize::get_display_name() const
165 return Glib::convert_const_gchar_ptr_to_ustring(gtk_paper_size_get_display_name(const_cast<GtkPaperSize*>(gobj())));
168 Glib::ustring PaperSize::get_ppd_name() const
170 return Glib::convert_const_gchar_ptr_to_ustring(gtk_paper_size_get_ppd_name(const_cast<GtkPaperSize*>(gobj())));
173 double PaperSize::get_width(Unit unit) const
175 return gtk_paper_size_get_width(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
178 double PaperSize::get_height(Unit unit) const
180 return gtk_paper_size_get_height(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
183 bool PaperSize::is_custom() const
185 return gtk_paper_size_is_custom(const_cast<GtkPaperSize*>(gobj()));
188 void PaperSize::set_size(double width, double height, Unit unit)
190 gtk_paper_size_set_size(gobj(), width, height, ((GtkUnit)(unit)));
193 double PaperSize::get_default_top_margin(Unit unit) const
195 return gtk_paper_size_get_default_top_margin(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
198 double PaperSize::get_default_bottom_margin(Unit unit) const
200 return gtk_paper_size_get_default_bottom_margin(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
203 double PaperSize::get_default_left_margin(Unit unit) const
205 return gtk_paper_size_get_default_left_margin(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
208 double PaperSize::get_default_right_margin(Unit unit) const
210 return gtk_paper_size_get_default_right_margin(const_cast<GtkPaperSize*>(gobj()), ((GtkUnit)(unit)));
213 Glib::ustring PaperSize::get_default()
215 return Glib::convert_const_gchar_ptr_to_ustring(gtk_paper_size_get_default());
219 void PaperSize::save_to_key_file(Glib::KeyFile& key_file, const Glib::ustring& group_name)
221 gtk_paper_size_to_key_file(gobj(), (key_file).gobj(), group_name.c_str());