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.Structs.PaperSize

Contents

- Exported types
- Methods
  - copy
  - free
  - getDefault
  - getDefaultBottomMargin
  - getDefaultLeftMargin
  - getDefaultRightMargin
  - getDefaultTopMargin
  - getDisplayName
  - getHeight
  - getName
  - getPaperSizes
  - getPpdName
  - getWidth
  - isCustom
  - isEqual
  - isIpp
  - new
  - newCustom
  - newFromGvariant
  - newFromIpp
  - newFromKeyFile
  - newFromPpd
  - setSize
  - toGvariant
  - toKeyFile

Description

GtkPaperSize handles paper sizes. It uses the standard called PWG 5101.1-2002 PWG: Standard for Media Standardized Names to name the paper sizes (and to get the data for the page sizes). In addition to standard paper sizes, GtkPaperSize allows to construct custom paper sizes with arbitrary dimensions.

The `PaperSize` object stores not only the dimensions (width and height) of a paper size and its name, it also provides default [print margins][print-margins].

Printing support has been added in GTK+ 2.10.

Synopsis

- newtype PaperSize = PaperSize (ManagedPtr PaperSize)
- paperSizeCopy :: (HasCallStack, MonadIO m) => PaperSize -> m PaperSize
- paperSizeFree :: (HasCallStack, MonadIO m) => PaperSize -> m ()
- paperSizeGetDefault :: (HasCallStack, MonadIO m) => m Text
- paperSizeGetDefaultBottomMargin :: (HasCallStack, MonadIO m) => PaperSize -> Unit -> m Double
- paperSizeGetDefaultLeftMargin :: (HasCallStack, MonadIO m) => PaperSize -> Unit -> m Double
- paperSizeGetDefaultRightMargin :: (HasCallStack, MonadIO m) => PaperSize -> Unit -> m Double
- paperSizeGetDefaultTopMargin :: (HasCallStack, MonadIO m) => PaperSize -> Unit -> m Double
- paperSizeGetDisplayName :: (HasCallStack, MonadIO m) => PaperSize -> m Text
- paperSizeGetHeight :: (HasCallStack, MonadIO m) => PaperSize -> Unit -> m Double
- paperSizeGetName :: (HasCallStack, MonadIO m) => PaperSize -> m Text
- paperSizeGetPaperSizes :: (HasCallStack, MonadIO m) => Bool -> m [PaperSize]
- paperSizeGetPpdName :: (HasCallStack, MonadIO m) => PaperSize -> m Text
- paperSizeGetWidth :: (HasCallStack, MonadIO m) => PaperSize -> Unit -> m Double
- paperSizeIsCustom :: (HasCallStack, MonadIO m) => PaperSize -> m Bool
- paperSizeIsEqual :: (HasCallStack, MonadIO m) => PaperSize -> PaperSize -> m Bool
- paperSizeIsIpp :: (HasCallStack, MonadIO m) => PaperSize -> m Bool
- paperSizeNew :: (HasCallStack, MonadIO m) => Maybe Text -> m PaperSize
- paperSizeNewCustom :: (HasCallStack, MonadIO m) => Text -> Text -> Double -> Double -> Unit -> m PaperSize
- paperSizeNewFromGvariant :: (HasCallStack, MonadIO m) => GVariant -> m PaperSize
- paperSizeNewFromIpp :: (HasCallStack, MonadIO m) => Text -> Double -> Double -> m PaperSize
- paperSizeNewFromKeyFile :: (HasCallStack, MonadIO m) => KeyFile -> Maybe Text -> m PaperSize
- paperSizeNewFromPpd :: (HasCallStack, MonadIO m) => Text -> Text -> Double -> Double -> m PaperSize
- paperSizeSetSize :: (HasCallStack, MonadIO m) => PaperSize -> Double -> Double -> Unit -> m ()
- paperSizeToGvariant :: (HasCallStack, MonadIO m) => PaperSize -> m GVariant
- paperSizeToKeyFile :: (HasCallStack, MonadIO m) => PaperSize -> KeyFile -> Text -> m ()

# Exported types

newtype PaperSize Source #

Memory-managed wrapper type.

Constructors

PaperSize (ManagedPtr PaperSize) |

