Gtk.Page_Setup

Entities

Tagged Types

Access Types

Subprograms

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 Gtk.Print_Operation.Gtk_Print_Operation when printing. The benefit of splitting this out of the Gtk.Print_Settings.Gtk_Print_Settings is that these affect the actual layout of the page, and thus need to be set long before user prints.

## Margins ## {print-margins} 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 Gtk.Page_Setup.Gtk_Page_Setup use Gtk.Page_Setup.Gtk_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.

## 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.

Copy

function Copy
   (Self : not null access Gtk_Page_Setup_Record) return Gtk_Page_Setup

Copies a Gtk.Page_Setup.Gtk_Page_Setup. Since: gtk+ 2.10

Parameters
Self
Return Value

a copy of Other

Get_Bottom_Margin

function Get_Bottom_Margin
   (Self : not null access Gtk_Page_Setup_Record;
    Unit : Gtk.Enums.Gtk_Unit) return Gdouble

Gets the bottom margin in units of Unit. Since: gtk+ 2.10

Parameters
Self
Unit

the unit for the return value

Return Value

the bottom margin

Get_Left_Margin

function Get_Left_Margin
   (Self : not null access Gtk_Page_Setup_Record;
    Unit : Gtk.Enums.Gtk_Unit) return Gdouble

Gets the left margin in units of Unit. Since: gtk+ 2.10

Parameters
Self
Unit

the unit for the return value

Return Value

the left margin

Get_Orientation

function Get_Orientation
   (Self : not null access Gtk_Page_Setup_Record)
    return Gtk.Enums.Gtk_Page_Orientation

Gets the page orientation of the Gtk.Page_Setup.Gtk_Page_Setup. Since: gtk+ 2.10

Parameters
Self
Return Value

the page orientation

Get_Page_Height

function Get_Page_Height
   (Self : not null access Gtk_Page_Setup_Record;
    Unit : Gtk.Enums.Gtk_Unit) return Gdouble

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. Since: gtk+ 2.10

Parameters
Self
Unit

the unit for the return value

Return Value

the page height.

Get_Page_Width

function Get_Page_Width
   (Self : not null access Gtk_Page_Setup_Record;
    Unit : Gtk.Enums.Gtk_Unit) return Gdouble

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. Since: gtk+ 2.10

Parameters
Self
Unit

the unit for the return value

Return Value

the page width.

Get_Paper_Height

function Get_Paper_Height
   (Self : not null access Gtk_Page_Setup_Record;
    Unit : Gtk.Enums.Gtk_Unit) return Gdouble

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. Since: gtk+ 2.10

Parameters
Self
Unit

the unit for the return value

Return Value

the paper height.

Get_Paper_Size

function Get_Paper_Size
   (Self : not null access Gtk_Page_Setup_Record)
    return Gtk.Paper_Size.Gtk_Paper_Size

Gets the paper size of the Gtk.Page_Setup.Gtk_Page_Setup. Since: gtk+ 2.10

Parameters
Self
Return Value

the paper size

Get_Paper_Width

function Get_Paper_Width
   (Self : not null access Gtk_Page_Setup_Record;
    Unit : Gtk.Enums.Gtk_Unit) return Gdouble

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. Since: gtk+ 2.10

Parameters
Self
Unit

the unit for the return value

Return Value

the paper width.

Get_Right_Margin

function Get_Right_Margin
   (Self : not null access Gtk_Page_Setup_Record;
    Unit : Gtk.Enums.Gtk_Unit) return Gdouble

Gets the right margin in units of Unit. Since: gtk+ 2.10

Parameters
Self
Unit

the unit for the return value

Return Value

the right margin

Get_Top_Margin

function Get_Top_Margin
   (Self : not null access Gtk_Page_Setup_Record;
    Unit : Gtk.Enums.Gtk_Unit) return Gdouble

Gets the top margin in units of Unit. Since: gtk+ 2.10

Parameters
Self
Unit

the unit for the return value

Return Value

the top margin

Get_Type

function Get_Type return Glib.GType
Return Value

Gtk_New

procedure Gtk_New (Self : out Gtk_Page_Setup)

Creates a new Gtk.Page_Setup.Gtk_Page_Setup. Since: gtk+ 2.10 Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Self

Gtk_New_From_File

procedure Gtk_New_From_File
   (Self      : out Gtk_Page_Setup;
    File_Name : UTF8_String)

Reads the page setup from the file File_Name. Returns a new Gtk.Page_Setup.Gtk_Page_Setup object with the restored page setup, or null if an error occurred. See Gtk.Page_Setup.To_File. Since: gtk+ 2.12 Initialize_From_File does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Self
File_Name

the filename to read the page setup from

Gtk_New_From_Gvariant

procedure Gtk_New_From_Gvariant
   (Self    : out Gtk_Page_Setup;
    Variant : Glib.Variant.Gvariant)

