{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gdk.Objects.DrawingContext
(
DrawingContext(..) ,
IsDrawingContext ,
toDrawingContext ,
noDrawingContext ,
#if defined(ENABLE_OVERLOADING)
ResolveDrawingContextMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
DrawingContextGetCairoContextMethodInfo ,
#endif
drawingContextGetCairoContext ,
#if defined(ENABLE_OVERLOADING)
DrawingContextGetClipMethodInfo ,
#endif
drawingContextGetClip ,
#if defined(ENABLE_OVERLOADING)
DrawingContextGetWindowMethodInfo ,
#endif
drawingContextGetWindow ,
#if defined(ENABLE_OVERLOADING)
DrawingContextIsValidMethodInfo ,
#endif
drawingContextIsValid ,
#if defined(ENABLE_OVERLOADING)
DrawingContextClipPropertyInfo ,
#endif
constructDrawingContextClip ,
#if defined(ENABLE_OVERLOADING)
drawingContextClip ,
#endif
getDrawingContextClip ,
#if defined(ENABLE_OVERLOADING)
DrawingContextWindowPropertyInfo ,
#endif
constructDrawingContextWindow ,
#if defined(ENABLE_OVERLOADING)
drawingContextWindow ,
#endif
getDrawingContextWindow ,
) 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.GClosure as B.GClosure
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.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
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 GHC.OverloadedLabels as OL
import qualified GI.Cairo.Structs.Context as Cairo.Context
import qualified GI.Cairo.Structs.Region as Cairo.Region
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gdk.Objects.Window as Gdk.Window
newtype DrawingContext = DrawingContext (ManagedPtr DrawingContext)
deriving (Eq)
foreign import ccall "gdk_drawing_context_get_type"
c_gdk_drawing_context_get_type :: IO GType
instance GObject DrawingContext where
gobjectType = c_gdk_drawing_context_get_type
instance B.GValue.IsGValue DrawingContext where
toGValue o = do
gtype <- c_gdk_drawing_context_get_type
B.ManagedPtr.withManagedPtr o (B.GValue.buildGValue gtype B.GValue.set_object)
fromGValue gv = do
ptr <- B.GValue.get_object gv :: IO (Ptr DrawingContext)
B.ManagedPtr.newObject DrawingContext ptr
class (GObject o, O.IsDescendantOf DrawingContext o) => IsDrawingContext o
instance (GObject o, O.IsDescendantOf DrawingContext o) => IsDrawingContext o
instance O.HasParentTypes DrawingContext
type instance O.ParentTypes DrawingContext = '[GObject.Object.Object]
toDrawingContext :: (MonadIO m, IsDrawingContext o) => o -> m DrawingContext
toDrawingContext = liftIO . unsafeCastTo DrawingContext
noDrawingContext :: Maybe DrawingContext
noDrawingContext = Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveDrawingContextMethod (t :: Symbol) (o :: *) :: * where
ResolveDrawingContextMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveDrawingContextMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveDrawingContextMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveDrawingContextMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveDrawingContextMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveDrawingContextMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveDrawingContextMethod "isValid" o = DrawingContextIsValidMethodInfo
ResolveDrawingContextMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveDrawingContextMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveDrawingContextMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveDrawingContextMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveDrawingContextMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveDrawingContextMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveDrawingContextMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveDrawingContextMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveDrawingContextMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveDrawingContextMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveDrawingContextMethod "getCairoContext" o = DrawingContextGetCairoContextMethodInfo
ResolveDrawingContextMethod "getClip" o = DrawingContextGetClipMethodInfo
ResolveDrawingContextMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveDrawingContextMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveDrawingContextMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveDrawingContextMethod "getWindow" o = DrawingContextGetWindowMethodInfo
ResolveDrawingContextMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveDrawingContextMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveDrawingContextMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveDrawingContextMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDrawingContextMethod t DrawingContext, O.MethodInfo info DrawingContext p) => OL.IsLabel t (DrawingContext -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
getDrawingContextClip :: (MonadIO m, IsDrawingContext o) => o -> m (Maybe Cairo.Region.Region)
getDrawingContextClip obj = liftIO $ B.Properties.getObjectPropertyBoxed obj "clip" Cairo.Region.Region
constructDrawingContextClip :: (IsDrawingContext o) => Cairo.Region.Region -> IO (GValueConstruct o)
constructDrawingContextClip val = B.Properties.constructObjectPropertyBoxed "clip" (Just val)
#if defined(ENABLE_OVERLOADING)
data DrawingContextClipPropertyInfo
instance AttrInfo DrawingContextClipPropertyInfo where
type AttrAllowedOps DrawingContextClipPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint DrawingContextClipPropertyInfo = IsDrawingContext
type AttrSetTypeConstraint DrawingContextClipPropertyInfo = (~) Cairo.Region.Region
type AttrTransferTypeConstraint DrawingContextClipPropertyInfo = (~) Cairo.Region.Region
type AttrTransferType DrawingContextClipPropertyInfo = Cairo.Region.Region
type AttrGetType DrawingContextClipPropertyInfo = (Maybe Cairo.Region.Region)
type AttrLabel DrawingContextClipPropertyInfo = "clip"
type AttrOrigin DrawingContextClipPropertyInfo = DrawingContext
attrGet = getDrawingContextClip
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructDrawingContextClip
attrClear = undefined
#endif
getDrawingContextWindow :: (MonadIO m, IsDrawingContext o) => o -> m Gdk.Window.Window
getDrawingContextWindow obj = liftIO $ checkUnexpectedNothing "getDrawingContextWindow" $ B.Properties.getObjectPropertyObject obj "window" Gdk.Window.Window
constructDrawingContextWindow :: (IsDrawingContext o, Gdk.Window.IsWindow a) => a -> IO (GValueConstruct o)
constructDrawingContextWindow val = B.Properties.constructObjectPropertyObject "window" (Just val)
#if defined(ENABLE_OVERLOADING)
data DrawingContextWindowPropertyInfo
instance AttrInfo DrawingContextWindowPropertyInfo where
type AttrAllowedOps DrawingContextWindowPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint DrawingContextWindowPropertyInfo = IsDrawingContext
type AttrSetTypeConstraint DrawingContextWindowPropertyInfo = Gdk.Window.IsWindow
type AttrTransferTypeConstraint DrawingContextWindowPropertyInfo = Gdk.Window.IsWindow
type AttrTransferType DrawingContextWindowPropertyInfo = Gdk.Window.Window
type AttrGetType DrawingContextWindowPropertyInfo = Gdk.Window.Window
type AttrLabel DrawingContextWindowPropertyInfo = "window"
type AttrOrigin DrawingContextWindowPropertyInfo = DrawingContext
attrGet = getDrawingContextWindow
attrSet = undefined
attrTransfer _ v = do
unsafeCastTo Gdk.Window.Window v
attrConstruct = constructDrawingContextWindow
attrClear = undefined
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DrawingContext
type instance O.AttributeList DrawingContext = DrawingContextAttributeList
type DrawingContextAttributeList = ('[ '("clip", DrawingContextClipPropertyInfo), '("window", DrawingContextWindowPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
drawingContextClip :: AttrLabelProxy "clip"
drawingContextClip = AttrLabelProxy
drawingContextWindow :: AttrLabelProxy "window"
drawingContextWindow = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList DrawingContext = DrawingContextSignalList
type DrawingContextSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gdk_drawing_context_get_cairo_context" gdk_drawing_context_get_cairo_context ::
Ptr DrawingContext ->
IO (Ptr Cairo.Context.Context)
drawingContextGetCairoContext ::
(B.CallStack.HasCallStack, MonadIO m, IsDrawingContext a) =>
a
-> m Cairo.Context.Context
drawingContextGetCairoContext context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gdk_drawing_context_get_cairo_context context'
checkUnexpectedReturnNULL "drawingContextGetCairoContext" result
result' <- (newBoxed Cairo.Context.Context) result
touchManagedPtr context
return result'
#if defined(ENABLE_OVERLOADING)
data DrawingContextGetCairoContextMethodInfo
instance (signature ~ (m Cairo.Context.Context), MonadIO m, IsDrawingContext a) => O.MethodInfo DrawingContextGetCairoContextMethodInfo a signature where
overloadedMethod = drawingContextGetCairoContext
#endif
foreign import ccall "gdk_drawing_context_get_clip" gdk_drawing_context_get_clip ::
Ptr DrawingContext ->
IO (Ptr Cairo.Region.Region)
drawingContextGetClip ::
(B.CallStack.HasCallStack, MonadIO m, IsDrawingContext a) =>
a
-> m (Maybe Cairo.Region.Region)
drawingContextGetClip context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gdk_drawing_context_get_clip context'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed Cairo.Region.Region) result'
return result''
touchManagedPtr context
return maybeResult
#if defined(ENABLE_OVERLOADING)
data DrawingContextGetClipMethodInfo
instance (signature ~ (m (Maybe Cairo.Region.Region)), MonadIO m, IsDrawingContext a) => O.MethodInfo DrawingContextGetClipMethodInfo a signature where
overloadedMethod = drawingContextGetClip
#endif
foreign import ccall "gdk_drawing_context_get_window" gdk_drawing_context_get_window ::
Ptr DrawingContext ->
IO (Ptr Gdk.Window.Window)
drawingContextGetWindow ::
(B.CallStack.HasCallStack, MonadIO m, IsDrawingContext a) =>
a
-> m Gdk.Window.Window
drawingContextGetWindow context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gdk_drawing_context_get_window context'
checkUnexpectedReturnNULL "drawingContextGetWindow" result
result' <- (newObject Gdk.Window.Window) result
touchManagedPtr context
return result'
#if defined(ENABLE_OVERLOADING)
data DrawingContextGetWindowMethodInfo
instance (signature ~ (m Gdk.Window.Window), MonadIO m, IsDrawingContext a) => O.MethodInfo DrawingContextGetWindowMethodInfo a signature where
overloadedMethod = drawingContextGetWindow
#endif
foreign import ccall "gdk_drawing_context_is_valid" gdk_drawing_context_is_valid ::
Ptr DrawingContext ->
IO CInt
drawingContextIsValid ::
(B.CallStack.HasCallStack, MonadIO m, IsDrawingContext a) =>
a
-> m Bool
drawingContextIsValid context = liftIO $ do
context' <- unsafeManagedPtrCastPtr context
result <- gdk_drawing_context_is_valid context'
let result' = (/= 0) result
touchManagedPtr context
return result'
#if defined(ENABLE_OVERLOADING)
data DrawingContextIsValidMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrawingContext a) => O.MethodInfo DrawingContextIsValidMethodInfo a signature where
overloadedMethod = drawingContextIsValid
#endif