#### Instances

Instances details

Eq PaperSize Source # |
Instance details Defined in GI.Gtk.Structs.PaperSize Methods (==) :: PaperSize -> PaperSize -> Bool Source # (/=) :: PaperSize -> PaperSize -> Bool Source #
GBoxed PaperSize Source # |
Instance details Defined in GI.Gtk.Structs.PaperSize
ManagedPtrNewtype PaperSize Source # |
Instance details Defined in GI.Gtk.Structs.PaperSize Methods toManagedPtr :: PaperSize -> ManagedPtr PaperSize Source #
TypedObject PaperSize Source # |
Instance details Defined in GI.Gtk.Structs.PaperSize Methods glibType :: IO GType Source #
HasParentTypes PaperSize Source # |
Instance details Defined in GI.Gtk.Structs.PaperSize
IsGValue (Maybe PaperSize) Source # | Convert `PaperSize` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Structs.PaperSize Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe PaperSize -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe PaperSize) Source #
type ParentTypes PaperSize Source # |
Instance details Defined in GI.Gtk.Structs.PaperSize type ParentTypes PaperSize = '[] :: [Type]

# Methods

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

Expand

#### Methods

copy, free, isCustom, isEqual, isIpp, toGvariant, toKeyFile.

#### Getters

getDefaultBottomMargin, getDefaultLeftMargin, getDefaultRightMargin, getDefaultTopMargin, getDisplayName, getHeight, getName, getPpdName, getWidth.

#### Setters

setSize.

## copy

paperSizeCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `other`: a `PaperSize`
-> m PaperSize | Returns: a copy of `other`

Copies an existing `PaperSize`.

Since: 2.10

## free

paperSizeFree Source #

Arguments

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

Free the given `PaperSize` object.

Since: 2.10

## getDefault

paperSizeGetDefault Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Text | Returns: the name of the default paper size. The string is owned by GTK+ and should not be modified.

Returns the name of the default paper size, which depends on the current locale.

Since: 2.10

## getDefaultBottomMargin

paperSizeGetDefaultBottomMargin Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize` object
-> Unit | `unit`: the unit for the return value, not `UnitNone`
-> m Double | Returns: the default bottom margin

Gets the default bottom margin for the `PaperSize`.

Since: 2.10

## getDefaultLeftMargin

paperSizeGetDefaultLeftMargin Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize` object
-> Unit | `unit`: the unit for the return value, not `UnitNone`
-> m Double | Returns: the default left margin

Gets the default left margin for the `PaperSize`.

Since: 2.10

## getDefaultRightMargin

paperSizeGetDefaultRightMargin Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize` object
-> Unit | `unit`: the unit for the return value, not `UnitNone`
-> m Double | Returns: the default right margin

Gets the default right margin for the `PaperSize`.

Since: 2.10

## getDefaultTopMargin

paperSizeGetDefaultTopMargin Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize` object
-> Unit | `unit`: the unit for the return value, not `UnitNone`
-> m Double | Returns: the default top margin

Gets the default top margin for the `PaperSize`.

Since: 2.10

## getDisplayName

paperSizeGetDisplayName Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize` object
-> m Text | Returns: the human-readable name of `size`

Gets the human-readable name of the `PaperSize`.

Since: 2.10

## getHeight

paperSizeGetHeight Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize` object
-> Unit | `unit`: the unit for the return value, not `UnitNone`
-> m Double | Returns: the paper height

Gets the paper height of the `PaperSize`, in units of `unit`.

Since: 2.10

## getName

paperSizeGetName Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize` object
-> m Text | Returns: the name of `size`

Gets the name of the `PaperSize`.

Since: 2.10

## getPaperSizes

paperSizeGetPaperSizes Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Bool | `includeCustom`: whether to include custom paper sizes as defined in the page setup dialog
-> m [PaperSize] | Returns: a newly allocated list of newly allocated `PaperSize` objects

Creates a list of known paper sizes.

Since: 2.12

## getPpdName

paperSizeGetPpdName Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize` object
-> m Text | Returns: the PPD name of `size`

Gets the PPD name of the `PaperSize`, which may be `Nothing`.

Since: 2.10

## getWidth

