gi-gtk3-3.0.44: Gtk 3.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.PageSetup

Contents

- Exported types
- Methods
  - copy
  - getBottomMargin
  - getLeftMargin
  - getOrientation
  - getPageHeight
  - getPageWidth
  - getPaperHeight
  - getPaperSize
  - getPaperWidth
  - getRightMargin
  - getTopMargin
  - loadFile
  - loadKeyFile
  - new
  - newFromFile
  - newFromGvariant
  - newFromKeyFile
  - setBottomMargin
  - setLeftMargin
  - setOrientation
  - setPaperSize
  - setPaperSizeAndDefaultMargins
  - setRightMargin
  - setTopMargin
  - toFile
  - toGvariant
  - toKeyFile

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 `PrintOperation` when printing. The benefit of splitting this out of the `PrintSettings` 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 `PageSetup` 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;
    }

Printing support was added in GTK+ 2.10.

Synopsis

- newtype PageSetup = PageSetup (ManagedPtr PageSetup)
- class (GObject o, IsDescendantOf PageSetup o) => IsPageSetup o
- toPageSetup :: (MonadIO m, IsPageSetup o) => o -> m PageSetup
- pageSetupCopy :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> m PageSetup
- pageSetupGetBottomMargin :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Unit -> m Double
- pageSetupGetLeftMargin :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Unit -> m Double
- pageSetupGetOrientation :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> m PageOrientation
- pageSetupGetPageHeight :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Unit -> m Double
- pageSetupGetPageWidth :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Unit -> m Double
- pageSetupGetPaperHeight :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Unit -> m Double
- pageSetupGetPaperSize :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> m PaperSize
- pageSetupGetPaperWidth :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Unit -> m Double
- pageSetupGetRightMargin :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Unit -> m Double
- pageSetupGetTopMargin :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Unit -> m Double
- pageSetupLoadFile :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> [Char] -> m ()
- pageSetupLoadKeyFile :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> KeyFile -> Maybe Text -> m ()
- pageSetupNew :: (HasCallStack, MonadIO m) => m PageSetup
- pageSetupNewFromFile :: (HasCallStack, MonadIO m) => [Char] -> m PageSetup
- pageSetupNewFromGvariant :: (HasCallStack, MonadIO m) => GVariant -> m PageSetup
- pageSetupNewFromKeyFile :: (HasCallStack, MonadIO m) => KeyFile -> Maybe Text -> m PageSetup
- pageSetupSetBottomMargin :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Double -> Unit -> m ()
- pageSetupSetLeftMargin :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Double -> Unit -> m ()
- pageSetupSetOrientation :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> PageOrientation -> m ()
- pageSetupSetPaperSize :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> PaperSize -> m ()
- pageSetupSetPaperSizeAndDefaultMargins :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> PaperSize -> m ()
- pageSetupSetRightMargin :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Double -> Unit -> m ()
- pageSetupSetTopMargin :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> Double -> Unit -> m ()
- pageSetupToFile :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> [Char] -> m ()
- pageSetupToGvariant :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> m GVariant
- pageSetupToKeyFile :: (HasCallStack, MonadIO m, IsPageSetup a) => a -> KeyFile -> Maybe Text -> m ()

# Exported types

newtype PageSetup Source #

Memory-managed wrapper type.

Constructors

PageSetup (ManagedPtr PageSetup) |

#### Instances

Instances details

Eq PageSetup Source # |
Instance details Defined in GI.Gtk.Objects.PageSetup Methods (==) :: PageSetup -> PageSetup -> Bool Source # (/=) :: PageSetup -> PageSetup -> Bool Source #
GObject PageSetup Source # |
Instance details Defined in GI.Gtk.Objects.PageSetup
ManagedPtrNewtype PageSetup Source # |
Instance details Defined in GI.Gtk.Objects.PageSetup Methods toManagedPtr :: PageSetup -> ManagedPtr PageSetup Source #
TypedObject PageSetup Source # |
Instance details Defined in GI.Gtk.Objects.PageSetup Methods glibType :: IO GType Source #
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 Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe PageSetup -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe PageSetup) Source #
type ParentTypes PageSetup Source # |
Instance details Defined in GI.Gtk.Objects.PageSetup type ParentTypes PageSetup = '[Object]

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

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, copy, forceFloating, freezeNotify, getv, isFloating, loadFile, loadKeyFile, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, toFile, toGvariant, toKeyFile, unref, watchClosure.

#### Getters

getBottomMargin, getData, getLeftMargin, getOrientation, getPageHeight, getPageWidth, getPaperHeight, getPaperSize, getPaperWidth, getProperty, getQdata, getRightMargin, getTopMargin.

#### Setters

setBottomMargin, setData, setDataFull, setLeftMargin, setOrientation, setPaperSize, setPaperSizeAndDefaultMargins, setProperty, setRightMargin, setTopMargin.

## copy

pageSetupCopy Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `other`: the `PageSetup` to copy
-> m PageSetup | Returns: a copy of `other`

Copies a `PageSetup`.

Since: 2.10

## getBottomMargin

pageSetupGetBottomMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> Unit | `unit`: the unit for the return value
-> m Double | Returns: the bottom margin

Gets the bottom margin in units of `unit`.

Since: 2.10

## getLeftMargin

pageSetupGetLeftMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> Unit | `unit`: the unit for the return value
-> m Double | Returns: the left margin

Gets the left margin in units of `unit`.

Since: 2.10

## getOrientation

pageSetupGetOrientation Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> m PageOrientation | Returns: the page orientation

Gets the page orientation of the `PageSetup`.

Since: 2.10

## getPageHeight

pageSetupGetPageHeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> 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`.

Since: 2.10

## getPageWidth

pageSetupGetPageWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> 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`.

Since: 2.10

## getPaperHeight

pageSetupGetPaperHeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> 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`.

Since: 2.10

## getPaperSize

pageSetupGetPaperSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> m PaperSize | Returns: the paper size

Gets the paper size of the `PageSetup`.

Since: 2.10

## getPaperWidth

pageSetupGetPaperWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> 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`.

Since: 2.10

## getRightMargin

pageSetupGetRightMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> Unit | `unit`: the unit for the return value
-> m Double | Returns: the right margin

Gets the right margin in units of `unit`.

Since: 2.10

## getTopMargin

pageSetupGetTopMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> Unit | `unit`: the unit for the return value
-> m Double | Returns: the top margin

Gets the top margin in units of `unit`.

Since: 2.10

## loadFile

pageSetupLoadFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> [Char] | `fileName`: the filename to read the page setup from
-> m () | (Can throw `GError`)

Reads the page setup from the file `fileName`. See `pageSetupToFile`.

Since: 2.14

## loadKeyFile

pageSetupLoadKeyFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> KeyFile | `keyFile`: the `KeyFile` to retrieve the page_setup from
-> Maybe Text | `groupName`: the name of the group in the key_file to read, or `Nothing` to use the default name “Page Setup”
-> m () | (Can throw `GError`)

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

Since: 2.14

## new

pageSetupNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m PageSetup | Returns: a new `PageSetup`.

Creates a new `PageSetup`.

Since: 2.10

## newFromFile

pageSetupNewFromFile Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> [Char] | `fileName`: the filename to read the page setup from
-> m PageSetup | Returns: the restored `PageSetup` (Can throw `GError`)

Reads the page setup from the file `fileName`. Returns a new `PageSetup` object with the restored page setup, or `Nothing` if an error occurred. See `pageSetupToFile`.

Since: 2.12

## newFromGvariant

pageSetupNewFromGvariant Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> GVariant | `variant`: an a{sv} `GVariant`
-> m PageSetup | Returns: a new `PageSetup` object

Desrialize a page setup from an a{sv} variant in the format produced by `pageSetupToGvariant`.

Since: 3.22

## newFromKeyFile

pageSetupNewFromKeyFile Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> KeyFile | `keyFile`: the `KeyFile` to retrieve the page_setup from
-> Maybe Text | `groupName`: the name of the group in the key_file to read, or `Nothing` to use the default name “Page Setup”
-> m PageSetup | Returns: the restored `PageSetup` (Can throw `GError`)

Reads the page setup from the group `groupName` in the key file `keyFile`. Returns a new `PageSetup` object with the restored page setup, or `Nothing` if an error occurred.

Since: 2.12

## setBottomMargin

pageSetupSetBottomMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> Double | `margin`: the new bottom margin in units of `unit`
-> Unit | `unit`: the units for `margin`
-> m () |

Sets the bottom margin of the `PageSetup`.

Since: 2.10

## setLeftMargin

pageSetupSetLeftMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> Double | `margin`: the new left margin in units of `unit`
-> Unit | `unit`: the units for `margin`
-> m () |

Sets the left margin of the `PageSetup`.

Since: 2.10

## setOrientation

pageSetupSetOrientation Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> PageOrientation | `orientation`: a `PageOrientation` value
-> m () |

Sets the page orientation of the `PageSetup`.

Since: 2.10

## setPaperSize

pageSetupSetPaperSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> PaperSize | `size`: a `PaperSize`
-> m () |

Sets the paper size of the `PageSetup` without changing the margins. See `pageSetupSetPaperSizeAndDefaultMargins`.

Since: 2.10

## setPaperSizeAndDefaultMargins

pageSetupSetPaperSizeAndDefaultMargins Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> PaperSize | `size`: a `PaperSize`
-> m () |

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

Since: 2.10

## setRightMargin

pageSetupSetRightMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> Double | `margin`: the new right margin in units of `unit`
-> Unit | `unit`: the units for `margin`
-> m () |

Sets the right margin of the `PageSetup`.

Since: 2.10

## setTopMargin

pageSetupSetTopMargin Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> Double | `margin`: the new top margin in units of `unit`
-> Unit | `unit`: the units for `margin`
-> m () |

Sets the top margin of the `PageSetup`.

Since: 2.10

## toFile

pageSetupToFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> [Char] | `fileName`: the file to save to
-> m () | (Can throw `GError`)

This function saves the information from `setup` to `fileName`.

Since: 2.12

## toGvariant

pageSetupToGvariant Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> m GVariant | Returns: a new, floating, `GVariant`

Serialize page setup to an a{sv} variant.

Since: 3.22

## toKeyFile

pageSetupToKeyFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsPageSetup a) |
=> a | `setup`: a `PageSetup`
-> KeyFile | `keyFile`: the `KeyFile` 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`.

Since: 2.12