gi-gtk-4.0.5: Gtk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gtk.Objects.PageSetup

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.

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 GtkPageSetup use pageSetupNew to get the defaults, or use printRunPageSetupDialog to show the page setup dialog and receive the resulting page setup.

A page setup dialog

c code

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;
}
Synopsis

Exported types

newtype PageSetup Source #

Memory-managed wrapper type.

Instances

Instances details
Eq PageSetup Source # 
Instance details

Defined in GI.Gtk.Objects.PageSetup

GObject PageSetup Source # 
Instance details

Defined in GI.Gtk.Objects.PageSetup

ManagedPtrNewtype PageSetup Source # 
Instance details

Defined in GI.Gtk.Objects.PageSetup

TypedObject PageSetup Source # 
Instance details

Defined in GI.Gtk.Objects.PageSetup

Methods

glibType :: IO GType #

HasParentTypes PageSetup Source # 
Instance details

Defined in GI.Gtk.Objects.PageSetup

IsGValue (Maybe PageSetup) Source #

Convert PageSetup to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.PageSetup

type ParentTypes PageSetup Source # 
Instance details

Defined in GI.Gtk.Objects.PageSetup

class (GObject o, IsDescendantOf PageSetup o) => IsPageSetup o Source #

Type class for types which can be safely cast to PageSetup, for instance with toPageSetup.

Instances

Instances details
(GObject o, IsDescendantOf PageSetup o) => IsPageSetup o Source # 
Instance details

Defined in GI.Gtk.Objects.PageSetup

toPageSetup :: (MonadIO m, IsPageSetup o) => o -> m PageSetup Source #

Cast to PageSetup, for types for which this is known to be safe. For general casts, use castTo.

Methods

copy

pageSetupCopy Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

other: the GtkPageSetup to copy

-> m PageSetup

Returns: a copy of other

Copies a GtkPageSetup.

getBottomMargin

pageSetupGetBottomMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Unit

unit: the unit for the return value

-> m Double

Returns: the bottom margin

Gets the bottom margin in units of unit.

getLeftMargin

pageSetupGetLeftMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Unit

unit: the unit for the return value

-> m Double

Returns: the left margin

Gets the left margin in units of unit.

getOrientation

pageSetupGetOrientation Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> m PageOrientation

Returns: the page orientation

Gets the page orientation of the GtkPageSetup.

getPageHeight

pageSetupGetPageHeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Unit

unit: the unit for the return value

-> m Double

Returns: the page height.

Returns the page height in units of unit.

Note that this function takes orientation and margins into consideration. See pageSetupGetPaperHeight.

getPageWidth

pageSetupGetPageWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Unit

unit: the unit for the return value

-> m Double

Returns: the page width.

Returns the page width in units of unit.

Note that this function takes orientation and margins into consideration. See pageSetupGetPaperWidth.

getPaperHeight

pageSetupGetPaperHeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Unit

unit: the unit for the return value

-> m Double

Returns: the paper height.

Returns the paper height in units of unit.

Note that this function takes orientation, but not margins into consideration. See pageSetupGetPageHeight.

getPaperSize

pageSetupGetPaperSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> m PaperSize

Returns: the paper size

Gets the paper size of the GtkPageSetup.

getPaperWidth

pageSetupGetPaperWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Unit

unit: the unit for the return value

-> m Double

Returns: the paper width.

Returns the paper width in units of unit.

Note that this function takes orientation, but not margins into consideration. See pageSetupGetPageWidth.

getRightMargin

pageSetupGetRightMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Unit

unit: the unit for the return value

-> m Double

Returns: the right margin

Gets the right margin in units of unit.

getTopMargin

pageSetupGetTopMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Unit

unit: the unit for the return value

-> m Double

Returns: the top margin

Gets the top margin in units of unit.

loadFile

pageSetupLoadFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> [Char]

fileName: the filename to read the page setup from

-> m ()

(Can throw GError)

Reads the page setup from the file fileName.

See pageSetupToFile.

loadKeyFile

pageSetupLoadKeyFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> KeyFile

keyFile: the GKeyFile to retrieve the page_setup from

-> Maybe Text

groupName: the name of the group in the key_file to read to use the default name “Page Setup”

-> m ()

(Can throw GError)

Reads the page setup from the group groupName in the key file keyFile.

new

pageSetupNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m PageSetup

Returns: a new GtkPageSetup.

Creates a new GtkPageSetup.

newFromFile

pageSetupNewFromFile Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Char]

fileName: the filename to read the page setup from

-> m PageSetup

Returns: the restored GtkPageSetup (Can throw GError)

Reads the page setup from the file fileName.

Returns a new GtkPageSetup object with the restored page setup, or Nothing if an error occurred. See pageSetupToFile.

newFromGvariant

pageSetupNewFromGvariant Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> GVariant

variant: an a{sv} GVariant

-> m PageSetup

Returns: a new GtkPageSetup object

Desrialize a page setup from an a{sv} variant.

The variant must be in the format produced by pageSetupToGvariant.

newFromKeyFile

pageSetupNewFromKeyFile Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> KeyFile

keyFile: the GKeyFile to retrieve the page_setup from

-> Maybe Text

groupName: the name of the group in the key_file to read to use the default name “Page Setup”

-> m PageSetup

Returns: the restored GtkPageSetup (Can throw GError)

Reads the page setup from the group groupName in the key file keyFile.

Returns a new GtkPageSetup object with the restored page setup, or Nothing if an error occurred.

setBottomMargin

pageSetupSetBottomMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Double

margin: the new bottom margin in units of unit

-> Unit

unit: the units for margin

-> m () 

Sets the bottom margin of the GtkPageSetup.

setLeftMargin

pageSetupSetLeftMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Double

margin: the new left margin in units of unit

-> Unit

unit: the units for margin

-> m () 

Sets the left margin of the GtkPageSetup.

setOrientation

pageSetupSetOrientation Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> PageOrientation

orientation: a GtkPageOrientation value

-> m () 

Sets the page orientation of the GtkPageSetup.

setPaperSize

pageSetupSetPaperSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> PaperSize

size: a GtkPaperSize

-> m () 

Sets the paper size of the GtkPageSetup without changing the margins.

See pageSetupSetPaperSizeAndDefaultMargins.

setPaperSizeAndDefaultMargins

pageSetupSetPaperSizeAndDefaultMargins Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> PaperSize

size: a GtkPaperSize

-> m () 

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

setRightMargin

pageSetupSetRightMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Double

margin: the new right margin in units of unit

-> Unit

unit: the units for margin

-> m () 

Sets the right margin of the GtkPageSetup.

setTopMargin

pageSetupSetTopMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> Double

margin: the new top margin in units of unit

-> Unit

unit: the units for margin

-> m () 

Sets the top margin of the GtkPageSetup.

toFile

pageSetupToFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> [Char]

fileName: the file to save to

-> m ()

(Can throw GError)

This function saves the information from setup to fileName.

toGvariant

pageSetupToGvariant Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> m GVariant

Returns: a new, floating, GVariant

Serialize page setup to an a{sv} variant.

toKeyFile

pageSetupToKeyFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) 
=> a

setup: a GtkPageSetup

-> KeyFile

keyFile: the GKeyFile to save the page setup to

-> Maybe Text

groupName: the group to add the settings to in keyFile, or Nothing to use the default name “Page Setup”

-> m () 

This function adds the page setup from setup to keyFile.