{-# LANGUAGE ImplicitParams, RankNTypes, TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Interfaces.ListModel
(
ListModel(..) ,
IsListModel ,
toListModel ,
#if defined(ENABLE_OVERLOADING)
ResolveListModelMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ListModelGetItemMethodInfo ,
#endif
listModelGetItem ,
#if defined(ENABLE_OVERLOADING)
ListModelGetItemTypeMethodInfo ,
#endif
listModelGetItemType ,
#if defined(ENABLE_OVERLOADING)
ListModelGetNItemsMethodInfo ,
#endif
listModelGetNItems ,
#if defined(ENABLE_OVERLOADING)
ListModelItemsChangedMethodInfo ,
#endif
listModelItemsChanged ,
ListModelItemsChangedCallback ,
#if defined(ENABLE_OVERLOADING)
ListModelItemsChangedSignalInfo ,
#endif
afterListModelItemsChanged ,
onListModelItemsChanged ,
) 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.Kind as DK
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 Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.GObject.Objects.Object as GObject.Object
#else
import qualified GI.GObject.Objects.Object as GObject.Object
#endif
newtype ListModel = ListModel (SP.ManagedPtr ListModel)
deriving (ListModel -> ListModel -> Bool
(ListModel -> ListModel -> Bool)
-> (ListModel -> ListModel -> Bool) -> Eq ListModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListModel -> ListModel -> Bool
== :: ListModel -> ListModel -> Bool
$c/= :: ListModel -> ListModel -> Bool
/= :: ListModel -> ListModel -> Bool
Eq)
instance SP.ManagedPtrNewtype ListModel where
toManagedPtr :: ListModel -> ManagedPtr ListModel
toManagedPtr (ListModel ManagedPtr ListModel
p) = ManagedPtr ListModel
p
foreign import ccall "g_list_model_get_type"
c_g_list_model_get_type :: IO B.Types.GType
instance B.Types.TypedObject ListModel where
glibType :: IO GType
glibType = IO GType
c_g_list_model_get_type
instance B.Types.GObject ListModel
class (SP.GObject o, O.IsDescendantOf ListModel o) => IsListModel o
instance (SP.GObject o, O.IsDescendantOf ListModel o) => IsListModel o
instance O.HasParentTypes ListModel
type instance O.ParentTypes ListModel = '[GObject.Object.Object]
toListModel :: (MIO.MonadIO m, IsListModel o) => o -> m ListModel
toListModel :: forall (m :: * -> *) o.
(MonadIO m, IsListModel o) =>
o -> m ListModel
toListModel = IO ListModel -> m ListModel
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO ListModel -> m ListModel)
-> (o -> IO ListModel) -> o -> m ListModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr ListModel -> ListModel) -> o -> IO ListModel
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr ListModel -> ListModel
ListModel
instance B.GValue.IsGValue (Maybe ListModel) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_list_model_get_type
gvalueSet_ :: Ptr GValue -> Maybe ListModel -> IO ()
gvalueSet_ Ptr GValue
gv Maybe ListModel
P.Nothing = Ptr GValue -> Ptr ListModel -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr ListModel
forall a. Ptr a
FP.nullPtr :: FP.Ptr ListModel)
gvalueSet_ Ptr GValue
gv (P.Just ListModel
obj) = ListModel -> (Ptr ListModel -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ListModel
obj (Ptr GValue -> Ptr ListModel -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe ListModel)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr ListModel)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr ListModel)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject ListModel ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ListModel
type instance O.AttributeList ListModel = ListModelAttributeList
type ListModelAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveListModelMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveListModelMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveListModelMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveListModelMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveListModelMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveListModelMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveListModelMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveListModelMethod "itemsChanged" o = ListModelItemsChangedMethodInfo
ResolveListModelMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveListModelMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveListModelMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveListModelMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveListModelMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveListModelMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveListModelMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveListModelMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveListModelMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveListModelMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveListModelMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveListModelMethod "getItem" o = ListModelGetItemMethodInfo
ResolveListModelMethod "getItemType" o = ListModelGetItemTypeMethodInfo
ResolveListModelMethod "getNItems" o = ListModelGetNItemsMethodInfo
ResolveListModelMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveListModelMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveListModelMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveListModelMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveListModelMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveListModelMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveListModelMethod t ListModel, O.OverloadedMethod info ListModel p) => OL.IsLabel t (ListModel -> 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 ~ ResolveListModelMethod t ListModel, O.OverloadedMethod info ListModel p, R.HasField t ListModel p) => R.HasField t ListModel p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveListModelMethod t ListModel, O.OverloadedMethodInfo info ListModel) => OL.IsLabel t (O.MethodProxy info ListModel) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
foreign import ccall "g_list_model_get_item_type" g_list_model_get_item_type ::
Ptr ListModel ->
IO CGType
listModelGetItemType ::
(B.CallStack.HasCallStack, MonadIO m, IsListModel a) =>
a
-> m GType
listModelGetItemType :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsListModel a) =>
a -> m GType
listModelGetItemType a
list = IO GType -> m GType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
list' <- a -> IO (Ptr ListModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
result <- g_list_model_get_item_type list'
let result' = CGType -> GType
GType CGType
result
touchManagedPtr list
return result'
#if defined(ENABLE_OVERLOADING)
data ListModelGetItemTypeMethodInfo
instance (signature ~ (m GType), MonadIO m, IsListModel a) => O.OverloadedMethod ListModelGetItemTypeMethodInfo a signature where
overloadedMethod = listModelGetItemType
instance O.OverloadedMethodInfo ListModelGetItemTypeMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Interfaces.ListModel.listModelGetItemType",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Interfaces-ListModel.html#v:listModelGetItemType"
})
#endif
foreign import ccall "g_list_model_get_n_items" g_list_model_get_n_items ::
Ptr ListModel ->
IO Word32
listModelGetNItems ::
(B.CallStack.HasCallStack, MonadIO m, IsListModel a) =>
a
-> m Word32
listModelGetNItems :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsListModel a) =>
a -> m Word32
listModelGetNItems a
list = 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
list' <- a -> IO (Ptr ListModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
result <- g_list_model_get_n_items list'
touchManagedPtr list
return result
#if defined(ENABLE_OVERLOADING)
data ListModelGetNItemsMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsListModel a) => O.OverloadedMethod ListModelGetNItemsMethodInfo a signature where
overloadedMethod = listModelGetNItems
instance O.OverloadedMethodInfo ListModelGetNItemsMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Interfaces.ListModel.listModelGetNItems",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Interfaces-ListModel.html#v:listModelGetNItems"
})
#endif
foreign import ccall "g_list_model_get_object" g_list_model_get_object ::
Ptr ListModel ->
Word32 ->
IO (Ptr GObject.Object.Object)
listModelGetItem ::
(B.CallStack.HasCallStack, MonadIO m, IsListModel a) =>
a
-> Word32
-> m (Maybe GObject.Object.Object)
listModelGetItem :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsListModel a) =>
a -> Word32 -> m (Maybe Object)
listModelGetItem a
list Word32
position = IO (Maybe Object) -> m (Maybe Object)
forall a. IO a -> m a
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
$ do
list' <- a -> IO (Ptr ListModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
result <- g_list_model_get_object list' position
maybeResult <- convertIfNonNull result $ \Ptr Object
result' -> do
result'' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Object -> Object
GObject.Object.Object) Ptr Object
result'
return result''
touchManagedPtr list
return maybeResult
#if defined(ENABLE_OVERLOADING)
data ListModelGetItemMethodInfo
instance (signature ~ (Word32 -> m (Maybe GObject.Object.Object)), MonadIO m, IsListModel a) => O.OverloadedMethod ListModelGetItemMethodInfo a signature where
overloadedMethod = listModelGetItem
instance O.OverloadedMethodInfo ListModelGetItemMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Interfaces.ListModel.listModelGetItem",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Interfaces-ListModel.html#v:listModelGetItem"
})
#endif
foreign import ccall "g_list_model_items_changed" g_list_model_items_changed ::
Ptr ListModel ->
Word32 ->
Word32 ->
Word32 ->
IO ()
listModelItemsChanged ::
(B.CallStack.HasCallStack, MonadIO m, IsListModel a) =>
a
-> Word32
-> Word32
-> Word32
-> m ()
listModelItemsChanged :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsListModel a) =>
a -> Word32 -> Word32 -> Word32 -> m ()
listModelItemsChanged a
list Word32
position Word32
removed Word32
added = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
list' <- a -> IO (Ptr ListModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
g_list_model_items_changed list' position removed added
touchManagedPtr list
return ()
#if defined(ENABLE_OVERLOADING)
data ListModelItemsChangedMethodInfo
instance (signature ~ (Word32 -> Word32 -> Word32 -> m ()), MonadIO m, IsListModel a) => O.OverloadedMethod ListModelItemsChangedMethodInfo a signature where
overloadedMethod = listModelItemsChanged
instance O.OverloadedMethodInfo ListModelItemsChangedMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Interfaces.ListModel.listModelItemsChanged",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Interfaces-ListModel.html#v:listModelItemsChanged"
})
#endif
type ListModelItemsChangedCallback =
Word32
-> Word32
-> Word32
-> IO ()
type C_ListModelItemsChangedCallback =
Ptr ListModel ->
Word32 ->
Word32 ->
Word32 ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_ListModelItemsChangedCallback :: C_ListModelItemsChangedCallback -> IO (FunPtr C_ListModelItemsChangedCallback)
wrap_ListModelItemsChangedCallback ::
GObject a => (a -> ListModelItemsChangedCallback) ->
C_ListModelItemsChangedCallback
wrap_ListModelItemsChangedCallback :: forall a.
GObject a =>
(a -> Word32 -> Word32 -> Word32 -> IO ())
-> C_ListModelItemsChangedCallback
wrap_ListModelItemsChangedCallback a -> Word32 -> Word32 -> Word32 -> IO ()
gi'cb Ptr ListModel
gi'selfPtr Word32
position Word32
removed Word32
added Ptr ()
_ = do
Ptr ListModel -> (ListModel -> IO ()) -> IO ()
forall o b.
(HasCallStack, GObject o) =>
Ptr o -> (o -> IO b) -> IO b
B.ManagedPtr.withNewObject Ptr ListModel
gi'selfPtr ((ListModel -> IO ()) -> IO ()) -> (ListModel -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ListModel
gi'self -> a -> Word32 -> Word32 -> Word32 -> IO ()
gi'cb (ListModel -> a
forall a b. Coercible a b => a -> b
Coerce.coerce ListModel
gi'self) Word32
position Word32
removed Word32
added
onListModelItemsChanged :: (IsListModel a, MonadIO m) => a -> ((?self :: a) => ListModelItemsChangedCallback) -> m SignalHandlerId
onListModelItemsChanged :: forall a (m :: * -> *).
(IsListModel a, MonadIO m) =>
a
-> ((?self::a) => Word32 -> Word32 -> Word32 -> IO ())
-> m SignalHandlerId
onListModelItemsChanged a
obj (?self::a) => Word32 -> Word32 -> Word32 -> IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let wrapped :: a -> Word32 -> Word32 -> Word32 -> IO ()
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => Word32 -> Word32 -> Word32 -> IO ()
Word32 -> Word32 -> Word32 -> IO ()
cb
let wrapped' :: C_ListModelItemsChangedCallback
wrapped' = (a -> Word32 -> Word32 -> Word32 -> IO ())
-> C_ListModelItemsChangedCallback
forall a.
GObject a =>
(a -> Word32 -> Word32 -> Word32 -> IO ())
-> C_ListModelItemsChangedCallback
wrap_ListModelItemsChangedCallback a -> Word32 -> Word32 -> Word32 -> IO ()
wrapped
wrapped'' <- C_ListModelItemsChangedCallback
-> IO (FunPtr C_ListModelItemsChangedCallback)
mk_ListModelItemsChangedCallback C_ListModelItemsChangedCallback
wrapped'
connectSignalFunPtr obj "items-changed" wrapped'' SignalConnectBefore Nothing
afterListModelItemsChanged :: (IsListModel a, MonadIO m) => a -> ((?self :: a) => ListModelItemsChangedCallback) -> m SignalHandlerId
afterListModelItemsChanged :: forall a (m :: * -> *).
(IsListModel a, MonadIO m) =>
a
-> ((?self::a) => Word32 -> Word32 -> Word32 -> IO ())
-> m SignalHandlerId
afterListModelItemsChanged a
obj (?self::a) => Word32 -> Word32 -> Word32 -> IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
let wrapped :: a -> Word32 -> Word32 -> Word32 -> IO ()
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => Word32 -> Word32 -> Word32 -> IO ()
Word32 -> Word32 -> Word32 -> IO ()
cb
let wrapped' :: C_ListModelItemsChangedCallback
wrapped' = (a -> Word32 -> Word32 -> Word32 -> IO ())
-> C_ListModelItemsChangedCallback
forall a.
GObject a =>
(a -> Word32 -> Word32 -> Word32 -> IO ())
-> C_ListModelItemsChangedCallback
wrap_ListModelItemsChangedCallback a -> Word32 -> Word32 -> Word32 -> IO ()
wrapped
wrapped'' <- C_ListModelItemsChangedCallback
-> IO (FunPtr C_ListModelItemsChangedCallback)
mk_ListModelItemsChangedCallback C_ListModelItemsChangedCallback
wrapped'
connectSignalFunPtr obj "items-changed" wrapped'' SignalConnectAfter Nothing
#if defined(ENABLE_OVERLOADING)
data ListModelItemsChangedSignalInfo
instance SignalInfo ListModelItemsChangedSignalInfo where
type HaskellCallbackType ListModelItemsChangedSignalInfo = ListModelItemsChangedCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_ListModelItemsChangedCallback cb
cb'' <- mk_ListModelItemsChangedCallback cb'
connectSignalFunPtr obj "items-changed" cb'' connectMode detail
dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Interfaces.ListModel::items-changed"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Interfaces-ListModel.html#g:signal:itemsChanged"})
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList ListModel = ListModelSignalList
type ListModelSignalList = ('[ '("itemsChanged", ListModelItemsChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif