{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.Emblem
(
Emblem(..) ,
IsEmblem ,
toEmblem ,
noEmblem ,
#if defined(ENABLE_OVERLOADING)
ResolveEmblemMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
EmblemGetIconMethodInfo ,
#endif
emblemGetIcon ,
#if defined(ENABLE_OVERLOADING)
EmblemGetOriginMethodInfo ,
#endif
emblemGetOrigin ,
emblemNew ,
emblemNewWithOrigin ,
#if defined(ENABLE_OVERLOADING)
EmblemIconPropertyInfo ,
#endif
constructEmblemIcon ,
#if defined(ENABLE_OVERLOADING)
emblemIcon ,
#endif
getEmblemIcon ,
#if defined(ENABLE_OVERLOADING)
EmblemOriginPropertyInfo ,
#endif
constructEmblemOrigin ,
#if defined(ENABLE_OVERLOADING)
emblemOrigin ,
#endif
getEmblemOrigin ,
) 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 {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon
newtype Emblem = Emblem (ManagedPtr Emblem)
deriving (Emblem -> Emblem -> Bool
(Emblem -> Emblem -> Bool)
-> (Emblem -> Emblem -> Bool) -> Eq Emblem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Emblem -> Emblem -> Bool
$c/= :: Emblem -> Emblem -> Bool
== :: Emblem -> Emblem -> Bool
$c== :: Emblem -> Emblem -> Bool
Eq)
foreign import ccall "g_emblem_get_type"
c_g_emblem_get_type :: IO GType
instance GObject Emblem where
gobjectType :: IO GType
gobjectType = IO GType
c_g_emblem_get_type
instance B.GValue.IsGValue Emblem where
toGValue :: Emblem -> IO GValue
toGValue o :: Emblem
o = do
GType
gtype <- IO GType
c_g_emblem_get_type
Emblem -> (Ptr Emblem -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Emblem
o (GType -> (GValue -> Ptr Emblem -> IO ()) -> Ptr Emblem -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Emblem -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO Emblem
fromGValue gv :: GValue
gv = do
Ptr Emblem
ptr <- GValue -> IO (Ptr Emblem)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Emblem)
(ManagedPtr Emblem -> Emblem) -> Ptr Emblem -> IO Emblem
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Emblem -> Emblem
Emblem Ptr Emblem
ptr
class (GObject o, O.IsDescendantOf Emblem o) => IsEmblem o
instance (GObject o, O.IsDescendantOf Emblem o) => IsEmblem o
instance O.HasParentTypes Emblem
type instance O.ParentTypes Emblem = '[GObject.Object.Object, Gio.Icon.Icon]
toEmblem :: (MonadIO m, IsEmblem o) => o -> m Emblem
toEmblem :: o -> m Emblem
toEmblem = IO Emblem -> m Emblem
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Emblem -> m Emblem) -> (o -> IO Emblem) -> o -> m Emblem
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Emblem -> Emblem) -> o -> IO Emblem
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Emblem -> Emblem
Emblem
noEmblem :: Maybe Emblem
noEmblem :: Maybe Emblem
noEmblem = Maybe Emblem
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveEmblemMethod (t :: Symbol) (o :: *) :: * where
ResolveEmblemMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveEmblemMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveEmblemMethod "equal" o = Gio.Icon.IconEqualMethodInfo
ResolveEmblemMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveEmblemMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveEmblemMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveEmblemMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveEmblemMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveEmblemMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveEmblemMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveEmblemMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveEmblemMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveEmblemMethod "serialize" o = Gio.Icon.IconSerializeMethodInfo
ResolveEmblemMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveEmblemMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveEmblemMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveEmblemMethod "toString" o = Gio.Icon.IconToStringMethodInfo
ResolveEmblemMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveEmblemMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveEmblemMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveEmblemMethod "getIcon" o = EmblemGetIconMethodInfo
ResolveEmblemMethod "getOrigin" o = EmblemGetOriginMethodInfo
ResolveEmblemMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveEmblemMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveEmblemMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveEmblemMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveEmblemMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveEmblemMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveEmblemMethod t Emblem, O.MethodInfo info Emblem p) => OL.IsLabel t (Emblem -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
getEmblemIcon :: (MonadIO m, IsEmblem o) => o -> m (Maybe GObject.Object.Object)
getEmblemIcon :: o -> m (Maybe Object)
getEmblemIcon obj :: o
obj = IO (Maybe Object) -> m (Maybe Object)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Object) -> m (Maybe Object))
-> IO (Maybe Object) -> m (Maybe Object)
forall a b. (a -> b) -> a -> b
$ o -> String -> (ManagedPtr Object -> Object) -> IO (Maybe Object)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj "icon" ManagedPtr Object -> Object
GObject.Object.Object
constructEmblemIcon :: (IsEmblem o, GObject.Object.IsObject a) => a -> IO (GValueConstruct o)
constructEmblemIcon :: a -> IO (GValueConstruct o)
constructEmblemIcon val :: a
val = String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject "icon" (a -> Maybe a
forall a. a -> Maybe a
Just a
val)
#if defined(ENABLE_OVERLOADING)
data EmblemIconPropertyInfo
instance AttrInfo EmblemIconPropertyInfo where
type AttrAllowedOps EmblemIconPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint EmblemIconPropertyInfo = IsEmblem
type AttrSetTypeConstraint EmblemIconPropertyInfo = GObject.Object.IsObject
type AttrTransferTypeConstraint EmblemIconPropertyInfo = GObject.Object.IsObject
type AttrTransferType EmblemIconPropertyInfo = GObject.Object.Object
type AttrGetType EmblemIconPropertyInfo = (Maybe GObject.Object.Object)
type AttrLabel EmblemIconPropertyInfo = "icon"
type AttrOrigin EmblemIconPropertyInfo = Emblem
attrGet = getEmblemIcon
attrSet = undefined
attrTransfer _ v = do
unsafeCastTo GObject.Object.Object v
attrConstruct = constructEmblemIcon
attrClear = undefined
#endif
getEmblemOrigin :: (MonadIO m, IsEmblem o) => o -> m Gio.Enums.EmblemOrigin
getEmblemOrigin :: o -> m EmblemOrigin
getEmblemOrigin obj :: o
obj = IO EmblemOrigin -> m EmblemOrigin
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO EmblemOrigin -> m EmblemOrigin)
-> IO EmblemOrigin -> m EmblemOrigin
forall a b. (a -> b) -> a -> b
$ o -> String -> IO EmblemOrigin
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj "origin"
constructEmblemOrigin :: (IsEmblem o) => Gio.Enums.EmblemOrigin -> IO (GValueConstruct o)
constructEmblemOrigin :: EmblemOrigin -> IO (GValueConstruct o)
constructEmblemOrigin val :: EmblemOrigin
val = String -> EmblemOrigin -> IO (GValueConstruct o)
forall a o.
(Enum a, BoxedEnum a) =>
String -> a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyEnum "origin" EmblemOrigin
val
#if defined(ENABLE_OVERLOADING)
data EmblemOriginPropertyInfo
instance AttrInfo EmblemOriginPropertyInfo where
type AttrAllowedOps EmblemOriginPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint EmblemOriginPropertyInfo = IsEmblem
type AttrSetTypeConstraint EmblemOriginPropertyInfo = (~) Gio.Enums.EmblemOrigin
type AttrTransferTypeConstraint EmblemOriginPropertyInfo = (~) Gio.Enums.EmblemOrigin
type AttrTransferType EmblemOriginPropertyInfo = Gio.Enums.EmblemOrigin
type AttrGetType EmblemOriginPropertyInfo = Gio.Enums.EmblemOrigin
type AttrLabel EmblemOriginPropertyInfo = "origin"
type AttrOrigin EmblemOriginPropertyInfo = Emblem
attrGet = getEmblemOrigin
attrSet = undefined
attrTransfer _ v = do
return v
attrConstruct = constructEmblemOrigin
attrClear = undefined
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Emblem
type instance O.AttributeList Emblem = EmblemAttributeList
type EmblemAttributeList = ('[ '("icon", EmblemIconPropertyInfo), '("origin", EmblemOriginPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
emblemIcon :: AttrLabelProxy "icon"
emblemIcon = AttrLabelProxy
emblemOrigin :: AttrLabelProxy "origin"
emblemOrigin = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Emblem = EmblemSignalList
type EmblemSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_emblem_new" g_emblem_new ::
Ptr Gio.Icon.Icon ->
IO (Ptr Emblem)
emblemNew ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Icon.IsIcon a) =>
a
-> m Emblem
emblemNew :: a -> m Emblem
emblemNew icon :: a
icon = IO Emblem -> m Emblem
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Emblem -> m Emblem) -> IO Emblem -> m Emblem
forall a b. (a -> b) -> a -> b
$ do
Ptr Icon
icon' <- a -> IO (Ptr Icon)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
icon
Ptr Emblem
result <- Ptr Icon -> IO (Ptr Emblem)
g_emblem_new Ptr Icon
icon'
Text -> Ptr Emblem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "emblemNew" Ptr Emblem
result
Emblem
result' <- ((ManagedPtr Emblem -> Emblem) -> Ptr Emblem -> IO Emblem
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Emblem -> Emblem
Emblem) Ptr Emblem
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
icon
Emblem -> IO Emblem
forall (m :: * -> *) a. Monad m => a -> m a
return Emblem
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_emblem_new_with_origin" g_emblem_new_with_origin ::
Ptr Gio.Icon.Icon ->
CUInt ->
IO (Ptr Emblem)
emblemNewWithOrigin ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Icon.IsIcon a) =>
a
-> Gio.Enums.EmblemOrigin
-> m Emblem
emblemNewWithOrigin :: a -> EmblemOrigin -> m Emblem
emblemNewWithOrigin icon :: a
icon origin :: EmblemOrigin
origin = IO Emblem -> m Emblem
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Emblem -> m Emblem) -> IO Emblem -> m Emblem
forall a b. (a -> b) -> a -> b
$ do
Ptr Icon
icon' <- a -> IO (Ptr Icon)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
icon
let origin' :: CUInt
origin' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (EmblemOrigin -> Int) -> EmblemOrigin -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EmblemOrigin -> Int
forall a. Enum a => a -> Int
fromEnum) EmblemOrigin
origin
Ptr Emblem
result <- Ptr Icon -> CUInt -> IO (Ptr Emblem)
g_emblem_new_with_origin Ptr Icon
icon' CUInt
origin'
Text -> Ptr Emblem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "emblemNewWithOrigin" Ptr Emblem
result
Emblem
result' <- ((ManagedPtr Emblem -> Emblem) -> Ptr Emblem -> IO Emblem
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Emblem -> Emblem
Emblem) Ptr Emblem
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
icon
Emblem -> IO Emblem
forall (m :: * -> *) a. Monad m => a -> m a
return Emblem
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_emblem_get_icon" g_emblem_get_icon ::
Ptr Emblem ->
IO (Ptr Gio.Icon.Icon)
emblemGetIcon ::
(B.CallStack.HasCallStack, MonadIO m, IsEmblem a) =>
a
-> m Gio.Icon.Icon
emblemGetIcon :: a -> m Icon
emblemGetIcon emblem :: a
emblem = IO Icon -> m Icon
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Icon -> m Icon) -> IO Icon -> m Icon
forall a b. (a -> b) -> a -> b
$ do
Ptr Emblem
emblem' <- a -> IO (Ptr Emblem)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
emblem
Ptr Icon
result <- Ptr Emblem -> IO (Ptr Icon)
g_emblem_get_icon Ptr Emblem
emblem'
Text -> Ptr Icon -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "emblemGetIcon" Ptr Icon
result
Icon
result' <- ((ManagedPtr Icon -> Icon) -> Ptr Icon -> IO Icon
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Icon -> Icon
Gio.Icon.Icon) Ptr Icon
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
emblem
Icon -> IO Icon
forall (m :: * -> *) a. Monad m => a -> m a
return Icon
result'
#if defined(ENABLE_OVERLOADING)
data EmblemGetIconMethodInfo
instance (signature ~ (m Gio.Icon.Icon), MonadIO m, IsEmblem a) => O.MethodInfo EmblemGetIconMethodInfo a signature where
overloadedMethod = emblemGetIcon
#endif
foreign import ccall "g_emblem_get_origin" g_emblem_get_origin ::
Ptr Emblem ->
IO CUInt
emblemGetOrigin ::
(B.CallStack.HasCallStack, MonadIO m, IsEmblem a) =>
a
-> m Gio.Enums.EmblemOrigin
emblemGetOrigin :: a -> m EmblemOrigin
emblemGetOrigin emblem :: a
emblem = IO EmblemOrigin -> m EmblemOrigin
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO EmblemOrigin -> m EmblemOrigin)
-> IO EmblemOrigin -> m EmblemOrigin
forall a b. (a -> b) -> a -> b
$ do
Ptr Emblem
emblem' <- a -> IO (Ptr Emblem)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
emblem
CUInt
result <- Ptr Emblem -> IO CUInt
g_emblem_get_origin Ptr Emblem
emblem'
let result' :: EmblemOrigin
result' = (Int -> EmblemOrigin
forall a. Enum a => Int -> a
toEnum (Int -> EmblemOrigin) -> (CUInt -> Int) -> CUInt -> EmblemOrigin
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
emblem
EmblemOrigin -> IO EmblemOrigin
forall (m :: * -> *) a. Monad m => a -> m a
return EmblemOrigin
result'
#if defined(ENABLE_OVERLOADING)
data EmblemGetOriginMethodInfo
instance (signature ~ (m Gio.Enums.EmblemOrigin), MonadIO m, IsEmblem a) => O.MethodInfo EmblemGetOriginMethodInfo a signature where
overloadedMethod = emblemGetOrigin
#endif