Main Page Widgets Namespaces Book

# Gtk::PrintContext Class Reference
[Printing]

A PrintContext encapsulates context information that is required when drawing pages for printing, such as the cairo context and important parameters like page size and resolution. More...

Inheritance diagram for Gtk::PrintContext:

[legend]

List of all members.

## Public Member Functions
Glib::RefPtr<Pango::Context> | create_pango_context ()
| Creates a new Pango::Context that can be used with the Gtk::PrintContext.
Glib::RefPtr<Pango::Layout> | create_pango_layout ()
| Creates a new Pango::Layout that is suitable for use with the Gtk::PrintContext.
Cairo::RefPtr< const Cairo::Context > | get_cairo_context () const
| Obtains the cairo context that is associated with the Gtk::PrintContext.
Cairo::RefPtr<Cairo::Context> | get_cairo_context ()
| Obtains the cairo context that is associated with the Gtk::PrintContext.
double | get_dpi_x () const
| Obtains the horizontal resolution of the Gtk::PrintContext, in dots per inch.
double | get_dpi_y () const
| Obtains the vertical resolution of the Gtk::PrintContext, in dots per inch.
double | get_height () const
| Obtains the height of the Gtk::PrintContext, in pixels.
Glib::RefPtr<const PageSetup> | get_page_setup () const
| Obtains the Gtk::PageSetup that determines the page dimensions of the Gtk::PrintContext.
Glib::RefPtr<PageSetup> | get_page_setup ()
| Obtains the Gtk::PageSetup that determines the page dimensions of the Gtk::PrintContext.
Glib::RefPtr< const Pango::FontMap > | get_pango_fontmap () const
| Return value: the font map of context.
Glib::RefPtr<Pango::FontMap> | get_pango_fontmap ()
| Return value: the font map of context.
double | get_width () const
| Obtains the width of the Gtk::PrintContext, in pixels.
const GtkPrintContext* | gobj () const
| Provides access to the underlying C GObject.
GtkPrintContext* | gobj ()
| Provides access to the underlying C GObject.
GtkPrintContext* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void | set_cairo_context (const Cairo::RefPtr<Cairo::Context>& cr, double dpi_x, double dpi_y)
| Sets a new cairo context on a print context.
virtual | ~PrintContext ()
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr<Gtk::PrintContext> | wrap (GtkPrintContext* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A PrintContext encapsulates context information that is required when drawing pages for printing, such as the cairo context and important parameters like page size and resolution.

It also lets you easily create Pango::Layout and Pango::Context objects that match the font metrics of the cairo surface.

PrintContext objects gets passed to the begin-print, end-print, request-page-setup and draw-page signals on the PrintOperation.

Since gtkmm 2.10:

## Constructor & Destructor Documentation

virtual Gtk::PrintContext::~PrintContext | ( |  | ) | `[virtual]`

## Member Function Documentation

Glib::RefPtr<Pango::Context> Gtk::PrintContext::create_pango_context | ( |  | ) |

Creates a new Pango::Context that can be used with the Gtk::PrintContext.

Returns:
  A new Pango context for context

Since gtkmm 2.10:

Glib::RefPtr<Pango::Layout> Gtk::PrintContext::create_pango_layout | ( |  | ) |

Creates a new Pango::Layout that is suitable for use with the Gtk::PrintContext.

Returns:
  A new Pango layout for context

Since gtkmm 2.10:

Cairo::RefPtr<const Cairo::Context> Gtk::PrintContext::get_cairo_context | ( |  | ) | const

Obtains the cairo context that is associated with the Gtk::PrintContext.

Returns:
  The cairo context of context

Since gtkmm 2.10:

Cairo::RefPtr<Cairo::Context> Gtk::PrintContext::get_cairo_context | ( |  | ) |

Obtains the cairo context that is associated with the Gtk::PrintContext.

Returns:
  The cairo context of context

Since gtkmm 2.10:

double Gtk::PrintContext::get_dpi_x | ( |  | ) | const

Obtains the horizontal resolution of the Gtk::PrintContext, in dots per inch.

Returns:
  The horizontal resolution of context

Since gtkmm 2.10:

double Gtk::PrintContext::get_dpi_y | ( |  | ) | const

Obtains the vertical resolution of the Gtk::PrintContext, in dots per inch.

Returns:
  The vertical resolution of context

Since gtkmm 2.10:

double Gtk::PrintContext::get_height | ( |  | ) | const

Obtains the height of the Gtk::PrintContext, in pixels.

Returns:
  The height of context

Since gtkmm 2.10:

Glib::RefPtr<const PageSetup> Gtk::PrintContext::get_page_setup | ( |  | ) | const

Obtains the Gtk::PageSetup that determines the page dimensions of the Gtk::PrintContext.

Returns:
  The page setup of context

Since gtkmm 2.10:

Glib::RefPtr<PageSetup> Gtk::PrintContext::get_page_setup | ( |  | ) |

Obtains the Gtk::PageSetup that determines the page dimensions of the Gtk::PrintContext.

Returns:
  The page setup of context

Since gtkmm 2.10:

Glib::RefPtr<const Pango::FontMap> Gtk::PrintContext::get_pango_fontmap | ( |  | ) | const

Return value: the font map of context.

Returns:
  The font map of context

Since gtkmm 2.10:

Glib::RefPtr<Pango::FontMap> Gtk::PrintContext::get_pango_fontmap | ( |  | ) |

Return value: the font map of context.

Returns:
  The font map of context

Since gtkmm 2.10:

double Gtk::PrintContext::get_width | ( |  | ) | const

Obtains the width of the Gtk::PrintContext, in pixels.

Returns:
  The width of context

Since gtkmm 2.10:

const GtkPrintContext* Gtk::PrintContext::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

GtkPrintContext* Gtk::PrintContext::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

GtkPrintContext* Gtk::PrintContext::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

void Gtk::PrintContext::set_cairo_context | ( | const Cairo::RefPtr< Cairo::Context > & | cr,
|  | double | dpi_x,
|  | double | dpi_y |
| ) |  |  |

Sets a new cairo context on a print context.

This function is intended to be used when implementing an internal print preview, it is not needed for printing, since GTK+ itself creates a suitable cairo context in that case.

Since gtkmm 2.10:

Parameters:

  | cr | The cairo context.
  | dpi_x | The horizontal resolution to use with cr.
  | dpi_y | The vertical resolution to use with cr.

## Friends And Related Function Documentation

Glib::RefPtr<Gtk::PrintContext> wrap | ( | GtkPrintContext * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- printcontext.h