Desrialize a page setup from an a{sv} variant in the format produced by Gtk.Page_Setup.To_Gvariant. Since: gtk+ 3.22 Initialize_From_Gvariant does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Self
Variant

an a{sv} Glib.Variant.Gvariant

Gtk_New_From_Key_File

procedure Gtk_New_From_Key_File
   (Self       : out Gtk_Page_Setup;
    Key_File   : Glib.Key_File.G_Key_File;
    Group_Name : UTF8_String := "")

Reads the page setup from the group Group_Name in the key file Key_File. Returns a new Gtk.Page_Setup.Gtk_Page_Setup object with the restored page setup, or null if an error occurred. Since: gtk+ 2.12 Initialize_From_Key_File does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Self
Key_File

the Gkey.File.Gkey_File to retrieve the page_setup from

Group_Name

the name of the group in the key_file to read, or null to use the default name "Page Setup"

Gtk_Page_Setup

type Gtk_Page_Setup is access all Gtk_Page_Setup_Record'Class;

Gtk_Page_Setup_New

function Gtk_Page_Setup_New return Gtk_Page_Setup

Creates a new Gtk.Page_Setup.Gtk_Page_Setup. Since: gtk+ 2.10

Return Value

Gtk_Page_Setup_New_From_File

function Gtk_Page_Setup_New_From_File
   (File_Name : UTF8_String) return Gtk_Page_Setup

Reads the page setup from the file File_Name. Returns a new Gtk.Page_Setup.Gtk_Page_Setup object with the restored page setup, or null if an error occurred. See Gtk.Page_Setup.To_File. Since: gtk+ 2.12

Parameters
File_Name

the filename to read the page setup from

Return Value

Gtk_Page_Setup_New_From_Gvariant

function Gtk_Page_Setup_New_From_Gvariant
   (Variant : Glib.Variant.Gvariant) return Gtk_Page_Setup

Desrialize a page setup from an a{sv} variant in the format produced by Gtk.Page_Setup.To_Gvariant. Since: gtk+ 3.22

Parameters
Variant

an a{sv} Glib.Variant.Gvariant

Return Value

Gtk_Page_Setup_New_From_Key_File

function Gtk_Page_Setup_New_From_Key_File
   (Key_File   : Glib.Key_File.G_Key_File;
    Group_Name : UTF8_String := "") return Gtk_Page_Setup

Reads the page setup from the group Group_Name in the key file Key_File. Returns a new Gtk.Page_Setup.Gtk_Page_Setup object with the restored page setup, or null if an error occurred. Since: gtk+ 2.12

Parameters
Key_File

the Gkey.File.Gkey_File to retrieve the page_setup from

Group_Name

the name of the group in the key_file to read, or null to use the default name "Page Setup"

Return Value

Gtk_Page_Setup_Record

type Gtk_Page_Setup_Record is new GObject_Record with null record;

Initialize

