Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
- 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
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
- 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
Memory-managed wrapper type.
Instances
Eq PageSetup Source # | |
GObject PageSetup Source # | |
Defined in GI.Gtk.Objects.PageSetup | |
ManagedPtrNewtype PageSetup Source # | |
Defined in GI.Gtk.Objects.PageSetup | |
TypedObject PageSetup Source # | |
Defined in GI.Gtk.Objects.PageSetup | |
HasParentTypes PageSetup Source # | |
Defined in GI.Gtk.Objects.PageSetup | |
IsGValue (Maybe PageSetup) Source # | Convert |
Defined in GI.Gtk.Objects.PageSetup | |
type ParentTypes PageSetup Source # | |
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
(GObject o, IsDescendantOf PageSetup o) => IsPageSetup o Source # | |
Defined in GI.Gtk.Objects.PageSetup |
toPageSetup :: (MonadIO m, IsPageSetup o) => o -> m PageSetup Source #
Methods
Click to display all available methods, including inherited ones
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
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> m PageSetup | Returns: a copy of |
Copies a GtkPageSetup
.
getBottomMargin
pageSetupGetBottomMargin Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Unit |
|
-> m Double | Returns: the bottom margin |
Gets the bottom margin in units of unit
.
getLeftMargin
pageSetupGetLeftMargin Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Unit |
|
-> m Double | Returns: the left margin |
Gets the left margin in units of unit
.
getOrientation
pageSetupGetOrientation Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> m PageOrientation | Returns: the page orientation |
Gets the page orientation of the GtkPageSetup
.
getPageHeight
pageSetupGetPageHeight Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Unit |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Unit |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Unit |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> m PaperSize | Returns: the paper size |
Gets the paper size of the GtkPageSetup
.
getPaperWidth
pageSetupGetPaperWidth Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Unit |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Unit |
|
-> m Double | Returns: the right margin |
Gets the right margin in units of unit
.
getTopMargin
pageSetupGetTopMargin Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Unit |
|
-> m Double | Returns: the top margin |
Gets the top margin in units of unit
.
loadFile
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> [Char] |
|
-> m () | (Can throw |
Reads the page setup from the file fileName
.
See pageSetupToFile
.
loadKeyFile
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> KeyFile |
|
-> Maybe Text |
|
-> m () | (Can throw |
Reads the page setup from the group groupName
in the key file
keyFile
.
new
:: (HasCallStack, MonadIO m) | |
=> m PageSetup | Returns: a new |
Creates a new GtkPageSetup
.
newFromFile
:: (HasCallStack, MonadIO m) | |
=> [Char] |
|
-> m PageSetup | Returns: the restored |
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 #
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m PageSetup | Returns: a new |
Desrialize a page setup from an a{sv} variant.
The variant must be in the format produced by
pageSetupToGvariant
.
newFromKeyFile
pageSetupNewFromKeyFile Source #
:: (HasCallStack, MonadIO m) | |
=> KeyFile |
|
-> Maybe Text |
|
-> m PageSetup | Returns: the restored |
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 #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Double |
|
-> Unit |
|
-> m () |
Sets the bottom margin of the GtkPageSetup
.
setLeftMargin
pageSetupSetLeftMargin Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Double |
|
-> Unit |
|
-> m () |
Sets the left margin of the GtkPageSetup
.
setOrientation
pageSetupSetOrientation Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> PageOrientation |
|
-> m () |
Sets the page orientation of the GtkPageSetup
.
setPaperSize
pageSetupSetPaperSize Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> PaperSize |
|
-> m () |
Sets the paper size of the GtkPageSetup
without
changing the margins.
setPaperSizeAndDefaultMargins
pageSetupSetPaperSizeAndDefaultMargins Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> PaperSize |
|
-> m () |
Sets the paper size of the GtkPageSetup
and modifies
the margins according to the new paper size.
setRightMargin
pageSetupSetRightMargin Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Double |
|
-> Unit |
|
-> m () |
Sets the right margin of the GtkPageSetup
.
setTopMargin
pageSetupSetTopMargin Source #
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> Double |
|
-> Unit |
|
-> m () |
Sets the top margin of the GtkPageSetup
.
toFile
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> [Char] |
|
-> m () | (Can throw |
This function saves the information from setup
to fileName
.
toGvariant
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> m GVariant | Returns: a new, floating, |
Serialize page setup to an a{sv} variant.
toKeyFile
:: (HasCallStack, MonadIO m, IsPageSetup a) | |
=> a |
|
-> KeyFile |
|
-> Maybe Text |
|
-> m () |
This function adds the page setup from setup
to keyFile
.