~ubuntu-branches/ubuntu/precise/gtkmm3.0/precise

« back to all changes in this revision

Viewing changes to gtk/src/printcontext.hg

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-06-17 00:12:44 UTC
  • Revision ID: james.westby@ubuntu.com-20110617001244-9hl5an15hiaaahi6
Tags: upstream-3.0.1
ImportĀ upstreamĀ versionĀ 3.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2006 The gtkmm Development Team
 
2
 *
 
3
 * This library is free software; you can redistribute it and/or
 
4
 * modify it under the terms of the GNU Lesser General Public
 
5
 * License as published by the Free Software Foundation; either
 
6
 * version 2.1 of the License, or (at your option) any later version.
 
7
 *
 
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
 * Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser 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.
 
16
 */
 
17
 
 
18
#include <glibmm/object.h>
 
19
 
 
20
#include <cairomm/context.h>
 
21
 
 
22
#include <pangomm/fontmap.h>
 
23
#include <pangomm/context.h>
 
24
#include <pangomm/layout.h>
 
25
 
 
26
#include <gtkmm/pagesetup.h>
 
27
 
 
28
_DEFS(gtkmm,gtk)
 
29
_PINCLUDE(glibmm/private/object_p.h)
 
30
 
 
31
namespace Gtk
 
32
{
 
33
 
 
34
/** A PrintContext encapsulates context information that is required when
 
35
 * drawing pages for printing, such as the cairo context and important 
 
36
 * parameters like page size and resolution. It also lets you easily
 
37
 * create Pango::Layout and Pango::Context objects that match the font metrics 
 
38
 * of the cairo surface.
 
39
 * 
 
40
 * PrintContext objects gets passed to the begin-print, end-print, 
 
41
 * request-page-setup and draw-page signals on the PrintOperation.
 
42
 *
 
43
 * @newin{2,10}
 
44
 *
 
45
 * @ingroup Printing
 
46
 */
 
47
class PrintContext : public Glib::Object
 
48
{
 
49
  _CLASS_GOBJECT(PrintContext, GtkPrintContext, GTK_PRINT_CONTEXT, Glib::Object, GObject)
 
50
 
 
51
public:
 
52
 
 
53
  #m4 _CONVERSION(`cairo_t*',`Cairo::RefPtr<Cairo::Context>',`Cairo::RefPtr<Cairo::Context>(new Cairo::Context($3, false /* take ref */))')
 
54
  #m4 _CONVERSION(`cairo_t*',`Cairo::RefPtr<const Cairo::Context>',`Cairo::RefPtr<Cairo::Context>(new Cairo::Context($3, false /* take ref */))')
 
55
  _WRAP_METHOD(Cairo::RefPtr<Cairo::Context> get_cairo_context(), gtk_print_context_get_cairo_context)
 
56
  _WRAP_METHOD(Cairo::RefPtr<const Cairo::Context> get_cairo_context() const, gtk_print_context_get_cairo_context, constversion)
 
57
 
 
58
  _WRAP_METHOD(Glib::RefPtr<PageSetup> get_page_setup(), gtk_print_context_get_page_setup, refreturn)
 
59
  _WRAP_METHOD(Glib::RefPtr<const PageSetup> get_page_setup() const, gtk_print_context_get_page_setup, refreturn, constversion)
 
60
 
 
61
  _WRAP_METHOD(double get_width() const, gtk_print_context_get_width)
 
62
  _WRAP_METHOD(double get_height() const, gtk_print_context_get_height)
 
63
 
 
64
  _WRAP_METHOD(double get_dpi_x() const, gtk_print_context_get_dpi_x)
 
65
  _WRAP_METHOD(double get_dpi_y() const, gtk_print_context_get_dpi_y)
 
66
 
 
67
  _WRAP_METHOD(bool get_hard_margins(double& top, double& bottom, double& left, double& right) const, gtk_print_context_get_hard_margins)
 
68
 
 
69
  _WRAP_METHOD(Glib::RefPtr<Pango::FontMap> get_pango_fontmap(), gtk_print_context_get_pango_fontmap, refreturn)
 
70
  _WRAP_METHOD(Glib::RefPtr<const Pango::FontMap> get_pango_fontmap() const, gtk_print_context_get_pango_fontmap, refreturn, constversion)
 
71
 
 
72
  _WRAP_METHOD(Glib::RefPtr<Pango::Context> create_pango_context(), gtk_print_context_create_pango_context, refreturn)
 
73
  _WRAP_METHOD(Glib::RefPtr<Pango::Layout> create_pango_layout(), gtk_print_context_create_pango_layout, refreturn)
 
74
 
 
75
  _WRAP_METHOD(void set_cairo_context(const Cairo::RefPtr<Cairo::Context>& cr, double dpi_x, double dpi_y), gtk_print_context_set_cairo_context)
 
76
 
 
77
};
 
78
 
 
79
} // namespace Gtk