{-# LINE 2 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
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 Graphics.UI.Gtk.Types
{-# LINE 73 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
import Graphics.UI.Gtk.ModelView.TreeModel
{-# LINE 74 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
import Graphics.UI.Gtk.ModelView.Types
{-# LINE 75 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
{-# LINE 77 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
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)
{-# LINE 99 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
    (toTreeModel childModel)
treeModelSortGetModel :: TreeModelSortClass self => self -> IO TreeModel
treeModelSortGetModel self =
  makeNewGObject mkTreeModel $
  (\(TreeModelSort arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_sort_get_model argPtr1)
{-# LINE 110 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
    (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)
{-# LINE 124 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
    (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)
{-# LINE 140 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
    (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)
{-# LINE 154 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
    (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)
{-# LINE 169 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
    (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)
{-# LINE 180 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
    (toTreeModelSort self)
treeModelSortClearCache :: TreeModelSortClass self => self -> IO ()
treeModelSortClearCache self =
  (\(TreeModelSort arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_sort_clear_cache argPtr1)
{-# LINE 194 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
    (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)
{-# LINE 212 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
    (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)))