module Graphics.UI.Gtk.ModelView.TreeModelSort (
TreeModelSort,
TreeModelSortClass,
castToTreeModelSort, gTypeTreeModelSort,
toTreeModelSort,
TypedTreeModelSort,
treeModelSortNewWithModel,
treeModelSortGetModel,
treeModelSortConvertChildPathToPath,
treeModelSortConvertPathToChildPath,
treeModelSortConvertChildIterToIter,
treeModelSortConvertIterToChildIter,
treeModelSortResetDefaultSortFunc,
treeModelSortClearCache,
treeModelSortIterIsValid,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.GObject (wrapNewGObject, makeNewGObject)
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.ModelView.TreeModel
import Graphics.UI.Gtk.ModelView.Types
instance TreeModelClass (TypedTreeModelSort a)
instance TreeModelSortClass (TypedTreeModelSort a)
instance GObjectClass (TypedTreeModelSort a) where
toGObject (TypedTreeModelSort tm) = GObject (castForeignPtr tm)
unsafeCastGObject = TypedTreeModelSort . castForeignPtr . unGObject
instance TreeSortableClass TreeModelSort
instance TreeSortableClass (TypedTreeModelSort row)
treeModelSortNewWithModel :: (TreeModelClass (childModel row),
TypedTreeModelClass childModel) =>
childModel row -> IO (TypedTreeModelSort row)
treeModelSortNewWithModel childModel = liftM unsafeTreeModelSortToGeneric $
wrapNewGObject mkTreeModelSort $
liftM (castPtr :: Ptr TreeModel -> Ptr TreeModelSort) $
(\(TreeModel arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_sort_new_with_model argPtr1)
(toTreeModel childModel)
treeModelSortGetModel :: TreeModelSortClass self => self -> IO TreeModel
treeModelSortGetModel self =
makeNewGObject mkTreeModel $
(\(TreeModelSort arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_sort_get_model argPtr1)
(toTreeModelSort self)
treeModelSortConvertChildPathToPath :: TreeModelSortClass self => self
-> TreePath
-> IO TreePath
treeModelSortConvertChildPathToPath self [] = return []
treeModelSortConvertChildPathToPath self childPath =
withTreePath childPath $ \childPath ->
(\(TreeModelSort arg1) (NativeTreePath arg2) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_sort_convert_child_path_to_path argPtr1 arg2)
(toTreeModelSort self)
childPath
>>= fromTreePath
treeModelSortConvertPathToChildPath :: TreeModelSortClass self => self
-> TreePath
-> IO TreePath
treeModelSortConvertPathToChildPath self [] = return []
treeModelSortConvertPathToChildPath self sortedPath =
withTreePath sortedPath $ \sortedPath ->
(\(TreeModelSort arg1) (NativeTreePath arg2) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_sort_convert_path_to_child_path argPtr1 arg2)
(toTreeModelSort self)
sortedPath
>>= fromTreePath
treeModelSortConvertChildIterToIter :: TreeModelSortClass self => self
-> TreeIter
-> IO TreeIter
treeModelSortConvertChildIterToIter self childIter =
with childIter $ \childIterPtr ->
alloca $ \sortIterPtr -> do
(\(TreeModelSort arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_sort_convert_child_iter_to_iter argPtr1 arg2 arg3)
(toTreeModelSort self)
sortIterPtr
childIterPtr
peek sortIterPtr
treeModelSortConvertIterToChildIter :: TreeModelSortClass self => self
-> TreeIter
-> IO TreeIter
treeModelSortConvertIterToChildIter self sortedIter =
with sortedIter $ \sortedIterPtr ->
alloca $ \childIterPtr -> do
(\(TreeModelSort arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_sort_convert_iter_to_child_iter argPtr1 arg2 arg3)
(toTreeModelSort self)
childIterPtr
sortedIterPtr
peek childIterPtr
treeModelSortResetDefaultSortFunc :: TreeModelSortClass self => self -> IO ()
treeModelSortResetDefaultSortFunc self =
(\(TreeModelSort arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_sort_reset_default_sort_func argPtr1)
(toTreeModelSort self)
treeModelSortClearCache :: TreeModelSortClass self => self -> IO ()
treeModelSortClearCache self =
(\(TreeModelSort arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_sort_clear_cache argPtr1)
(toTreeModelSort self)
treeModelSortIterIsValid :: TreeModelSortClass self => self
-> TreeIter
-> IO Bool
treeModelSortIterIsValid self iter =
liftM toBool $
with iter $ \iterPtr ->
(\(TreeModelSort arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_sort_iter_is_valid argPtr1 arg2)
(toTreeModelSort self)
iterPtr
foreign import ccall safe "gtk_tree_model_sort_new_with_model"
gtk_tree_model_sort_new_with_model :: ((Ptr TreeModel) -> (IO (Ptr TreeModel)))
foreign import ccall safe "gtk_tree_model_sort_get_model"
gtk_tree_model_sort_get_model :: ((Ptr TreeModelSort) -> (IO (Ptr TreeModel)))
foreign import ccall safe "gtk_tree_model_sort_convert_child_path_to_path"
gtk_tree_model_sort_convert_child_path_to_path :: ((Ptr TreeModelSort) -> ((Ptr NativeTreePath) -> (IO (Ptr NativeTreePath))))
foreign import ccall safe "gtk_tree_model_sort_convert_path_to_child_path"
gtk_tree_model_sort_convert_path_to_child_path :: ((Ptr TreeModelSort) -> ((Ptr NativeTreePath) -> (IO (Ptr NativeTreePath))))
foreign import ccall safe "gtk_tree_model_sort_convert_child_iter_to_iter"
gtk_tree_model_sort_convert_child_iter_to_iter :: ((Ptr TreeModelSort) -> ((Ptr TreeIter) -> ((Ptr TreeIter) -> (IO CInt))))
foreign import ccall safe "gtk_tree_model_sort_convert_iter_to_child_iter"
gtk_tree_model_sort_convert_iter_to_child_iter :: ((Ptr TreeModelSort) -> ((Ptr TreeIter) -> ((Ptr TreeIter) -> (IO ()))))
foreign import ccall safe "gtk_tree_model_sort_reset_default_sort_func"
gtk_tree_model_sort_reset_default_sort_func :: ((Ptr TreeModelSort) -> (IO ()))
foreign import ccall safe "gtk_tree_model_sort_clear_cache"
gtk_tree_model_sort_clear_cache :: ((Ptr TreeModelSort) -> (IO ()))
foreign import ccall safe "gtk_tree_model_sort_iter_is_valid"
gtk_tree_model_sort_iter_is_valid :: ((Ptr TreeModelSort) -> ((Ptr TreeIter) -> (IO CInt)))