#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gdk.Objects.DrawingContext
(
DrawingContext(..) ,
IsDrawingContext ,
toDrawingContext ,
noDrawingContext ,
#if ENABLE_OVERLOADING
DrawingContextGetCairoContextMethodInfo ,
#endif
drawingContextGetCairoContext ,
#if ENABLE_OVERLOADING
DrawingContextGetClipMethodInfo ,
#endif
drawingContextGetClip ,
#if ENABLE_OVERLOADING
DrawingContextGetWindowMethodInfo ,
#endif
drawingContextGetWindow ,
#if ENABLE_OVERLOADING
DrawingContextIsValidMethodInfo ,
#endif
drawingContextIsValid ,
#if ENABLE_OVERLOADING
DrawingContextClipPropertyInfo ,
#endif
constructDrawingContextClip ,
#if ENABLE_OVERLOADING
drawingContextClip ,
#endif
getDrawingContextClip ,
#if ENABLE_OVERLOADING
DrawingContextWindowPropertyInfo ,
#endif
constructDrawingContextWindow ,
#if 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.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.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)
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
class GObject o => IsDrawingContext o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError DrawingContext a) =>
IsDrawingContext a
#endif
instance IsDrawingContext DrawingContext
instance GObject.Object.IsObject DrawingContext
toDrawingContext :: (MonadIO m, IsDrawingContext o) => o -> m DrawingContext
toDrawingContext = liftIO . unsafeCastTo DrawingContext
noDrawingContext :: Maybe DrawingContext
noDrawingContext = Nothing
#if 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 "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveDrawingContextMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDrawingContextMethod t DrawingContext, O.MethodInfo info DrawingContext p) => O.IsLabelProxy t (DrawingContext -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDrawingContextMethod t DrawingContext, O.MethodInfo info DrawingContext p) => O.IsLabel t (DrawingContext -> 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
getDrawingContextClip :: (MonadIO m, IsDrawingContext o) => o -> m (Maybe Cairo.Region.Region)
getDrawingContextClip obj = liftIO $ getObjectPropertyBoxed obj "clip" Cairo.Region.Region
constructDrawingContextClip :: (IsDrawingContext o) => Cairo.Region.Region -> IO (GValueConstruct o)
constructDrawingContextClip val = constructObjectPropertyBoxed "clip" (Just val)
#if ENABLE_OVERLOADING
data DrawingContextClipPropertyInfo
instance AttrInfo DrawingContextClipPropertyInfo where
type AttrAllowedOps DrawingContextClipPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint DrawingContextClipPropertyInfo = (~) Cairo.Region.Region
type AttrBaseTypeConstraint DrawingContextClipPropertyInfo = IsDrawingContext
type AttrGetType DrawingContextClipPropertyInfo = (Maybe Cairo.Region.Region)
type AttrLabel DrawingContextClipPropertyInfo = "clip"
type AttrOrigin DrawingContextClipPropertyInfo = DrawingContext
attrGet _ = getDrawingContextClip
attrSet _ = undefined
attrConstruct _ = constructDrawingContextClip
attrClear _ = undefined
#endif
getDrawingContextWindow :: (MonadIO m, IsDrawingContext o) => o -> m Gdk.Window.Window
getDrawingContextWindow obj = liftIO $ checkUnexpectedNothing "getDrawingContextWindow" $ getObjectPropertyObject obj "window" Gdk.Window.Window
constructDrawingContextWindow :: (IsDrawingContext o, Gdk.Window.IsWindow a) => a -> IO (GValueConstruct o)
constructDrawingContextWindow val = constructObjectPropertyObject "window" (Just val)
#if ENABLE_OVERLOADING
data DrawingContextWindowPropertyInfo
instance AttrInfo DrawingContextWindowPropertyInfo where
type AttrAllowedOps DrawingContextWindowPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint DrawingContextWindowPropertyInfo = Gdk.Window.IsWindow
type AttrBaseTypeConstraint DrawingContextWindowPropertyInfo = IsDrawingContext
type AttrGetType DrawingContextWindowPropertyInfo = Gdk.Window.Window
type AttrLabel DrawingContextWindowPropertyInfo = "window"
type AttrOrigin DrawingContextWindowPropertyInfo = DrawingContext
attrGet _ = getDrawingContextWindow
attrSet _ = undefined
attrConstruct _ = constructDrawingContextWindow
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList DrawingContext
type instance O.AttributeList DrawingContext = DrawingContextAttributeList
type DrawingContextAttributeList = ('[ '("clip", DrawingContextClipPropertyInfo), '("window", DrawingContextWindowPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
drawingContextClip :: AttrLabelProxy "clip"
drawingContextClip = AttrLabelProxy
drawingContextWindow :: AttrLabelProxy "window"
drawingContextWindow = AttrLabelProxy
#endif
#if 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 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 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 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 ENABLE_OVERLOADING
data DrawingContextIsValidMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsDrawingContext a) => O.MethodInfo DrawingContextIsValidMethodInfo a signature where
overloadedMethod _ = drawingContextIsValid
#endif