#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gtk.Objects.PrintContext
(
PrintContext(..) ,
IsPrintContext ,
toPrintContext ,
noPrintContext ,
#if ENABLE_OVERLOADING
PrintContextCreatePangoContextMethodInfo,
#endif
printContextCreatePangoContext ,
#if ENABLE_OVERLOADING
PrintContextCreatePangoLayoutMethodInfo ,
#endif
printContextCreatePangoLayout ,
#if ENABLE_OVERLOADING
PrintContextGetCairoContextMethodInfo ,
#endif
printContextGetCairoContext ,
#if ENABLE_OVERLOADING
PrintContextGetDpiXMethodInfo ,
#endif
printContextGetDpiX ,
#if ENABLE_OVERLOADING
PrintContextGetDpiYMethodInfo ,
#endif
printContextGetDpiY ,
#if ENABLE_OVERLOADING
PrintContextGetHardMarginsMethodInfo ,
#endif
printContextGetHardMargins ,
#if ENABLE_OVERLOADING
PrintContextGetHeightMethodInfo ,
#endif
printContextGetHeight ,
#if ENABLE_OVERLOADING
PrintContextGetPageSetupMethodInfo ,
#endif
printContextGetPageSetup ,
#if ENABLE_OVERLOADING
PrintContextGetPangoFontmapMethodInfo ,
#endif
printContextGetPangoFontmap ,
#if ENABLE_OVERLOADING
PrintContextGetWidthMethodInfo ,
#endif
printContextGetWidth ,
#if ENABLE_OVERLOADING
PrintContextSetCairoContextMethodInfo ,
#endif
printContextSetCairoContext ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GI.Cairo.Structs.Context as Cairo.Context
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gtk.Objects.PageSetup as Gtk.PageSetup
import qualified GI.Pango.Objects.Context as Pango.Context
import qualified GI.Pango.Objects.FontMap as Pango.FontMap
import qualified GI.Pango.Objects.Layout as Pango.Layout
newtype PrintContext = PrintContext (ManagedPtr PrintContext)
foreign import ccall "gtk_print_context_get_type"
c_gtk_print_context_get_type :: IO GType
instance GObject PrintContext where
gobjectType _ = c_gtk_print_context_get_type
class GObject o => IsPrintContext o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError PrintContext a) =>
IsPrintContext a
#endif
instance IsPrintContext PrintContext
instance GObject.Object.IsObject PrintContext
toPrintContext :: (MonadIO m, IsPrintContext o) => o -> m PrintContext
toPrintContext = liftIO . unsafeCastTo PrintContext
noPrintContext :: Maybe PrintContext
noPrintContext = Nothing
#if ENABLE_OVERLOADING
type family ResolvePrintContextMethod (t :: Symbol) (o :: *) :: * where
ResolvePrintContextMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolvePrintContextMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolvePrintContextMethod "createPangoContext" o = PrintContextCreatePangoContextMethodInfo
ResolvePrintContextMethod "createPangoLayout" o = PrintContextCreatePangoLayoutMethodInfo
ResolvePrintContextMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolvePrintContextMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolvePrintContextMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolvePrintContextMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolvePrintContextMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolvePrintContextMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolvePrintContextMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolvePrintContextMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolvePrintContextMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolvePrintContextMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolvePrintContextMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolvePrintContextMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolvePrintContextMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolvePrintContextMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolvePrintContextMethod "getCairoContext" o = PrintContextGetCairoContextMethodInfo
ResolvePrintContextMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolvePrintContextMethod "getDpiX" o = PrintContextGetDpiXMethodInfo
ResolvePrintContextMethod "getDpiY" o = PrintContextGetDpiYMethodInfo
ResolvePrintContextMethod "getHardMargins" o = PrintContextGetHardMarginsMethodInfo
ResolvePrintContextMethod "getHeight" o = PrintContextGetHeightMethodInfo
ResolvePrintContextMethod "getPageSetup" o = PrintContextGetPageSetupMethodInfo
ResolvePrintContextMethod "getPangoFontmap" o = PrintContextGetPangoFontmapMethodInfo
ResolvePrintContextMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolvePrintContextMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolvePrintContextMethod "getWidth" o = PrintContextGetWidthMethodInfo
ResolvePrintContextMethod "setCairoContext" o = PrintContextSetCairoContextMethodInfo
ResolvePrintContextMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolvePrintContextMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolvePrintContextMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolvePrintContextMethod t PrintContext, O.MethodInfo info PrintContext p) => O.IsLabelProxy t (PrintContext -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolvePrintContextMethod t PrintContext, O.MethodInfo info PrintContext p) => O.IsLabel t (PrintContext -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList PrintContext
type instance O.AttributeList PrintContext = PrintContextAttributeList
type PrintContextAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList PrintContext = PrintContextSignalList
type PrintContextSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gtk_print_context_create_pango_context" gtk_print_context_create_pango_context ::
Ptr PrintContext ->
IO (Ptr Pango.Context.Context)
printContextCreatePangoContext ::
(B.CallStack.HasCallStack, MonadIO m, IsPrintContext a) =>
a
-> m Pango.Context.Context
printContextCreatePangoContext context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gtk_print_context_create_pango_context context'
checkUnexpectedReturnNULL "printContextCreatePangoContext" result
result' <- (wrapObject Pango.Context.Context) result
touchManagedPtr context
return result'
#if ENABLE_OVERLOADING
data PrintContextCreatePangoContextMethodInfo
instance (signature ~ (m Pango.Context.Context), MonadIO m, IsPrintContext a) => O.MethodInfo PrintContextCreatePangoContextMethodInfo a signature where
overloadedMethod _ = printContextCreatePangoContext
#endif
foreign import ccall "gtk_print_context_create_pango_layout" gtk_print_context_create_pango_layout ::
Ptr PrintContext ->
IO (Ptr Pango.Layout.Layout)
printContextCreatePangoLayout ::
(B.CallStack.HasCallStack, MonadIO m, IsPrintContext a) =>
a
-> m Pango.Layout.Layout
printContextCreatePangoLayout context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gtk_print_context_create_pango_layout context'
checkUnexpectedReturnNULL "printContextCreatePangoLayout" result
result' <- (wrapObject Pango.Layout.Layout) result
touchManagedPtr context
return result'
#if ENABLE_OVERLOADING
data PrintContextCreatePangoLayoutMethodInfo
instance (signature ~ (m Pango.Layout.Layout), MonadIO m, IsPrintContext a) => O.MethodInfo PrintContextCreatePangoLayoutMethodInfo a signature where
overloadedMethod _ = printContextCreatePangoLayout
#endif
foreign import ccall "gtk_print_context_get_cairo_context" gtk_print_context_get_cairo_context ::
Ptr PrintContext ->
IO (Ptr Cairo.Context.Context)
printContextGetCairoContext ::
(B.CallStack.HasCallStack, MonadIO m, IsPrintContext a) =>
a
-> m Cairo.Context.Context
printContextGetCairoContext context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gtk_print_context_get_cairo_context context'
checkUnexpectedReturnNULL "printContextGetCairoContext" result
result' <- (newBoxed Cairo.Context.Context) result
touchManagedPtr context
return result'
#if ENABLE_OVERLOADING
data PrintContextGetCairoContextMethodInfo
instance (signature ~ (m Cairo.Context.Context), MonadIO m, IsPrintContext a) => O.MethodInfo PrintContextGetCairoContextMethodInfo a signature where
overloadedMethod _ = printContextGetCairoContext
#endif
foreign import ccall "gtk_print_context_get_dpi_x" gtk_print_context_get_dpi_x ::
Ptr PrintContext ->
IO CDouble
printContextGetDpiX ::
(B.CallStack.HasCallStack, MonadIO m, IsPrintContext a) =>
a
-> m Double
printContextGetDpiX context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gtk_print_context_get_dpi_x context'
let result' = realToFrac result
touchManagedPtr context
return result'
#if ENABLE_OVERLOADING
data PrintContextGetDpiXMethodInfo
instance (signature ~ (m Double), MonadIO m, IsPrintContext a) => O.MethodInfo PrintContextGetDpiXMethodInfo a signature where
overloadedMethod _ = printContextGetDpiX
#endif
foreign import ccall "gtk_print_context_get_dpi_y" gtk_print_context_get_dpi_y ::
Ptr PrintContext ->
IO CDouble
printContextGetDpiY ::
(B.CallStack.HasCallStack, MonadIO m, IsPrintContext a) =>
a
-> m Double
printContextGetDpiY context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gtk_print_context_get_dpi_y context'
let result' = realToFrac result
touchManagedPtr context
return result'
#if ENABLE_OVERLOADING
data PrintContextGetDpiYMethodInfo
instance (signature ~ (m Double), MonadIO m, IsPrintContext a) => O.MethodInfo PrintContextGetDpiYMethodInfo a signature where
overloadedMethod _ = printContextGetDpiY
#endif
foreign import ccall "gtk_print_context_get_hard_margins" gtk_print_context_get_hard_margins ::
Ptr PrintContext ->
Ptr CDouble ->
Ptr CDouble ->
Ptr CDouble ->
Ptr CDouble ->
IO CInt
printContextGetHardMargins ::
(B.CallStack.HasCallStack, MonadIO m, IsPrintContext a) =>
a
-> m ((Bool, Double, Double, Double, Double))
printContextGetHardMargins context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
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 context' 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 context
freeMem top
freeMem bottom
freeMem left
freeMem right
return (result', top'', bottom'', left'', right'')
#if ENABLE_OVERLOADING
data PrintContextGetHardMarginsMethodInfo
instance (signature ~ (m ((Bool, Double, Double, Double, Double))), MonadIO m, IsPrintContext a) => O.MethodInfo PrintContextGetHardMarginsMethodInfo a signature where
overloadedMethod _ = printContextGetHardMargins
#endif
foreign import ccall "gtk_print_context_get_height" gtk_print_context_get_height ::
Ptr PrintContext ->
IO CDouble
printContextGetHeight ::
(B.CallStack.HasCallStack, MonadIO m, IsPrintContext a) =>
a
-> m Double
printContextGetHeight context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gtk_print_context_get_height context'
let result' = realToFrac result
touchManagedPtr context
return result'
#if ENABLE_OVERLOADING
data PrintContextGetHeightMethodInfo
instance (signature ~ (m Double), MonadIO m, IsPrintContext a) => O.MethodInfo PrintContextGetHeightMethodInfo a signature where
overloadedMethod _ = printContextGetHeight
#endif
foreign import ccall "gtk_print_context_get_page_setup" gtk_print_context_get_page_setup ::
Ptr PrintContext ->
IO (Ptr Gtk.PageSetup.PageSetup)
printContextGetPageSetup ::
(B.CallStack.HasCallStack, MonadIO m, IsPrintContext a) =>
a
-> m Gtk.PageSetup.PageSetup
printContextGetPageSetup context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gtk_print_context_get_page_setup context'
checkUnexpectedReturnNULL "printContextGetPageSetup" result
result' <- (newObject Gtk.PageSetup.PageSetup) result
touchManagedPtr context
return result'
#if ENABLE_OVERLOADING
data PrintContextGetPageSetupMethodInfo
instance (signature ~ (m Gtk.PageSetup.PageSetup), MonadIO m, IsPrintContext a) => O.MethodInfo PrintContextGetPageSetupMethodInfo a signature where
overloadedMethod _ = printContextGetPageSetup
#endif
foreign import ccall "gtk_print_context_get_pango_fontmap" gtk_print_context_get_pango_fontmap ::
Ptr PrintContext ->
IO (Ptr Pango.FontMap.FontMap)
printContextGetPangoFontmap ::
(B.CallStack.HasCallStack, MonadIO m, IsPrintContext a) =>
a
-> m Pango.FontMap.FontMap
printContextGetPangoFontmap context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gtk_print_context_get_pango_fontmap context'
checkUnexpectedReturnNULL "printContextGetPangoFontmap" result
result' <- (newObject Pango.FontMap.FontMap) result
touchManagedPtr context
return result'
#if ENABLE_OVERLOADING
data PrintContextGetPangoFontmapMethodInfo
instance (signature ~ (m Pango.FontMap.FontMap), MonadIO m, IsPrintContext a) => O.MethodInfo PrintContextGetPangoFontmapMethodInfo a signature where
overloadedMethod _ = printContextGetPangoFontmap
#endif
foreign import ccall "gtk_print_context_get_width" gtk_print_context_get_width ::
Ptr PrintContext ->
IO CDouble
printContextGetWidth ::
(B.CallStack.HasCallStack, MonadIO m, IsPrintContext a) =>
a
-> m Double
printContextGetWidth context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gtk_print_context_get_width context'
let result' = realToFrac result
touchManagedPtr context
return result'
#if ENABLE_OVERLOADING
data PrintContextGetWidthMethodInfo
instance (signature ~ (m Double), MonadIO m, IsPrintContext a) => O.MethodInfo PrintContextGetWidthMethodInfo a signature where
overloadedMethod _ = printContextGetWidth
#endif
foreign import ccall "gtk_print_context_set_cairo_context" gtk_print_context_set_cairo_context ::
Ptr PrintContext ->
Ptr Cairo.Context.Context ->
CDouble ->
CDouble ->
IO ()
printContextSetCairoContext ::
(B.CallStack.HasCallStack, MonadIO m, IsPrintContext a) =>
a
-> Cairo.Context.Context
-> Double
-> Double
-> m ()
printContextSetCairoContext context cr dpiX dpiY = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
cr' <- unsafeManagedPtrGetPtr cr
let dpiX' = realToFrac dpiX
let dpiY' = realToFrac dpiY
gtk_print_context_set_cairo_context context' cr' dpiX' dpiY'
touchManagedPtr context
touchManagedPtr cr
return ()
#if ENABLE_OVERLOADING
data PrintContextSetCairoContextMethodInfo
instance (signature ~ (Cairo.Context.Context -> Double -> Double -> m ()), MonadIO m, IsPrintContext a) => O.MethodInfo PrintContextSetCairoContextMethodInfo a signature where
overloadedMethod _ = printContextSetCairoContext
#endif