paperSizeGetWidth Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize` object
-> Unit | `unit`: the unit for the return value, not `UnitNone`
-> m Double | Returns: the paper width

Gets the paper width of the `PaperSize`, in units of `unit`.

Since: 2.10

## isCustom

paperSizeIsCustom Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize` object
-> m Bool | Returns: whether `size` is a custom paper size.

Returns `True` if `size` is not a standard paper size.

## isEqual

paperSizeIsEqual Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size1`: a `PaperSize` object
-> PaperSize | `size2`: another `PaperSize` object
-> m Bool | Returns: `True`, if `size1` and `size2` represent the same paper size

Compares two `PaperSize` objects.

Since: 2.10

## isIpp

paperSizeIsIpp Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize` object
-> m Bool | Returns: whether `size` is not an IPP custom paper size.

Returns `True` if `size` is an IPP standard paper size.

## new

paperSizeNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe Text | `name`: a paper size name, or `Nothing`
-> m PaperSize | Returns: a new `PaperSize`, use `paperSizeFree` to free it

Creates a new `PaperSize` object by parsing a PWG 5101.1-2002 paper name.

If `name` is `Nothing`, the default paper size is returned, see `paperSizeGetDefault`.

Since: 2.10

## newCustom

paperSizeNewCustom Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `name`: the paper name
-> Text | `displayName`: the human-readable name
-> Double | `width`: the paper width, in units of `unit`
-> Double | `height`: the paper height, in units of `unit`
-> Unit | `unit`: the unit for `width` and `height`. not `UnitNone`.
-> m PaperSize | Returns: a new `PaperSize` object, use `paperSizeFree` to free it

Creates a new `PaperSize` object with the given parameters.

Since: 2.10

## newFromGvariant

paperSizeNewFromGvariant Source #

Arguments

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

Deserialize a paper size from an a{sv} variant in the format produced by `paperSizeToGvariant`.

Since: 3.22

## newFromIpp

paperSizeNewFromIpp Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `ippName`: an IPP paper name
-> Double | `width`: the paper width, in points
-> Double | `height`: the paper height in points
-> m PaperSize | Returns: a new `PaperSize`, use `paperSizeFree` to free it

Creates a new `PaperSize` object by using IPP information.

If `ippName` is not a recognized paper name, `width` and `height` are used to construct a custom `PaperSize` object.

Since: 3.16

## newFromKeyFile

paperSizeNewFromKeyFile Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> KeyFile | `keyFile`: the `KeyFile` to retrieve the papersize from
-> Maybe Text | `groupName`: the name of the group in the key file to read, or `Nothing` to read the first group
-> m PaperSize | Returns: a new `PaperSize` object with the restored paper size, or `Nothing` if an error occurred (Can throw `GError`)

Reads a paper size from the group `groupName` in the key file `keyFile`.

Since: 2.12

## newFromPpd

paperSizeNewFromPpd Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `ppdName`: a PPD paper name
-> Text | `ppdDisplayName`: the corresponding human-readable name
-> Double | `width`: the paper width, in points
-> Double | `height`: the paper height in points
-> m PaperSize | Returns: a new `PaperSize`, use `paperSizeFree` to free it

Creates a new `PaperSize` object by using PPD information.

If `ppdName` is not a recognized PPD paper name, `ppdDisplayName`, `width` and `height` are used to construct a custom `PaperSize` object.

Since: 2.10

## setSize

paperSizeSetSize Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a custom `PaperSize` object
-> Double | `width`: the new width in units of `unit`
-> Double | `height`: the new height in units of `unit`
-> Unit | `unit`: the unit for `width` and `height`
-> m () |

Changes the dimensions of a `size` to `width` x `height`.

Since: 2.10

## toGvariant

paperSizeToGvariant Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `paperSize`: a `PaperSize`
-> m GVariant | Returns: a new, floating, `GVariant`

Serialize a paper size to an a{sv} variant.

Since: 3.22

## toKeyFile

paperSizeToKeyFile Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PaperSize | `size`: a `PaperSize`
-> KeyFile | `keyFile`: the `KeyFile` to save the paper size to
-> Text | `groupName`: the group to add the settings to in `keyFile`
-> m () |

This function adds the paper size from `size` to `keyFile`.

Since: 2.12