    {-# LANGUAGE OverloadedStrings #-}

    {-# LINE 2 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) Widget PrintContext
    --
    -- Author : Andy Stewart
    --
    -- Created: 28 Mar 2010
    --
    -- Copyright (C) 2010 Andy Stewart
    --
    -- This library is free software; you can redistribute it and/or
    -- modify it under the terms of the GNU Lesser General Public
    -- License as published by the Free Software Foundation; either
    -- version 2.1 of the License, or (at your option) any later version.
    --
    -- This library is distributed in the hope that it will be useful,
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    -- Lesser General Public License for more details.
    --
    -- |
    -- Maintainer : gtk2hs-users@lists.sourceforge.net
    -- Stability : provisional
    -- Portability : portable (depends on GHC)
    --
    -- Encapsulates context for drawing pages
    --
    -- * Module available since Gtk+ version 2.10
    --
    module Graphics.UI.Gtk.Printing.PrintContext (

    -- * Detail
    --
    -- | A 'PrintContext' encapsulates context information that is required when
    -- drawing pages for printing, such as the cairo context and important
    -- parameters like page size and resolution. It also lets you easily create
    -- 'PangoLayout' and 'Context' objects that match the font metrics of the cairo
    -- surface.
    --
    -- 'PrintContext' objects gets passed to the 'beginPrint', 'endPrint',
    -- 'requestPageSetup' and 'drawPage' signals on the 'PrintOperation'.
    --
    -- Printing support was added in Gtk+ 2.10.

    -- * Class Hierarchy
    --
    -- |
    -- @
    -- | 'GObject'
    -- | +----PrintContext
    -- @

    -- * Types
      PrintContext,
      PrintContextClass,
      castToPrintContext,
      toPrintContext,

    -- * Methods
      printContextGetCairoContext,
      printContextSetCairoContext,
      printContextGetPageSetup,
      printContextGetWidth,
      printContextGetHeight,
      printContextGetDpiX,
      printContextGetDpiY,
      printContextGetPangoFontmap,
      printContextCreatePangoContext,
      printContextCreatePangoLayout,

      printContextGetHardMargins,

      ) where

    import Control.Monad (liftM)
    import Data.IORef (newIORef)

    import System.Glib.FFI
    import System.Glib.UTFString
    import Graphics.UI.Gtk.Types
    {-# LINE 83 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
    import Graphics.Rendering.Pango.Types
    {-# LINE 84 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
    import Graphics.Rendering.Pango.BasicTypes
    {-# LINE 85 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
    import Graphics.Rendering.Cairo.Types
    {-# LINE 86 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}

    {-# LINE 88 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}

    --------------------
    -- Methods

    -- | Obtains the cairo context that is associated with the 'PrintContext'.
    --
    printContextGetCairoContext :: PrintContextClass self => self
     -> IO Cairo -- ^ returns the cairo context of @context@
    printContextGetCairoContext :: forall self. PrintContextClass self => self -> IO Cairo
    printContextGetCairoContext self
    self =
      (Ptr Cairo -> Cairo) -> IO (Ptr Cairo) -> IO Cairo
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM Ptr Cairo -> Cairo
    Cairo (IO (Ptr Cairo) -> IO Cairo) -> IO (Ptr Cairo) -> IO Cairo
    forall a b. (a -> b) -> a -> b
    $
      (\(PrintContext ForeignPtr PrintContext
    arg1) -> ForeignPtr PrintContext
    -> (Ptr PrintContext -> IO (Ptr Cairo)) -> IO (Ptr Cairo)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr PrintContext
    arg1 ((Ptr PrintContext -> IO (Ptr Cairo)) -> IO (Ptr Cairo))
    -> (Ptr PrintContext -> IO (Ptr Cairo)) -> IO (Ptr Cairo)
    forall a b. (a -> b) -> a -> b
    $ \Ptr PrintContext
    argPtr1 ->Ptr PrintContext -> IO (Ptr Cairo)
    gtk_print_context_get_cairo_context Ptr PrintContext
    argPtr1) (self -> PrintContext
    forall o. PrintContextClass o => o -> PrintContext
    toPrintContext self
    self)

    -- | Sets a new cairo context on a print context.
    --
    -- This function is intended to be used when implementing an internal print
    -- preview, it is not needed for printing, since Gtk+ itself creates a suitable
    -- cairo context in that case.
    --
    printContextSetCairoContext :: PrintContextClass self => self
     -> Cairo -- ^ @cr@ - the cairo context
     -> Double -- ^ @dpiX@ - the horizontal resolution to use with @cr@
     -> Double -- ^ @dpiY@ - the vertical resolution to use with @cr@
     -> IO ()
    printContextSetCairoContext :: forall self.
    PrintContextClass self =>
    self -> Cairo -> Double -> Double -> IO ()
    printContextSetCairoContext self
    self Cairo
    cr Double
    dpiX Double
    dpiY =
      (\(PrintContext ForeignPtr PrintContext
    arg1) (Cairo Ptr Cairo
    arg2) CDouble
    arg3 CDouble
    arg4 -> ForeignPtr PrintContext -> (Ptr PrintContext -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr PrintContext
    arg1 ((Ptr PrintContext -> IO ()) -> IO ())
    -> (Ptr PrintContext -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr PrintContext
    argPtr1 ->Ptr PrintContext -> Ptr Cairo -> CDouble -> CDouble -> IO ()
    gtk_print_context_set_cairo_context Ptr PrintContext
    argPtr1 Ptr Cairo
    arg2 CDouble
    arg3 CDouble
    arg4)
    {-# LINE 114 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
        (toPrintContext self)
        Cairo
    cr
        (Double -> CDouble
    forall a b. (Real a, Fractional b) => a -> b
    realToFrac Double
    dpiX)
        (Double -> CDouble
    forall a b. (Real a, Fractional b) => a -> b
    realToFrac Double
    dpiY)

    -- | Obtains the 'PageSetup' that determines the page dimensions of the
    -- 'PrintContext'.
    --
    printContextGetPageSetup :: PrintContextClass self => self
     -> IO PageSetup -- ^ returns the page setup of @context@
    printContextGetPageSetup :: forall self. PrintContextClass self => self -> IO PageSetup
    printContextGetPageSetup self
    self =
      (ForeignPtr PageSetup -> PageSetup, FinalizerPtr PageSetup)
    -> IO (Ptr PageSetup) -> IO PageSetup
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewGObject (ForeignPtr PageSetup -> PageSetup, FinalizerPtr PageSetup)
    forall {a}. (ForeignPtr PageSetup -> PageSetup, FinalizerPtr a)
    mkPageSetup (IO (Ptr PageSetup) -> IO PageSetup)
    -> IO (Ptr PageSetup) -> IO PageSetup
    forall a b. (a -> b) -> a -> b
    $
      (\(PrintContext ForeignPtr PrintContext
    arg1) -> ForeignPtr PrintContext
    -> (Ptr PrintContext -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr PrintContext
    arg1 ((Ptr PrintContext -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup))
    -> (Ptr PrintContext -> IO (Ptr PageSetup)) -> IO (Ptr PageSetup)
    forall a b. (a -> b) -> a -> b
    $ \Ptr PrintContext
    argPtr1 ->Ptr PrintContext -> IO (Ptr PageSetup)
    gtk_print_context_get_page_setup Ptr PrintContext
    argPtr1)
    {-# LINE 127 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
        (toPrintContext self)

    -- | Obtains the width of the 'PrintContext', in pixels.
    --
    printContextGetWidth :: PrintContextClass self => self
     -> IO Double -- ^ returns the width of @context@
    printContextGetWidth :: forall self. PrintContextClass self => self -> IO Double
    printContextGetWidth self
    self =
      (CDouble -> Double) -> IO CDouble -> IO Double
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM CDouble -> Double
    forall a b. (Real a, Fractional b) => a -> b
    realToFrac (IO CDouble -> IO Double) -> IO CDouble -> IO Double
    forall a b. (a -> b) -> a -> b
    $
      (\(PrintContext ForeignPtr PrintContext
    arg1) -> ForeignPtr PrintContext
    -> (Ptr PrintContext -> IO CDouble) -> IO CDouble
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr PrintContext
    arg1 ((Ptr PrintContext -> IO CDouble) -> IO CDouble)
    -> (Ptr PrintContext -> IO CDouble) -> IO CDouble
    forall a b. (a -> b) -> a -> b
    $ \Ptr PrintContext
    argPtr1 ->Ptr PrintContext -> IO CDouble
    gtk_print_context_get_width Ptr PrintContext
    argPtr1)
    {-# LINE 136 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
        (toPrintContext self)

    -- | Obtains the height of the 'PrintContext', in pixels.
    --
    printContextGetHeight :: PrintContextClass self => self
     -> IO Double -- ^ returns the height of @context@
    printContextGetHeight :: forall self. PrintContextClass self => self -> IO Double
    printContextGetHeight self
    self =
      (CDouble -> Double) -> IO CDouble -> IO Double
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM CDouble -> Double
    forall a b. (Real a, Fractional b) => a -> b
    realToFrac (IO CDouble -> IO Double) -> IO CDouble -> IO Double
    forall a b. (a -> b) -> a -> b
    $
      (\(PrintContext ForeignPtr PrintContext
    arg1) -> ForeignPtr PrintContext
    -> (Ptr PrintContext -> IO CDouble) -> IO CDouble
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr PrintContext
    arg1 ((Ptr PrintContext -> IO CDouble) -> IO CDouble)
    -> (Ptr PrintContext -> IO CDouble) -> IO CDouble
    forall a b. (a -> b) -> a -> b
    $ \Ptr PrintContext
    argPtr1 ->Ptr PrintContext -> IO CDouble
    gtk_print_context_get_height Ptr PrintContext
    argPtr1)
    {-# LINE 145 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
        (toPrintContext self)

    -- | Obtains the horizontal resolution of the 'PrintContext', in dots per
    -- inch.
    --
    printContextGetDpiX :: PrintContextClass self => self
     -> IO Double -- ^ returns the horizontal resolution of @context@
    printContextGetDpiX :: forall self. PrintContextClass self => self -> IO Double
    printContextGetDpiX self
    self =
      (CDouble -> Double) -> IO CDouble -> IO Double
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM CDouble -> Double
    forall a b. (Real a, Fractional b) => a -> b
    realToFrac (IO CDouble -> IO Double) -> IO CDouble -> IO Double
    forall a b. (a -> b) -> a -> b
    $
      (\(PrintContext ForeignPtr PrintContext
    arg1) -> ForeignPtr PrintContext
    -> (Ptr PrintContext -> IO CDouble) -> IO CDouble
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr PrintContext
    arg1 ((Ptr PrintContext -> IO CDouble) -> IO CDouble)
    -> (Ptr PrintContext -> IO CDouble) -> IO CDouble
    forall a b. (a -> b) -> a -> b
    $ \Ptr PrintContext
    argPtr1 ->Ptr PrintContext -> IO CDouble
    gtk_print_context_get_dpi_x Ptr PrintContext
    argPtr1)
    {-# LINE 155 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
        (toPrintContext self)

    -- | Obtains the vertical resolution of the 'PrintContext', in dots per inch.
    --
    printContextGetDpiY :: PrintContextClass self => self
     -> IO Double -- ^ returns the vertical resolution of @context@
    printContextGetDpiY :: forall self. PrintContextClass self => self -> IO Double
    printContextGetDpiY self
    self =
      (CDouble -> Double) -> IO CDouble -> IO Double
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM CDouble -> Double
    forall a b. (Real a, Fractional b) => a -> b
    realToFrac (IO CDouble -> IO Double) -> IO CDouble -> IO Double
    forall a b. (a -> b) -> a -> b
    $
      (\(PrintContext ForeignPtr PrintContext
    arg1) -> ForeignPtr PrintContext
    -> (Ptr PrintContext -> IO CDouble) -> IO CDouble
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr PrintContext
    arg1 ((Ptr PrintContext -> IO CDouble) -> IO CDouble)
    -> (Ptr PrintContext -> IO CDouble) -> IO CDouble
    forall a b. (a -> b) -> a -> b
    $ \Ptr PrintContext
    argPtr1 ->Ptr PrintContext -> IO CDouble
    gtk_print_context_get_dpi_y Ptr PrintContext
    argPtr1)
    {-# LINE 164 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
        (toPrintContext self)

    -- | Returns a 'FontMap' that is suitable for use with the 'PrintContext'.
    --
    printContextGetPangoFontmap :: PrintContextClass self => self
     -> IO FontMap -- ^ returns the font map of @context@
    printContextGetPangoFontmap :: forall self. PrintContextClass self => self -> IO FontMap
    printContextGetPangoFontmap self
    self =
      (ForeignPtr FontMap -> FontMap, FinalizerPtr FontMap)
    -> IO (Ptr FontMap) -> IO FontMap
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewGObject (ForeignPtr FontMap -> FontMap, FinalizerPtr FontMap)
    forall {a}. (ForeignPtr FontMap -> FontMap, FinalizerPtr a)
    mkFontMap (IO (Ptr FontMap) -> IO FontMap) -> IO (Ptr FontMap) -> IO FontMap
    forall a b. (a -> b) -> a -> b
    $
      (\(PrintContext ForeignPtr PrintContext
    arg1) -> ForeignPtr PrintContext
    -> (Ptr PrintContext -> IO (Ptr FontMap)) -> IO (Ptr FontMap)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr PrintContext
    arg1 ((Ptr PrintContext -> IO (Ptr FontMap)) -> IO (Ptr FontMap))
    -> (Ptr PrintContext -> IO (Ptr FontMap)) -> IO (Ptr FontMap)
    forall a b. (a -> b) -> a -> b
    $ \Ptr PrintContext
    argPtr1 ->Ptr PrintContext -> IO (Ptr FontMap)
    gtk_print_context_get_pango_fontmap Ptr PrintContext
    argPtr1)
    {-# LINE 173 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
        (toPrintContext self)

    -- | Creates a new 'Context' that can be used with the 'PrintContext'.
    --
    printContextCreatePangoContext :: PrintContextClass self => self
     -> IO PangoContext -- ^ returns a new Pango context for @context@
    printContextCreatePangoContext :: forall self. PrintContextClass self => self -> IO PangoContext
    printContextCreatePangoContext self
    self =
      (ForeignPtr PangoContext -> PangoContext,
     FinalizerPtr PangoContext)
    -> IO (Ptr PangoContext) -> IO PangoContext
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    wrapNewGObject (ForeignPtr PangoContext -> PangoContext,
     FinalizerPtr PangoContext)
    forall {a}.
    (ForeignPtr PangoContext -> PangoContext, FinalizerPtr a)
    mkPangoContext (IO (Ptr PangoContext) -> IO PangoContext)
    -> IO (Ptr PangoContext) -> IO PangoContext
    forall a b. (a -> b) -> a -> b
    $
      (\(PrintContext ForeignPtr PrintContext
    arg1) -> ForeignPtr PrintContext
    -> (Ptr PrintContext -> IO (Ptr PangoContext))
    -> IO (Ptr PangoContext)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr PrintContext
    arg1 ((Ptr PrintContext -> IO (Ptr PangoContext))
     -> IO (Ptr PangoContext))
    -> (Ptr PrintContext -> IO (Ptr PangoContext))
    -> IO (Ptr PangoContext)
    forall a b. (a -> b) -> a -> b
    $ \Ptr PrintContext
    argPtr1 ->Ptr PrintContext -> IO (Ptr PangoContext)
    gtk_print_context_create_pango_context Ptr PrintContext
    argPtr1)
    {-# LINE 182 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
        (toPrintContext self)

    -- | Creates a new 'PangoLayout' that is suitable for use with the
    -- 'PrintContext'.
    --
    printContextCreatePangoLayout :: PrintContextClass self => self
     -> IO PangoLayout -- ^ returns a new Pango layout for @context@
    printContextCreatePangoLayout :: forall self. PrintContextClass self => self -> IO PangoLayout
    printContextCreatePangoLayout self
    self = do
      pl <- (ForeignPtr PangoLayoutRaw -> PangoLayoutRaw,
     FinalizerPtr PangoLayoutRaw)
    -> IO (Ptr PangoLayoutRaw) -> IO PangoLayoutRaw
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    wrapNewGObject (ForeignPtr PangoLayoutRaw -> PangoLayoutRaw,
     FinalizerPtr PangoLayoutRaw)
    forall {a}.
    (ForeignPtr PangoLayoutRaw -> PangoLayoutRaw, FinalizerPtr a)
    mkPangoLayoutRaw (IO (Ptr PangoLayoutRaw) -> IO PangoLayoutRaw)
    -> IO (Ptr PangoLayoutRaw) -> IO PangoLayoutRaw
    forall a b. (a -> b) -> a -> b
    $
        (\(PrintContext ForeignPtr PrintContext
    arg1) -> ForeignPtr PrintContext
    -> (Ptr PrintContext -> IO (Ptr PangoLayoutRaw))
    -> IO (Ptr PangoLayoutRaw)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr PrintContext
    arg1 ((Ptr PrintContext -> IO (Ptr PangoLayoutRaw))
     -> IO (Ptr PangoLayoutRaw))
    -> (Ptr PrintContext -> IO (Ptr PangoLayoutRaw))
    -> IO (Ptr PangoLayoutRaw)
    forall a b. (a -> b) -> a -> b
    $ \Ptr PrintContext
    argPtr1 ->Ptr PrintContext -> IO (Ptr PangoLayoutRaw)
    gtk_print_context_create_pango_layout Ptr PrintContext
    argPtr1)
    {-# LINE 192 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
        (toPrintContext self)
      ps <- makeNewPangoString (""::DefaultGlibString)
      psRef <- newIORef ps
      return (PangoLayout psRef pl)

    printContextGetHardMargins :: PrintContextClass self => self
                               -> IO (Maybe (Double, Double, Double, Double))
                                 -- ^ returns @(top, bottom, left, right)@
                                 -- @top@ top hardware printer margin
                                 -- @bottom@ bottom hardware printer margin
                                 -- @left@ left hardware printer margin
                                 -- @right@ right hardware printer margin
    printContextGetHardMargins :: forall self.
    PrintContextClass self =>
    self -> IO (Maybe (Double, Double, Double, Double))
    printContextGetHardMargins self
    self =
      (Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
    -> IO (Maybe (Double, Double, Double, Double))
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
     -> IO (Maybe (Double, Double, Double, Double)))
    -> (Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
    -> IO (Maybe (Double, Double, Double, Double))
    forall a b. (a -> b) -> a -> b
    $ \ Ptr CDouble
    topPtr ->
      (Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
    -> IO (Maybe (Double, Double, Double, Double))
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
     -> IO (Maybe (Double, Double, Double, Double)))
    -> (Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
    -> IO (Maybe (Double, Double, Double, Double))
    forall a b. (a -> b) -> a -> b
    $ \ Ptr CDouble
    bottomPtr ->
      (Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
    -> IO (Maybe (Double, Double, Double, Double))
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
     -> IO (Maybe (Double, Double, Double, Double)))
    -> (Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
    -> IO (Maybe (Double, Double, Double, Double))
    forall a b. (a -> b) -> a -> b
    $ \ Ptr CDouble
    leftPtr ->
      (Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
    -> IO (Maybe (Double, Double, Double, Double))
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
     -> IO (Maybe (Double, Double, Double, Double)))
    -> (Ptr CDouble -> IO (Maybe (Double, Double, Double, Double)))
    -> IO (Maybe (Double, Double, Double, Double))
    forall a b. (a -> b) -> a -> b
    $ \ Ptr CDouble
    rightPtr -> do
      success <- (CInt -> Bool) -> IO CInt -> IO Bool
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM CInt -> Bool
    forall a. (Eq a, Num a) => a -> Bool
    toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
    forall a b. (a -> b) -> a -> b
    $ (\(PrintContext ForeignPtr PrintContext
    arg1) Ptr CDouble
    arg2 Ptr CDouble
    arg3 Ptr CDouble
    arg4 Ptr CDouble
    arg5 -> ForeignPtr PrintContext -> (Ptr PrintContext -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr PrintContext
    arg1 ((Ptr PrintContext -> IO CInt) -> IO CInt)
    -> (Ptr PrintContext -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr PrintContext
    argPtr1 ->Ptr PrintContext
    -> Ptr CDouble
    -> Ptr CDouble
    -> Ptr CDouble
    -> Ptr CDouble
    -> IO CInt
    gtk_print_context_get_hard_margins Ptr PrintContext
    argPtr1 Ptr CDouble
    arg2 Ptr CDouble
    arg3 Ptr CDouble
    arg4 Ptr CDouble
    arg5)
    {-# LINE 211 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}
                   (self -> PrintContext
    forall o. PrintContextClass o => o -> PrintContext
    toPrintContext self
    self)
                   Ptr CDouble
    topPtr
                   Ptr CDouble
    bottomPtr
                   Ptr CDouble
    leftPtr
                   Ptr CDouble
    rightPtr
      if success
         then do
           top <- liftM realToFrac $ peek topPtr
           bottom <- liftM realToFrac $ peek bottomPtr
           left <- liftM realToFrac $ peek leftPtr
           right <- liftM realToFrac $ peek rightPtr
           return $ Just (top, bottom, left, right)
         else return Nothing

    foreign import ccall safe "gtk_print_context_get_cairo_context"
      gtk_print_context_get_cairo_context :: ((Ptr PrintContext) -> (IO (Ptr Cairo)))

    foreign import ccall safe "gtk_print_context_set_cairo_context"
      gtk_print_context_set_cairo_context :: ((Ptr PrintContext) -> ((Ptr Cairo) -> (CDouble -> (CDouble -> (IO ())))))

    foreign import ccall safe "gtk_print_context_get_page_setup"
      gtk_print_context_get_page_setup :: ((Ptr PrintContext) -> (IO (Ptr PageSetup)))

    foreign import ccall safe "gtk_print_context_get_width"
      gtk_print_context_get_width :: ((Ptr PrintContext) -> (IO CDouble))

    foreign import ccall safe "gtk_print_context_get_height"
      gtk_print_context_get_height :: ((Ptr PrintContext) -> (IO CDouble))

    foreign import ccall safe "gtk_print_context_get_dpi_x"
      gtk_print_context_get_dpi_x :: ((Ptr PrintContext) -> (IO CDouble))

    foreign import ccall safe "gtk_print_context_get_dpi_y"
      gtk_print_context_get_dpi_y :: ((Ptr PrintContext) -> (IO CDouble))

    foreign import ccall safe "gtk_print_context_get_pango_fontmap"
      gtk_print_context_get_pango_fontmap :: ((Ptr PrintContext) -> (IO (Ptr FontMap)))

    foreign import ccall safe "gtk_print_context_create_pango_context"
      gtk_print_context_create_pango_context :: ((Ptr PrintContext) -> (IO (Ptr PangoContext)))

    foreign import ccall safe "gtk_print_context_create_pango_layout"
      gtk_print_context_create_pango_layout :: ((Ptr PrintContext) -> (IO (Ptr PangoLayoutRaw)))

    foreign import ccall safe "gtk_print_context_get_hard_margins"
      gtk_print_context_get_hard_margins :: ((Ptr PrintContext) -> ((Ptr CDouble) -> ((Ptr CDouble) -> ((Ptr CDouble) -> ((Ptr CDouble) -> (IO CInt))))))