GtkPageSetup

GtkPageSetup — Stores page setup information

Synopsis


#include <gtk/gtk.h>


            GtkPageSetup;
GtkPageSetup* gtk_page_setup_new            (void);
GtkPageSetup* gtk_page_setup_copy           (GtkPageSetup *other);
GtkPageOrientation gtk_page_setup_get_orientation
                                            (GtkPageSetup *setup);
void        gtk_page_setup_set_orientation  (GtkPageSetup *setup,
                                             GtkPageOrientation orientation);
GtkPaperSize* gtk_page_setup_get_paper_size (GtkPageSetup *setup);
void        gtk_page_setup_set_paper_size   (GtkPageSetup *setup,
                                             GtkPaperSize *size);
gdouble     gtk_page_setup_get_top_margin   (GtkPageSetup *setup,
                                             GtkUnit unit);
void        gtk_page_setup_set_top_margin   (GtkPageSetup *setup,
                                             gdouble margin,
                                             GtkUnit unit);
gdouble     gtk_page_setup_get_bottom_margin
                                            (GtkPageSetup *setup,
                                             GtkUnit unit);
void        gtk_page_setup_set_bottom_margin
                                            (GtkPageSetup *setup,
                                             gdouble margin,
                                             GtkUnit unit);
gdouble     gtk_page_setup_get_left_margin  (GtkPageSetup *setup,
                                             GtkUnit unit);
void        gtk_page_setup_set_left_margin  (GtkPageSetup *setup,
                                             gdouble margin,
                                             GtkUnit unit);
gdouble     gtk_page_setup_get_right_margin (GtkPageSetup *setup,
                                             GtkUnit unit);
void        gtk_page_setup_set_right_margin (GtkPageSetup *setup,
                                             gdouble margin,
                                             GtkUnit unit);
void        gtk_page_setup_set_paper_size_and_default_margins
                                            (GtkPageSetup *setup,
                                             GtkPaperSize *size);
gdouble     gtk_page_setup_get_paper_width  (GtkPageSetup *setup,
                                             GtkUnit unit);
gdouble     gtk_page_setup_get_paper_height (GtkPageSetup *setup,
                                             GtkUnit unit);
gdouble     gtk_page_setup_get_page_width   (GtkPageSetup *setup,
                                             GtkUnit unit);
gdouble     gtk_page_setup_get_page_height  (GtkPageSetup *setup,
                                             GtkUnit unit);


Object Hierarchy


  GObject
   +----GtkPageSetup

Description

A GtkPageSetup object stores the page size, orientation and margins. The idea is that you can get one of these from the page setup dialog and then pass it to the GtkPrintOperation when printing. The benefit of splitting this out of the GtkPrintSettings is that these affect the actual layout of the page, and thus need to be set long before user prints.

The margins specified in this object are the "print margins", i.e. the parts of the page that the printer cannot print on. These are different from the layout margins that a word processor uses; they are typically used to determine the minimal size for the layout margins.

To obtain a GtkPageSetup use gtk_page_setup_new() to get the defaults, or use gtk_print_run_page_setup_dialog() to show the page setup dialog and receive the resulting page setup.

Example 40. A page setup dialog

static GtkPrintSettings *settings = NULL;
static GtkPageSetup *page_setup = NULL;

static void
do_page_setup (void)
{
  GtkPageSetup *new_page_setup;

  if (settings == NULL)
    settings = gtk_print_settings_new ();

  new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window),
                                                    page_setup, settings);

  if (page_setup)
    g_object_unref (page_setup);

  page_setup = new_page_setup;
}

Printing support was added in GTK+ 2.10.

Details

GtkPageSetup

typedef struct _GtkPageSetup GtkPageSetup;


gtk_page_setup_new ()

GtkPageSetup* gtk_page_setup_new            (void);

Creates a new GtkPageSetup.

Returns : a new GtkPageSetup.

Since 2.10


gtk_page_setup_copy ()

GtkPageSetup* gtk_page_setup_copy           (GtkPageSetup *other);

Copies a GtkPageSetup.

other : the GtkPageSetup to copy
Returns : a copy of other

Since 2.10


gtk_page_setup_get_orientation ()

GtkPageOrientation gtk_page_setup_get_orientation
                                            (GtkPageSetup *setup);

Gets the page orientation of the GtkPageSetup.

setup : a GtkPageSetup
Returns : the page orientation

Since 2.10


gtk_page_setup_set_orientation ()

void        gtk_page_setup_set_orientation  (GtkPageSetup *setup,
                                             GtkPageOrientation orientation);

Sets the page orientation of the GtkPageSetup.

setup : a GtkPageSetup
orientation : a GtkPageOrientation value

Since 2.10


gtk_page_setup_get_paper_size ()

GtkPaperSize* gtk_page_setup_get_paper_size (GtkPageSetup *setup);

Gets the paper size of the GtkPageSetup.

setup : a GtkPageSetup
Returns : the paper size

