gi-gtk-0.3.18.12: GI/Gtk/Objects/PrintContext.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}
module GI.Gtk.Objects.PrintContext
(
-- * Exported types
PrintContext(..) ,
PrintContextK ,
toPrintContext ,
noPrintContext ,
-- * Methods
-- ** printContextCreatePangoContext
printContextCreatePangoContext ,
-- ** printContextCreatePangoLayout
printContextCreatePangoLayout ,
-- ** printContextGetCairoContext
printContextGetCairoContext ,
-- ** printContextGetDpiX
printContextGetDpiX ,
-- ** printContextGetDpiY
printContextGetDpiY ,
-- ** printContextGetHardMargins
printContextGetHardMargins ,
-- ** printContextGetHeight
printContextGetHeight ,
-- ** printContextGetPageSetup
printContextGetPageSetup ,
-- ** printContextGetPangoFontmap
printContextGetPangoFontmap ,
-- ** printContextGetWidth
printContextGetWidth ,
-- ** printContextSetCairoContext
printContextSetCairoContext ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gtk.Types
import GI.Gtk.Callbacks
import qualified GI.GObject as GObject
import qualified GI.Pango as Pango
import qualified GI.Cairo as Cairo
newtype PrintContext = PrintContext (ForeignPtr PrintContext)
foreign import ccall "gtk_print_context_get_type"
c_gtk_print_context_get_type :: IO GType
type instance ParentTypes PrintContext = PrintContextParentTypes
type PrintContextParentTypes = '[GObject.Object]
instance GObject PrintContext where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_gtk_print_context_get_type
class GObject o => PrintContextK o
instance (GObject o, IsDescendantOf PrintContext o) => PrintContextK o
toPrintContext :: PrintContextK o => o -> IO PrintContext
toPrintContext = unsafeCastTo PrintContext
noPrintContext :: Maybe PrintContext
noPrintContext = Nothing
type instance AttributeList PrintContext = PrintContextAttributeList
type PrintContextAttributeList = ('[ ] :: [(Symbol, *)])
type instance SignalList PrintContext = PrintContextSignalList
type PrintContextSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method PrintContext::create_pango_context
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "Context"
-- throws : False
-- Skip return : False
foreign import ccall "gtk_print_context_create_pango_context" gtk_print_context_create_pango_context ::
Ptr PrintContext -> -- _obj : TInterface "Gtk" "PrintContext"
IO (Ptr Pango.Context)
printContextCreatePangoContext ::
(MonadIO m, PrintContextK a) =>
a -> -- _obj
m Pango.Context
printContextCreatePangoContext _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- gtk_print_context_create_pango_context _obj'
checkUnexpectedReturnNULL "gtk_print_context_create_pango_context" result
result' <- (wrapObject Pango.Context) result
touchManagedPtr _obj
return result'
-- method PrintContext::create_pango_layout
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "Layout"
-- throws : False
-- Skip return : False
foreign import ccall "gtk_print_context_create_pango_layout" gtk_print_context_create_pango_layout ::
Ptr PrintContext -> -- _obj : TInterface "Gtk" "PrintContext"
IO (Ptr Pango.Layout)
printContextCreatePangoLayout ::
(MonadIO m, PrintContextK a) =>
a -> -- _obj
m Pango.Layout
printContextCreatePangoLayout _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- gtk_print_context_create_pango_layout _obj'
checkUnexpectedReturnNULL "gtk_print_context_create_pango_layout" result
result' <- (wrapObject Pango.Layout) result
touchManagedPtr _obj
return result'
-- method PrintContext::get_cairo_context
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "cairo" "Context"
-- throws : False
-- Skip return : False
foreign import ccall "gtk_print_context_get_cairo_context" gtk_print_context_get_cairo_context ::
Ptr PrintContext -> -- _obj : TInterface "Gtk" "PrintContext"
IO (Ptr Cairo.Context)
printContextGetCairoContext ::
(MonadIO m, PrintContextK a) =>
a -> -- _obj
m Cairo.Context
printContextGetCairoContext _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- gtk_print_context_get_cairo_context _obj'
checkUnexpectedReturnNULL "gtk_print_context_get_cairo_context" result
result' <- (newBoxed Cairo.Context) result
touchManagedPtr _obj
return result'
-- method PrintContext::get_dpi_x
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TDouble
-- throws : False
-- Skip return : False
foreign import ccall "gtk_print_context_get_dpi_x" gtk_print_context_get_dpi_x ::
Ptr PrintContext -> -- _obj : TInterface "Gtk" "PrintContext"
IO CDouble
printContextGetDpiX ::
(MonadIO m, PrintContextK a) =>
a -> -- _obj
m Double
printContextGetDpiX _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- gtk_print_context_get_dpi_x _obj'
let result' = realToFrac result
touchManagedPtr _obj
return result'
-- method PrintContext::get_dpi_y
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TDouble
-- throws : False
-- Skip return : False
foreign import ccall "gtk_print_context_get_dpi_y" gtk_print_context_get_dpi_y ::
Ptr PrintContext -> -- _obj : TInterface "Gtk" "PrintContext"
IO CDouble
printContextGetDpiY ::
(MonadIO m, PrintContextK a) =>
a -> -- _obj
m Double
printContextGetDpiY _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- gtk_print_context_get_dpi_y _obj'
let result' = realToFrac result
touchManagedPtr _obj
return result'
-- method PrintContext::get_hard_margins
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "top", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "bottom", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "left", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "right", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "gtk_print_context_get_hard_margins" gtk_print_context_get_hard_margins ::
Ptr PrintContext -> -- _obj : TInterface "Gtk" "PrintContext"
Ptr CDouble -> -- top : TBasicType TDouble
Ptr CDouble -> -- bottom : TBasicType TDouble
Ptr CDouble -> -- left : TBasicType TDouble
Ptr CDouble -> -- right : TBasicType TDouble
IO CInt
printContextGetHardMargins ::
(MonadIO m, PrintContextK a) =>
a -> -- _obj
m (Bool,Double,Double,Double,Double)
printContextGetHardMargins _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
top <- allocMem :: IO (Ptr CDouble)
bottom <- allocMem :: IO (Ptr CDouble)
left <- allocMem :: IO (Ptr CDouble)
right <- allocMem :: IO (Ptr CDouble)
result <- gtk_print_context_get_hard_margins _obj' top bottom left right
let result' = (/= 0) result
top' <- peek top
let top'' = realToFrac top'
bottom' <- peek bottom
let bottom'' = realToFrac bottom'
left' <- peek left
let left'' = realToFrac left'
right' <- peek right
let right'' = realToFrac right'
touchManagedPtr _obj
freeMem top
freeMem bottom
freeMem left
freeMem right
return (result', top'', bottom'', left'', right'')
-- method PrintContext::get_height
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TDouble
-- throws : False
-- Skip return : False
foreign import ccall "gtk_print_context_get_height" gtk_print_context_get_height ::
Ptr PrintContext -> -- _obj : TInterface "Gtk" "PrintContext"
IO CDouble
printContextGetHeight ::
(MonadIO m, PrintContextK a) =>
a -> -- _obj
m Double
printContextGetHeight _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- gtk_print_context_get_height _obj'
let result' = realToFrac result
touchManagedPtr _obj
return result'
-- method PrintContext::get_page_setup
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "PageSetup"
-- throws : False
-- Skip return : False
foreign import ccall "gtk_print_context_get_page_setup" gtk_print_context_get_page_setup ::
Ptr PrintContext -> -- _obj : TInterface "Gtk" "PrintContext"
IO (Ptr PageSetup)
printContextGetPageSetup ::
(MonadIO m, PrintContextK a) =>
a -> -- _obj
m PageSetup
printContextGetPageSetup _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- gtk_print_context_get_page_setup _obj'
checkUnexpectedReturnNULL "gtk_print_context_get_page_setup" result
result' <- (newObject PageSetup) result
touchManagedPtr _obj
return result'
-- method PrintContext::get_pango_fontmap
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "FontMap"
-- throws : False
-- Skip return : False
foreign import ccall "gtk_print_context_get_pango_fontmap" gtk_print_context_get_pango_fontmap ::
Ptr PrintContext -> -- _obj : TInterface "Gtk" "PrintContext"
IO (Ptr Pango.FontMap)
printContextGetPangoFontmap ::
(MonadIO m, PrintContextK a) =>
a -> -- _obj
m Pango.FontMap
printContextGetPangoFontmap _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- gtk_print_context_get_pango_fontmap _obj'
checkUnexpectedReturnNULL "gtk_print_context_get_pango_fontmap" result
result' <- (newObject Pango.FontMap) result
touchManagedPtr _obj
return result'
-- method PrintContext::get_width
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TDouble
-- throws : False
-- Skip return : False
foreign import ccall "gtk_print_context_get_width" gtk_print_context_get_width ::
Ptr PrintContext -> -- _obj : TInterface "Gtk" "PrintContext"
IO CDouble
printContextGetWidth ::
(MonadIO m, PrintContextK a) =>
a -> -- _obj
m Double
printContextGetWidth _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- gtk_print_context_get_width _obj'
let result' = realToFrac result
touchManagedPtr _obj
return result'
-- method PrintContext::set_cairo_context
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "dpi_x", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "dpi_y", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "PrintContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "dpi_x", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "dpi_y", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_print_context_set_cairo_context" gtk_print_context_set_cairo_context ::
Ptr PrintContext -> -- _obj : TInterface "Gtk" "PrintContext"
Ptr Cairo.Context -> -- cr : TInterface "cairo" "Context"
CDouble -> -- dpi_x : TBasicType TDouble
CDouble -> -- dpi_y : TBasicType TDouble
IO ()
printContextSetCairoContext ::
(MonadIO m, PrintContextK a) =>
a -> -- _obj
Cairo.Context -> -- cr
Double -> -- dpi_x
Double -> -- dpi_y
m ()
printContextSetCairoContext _obj cr dpi_x dpi_y = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let cr' = unsafeManagedPtrGetPtr cr
let dpi_x' = realToFrac dpi_x
let dpi_y' = realToFrac dpi_y
gtk_print_context_set_cairo_context _obj' cr' dpi_x' dpi_y'
touchManagedPtr _obj
touchManagedPtr cr
return ()