gi-gtk-0.3.16.12: GI/Gtk/Objects/ListStore.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}
module GI.Gtk.Objects.ListStore
(
-- * Exported types
ListStore(..) ,
ListStoreK ,
toListStore ,
noListStore ,
-- * Methods
-- ** listStoreAppend
listStoreAppend ,
-- ** listStoreClear
listStoreClear ,
-- ** listStoreInsert
listStoreInsert ,
-- ** listStoreInsertAfter
listStoreInsertAfter ,
-- ** listStoreInsertBefore
listStoreInsertBefore ,
-- ** listStoreInsertWithValuesv
listStoreInsertWithValuesv ,
-- ** listStoreIterIsValid
listStoreIterIsValid ,
-- ** listStoreMoveAfter
listStoreMoveAfter ,
-- ** listStoreMoveBefore
listStoreMoveBefore ,
-- ** listStoreNew
listStoreNew ,
-- ** listStorePrepend
listStorePrepend ,
-- ** listStoreRemove
listStoreRemove ,
-- ** listStoreReorder
listStoreReorder ,
-- ** listStoreSet
listStoreSet ,
-- ** listStoreSetColumnTypes
listStoreSetColumnTypes ,
-- ** listStoreSetValue
listStoreSetValue ,
-- ** listStoreSwap
listStoreSwap ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gtk.Types
import GI.Gtk.Callbacks
import qualified GI.GObject as GObject
newtype ListStore = ListStore (ForeignPtr ListStore)
foreign import ccall "gtk_list_store_get_type"
c_gtk_list_store_get_type :: IO GType
type instance ParentTypes ListStore = ListStoreParentTypes
type ListStoreParentTypes = '[GObject.Object, Buildable, TreeDragDest, TreeDragSource, TreeModel, TreeSortable]
instance GObject ListStore where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_gtk_list_store_get_type
class GObject o => ListStoreK o
instance (GObject o, IsDescendantOf ListStore o) => ListStoreK o
toListStore :: ListStoreK o => o -> IO ListStore
toListStore = unsafeCastTo ListStore
noListStore :: Maybe ListStore
noListStore = Nothing
type instance AttributeList ListStore = ListStoreAttributeList
type ListStoreAttributeList = ('[ ] :: [(Symbol, *)])
type instance SignalList ListStore = ListStoreSignalList
type ListStoreSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("row-changed", TreeModelRowChangedSignalInfo), '("row-deleted", TreeModelRowDeletedSignalInfo), '("row-has-child-toggled", TreeModelRowHasChildToggledSignalInfo), '("row-inserted", TreeModelRowInsertedSignalInfo), '("sort-column-changed", TreeSortableSortColumnChangedSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method ListStore::new
-- method type : Constructor
-- Args : [Arg {argName = "n_columns", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "types", argType = TCArray False (-1) 0 (TBasicType TGType), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "n_columns", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "types", argType = TCArray False (-1) 0 (TBasicType TGType), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "ListStore"
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_newv" gtk_list_store_newv ::
Int32 -> -- n_columns : TBasicType TInt32
Ptr CGType -> -- types : TCArray False (-1) 0 (TBasicType TGType)
IO (Ptr ListStore)
listStoreNew ::
(MonadIO m) =>
[GType] -> -- types
m ListStore
listStoreNew types = liftIO $ do
let n_columns = fromIntegral $ length types
types' <- (packMapStorableArray gtypeToCGType) types
result <- gtk_list_store_newv n_columns types'
checkUnexpectedReturnNULL "gtk_list_store_newv" result
result' <- (wrapObject ListStore) result
freeMem types'
return result'
-- method ListStore::append
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_append" gtk_list_store_append ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
IO ()
listStoreAppend ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
m (TreeIter)
listStoreAppend _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
iter <- callocBoxedBytes 32 :: IO (Ptr TreeIter)
gtk_list_store_append _obj' iter
iter' <- (wrapBoxed TreeIter) iter
touchManagedPtr _obj
return iter'
-- method ListStore::clear
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_clear" gtk_list_store_clear ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
IO ()
listStoreClear ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
m ()
listStoreClear _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
gtk_list_store_clear _obj'
touchManagedPtr _obj
return ()
-- method ListStore::insert
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_insert" gtk_list_store_insert ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
Int32 -> -- position : TBasicType TInt32
IO ()
listStoreInsert ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
Int32 -> -- position
m (TreeIter)
listStoreInsert _obj position = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
iter <- callocBoxedBytes 32 :: IO (Ptr TreeIter)
gtk_list_store_insert _obj' iter position
iter' <- (wrapBoxed TreeIter) iter
touchManagedPtr _obj
return iter'
-- method ListStore::insert_after
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "sibling", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "sibling", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_insert_after" gtk_list_store_insert_after ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
Ptr TreeIter -> -- sibling : TInterface "Gtk" "TreeIter"
IO ()
listStoreInsertAfter ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
Maybe (TreeIter) -> -- sibling
m (TreeIter)
listStoreInsertAfter _obj sibling = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
iter <- callocBoxedBytes 32 :: IO (Ptr TreeIter)
maybeSibling <- case sibling of
Nothing -> return nullPtr
Just jSibling -> do
let jSibling' = unsafeManagedPtrGetPtr jSibling
return jSibling'
gtk_list_store_insert_after _obj' iter maybeSibling
iter' <- (wrapBoxed TreeIter) iter
touchManagedPtr _obj
whenJust sibling touchManagedPtr
return iter'
-- method ListStore::insert_before
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "sibling", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "sibling", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_insert_before" gtk_list_store_insert_before ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
Ptr TreeIter -> -- sibling : TInterface "Gtk" "TreeIter"
IO ()
listStoreInsertBefore ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
Maybe (TreeIter) -> -- sibling
m (TreeIter)
listStoreInsertBefore _obj sibling = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
iter <- callocBoxedBytes 32 :: IO (Ptr TreeIter)
maybeSibling <- case sibling of
Nothing -> return nullPtr
Just jSibling -> do
let jSibling' = unsafeManagedPtrGetPtr jSibling
return jSibling'
gtk_list_store_insert_before _obj' iter maybeSibling
iter' <- (wrapBoxed TreeIter) iter
touchManagedPtr _obj
whenJust sibling touchManagedPtr
return iter'
-- method ListStore::insert_with_valuesv
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "columns", argType = TCArray False (-1) 5 (TBasicType TInt32), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "values", argType = TCArray False (-1) 5 (TInterface "GObject" "Value"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_values", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "n_values", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_values", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "columns", argType = TCArray False (-1) 5 (TBasicType TInt32), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "values", argType = TCArray False (-1) 5 (TInterface "GObject" "Value"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_insert_with_valuesv" gtk_list_store_insert_with_valuesv ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
Int32 -> -- position : TBasicType TInt32
Ptr Int32 -> -- columns : TCArray False (-1) 5 (TBasicType TInt32)
Ptr GValue -> -- values : TCArray False (-1) 5 (TInterface "GObject" "Value")
Int32 -> -- n_values : TBasicType TInt32
IO ()
listStoreInsertWithValuesv ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
Int32 -> -- position
[Int32] -> -- columns
[GValue] -> -- values
m (TreeIter)
listStoreInsertWithValuesv _obj position columns values = liftIO $ do
let n_values = fromIntegral $ length values
let columns_expected_length_ = fromIntegral $ length columns
when (columns_expected_length_ /= n_values) $
error "Gtk.listStoreInsertWithValuesv : length of 'columns' does not agree with that of 'values'."
let _obj' = unsafeManagedPtrCastPtr _obj
iter <- callocBoxedBytes 32 :: IO (Ptr TreeIter)
columns' <- packStorableArray columns
let values' = map unsafeManagedPtrGetPtr values
values'' <- packBlockArray 24 values'
gtk_list_store_insert_with_valuesv _obj' iter position columns' values'' n_values
iter' <- (wrapBoxed TreeIter) iter
touchManagedPtr _obj
mapM_ touchManagedPtr values
freeMem columns'
freeMem values''
return iter'
-- method ListStore::iter_is_valid
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_iter_is_valid" gtk_list_store_iter_is_valid ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
IO CInt
listStoreIterIsValid ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
TreeIter -> -- iter
m Bool
listStoreIterIsValid _obj iter = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let iter' = unsafeManagedPtrGetPtr iter
result <- gtk_list_store_iter_is_valid _obj' iter'
let result' = (/= 0) result
touchManagedPtr _obj
touchManagedPtr iter
return result'
-- method ListStore::move_after
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_move_after" gtk_list_store_move_after ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
Ptr TreeIter -> -- position : TInterface "Gtk" "TreeIter"
IO ()
listStoreMoveAfter ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
TreeIter -> -- iter
Maybe (TreeIter) -> -- position
m ()
listStoreMoveAfter _obj iter position = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let iter' = unsafeManagedPtrGetPtr iter
maybePosition <- case position of
Nothing -> return nullPtr
Just jPosition -> do
let jPosition' = unsafeManagedPtrGetPtr jPosition
return jPosition'
gtk_list_store_move_after _obj' iter' maybePosition
touchManagedPtr _obj
touchManagedPtr iter
whenJust position touchManagedPtr
return ()
-- method ListStore::move_before
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_move_before" gtk_list_store_move_before ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
Ptr TreeIter -> -- position : TInterface "Gtk" "TreeIter"
IO ()
listStoreMoveBefore ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
TreeIter -> -- iter
Maybe (TreeIter) -> -- position
m ()
listStoreMoveBefore _obj iter position = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let iter' = unsafeManagedPtrGetPtr iter
maybePosition <- case position of
Nothing -> return nullPtr
Just jPosition -> do
let jPosition' = unsafeManagedPtrGetPtr jPosition
return jPosition'
gtk_list_store_move_before _obj' iter' maybePosition
touchManagedPtr _obj
touchManagedPtr iter
whenJust position touchManagedPtr
return ()
-- method ListStore::prepend
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_prepend" gtk_list_store_prepend ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
IO ()
listStorePrepend ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
m (TreeIter)
listStorePrepend _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
iter <- callocBoxedBytes 32 :: IO (Ptr TreeIter)
gtk_list_store_prepend _obj' iter
iter' <- (wrapBoxed TreeIter) iter
touchManagedPtr _obj
return iter'
-- method ListStore::remove
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_remove" gtk_list_store_remove ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
IO CInt
listStoreRemove ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
TreeIter -> -- iter
m Bool
listStoreRemove _obj iter = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let iter' = unsafeManagedPtrGetPtr iter
result <- gtk_list_store_remove _obj' iter'
let result' = (/= 0) result
touchManagedPtr _obj
touchManagedPtr iter
return result'
-- method ListStore::reorder
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "new_order", argType = TCArray True (-1) (-1) (TBasicType TInt32), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "new_order", argType = TCArray True (-1) (-1) (TBasicType TInt32), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_reorder" gtk_list_store_reorder ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr Int32 -> -- new_order : TCArray True (-1) (-1) (TBasicType TInt32)
IO ()
listStoreReorder ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
[Int32] -> -- new_order
m ()
listStoreReorder _obj new_order = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
new_order' <- packZeroTerminatedStorableArray new_order
gtk_list_store_reorder _obj' new_order'
touchManagedPtr _obj
freeMem new_order'
return ()
-- method ListStore::set_column_types
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_columns", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "types", argType = TCArray False (-1) 1 (TBasicType TGType), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "n_columns", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "types", argType = TCArray False (-1) 1 (TBasicType TGType), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_set_column_types" gtk_list_store_set_column_types ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Int32 -> -- n_columns : TBasicType TInt32
Ptr CGType -> -- types : TCArray False (-1) 1 (TBasicType TGType)
IO ()
listStoreSetColumnTypes ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
[GType] -> -- types
m ()
listStoreSetColumnTypes _obj types = liftIO $ do
let n_columns = fromIntegral $ length types
let _obj' = unsafeManagedPtrCastPtr _obj
types' <- (packMapStorableArray gtypeToCGType) types
gtk_list_store_set_column_types _obj' n_columns types'
touchManagedPtr _obj
freeMem types'
return ()
-- method ListStore::set_value
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "column", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "column", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_set_value" gtk_list_store_set_value ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
Int32 -> -- column : TBasicType TInt32
Ptr GValue -> -- value : TInterface "GObject" "Value"
IO ()
listStoreSetValue ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
TreeIter -> -- iter
Int32 -> -- column
GValue -> -- value
m ()
listStoreSetValue _obj iter column value = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let iter' = unsafeManagedPtrGetPtr iter
let value' = unsafeManagedPtrGetPtr value
gtk_list_store_set_value _obj' iter' column value'
touchManagedPtr _obj
touchManagedPtr iter
touchManagedPtr value
return ()
-- method ListStore::set
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "columns", argType = TCArray False (-1) 4 (TBasicType TInt32), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "values", argType = TCArray False (-1) 4 (TInterface "GObject" "Value"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_values", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "n_values", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_values", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "iter", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "columns", argType = TCArray False (-1) 4 (TBasicType TInt32), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "values", argType = TCArray False (-1) 4 (TInterface "GObject" "Value"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_set_valuesv" gtk_list_store_set_valuesv ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- iter : TInterface "Gtk" "TreeIter"
Ptr Int32 -> -- columns : TCArray False (-1) 4 (TBasicType TInt32)
Ptr GValue -> -- values : TCArray False (-1) 4 (TInterface "GObject" "Value")
Int32 -> -- n_values : TBasicType TInt32
IO ()
listStoreSet ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
TreeIter -> -- iter
[Int32] -> -- columns
[GValue] -> -- values
m ()
listStoreSet _obj iter columns values = liftIO $ do
let n_values = fromIntegral $ length values
let columns_expected_length_ = fromIntegral $ length columns
when (columns_expected_length_ /= n_values) $
error "Gtk.listStoreSet : length of 'columns' does not agree with that of 'values'."
let _obj' = unsafeManagedPtrCastPtr _obj
let iter' = unsafeManagedPtrGetPtr iter
columns' <- packStorableArray columns
let values' = map unsafeManagedPtrGetPtr values
values'' <- packBlockArray 24 values'
gtk_list_store_set_valuesv _obj' iter' columns' values'' n_values
touchManagedPtr _obj
touchManagedPtr iter
mapM_ touchManagedPtr values
freeMem columns'
freeMem values''
return ()
-- method ListStore::swap
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "a", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "b", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "ListStore", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "a", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "b", argType = TInterface "Gtk" "TreeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_list_store_swap" gtk_list_store_swap ::
Ptr ListStore -> -- _obj : TInterface "Gtk" "ListStore"
Ptr TreeIter -> -- a : TInterface "Gtk" "TreeIter"
Ptr TreeIter -> -- b : TInterface "Gtk" "TreeIter"
IO ()
listStoreSwap ::
(MonadIO m, ListStoreK a) =>
a -> -- _obj
TreeIter -> -- a
TreeIter -> -- b
m ()
listStoreSwap _obj a b = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let a' = unsafeManagedPtrGetPtr a
let b' = unsafeManagedPtrGetPtr b
gtk_list_store_swap _obj' a' b'
touchManagedPtr _obj
touchManagedPtr a
touchManagedPtr b
return ()