{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.IBus.Objects.Attribute
(
Attribute(..) ,
IsAttribute ,
toAttribute ,
#if defined(ENABLE_OVERLOADING)
ResolveAttributeMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
AttributeGetAttrTypeMethodInfo ,
#endif
attributeGetAttrType ,
#if defined(ENABLE_OVERLOADING)
AttributeGetEndIndexMethodInfo ,
#endif
attributeGetEndIndex ,
#if defined(ENABLE_OVERLOADING)
AttributeGetStartIndexMethodInfo ,
#endif
attributeGetStartIndex ,
#if defined(ENABLE_OVERLOADING)
AttributeGetValueMethodInfo ,
#endif
attributeGetValue ,
attributeNew ,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 GHC.Records as R
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.IBus.Objects.Object as IBus.Object
import {-# SOURCE #-} qualified GI.IBus.Objects.Serializable as IBus.Serializable
newtype Attribute = Attribute (SP.ManagedPtr Attribute)
deriving (Attribute -> Attribute -> Bool
(Attribute -> Attribute -> Bool)
-> (Attribute -> Attribute -> Bool) -> Eq Attribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Attribute -> Attribute -> Bool
== :: Attribute -> Attribute -> Bool
$c/= :: Attribute -> Attribute -> Bool
/= :: Attribute -> Attribute -> Bool
Eq)
instance SP.ManagedPtrNewtype Attribute where
toManagedPtr :: Attribute -> ManagedPtr Attribute
toManagedPtr (Attribute ManagedPtr Attribute
p) = ManagedPtr Attribute
p
foreign import ccall "ibus_attribute_get_type"
c_ibus_attribute_get_type :: IO B.Types.GType
instance B.Types.TypedObject Attribute where
glibType :: IO GType
glibType = IO GType
c_ibus_attribute_get_type
instance B.Types.GObject Attribute
class (SP.GObject o, O.IsDescendantOf Attribute o) => IsAttribute o
instance (SP.GObject o, O.IsDescendantOf Attribute o) => IsAttribute o
instance O.HasParentTypes Attribute
type instance O.ParentTypes Attribute = '[IBus.Serializable.Serializable, IBus.Object.Object, GObject.Object.Object]
toAttribute :: (MIO.MonadIO m, IsAttribute o) => o -> m Attribute
toAttribute :: forall (m :: * -> *) o.
(MonadIO m, IsAttribute o) =>
o -> m Attribute
toAttribute = IO Attribute -> m Attribute
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Attribute -> m Attribute)
-> (o -> IO Attribute) -> o -> m Attribute
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Attribute -> Attribute) -> o -> IO Attribute
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Attribute -> Attribute
Attribute
instance B.GValue.IsGValue (Maybe Attribute) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_ibus_attribute_get_type
gvalueSet_ :: Ptr GValue -> Maybe Attribute -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Attribute
P.Nothing = Ptr GValue -> Ptr Attribute -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Attribute
forall a. Ptr a
FP.nullPtr :: FP.Ptr Attribute)
gvalueSet_ Ptr GValue
gv (P.Just Attribute
obj) = Attribute -> (Ptr Attribute -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Attribute
obj (Ptr GValue -> Ptr Attribute -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Attribute)
gvalueGet_ Ptr GValue
gv = do
Ptr Attribute
ptr <- Ptr GValue -> IO (Ptr Attribute)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Attribute)
if Ptr Attribute
ptr Ptr Attribute -> Ptr Attribute -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Attribute
forall a. Ptr a
FP.nullPtr
then Attribute -> Maybe Attribute
forall a. a -> Maybe a
P.Just (Attribute -> Maybe Attribute)
-> IO Attribute -> IO (Maybe Attribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Attribute -> Attribute
Attribute Ptr Attribute
ptr
else Maybe Attribute -> IO (Maybe Attribute)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Attribute
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveAttributeMethod (t :: Symbol) (o :: *) :: * where
ResolveAttributeMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveAttributeMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveAttributeMethod "copy" o = IBus.Serializable.SerializableCopyMethodInfo
ResolveAttributeMethod "destroy" o = IBus.Object.ObjectDestroyMethodInfo
ResolveAttributeMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveAttributeMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveAttributeMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveAttributeMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveAttributeMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveAttributeMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveAttributeMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveAttributeMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveAttributeMethod "removeQattachment" o = IBus.Serializable.SerializableRemoveQattachmentMethodInfo
ResolveAttributeMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveAttributeMethod "serializeObject" o = IBus.Serializable.SerializableSerializeObjectMethodInfo
ResolveAttributeMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveAttributeMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveAttributeMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveAttributeMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveAttributeMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveAttributeMethod "getAttrType" o = AttributeGetAttrTypeMethodInfo
ResolveAttributeMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveAttributeMethod "getEndIndex" o = AttributeGetEndIndexMethodInfo
ResolveAttributeMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveAttributeMethod "getQattachment" o = IBus.Serializable.SerializableGetQattachmentMethodInfo
ResolveAttributeMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveAttributeMethod "getStartIndex" o = AttributeGetStartIndexMethodInfo
ResolveAttributeMethod "getValue" o = AttributeGetValueMethodInfo
ResolveAttributeMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveAttributeMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveAttributeMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveAttributeMethod "setQattachment" o = IBus.Serializable.SerializableSetQattachmentMethodInfo
ResolveAttributeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAttributeMethod t Attribute, O.OverloadedMethod info Attribute p) => OL.IsLabel t (Attribute -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveAttributeMethod t Attribute, O.OverloadedMethod info Attribute p, R.HasField t Attribute p) => R.HasField t Attribute p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveAttributeMethod t Attribute, O.OverloadedMethodInfo info Attribute) => OL.IsLabel t (O.MethodProxy info Attribute) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Attribute
type instance O.AttributeList Attribute = AttributeAttributeList
type AttributeAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Attribute = AttributeSignalList
type AttributeSignalList = ('[ '("destroy", IBus.Object.ObjectDestroySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "ibus_attribute_new" ibus_attribute_new ::
Word32 ->
Word32 ->
Word32 ->
Word32 ->
IO (Ptr Attribute)
attributeNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word32
-> Word32
-> Word32
-> Word32
-> m Attribute
attributeNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word32 -> Word32 -> Word32 -> Word32 -> m Attribute
attributeNew Word32
type_ Word32
value Word32
startIndex Word32
endIndex = IO Attribute -> m Attribute
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
Ptr Attribute
result <- Word32 -> Word32 -> Word32 -> Word32 -> IO (Ptr Attribute)
ibus_attribute_new Word32
type_ Word32
value Word32
startIndex Word32
endIndex
Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attributeNew" Ptr Attribute
result
Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Attribute -> Attribute
Attribute) Ptr Attribute
result
Attribute -> IO Attribute
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "ibus_attribute_get_attr_type" ibus_attribute_get_attr_type ::
Ptr Attribute ->
IO Word32
attributeGetAttrType ::
(B.CallStack.HasCallStack, MonadIO m, IsAttribute a) =>
a
-> m Word32
attributeGetAttrType :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttribute a) =>
a -> m Word32
attributeGetAttrType a
attr = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Attribute
attr' <- a -> IO (Ptr Attribute)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attr
Word32
result <- Ptr Attribute -> IO Word32
ibus_attribute_get_attr_type Ptr Attribute
attr'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attr
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data AttributeGetAttrTypeMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsAttribute a) => O.OverloadedMethod AttributeGetAttrTypeMethodInfo a signature where
overloadedMethod = attributeGetAttrType
instance O.OverloadedMethodInfo AttributeGetAttrTypeMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.IBus.Objects.Attribute.attributeGetAttrType",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.5/docs/GI-IBus-Objects-Attribute.html#v:attributeGetAttrType"
})
#endif
foreign import ccall "ibus_attribute_get_end_index" ibus_attribute_get_end_index ::
Ptr Attribute ->
IO Word32
attributeGetEndIndex ::
(B.CallStack.HasCallStack, MonadIO m, IsAttribute a) =>
a
-> m Word32
attributeGetEndIndex :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttribute a) =>
a -> m Word32
attributeGetEndIndex a
attr = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Attribute
attr' <- a -> IO (Ptr Attribute)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attr
Word32
result <- Ptr Attribute -> IO Word32
ibus_attribute_get_end_index Ptr Attribute
attr'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attr
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data AttributeGetEndIndexMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsAttribute a) => O.OverloadedMethod AttributeGetEndIndexMethodInfo a signature where
overloadedMethod = attributeGetEndIndex
instance O.OverloadedMethodInfo AttributeGetEndIndexMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.IBus.Objects.Attribute.attributeGetEndIndex",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.5/docs/GI-IBus-Objects-Attribute.html#v:attributeGetEndIndex"
})
#endif
foreign import ccall "ibus_attribute_get_start_index" ibus_attribute_get_start_index ::
Ptr Attribute ->
IO Word32
attributeGetStartIndex ::
(B.CallStack.HasCallStack, MonadIO m, IsAttribute a) =>
a
-> m Word32
attributeGetStartIndex :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttribute a) =>
a -> m Word32
attributeGetStartIndex a
attr = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Attribute
attr' <- a -> IO (Ptr Attribute)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attr
Word32
result <- Ptr Attribute -> IO Word32
ibus_attribute_get_start_index Ptr Attribute
attr'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attr
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data AttributeGetStartIndexMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsAttribute a) => O.OverloadedMethod AttributeGetStartIndexMethodInfo a signature where
overloadedMethod = attributeGetStartIndex
instance O.OverloadedMethodInfo AttributeGetStartIndexMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.IBus.Objects.Attribute.attributeGetStartIndex",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.5/docs/GI-IBus-Objects-Attribute.html#v:attributeGetStartIndex"
})
#endif
foreign import ccall "ibus_attribute_get_value" ibus_attribute_get_value ::
Ptr Attribute ->
IO Word32
attributeGetValue ::
(B.CallStack.HasCallStack, MonadIO m, IsAttribute a) =>
a
-> m Word32
attributeGetValue :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAttribute a) =>
a -> m Word32
attributeGetValue a
attr = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
Ptr Attribute
attr' <- a -> IO (Ptr Attribute)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
attr
Word32
result <- Ptr Attribute -> IO Word32
ibus_attribute_get_value Ptr Attribute
attr'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
attr
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data AttributeGetValueMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsAttribute a) => O.OverloadedMethod AttributeGetValueMethodInfo a signature where
overloadedMethod = attributeGetValue
instance O.OverloadedMethodInfo AttributeGetValueMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.IBus.Objects.Attribute.attributeGetValue",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-ibus-1.5.5/docs/GI-IBus-Objects-Attribute.html#v:attributeGetValue"
})
#endif