procedure Initialize (Self : not null access Gtk_Page_Setup_Record'Class)

Creates a new Gtk.Page_Setup.Gtk_Page_Setup. Since: gtk+ 2.10 Initialize does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Self

Initialize_From_File

procedure Initialize_From_File
   (Self      : not null access Gtk_Page_Setup_Record'Class;
    File_Name : UTF8_String)

Reads the page setup from the file File_Name. Returns a new Gtk.Page_Setup.Gtk_Page_Setup object with the restored page setup, or null if an error occurred. See Gtk.Page_Setup.To_File. Since: gtk+ 2.12 Initialize_From_File does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Self
File_Name

the filename to read the page setup from

Initialize_From_Gvariant

procedure Initialize_From_Gvariant
   (Self    : not null access Gtk_Page_Setup_Record'Class;
    Variant : Glib.Variant.Gvariant)

Desrialize a page setup from an a{sv} variant in the format produced by Gtk.Page_Setup.To_Gvariant. Since: gtk+ 3.22 Initialize_From_Gvariant does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Self
Variant

an a{sv} Glib.Variant.Gvariant

Initialize_From_Key_File

procedure Initialize_From_Key_File
   (Self       : not null access Gtk_Page_Setup_Record'Class;
    Key_File   : Glib.Key_File.G_Key_File;
    Group_Name : UTF8_String := "")

Reads the page setup from the group Group_Name in the key file Key_File. Returns a new Gtk.Page_Setup.Gtk_Page_Setup object with the restored page setup, or null if an error occurred. Since: gtk+ 2.12 Initialize_From_Key_File does nothing if the object was already created with another call to Initialize* or G_New.

Parameters
Self
Key_File

the Gkey.File.Gkey_File to retrieve the page_setup from

Group_Name

the name of the group in the key_file to read, or null to use the default name "Page Setup"

Load_File

function Load_File
   (Self      : not null access Gtk_Page_Setup_Record;
    File_Name : UTF8_String) return Boolean

Reads the page setup from the file File_Name. See Gtk.Page_Setup.To_File. Since: gtk+ 2.14

Parameters
Self
File_Name

the filename to read the page setup from

Return Value

True on success

Load_Key_File

function Load_Key_File
   (Self       : not null access Gtk_Page_Setup_Record;
    Key_File   : Glib.Key_File.G_Key_File;
    Group_Name : UTF8_String := "") return Boolean

Reads the page setup from the group Group_Name in the key file Key_File. Since: gtk+ 2.14

Parameters
Self
Key_File

the Gkey.File.Gkey_File to retrieve the page_setup from

Group_Name

the name of the group in the key_file to read, or null to use the default name "Page Setup"

Return Value

True on success

Set_Bottom_Margin

procedure Set_Bottom_Margin
   (Self   : not null access Gtk_Page_Setup_Record;
    Margin : Gdouble;
    Unit   : Gtk.Enums.Gtk_Unit)

Sets the bottom margin of the Gtk.Page_Setup.Gtk_Page_Setup. Since: gtk+ 2.10

Parameters
Self
Margin

the new bottom margin in units of Unit

Unit

the units for Margin

Set_Left_Margin

procedure Set_Left_Margin
   (Self   : not null access Gtk_Page_Setup_Record;
    Margin : Gdouble;
    Unit   : Gtk.Enums.Gtk_Unit)

Sets the left margin of the Gtk.Page_Setup.Gtk_Page_Setup. Since: gtk+ 2.10

Parameters
Self
Margin

the new left margin in units of Unit

Unit

the units for Margin

Set_Orientation

procedure Set_Orientation
   (Self        : not null access Gtk_Page_Setup_Record;
    Orientation : Gtk.Enums.Gtk_Page_Orientation)

Sets the page orientation of the Gtk.Page_Setup.Gtk_Page_Setup. Since: gtk+ 2.10

Parameters
Self
Orientation

a Gtk.Enums.Gtk_Page_Orientation value

Set_Paper_Size

procedure Set_Paper_Size
   (Self : not null access Gtk_Page_Setup_Record;
    Size : Gtk.Paper_Size.Gtk_Paper_Size)

Sets the paper size of the Gtk.Page_Setup.Gtk_Page_Setup without changing the margins. See Gtk.Page_Setup.Set_Paper_Size_And_Default_Margins. Since: gtk+ 2.10

Parameters
Self
Size

a Gtk.Paper_Size.Gtk_Paper_Size

Set_Paper_Size_And_Default_Margins

procedure Set_Paper_Size_And_Default_Margins
   (Self : not null access Gtk_Page_Setup_Record;
    Size : Gtk.Paper_Size.Gtk_Paper_Size)

Sets the paper size of the Gtk.Page_Setup.Gtk_Page_Setup and modifies the margins according to the new paper size. Since: gtk+ 2.10

Parameters
Self
Size

a Gtk.Paper_Size.Gtk_Paper_Size

Set_Right_Margin

procedure Set_Right_Margin
   (Self   : not null access Gtk_Page_Setup_Record;
    Margin : Gdouble;
    Unit   : Gtk.Enums.Gtk_Unit)

Sets the right margin of the Gtk.Page_Setup.Gtk_Page_Setup. Since: gtk+ 2.10

Parameters
Self
Margin

the new right margin in units of Unit

Unit

the units for Margin

Set_Top_Margin

procedure Set_Top_Margin
   (Self   : not null access Gtk_Page_Setup_Record;
    Margin : Gdouble;
    Unit   : Gtk.Enums.Gtk_Unit)

Sets the top margin of the Gtk.Page_Setup.Gtk_Page_Setup. Since: gtk+ 2.10

Parameters
Self
Margin

the new top margin in units of Unit

Unit

the units for Margin

To_File

function To_File
   (Self      : not null access Gtk_Page_Setup_Record;
    File_Name : UTF8_String) return Boolean

This function saves the information from Setup to File_Name. Since: gtk+ 2.12

Parameters
Self
File_Name

the file to save to

Return Value

True on success

To_Gvariant

function To_Gvariant
   (Self : not null access Gtk_Page_Setup_Record)
    return Glib.Variant.Gvariant

Serialize page setup to an a{sv} variant. Since: gtk+ 3.22

Parameters
Self
Return Value

a new, floating, Glib.Variant.Gvariant

To_Key_File

procedure To_Key_File
   (Self       : not null access Gtk_Page_Setup_Record;
    Key_File   : Glib.Key_File.G_Key_File;
    Group_Name : UTF8_String := "")

This function adds the page setup from Setup to Key_File. Since: gtk+ 2.12

Parameters
Self
Key_File

the Gkey.File.Gkey_File to save the page setup to

Group_Name

the group to add the settings to in Key_File, or null to use the default name "Page Setup"