Since 2.10


gtk_page_setup_set_paper_size ()

void        gtk_page_setup_set_paper_size   (GtkPageSetup *setup,
                                             GtkPaperSize *size);

Sets the paper size of the GtkPageSetup without changing the margins. See gtk_page_setup_set_paper_size_and_default_margins().

setup : a GtkPageSetup
size : a GtkPaperSize

Since 2.10


gtk_page_setup_get_top_margin ()

gdouble     gtk_page_setup_get_top_margin   (GtkPageSetup *setup,
                                             GtkUnit unit);

Gets the top margin in units of unit.

setup : a GtkPageSetup
unit : the unit for the return value
Returns : the top margin

Since 2.10


gtk_page_setup_set_top_margin ()

void        gtk_page_setup_set_top_margin   (GtkPageSetup *setup,
                                             gdouble margin,
                                             GtkUnit unit);

Sets the top margin of the GtkPageSetup.

setup : a GtkPageSetup
margin : the new top margin in units of unit
unit : the units for margin

Since 2.10


gtk_page_setup_get_bottom_margin ()

gdouble     gtk_page_setup_get_bottom_margin
                                            (GtkPageSetup *setup,
                                             GtkUnit unit);

Gets the bottom margin in units of unit.

setup : a GtkPageSetup
unit : the unit for the return value
Returns : the bottom margin

Since 2.10


gtk_page_setup_set_bottom_margin ()

void        gtk_page_setup_set_bottom_margin
                                            (GtkPageSetup *setup,
                                             gdouble margin,
                                             GtkUnit unit);

Sets the bottom margin of the GtkPageSetup.

setup : a GtkPageSetup
margin : the new bottom margin in units of unit
unit : the units for margin

Since 2.10


gtk_page_setup_get_left_margin ()

gdouble     gtk_page_setup_get_left_margin  (GtkPageSetup *setup,
                                             GtkUnit unit);

Gets the left margin in units of unit.

setup : a GtkPageSetup
unit : the unit for the return value
Returns : the left margin

Since 2.10


gtk_page_setup_set_left_margin ()

void        gtk_page_setup_set_left_margin  (GtkPageSetup *setup,
                                             gdouble margin,
                                             GtkUnit unit);

Sets the left margin of the GtkPageSetup.

setup : a GtkPageSetup
margin : the new left margin in units of unit
unit : the units for margin

Since 2.10


gtk_page_setup_get_right_margin ()

gdouble     gtk_page_setup_get_right_margin (GtkPageSetup *setup,
                                             GtkUnit unit);

Gets the right margin in units of unit.

setup : a GtkPageSetup
unit : the unit for the return value
Returns : the right margin

Since 2.10


gtk_page_setup_set_right_margin ()

void        gtk_page_setup_set_right_margin (GtkPageSetup *setup,
                                             gdouble margin,
                                             GtkUnit unit);

Sets the right margin of the GtkPageSetup.

setup : a GtkPageSetup
margin : the new right margin in units of unit
unit : the units for margin

Since 2.10


gtk_page_setup_set_paper_size_and_default_margins ()

void        gtk_page_setup_set_paper_size_and_default_margins
                                            (GtkPageSetup *setup,
                                             GtkPaperSize *size);

Sets the paper size of the GtkPageSetup and modifies the margins according to the new paper size.

setup : a GtkPageSetup
size : a GtkPaperSize

Since 2.10


gtk_page_setup_get_paper_width ()

gdouble     gtk_page_setup_get_paper_width  (GtkPageSetup *setup,
                                             GtkUnit unit);

Returns the paper width in units of unit.

Note that this function takes orientation, but not margins into consideration. See gtk_page_setup_get_page_width().

setup : a GtkPageSetup
unit : the unit for the return value
Returns : the paper width.

Since 2.10


gtk_page_setup_get_paper_height ()

gdouble     gtk_page_setup_get_paper_height (GtkPageSetup *setup,
                                             GtkUnit unit);

Returns the paper height in units of unit.

Note that this function takes orientation, but not margins into consideration. See gtk_page_setup_get_page_height().

setup : a GtkPageSetup
unit : the unit for the return value
Returns : the paper height.

Since 2.10


gtk_page_setup_get_page_width ()

gdouble     gtk_page_setup_get_page_width   (GtkPageSetup *setup,
                                             GtkUnit unit);

Returns the page width in units of unit.

Note that this function takes orientation and margins into consideration. See gtk_page_setup_get_paper_width().

setup : a GtkPageSetup
unit : the unit for the return value
Returns : the page width.

Since 2.10


gtk_page_setup_get_page_height ()

gdouble     gtk_page_setup_get_page_height  (GtkPageSetup *setup,
                                             GtkUnit unit);

Returns the page height in units of unit.

Note that this function takes orientation and margins into consideration. See gtk_page_setup_get_paper_height().

setup : a GtkPageSetup
unit : the unit for the return value
Returns : the page height.

Since 2.10