{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Objects.WidgetPaintable
(
WidgetPaintable(..) ,
IsWidgetPaintable ,
toWidgetPaintable ,
noWidgetPaintable ,
#if defined(ENABLE_OVERLOADING)
ResolveWidgetPaintableMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
WidgetPaintableGetWidgetMethodInfo ,
#endif
widgetPaintableGetWidget ,
widgetPaintableNew ,
#if defined(ENABLE_OVERLOADING)
WidgetPaintableSetWidgetMethodInfo ,
#endif
widgetPaintableSetWidget ,
#if defined(ENABLE_OVERLOADING)
WidgetPaintableWidgetPropertyInfo ,
#endif
clearWidgetPaintableWidget ,
constructWidgetPaintableWidget ,
getWidgetPaintableWidget ,
setWidgetPaintableWidget ,
#if defined(ENABLE_OVERLOADING)
widgetPaintableWidget ,
#endif
) 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.GObject.Objects.Object as GObject.Object
import qualified GI.Gdk.Interfaces.Paintable as Gdk.Paintable
import {-# SOURCE #-} qualified GI.Gtk.Objects.Widget as Gtk.Widget
newtype WidgetPaintable = WidgetPaintable (ManagedPtr WidgetPaintable)
deriving (WidgetPaintable -> WidgetPaintable -> Bool
(WidgetPaintable -> WidgetPaintable -> Bool)
-> (WidgetPaintable -> WidgetPaintable -> Bool)
-> Eq WidgetPaintable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WidgetPaintable -> WidgetPaintable -> Bool
$c/= :: WidgetPaintable -> WidgetPaintable -> Bool
== :: WidgetPaintable -> WidgetPaintable -> Bool
$c== :: WidgetPaintable -> WidgetPaintable -> Bool
Eq)
foreign import ccall "gtk_widget_paintable_get_type"
c_gtk_widget_paintable_get_type :: IO GType
instance GObject WidgetPaintable where
gobjectType :: IO GType
gobjectType = IO GType
c_gtk_widget_paintable_get_type
instance B.GValue.IsGValue WidgetPaintable where
toGValue :: WidgetPaintable -> IO GValue
toGValue o :: WidgetPaintable
o = do
GType
gtype <- IO GType
c_gtk_widget_paintable_get_type
WidgetPaintable -> (Ptr WidgetPaintable -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr WidgetPaintable
o (GType
-> (GValue -> Ptr WidgetPaintable -> IO ())
-> Ptr WidgetPaintable
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr WidgetPaintable -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO WidgetPaintable
fromGValue gv :: GValue
gv = do
Ptr WidgetPaintable
ptr <- GValue -> IO (Ptr WidgetPaintable)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr WidgetPaintable)
(ManagedPtr WidgetPaintable -> WidgetPaintable)
-> Ptr WidgetPaintable -> IO WidgetPaintable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr WidgetPaintable -> WidgetPaintable
WidgetPaintable Ptr WidgetPaintable
ptr
class (GObject o, O.IsDescendantOf WidgetPaintable o) => IsWidgetPaintable o
instance (GObject o, O.IsDescendantOf WidgetPaintable o) => IsWidgetPaintable o
instance O.HasParentTypes WidgetPaintable
type instance O.ParentTypes WidgetPaintable = '[GObject.Object.Object, Gdk.Paintable.Paintable]
toWidgetPaintable :: (MonadIO m, IsWidgetPaintable o) => o -> m WidgetPaintable
toWidgetPaintable :: o -> m WidgetPaintable
toWidgetPaintable = IO WidgetPaintable -> m WidgetPaintable
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO WidgetPaintable -> m WidgetPaintable)
-> (o -> IO WidgetPaintable) -> o -> m WidgetPaintable
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr WidgetPaintable -> WidgetPaintable)
-> o -> IO WidgetPaintable
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr WidgetPaintable -> WidgetPaintable
WidgetPaintable
noWidgetPaintable :: Maybe WidgetPaintable
noWidgetPaintable :: Maybe WidgetPaintable
noWidgetPaintable = Maybe WidgetPaintable
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveWidgetPaintableMethod (t :: Symbol) (o :: *) :: * where
ResolveWidgetPaintableMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveWidgetPaintableMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveWidgetPaintableMethod "computeConcreteSize" o = Gdk.Paintable.PaintableComputeConcreteSizeMethodInfo
ResolveWidgetPaintableMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveWidgetPaintableMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveWidgetPaintableMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveWidgetPaintableMethod "invalidateContents" o = Gdk.Paintable.PaintableInvalidateContentsMethodInfo
ResolveWidgetPaintableMethod "invalidateSize" o = Gdk.Paintable.PaintableInvalidateSizeMethodInfo
ResolveWidgetPaintableMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveWidgetPaintableMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveWidgetPaintableMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveWidgetPaintableMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveWidgetPaintableMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveWidgetPaintableMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveWidgetPaintableMethod "snapshot" o = Gdk.Paintable.PaintableSnapshotMethodInfo
ResolveWidgetPaintableMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveWidgetPaintableMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveWidgetPaintableMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveWidgetPaintableMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveWidgetPaintableMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveWidgetPaintableMethod "getCurrentImage" o = Gdk.Paintable.PaintableGetCurrentImageMethodInfo
ResolveWidgetPaintableMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveWidgetPaintableMethod "getFlags" o = Gdk.Paintable.PaintableGetFlagsMethodInfo
ResolveWidgetPaintableMethod "getIntrinsicAspectRatio" o = Gdk.Paintable.PaintableGetIntrinsicAspectRatioMethodInfo
ResolveWidgetPaintableMethod "getIntrinsicHeight" o = Gdk.Paintable.PaintableGetIntrinsicHeightMethodInfo
ResolveWidgetPaintableMethod "getIntrinsicWidth" o = Gdk.Paintable.PaintableGetIntrinsicWidthMethodInfo
ResolveWidgetPaintableMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveWidgetPaintableMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveWidgetPaintableMethod "getWidget" o = WidgetPaintableGetWidgetMethodInfo
ResolveWidgetPaintableMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveWidgetPaintableMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveWidgetPaintableMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveWidgetPaintableMethod "setWidget" o = WidgetPaintableSetWidgetMethodInfo
ResolveWidgetPaintableMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveWidgetPaintableMethod t WidgetPaintable, O.MethodInfo info WidgetPaintable p) => OL.IsLabel t (WidgetPaintable -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
getWidgetPaintableWidget :: (MonadIO m, IsWidgetPaintable o) => o -> m (Maybe Gtk.Widget.Widget)
getWidgetPaintableWidget :: o -> m (Maybe Widget)
getWidgetPaintableWidget obj :: o
obj = IO (Maybe Widget) -> m (Maybe Widget)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Widget) -> m (Maybe Widget))
-> IO (Maybe Widget) -> m (Maybe Widget)
forall a b. (a -> b) -> a -> b
$ o -> String -> (ManagedPtr Widget -> Widget) -> IO (Maybe Widget)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj "widget" ManagedPtr Widget -> Widget
Gtk.Widget.Widget
setWidgetPaintableWidget :: (MonadIO m, IsWidgetPaintable o, Gtk.Widget.IsWidget a) => o -> a -> m ()
setWidgetPaintableWidget :: o -> a -> m ()
setWidgetPaintableWidget obj :: o
obj val :: a
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe a -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj "widget" (a -> Maybe a
forall a. a -> Maybe a
Just a
val)
constructWidgetPaintableWidget :: (IsWidgetPaintable o, Gtk.Widget.IsWidget a) => a -> IO (GValueConstruct o)
constructWidgetPaintableWidget :: a -> IO (GValueConstruct o)
constructWidgetPaintableWidget val :: a
val = String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject "widget" (a -> Maybe a
forall a. a -> Maybe a
Just a
val)
clearWidgetPaintableWidget :: (MonadIO m, IsWidgetPaintable o) => o -> m ()
clearWidgetPaintableWidget :: o -> m ()
clearWidgetPaintableWidget obj :: o
obj = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Widget -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj "widget" (Maybe Widget
forall a. Maybe a
Nothing :: Maybe Gtk.Widget.Widget)
#if defined(ENABLE_OVERLOADING)
data WidgetPaintableWidgetPropertyInfo
instance AttrInfo WidgetPaintableWidgetPropertyInfo where
type AttrAllowedOps WidgetPaintableWidgetPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint WidgetPaintableWidgetPropertyInfo = IsWidgetPaintable
type AttrSetTypeConstraint WidgetPaintableWidgetPropertyInfo = Gtk.Widget.IsWidget
type AttrTransferTypeConstraint WidgetPaintableWidgetPropertyInfo = Gtk.Widget.IsWidget
type AttrTransferType WidgetPaintableWidgetPropertyInfo = Gtk.Widget.Widget
type AttrGetType WidgetPaintableWidgetPropertyInfo = (Maybe Gtk.Widget.Widget)
type AttrLabel WidgetPaintableWidgetPropertyInfo = "widget"
type AttrOrigin WidgetPaintableWidgetPropertyInfo = WidgetPaintable
attrGet = getWidgetPaintableWidget
attrSet = setWidgetPaintableWidget
attrTransfer _ v = do
unsafeCastTo Gtk.Widget.Widget v
attrConstruct = constructWidgetPaintableWidget
attrClear = clearWidgetPaintableWidget
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList WidgetPaintable
type instance O.AttributeList WidgetPaintable = WidgetPaintableAttributeList
type WidgetPaintableAttributeList = ('[ '("widget", WidgetPaintableWidgetPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
widgetPaintableWidget :: AttrLabelProxy "widget"
widgetPaintableWidget = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList WidgetPaintable = WidgetPaintableSignalList
type WidgetPaintableSignalList = ('[ '("invalidateContents", Gdk.Paintable.PaintableInvalidateContentsSignalInfo), '("invalidateSize", Gdk.Paintable.PaintableInvalidateSizeSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gtk_widget_paintable_new" gtk_widget_paintable_new ::
Ptr Gtk.Widget.Widget ->
IO (Ptr WidgetPaintable)
widgetPaintableNew ::
(B.CallStack.HasCallStack, MonadIO m, Gtk.Widget.IsWidget a) =>
Maybe (a)
-> m WidgetPaintable
widgetPaintableNew :: Maybe a -> m WidgetPaintable
widgetPaintableNew widget :: Maybe a
widget = IO WidgetPaintable -> m WidgetPaintable
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO WidgetPaintable -> m WidgetPaintable)
-> IO WidgetPaintable -> m WidgetPaintable
forall a b. (a -> b) -> a -> b
$ do
Ptr Widget
maybeWidget <- case Maybe a
widget of
Nothing -> Ptr Widget -> IO (Ptr Widget)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Widget
forall a. Ptr a
nullPtr
Just jWidget :: a
jWidget -> do
Ptr Widget
jWidget' <- a -> IO (Ptr Widget)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jWidget
Ptr Widget -> IO (Ptr Widget)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Widget
jWidget'
Ptr WidgetPaintable
result <- Ptr Widget -> IO (Ptr WidgetPaintable)
gtk_widget_paintable_new Ptr Widget
maybeWidget
Text -> Ptr WidgetPaintable -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "widgetPaintableNew" Ptr WidgetPaintable
result
WidgetPaintable
result' <- ((ManagedPtr WidgetPaintable -> WidgetPaintable)
-> Ptr WidgetPaintable -> IO WidgetPaintable
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr WidgetPaintable -> WidgetPaintable
WidgetPaintable) Ptr WidgetPaintable
result
Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
widget a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
WidgetPaintable -> IO WidgetPaintable
forall (m :: * -> *) a. Monad m => a -> m a
return WidgetPaintable
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_widget_paintable_get_widget" gtk_widget_paintable_get_widget ::
Ptr WidgetPaintable ->
IO (Ptr Gtk.Widget.Widget)
widgetPaintableGetWidget ::
(B.CallStack.HasCallStack, MonadIO m, IsWidgetPaintable a) =>
a
-> m (Maybe Gtk.Widget.Widget)
widgetPaintableGetWidget :: a -> m (Maybe Widget)
widgetPaintableGetWidget self :: a
self = IO (Maybe Widget) -> m (Maybe Widget)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Widget) -> m (Maybe Widget))
-> IO (Maybe Widget) -> m (Maybe Widget)
forall a b. (a -> b) -> a -> b
$ do
Ptr WidgetPaintable
self' <- a -> IO (Ptr WidgetPaintable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr Widget
result <- Ptr WidgetPaintable -> IO (Ptr Widget)
gtk_widget_paintable_get_widget Ptr WidgetPaintable
self'
Maybe Widget
maybeResult <- Ptr Widget -> (Ptr Widget -> IO Widget) -> IO (Maybe Widget)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Widget
result ((Ptr Widget -> IO Widget) -> IO (Maybe Widget))
-> (Ptr Widget -> IO Widget) -> IO (Maybe Widget)
forall a b. (a -> b) -> a -> b
$ \result' :: Ptr Widget
result' -> do
Widget
result'' <- ((ManagedPtr Widget -> Widget) -> Ptr Widget -> IO Widget
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Widget -> Widget
Gtk.Widget.Widget) Ptr Widget
result'
Widget -> IO Widget
forall (m :: * -> *) a. Monad m => a -> m a
return Widget
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
Maybe Widget -> IO (Maybe Widget)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Widget
maybeResult
#if defined(ENABLE_OVERLOADING)
data WidgetPaintableGetWidgetMethodInfo
instance (signature ~ (m (Maybe Gtk.Widget.Widget)), MonadIO m, IsWidgetPaintable a) => O.MethodInfo WidgetPaintableGetWidgetMethodInfo a signature where
overloadedMethod = widgetPaintableGetWidget
#endif
foreign import ccall "gtk_widget_paintable_set_widget" gtk_widget_paintable_set_widget ::
Ptr WidgetPaintable ->
Ptr Gtk.Widget.Widget ->
IO ()
widgetPaintableSetWidget ::
(B.CallStack.HasCallStack, MonadIO m, IsWidgetPaintable a, Gtk.Widget.IsWidget b) =>
a
-> Maybe (b)
-> m ()
widgetPaintableSetWidget :: a -> Maybe b -> m ()
widgetPaintableSetWidget self :: a
self widget :: Maybe b
widget = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr WidgetPaintable
self' <- a -> IO (Ptr WidgetPaintable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr Widget
maybeWidget <- case Maybe b
widget of
Nothing -> Ptr Widget -> IO (Ptr Widget)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Widget
forall a. Ptr a
nullPtr
Just jWidget :: b
jWidget -> do
Ptr Widget
jWidget' <- b -> IO (Ptr Widget)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jWidget
Ptr Widget -> IO (Ptr Widget)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Widget
jWidget'
Ptr WidgetPaintable -> Ptr Widget -> IO ()
gtk_widget_paintable_set_widget Ptr WidgetPaintable
self' Ptr Widget
maybeWidget
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
widget b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data WidgetPaintableSetWidgetMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsWidgetPaintable a, Gtk.Widget.IsWidget b) => O.MethodInfo WidgetPaintableSetWidgetMethodInfo a signature where
overloadedMethod = widgetPaintableSetWidget
#endif