1 /* Copyright (C) 2006 The gtkmm Development Team
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Library General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
13 * You should have received a copy of the GNU Library General Public
14 * License along with this library; if not, write to the Free
15 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 #include <gtk/gtkpapersize.h>
19 #include <gtk/gtktypebuiltins.h>
24 //PaperSize::PaperSize()
26 // gobject_(gtk_paper_size_new(gtk_paper_size_get_default()))
29 PaperSize::PaperSize(const Glib::ustring& name)
31 gobject_(gtk_paper_size_new(name.c_str()))
34 PaperSize::PaperSize(const Glib::ustring& ppd_name, const Glib::ustring& ppd_display_name, double width, double height)
36 gobject_(gtk_paper_size_new_from_ppd(ppd_name.c_str(),
37 ppd_display_name.c_str(),
42 PaperSize::PaperSize(const Glib::ustring& name, const Glib::ustring& display_name, double width, double height, Unit unit)
44 gobject_(gtk_paper_size_new_custom(name.c_str(),
51 //TODO: Add an operator bool() so we can detect if this succeeded:
52 PaperSize::PaperSize(const Glib::KeyFile& key_file, const Glib::ustring& group_name)
54 gobject_(gtk_paper_size_new_from_key_file(const_cast<GKeyFile*>(key_file.gobj()), (group_name.empty() ? NULL : group_name.c_str()) , NULL /* GError */))
57 bool PaperSize::equal(const PaperSize& other) const
59 return (static_cast<bool>(gtk_paper_size_is_equal(const_cast<GtkPaperSize*>(this->gobj()),
60 const_cast<GtkPaperSize*>(other.gobj()))));
63 PaperSize::operator bool() const
65 return (gobj() != NULL);
68 void PaperSize::save_to_key_file(Glib::KeyFile& key_file)
70 gtk_paper_size_to_key_file( gobj(), (key_file).gobj(), 0);