{-# LANGUAGE 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 ,
C_ListModelItemsChangedCallback ,
ListModelItemsChangedCallback ,
#if defined(ENABLE_OVERLOADING)
ListModelItemsChangedSignalInfo ,
#endif
afterListModelItemsChanged ,
genClosure_ListModelItemsChanged ,
mk_ListModelItemsChangedCallback ,
noListModelItemsChangedCallback ,
onListModelItemsChanged ,
wrap_ListModelItemsChangedCallback ,
) 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.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 Control.Monad.IO.Class as MIO
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
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
/= :: ListModel -> ListModel -> Bool
$c/= :: ListModel -> ListModel -> Bool
== :: ListModel -> ListModel -> Bool
$c== :: 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
instance B.GValue.IsGValue ListModel where
toGValue :: ListModel -> IO GValue
toGValue ListModel
o = do
GType
gtype <- IO GType
c_g_list_model_get_type
ListModel -> (Ptr ListModel -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ListModel
o (GType
-> (GValue -> Ptr ListModel -> IO ()) -> Ptr ListModel -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr ListModel -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO ListModel
fromGValue GValue
gv = do
Ptr ListModel
ptr <- GValue -> IO (Ptr ListModel)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr ListModel)
(ManagedPtr ListModel -> ListModel)
-> Ptr ListModel -> IO ListModel
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr ListModel -> ListModel
ListModel Ptr ListModel
ptr
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 :: (MonadIO m, IsListModel o) => o -> m ListModel
toListModel :: o -> m ListModel
toListModel = IO ListModel -> m ListModel
forall (m :: * -> *) a. MonadIO m => IO a -> m a
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'
unsafeCastTo ManagedPtr ListModel -> ListModel
ListModel
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ListModel
type instance O.AttributeList ListModel = ListModelAttributeList
type ListModelAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveListModelMethod (t :: Symbol) (o :: *) :: * 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.MethodInfo 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
#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 :: a -> m GType
listModelGetItemType a
list = IO GType -> m GType
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
Ptr ListModel
list' <- a -> IO (Ptr ListModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
CGType
result <- Ptr ListModel -> IO CGType
g_list_model_get_item_type Ptr ListModel
list'
let result' :: GType
result' = CGType -> GType
GType CGType
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
list
GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'
#if defined(ENABLE_OVERLOADING)
data ListModelGetItemTypeMethodInfo
instance (signature ~ (m GType), MonadIO m, IsListModel a) => O.MethodInfo ListModelGetItemTypeMethodInfo a signature where
overloadedMethod = 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 :: a -> m Word32
listModelGetNItems a
list = IO Word32 -> m Word32
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 ListModel
list' <- a -> IO (Ptr ListModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
Word32
result <- Ptr ListModel -> IO Word32
g_list_model_get_n_items Ptr ListModel
list'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
list
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result
#if defined(ENABLE_OVERLOADING)
data ListModelGetNItemsMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsListModel a) => O.MethodInfo ListModelGetNItemsMethodInfo a signature where
overloadedMethod = 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 :: a -> Word32 -> m (Maybe Object)
listModelGetItem a
list Word32
position = 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
$ do
Ptr ListModel
list' <- a -> IO (Ptr ListModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
Ptr Object
result <- Ptr ListModel -> Word32 -> IO (Ptr Object)
g_list_model_get_object Ptr ListModel
list' Word32
position
Maybe Object
maybeResult <- Ptr Object -> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Object
result ((Ptr Object -> IO Object) -> IO (Maybe Object))
-> (Ptr Object -> IO Object) -> IO (Maybe Object)
forall a b. (a -> b) -> a -> b
$ \Ptr Object
result' -> do
Object
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'
Object -> IO Object
forall (m :: * -> *) a. Monad m => a -> m a
return Object
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
list
Maybe Object -> IO (Maybe Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Object
maybeResult
#if defined(ENABLE_OVERLOADING)
data ListModelGetItemMethodInfo
instance (signature ~ (Word32 -> m (Maybe GObject.Object.Object)), MonadIO m, IsListModel a) => O.MethodInfo ListModelGetItemMethodInfo a signature where
overloadedMethod = 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 :: a -> Word32 -> Word32 -> Word32 -> m ()
listModelItemsChanged a
list Word32
position Word32
removed Word32
added = 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 ListModel
list' <- a -> IO (Ptr ListModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
list
Ptr ListModel -> Word32 -> Word32 -> Word32 -> IO ()
g_list_model_items_changed Ptr ListModel
list' Word32
position Word32
removed Word32
added
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
list
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data ListModelItemsChangedMethodInfo
instance (signature ~ (Word32 -> Word32 -> Word32 -> m ()), MonadIO m, IsListModel a) => O.MethodInfo ListModelItemsChangedMethodInfo a signature where
overloadedMethod = listModelItemsChanged
#endif
type ListModelItemsChangedCallback =
Word32
-> Word32
-> Word32
-> IO ()
noListModelItemsChangedCallback :: Maybe ListModelItemsChangedCallback
noListModelItemsChangedCallback :: Maybe (Word32 -> Word32 -> Word32 -> IO ())
noListModelItemsChangedCallback = Maybe (Word32 -> Word32 -> Word32 -> IO ())
forall a. Maybe a
Nothing
type C_ListModelItemsChangedCallback =
Ptr () ->
Word32 ->
Word32 ->
Word32 ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_ListModelItemsChangedCallback :: C_ListModelItemsChangedCallback -> IO (FunPtr C_ListModelItemsChangedCallback)
genClosure_ListModelItemsChanged :: MonadIO m => ListModelItemsChangedCallback -> m (GClosure C_ListModelItemsChangedCallback)
genClosure_ListModelItemsChanged :: (Word32 -> Word32 -> Word32 -> IO ())
-> m (GClosure C_ListModelItemsChangedCallback)
genClosure_ListModelItemsChanged Word32 -> Word32 -> Word32 -> IO ()
cb = IO (GClosure C_ListModelItemsChangedCallback)
-> m (GClosure C_ListModelItemsChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ListModelItemsChangedCallback)
-> m (GClosure C_ListModelItemsChangedCallback))
-> IO (GClosure C_ListModelItemsChangedCallback)
-> m (GClosure C_ListModelItemsChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: C_ListModelItemsChangedCallback
cb' = (Word32 -> Word32 -> Word32 -> IO ())
-> C_ListModelItemsChangedCallback
wrap_ListModelItemsChangedCallback Word32 -> Word32 -> Word32 -> IO ()
cb
C_ListModelItemsChangedCallback
-> IO (FunPtr C_ListModelItemsChangedCallback)
mk_ListModelItemsChangedCallback C_ListModelItemsChangedCallback
cb' IO (FunPtr C_ListModelItemsChangedCallback)
-> (FunPtr C_ListModelItemsChangedCallback
-> IO (GClosure C_ListModelItemsChangedCallback))
-> IO (GClosure C_ListModelItemsChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ListModelItemsChangedCallback
-> IO (GClosure C_ListModelItemsChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_ListModelItemsChangedCallback ::
ListModelItemsChangedCallback ->
C_ListModelItemsChangedCallback
wrap_ListModelItemsChangedCallback :: (Word32 -> Word32 -> Word32 -> IO ())
-> C_ListModelItemsChangedCallback
wrap_ListModelItemsChangedCallback Word32 -> Word32 -> Word32 -> IO ()
_cb Ptr ()
_ Word32
position Word32
removed Word32
added Ptr ()
_ = do
Word32 -> Word32 -> Word32 -> IO ()
_cb Word32
position Word32
removed Word32
added
onListModelItemsChanged :: (IsListModel a, MonadIO m) => a -> ListModelItemsChangedCallback -> m SignalHandlerId
onListModelItemsChanged :: a -> (Word32 -> Word32 -> Word32 -> IO ()) -> m SignalHandlerId
onListModelItemsChanged a
obj Word32 -> Word32 -> Word32 -> IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
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 cb' :: C_ListModelItemsChangedCallback
cb' = (Word32 -> Word32 -> Word32 -> IO ())
-> C_ListModelItemsChangedCallback
wrap_ListModelItemsChangedCallback Word32 -> Word32 -> Word32 -> IO ()
cb
FunPtr C_ListModelItemsChangedCallback
cb'' <- C_ListModelItemsChangedCallback
-> IO (FunPtr C_ListModelItemsChangedCallback)
mk_ListModelItemsChangedCallback C_ListModelItemsChangedCallback
cb'
a
-> Text
-> FunPtr C_ListModelItemsChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"items-changed" FunPtr C_ListModelItemsChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing
afterListModelItemsChanged :: (IsListModel a, MonadIO m) => a -> ListModelItemsChangedCallback -> m SignalHandlerId
afterListModelItemsChanged :: a -> (Word32 -> Word32 -> Word32 -> IO ()) -> m SignalHandlerId
afterListModelItemsChanged a
obj Word32 -> Word32 -> Word32 -> IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
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 cb' :: C_ListModelItemsChangedCallback
cb' = (Word32 -> Word32 -> Word32 -> IO ())
-> C_ListModelItemsChangedCallback
wrap_ListModelItemsChangedCallback Word32 -> Word32 -> Word32 -> IO ()
cb
FunPtr C_ListModelItemsChangedCallback
cb'' <- C_ListModelItemsChangedCallback
-> IO (FunPtr C_ListModelItemsChangedCallback)
mk_ListModelItemsChangedCallback C_ListModelItemsChangedCallback
cb'
a
-> Text
-> FunPtr C_ListModelItemsChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"items-changed" FunPtr C_ListModelItemsChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
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
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList ListModel = ListModelSignalList
type ListModelSignalList = ('[ '("itemsChanged", ListModelItemsChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif