    {-# LINE 2 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) TreeModelSort
    --
    -- Author : Duncan Coutts
    --
    -- Created: 4 August 2004
    --
    -- Copyright (C) 2004-2005 Duncan Coutts, Axel Simon
    --
    -- This library is free software; you can redistribute it and/or
    -- modify it under the terms of the GNU Lesser General Public
    -- License as published by the Free Software Foundation; either
    -- version 2.1 of the License, or (at your option) any later version.
    --
    -- This library is distributed in the hope that it will be useful,
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    -- Lesser General Public License for more details.
    --
    -- |
    -- Maintainer : gtk2hs-users@lists.sourceforge.net
    -- Stability : provisional
    -- Portability : portable (depends on GHC)
    --
    -- A 'TreeModel' which makes an underlying tree model sortable
    --
    module Graphics.UI.Gtk.ModelView.TreeModelSort (
    -- * Detail
    --
    -- | The 'TreeModelSort' is a model which implements the 'TreeSortable'
    -- interface. It does not hold any data itself, but rather is created with a
    -- child model and proxies its data. It has identical rows to its
    -- child model, and the changes in the child are propagated. The primary
    -- purpose of this model is to provide a way to sort a model without
    -- modifying it.

    -- * Class Hierarchy
    -- |
    -- @
    -- | 'GObject'
    -- | +----TreeModelSort
    -- @

    -- * Types
      TreeModelSort,
      TreeModelSortClass,
      castToTreeModelSort, gTypeTreeModelSort,
      toTreeModelSort,

      TypedTreeModelSort,

    -- * Constructors
      treeModelSortNewWithModel,

    -- * Methods
      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 a -> GObject
    toGObject (TypedTreeModelSort ForeignPtr (TypedTreeModelSort a)
    tm) = ForeignPtr GObject -> GObject
    GObject (ForeignPtr (TypedTreeModelSort a) -> ForeignPtr GObject
    forall a b. ForeignPtr a -> ForeignPtr b
    castForeignPtr ForeignPtr (TypedTreeModelSort a)
    tm)
      unsafeCastGObject :: GObject -> TypedTreeModelSort a
    unsafeCastGObject = ForeignPtr (TypedTreeModelSort a) -> TypedTreeModelSort a
    forall row.
    ForeignPtr (TypedTreeModelSort row) -> TypedTreeModelSort row
    TypedTreeModelSort (ForeignPtr (TypedTreeModelSort a) -> TypedTreeModelSort a)
    -> (GObject -> ForeignPtr (TypedTreeModelSort a))
    -> GObject
    -> TypedTreeModelSort a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ForeignPtr GObject -> ForeignPtr (TypedTreeModelSort a)
    forall a b. ForeignPtr a -> ForeignPtr b
    castForeignPtr (ForeignPtr GObject -> ForeignPtr (TypedTreeModelSort a))
    -> (GObject -> ForeignPtr GObject)
    -> GObject
    -> ForeignPtr (TypedTreeModelSort a)
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . GObject -> ForeignPtr GObject
    unGObject
    instance TreeSortableClass TreeModelSort
    instance TreeSortableClass (TypedTreeModelSort row)

    --------------------
    -- Constructors

    -- | Creates a new 'TreeModelSort', that will be a sorted view of the given
    -- model.
    --
    treeModelSortNewWithModel :: (TreeModelClass (childModel row),
                                  TypedTreeModelClass childModel) =>
                                  childModel row -> IO (TypedTreeModelSort row)
    treeModelSortNewWithModel :: forall (childModel :: * -> *) row.
    (TreeModelClass (childModel row),
     TypedTreeModelClass childModel) =>
    childModel row -> IO (TypedTreeModelSort row)
    treeModelSortNewWithModel childModel row
    childModel = (TreeModelSort -> TypedTreeModelSort row)
    -> IO TreeModelSort -> IO (TypedTreeModelSort row)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM TreeModelSort -> TypedTreeModelSort row
    forall row. TreeModelSort -> TypedTreeModelSort row
    unsafeTreeModelSortToGeneric (IO TreeModelSort -> IO (TypedTreeModelSort row))
    -> IO TreeModelSort -> IO (TypedTreeModelSort row)
    forall a b. (a -> b) -> a -> b
    $
      (ForeignPtr TreeModelSort -> TreeModelSort,
     FinalizerPtr TreeModelSort)
    -> IO (Ptr TreeModelSort) -> IO TreeModelSort
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    wrapNewGObject (ForeignPtr TreeModelSort -> TreeModelSort,
     FinalizerPtr TreeModelSort)
    forall {a}.
    (ForeignPtr TreeModelSort -> TreeModelSort, FinalizerPtr a)
    mkTreeModelSort (IO (Ptr TreeModelSort) -> IO TreeModelSort)
    -> IO (Ptr TreeModelSort) -> IO TreeModelSort
    forall a b. (a -> b) -> a -> b
    $
      (Ptr TreeModel -> Ptr TreeModelSort)
    -> IO (Ptr TreeModel) -> IO (Ptr TreeModelSort)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr TreeModel -> Ptr TreeModelSort
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr TreeModel -> Ptr TreeModelSort) (IO (Ptr TreeModel) -> IO (Ptr TreeModelSort))
    -> IO (Ptr TreeModel) -> IO (Ptr TreeModelSort)
    forall a b. (a -> b) -> a -> b
    $
      (\(TreeModel ForeignPtr TreeModel
    arg1) -> ForeignPtr TreeModel
    -> (Ptr TreeModel -> IO (Ptr TreeModel)) -> IO (Ptr TreeModel)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr TreeModel
    arg1 ((Ptr TreeModel -> IO (Ptr TreeModel)) -> IO (Ptr TreeModel))
    -> (Ptr TreeModel -> IO (Ptr TreeModel)) -> IO (Ptr TreeModel)
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeModel
    argPtr1 ->Ptr TreeModel -> IO (Ptr TreeModel)
    gtk_tree_model_sort_new_with_model Ptr TreeModel
    argPtr1)
    {-# LINE 99 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
        (toTreeModel childModel)

    --------------------
    -- Methods

    -- | Returns the underlying model the 'TreeModelSort' is sorting.
    --
    treeModelSortGetModel :: TreeModelSortClass self => self -> IO TreeModel
    treeModelSortGetModel :: forall self. TreeModelSortClass self => self -> IO TreeModel
    treeModelSortGetModel self
    self =
      (ForeignPtr TreeModel -> TreeModel, FinalizerPtr TreeModel)
    -> IO (Ptr TreeModel) -> IO TreeModel
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewGObject (ForeignPtr TreeModel -> TreeModel, FinalizerPtr TreeModel)
    forall {a}. (ForeignPtr TreeModel -> TreeModel, FinalizerPtr a)
    mkTreeModel (IO (Ptr TreeModel) -> IO TreeModel)
    -> IO (Ptr TreeModel) -> IO TreeModel
    forall a b. (a -> b) -> a -> b
    $
      (\(TreeModelSort ForeignPtr TreeModelSort
    arg1) -> ForeignPtr TreeModelSort
    -> (Ptr TreeModelSort -> IO (Ptr TreeModel)) -> IO (Ptr TreeModel)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr TreeModelSort
    arg1 ((Ptr TreeModelSort -> IO (Ptr TreeModel)) -> IO (Ptr TreeModel))
    -> (Ptr TreeModelSort -> IO (Ptr TreeModel)) -> IO (Ptr TreeModel)
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeModelSort
    argPtr1 ->Ptr TreeModelSort -> IO (Ptr TreeModel)
    gtk_tree_model_sort_get_model Ptr TreeModelSort
    argPtr1)
    {-# LINE 110 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
        (toTreeModelSort self)

    -- | Converts the given path to a path relative to the given sorted model.
    --
    -- * The given path points to a row in the child model. The returned path will
    -- point to the same row in the sorted model.
    --
    treeModelSortConvertChildPathToPath :: TreeModelSortClass self => self
     -> TreePath
     -> IO TreePath
    treeModelSortConvertChildPathToPath :: forall self.
    TreeModelSortClass self =>
    self -> TreePath -> IO TreePath
    treeModelSortConvertChildPathToPath self
    self [] = TreePath -> IO TreePath
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return []
    treeModelSortConvertChildPathToPath self
    self TreePath
    childPath =
      TreePath -> (NativeTreePath -> IO TreePath) -> IO TreePath
    forall a. TreePath -> (NativeTreePath -> IO a) -> IO a
    withTreePath TreePath
    childPath ((NativeTreePath -> IO TreePath) -> IO TreePath)
    -> (NativeTreePath -> IO TreePath) -> IO TreePath
    forall a b. (a -> b) -> a -> b
    $ \NativeTreePath
    childPath ->
      (\(TreeModelSort ForeignPtr TreeModelSort
    arg1) (NativeTreePath Ptr NativeTreePath
    arg2) -> ForeignPtr TreeModelSort
    -> (Ptr TreeModelSort -> IO (Ptr NativeTreePath))
    -> IO (Ptr NativeTreePath)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr TreeModelSort
    arg1 ((Ptr TreeModelSort -> IO (Ptr NativeTreePath))
     -> IO (Ptr NativeTreePath))
    -> (Ptr TreeModelSort -> IO (Ptr NativeTreePath))
    -> IO (Ptr NativeTreePath)
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeModelSort
    argPtr1 ->Ptr TreeModelSort -> Ptr NativeTreePath -> IO (Ptr NativeTreePath)
    gtk_tree_model_sort_convert_child_path_to_path Ptr TreeModelSort
    argPtr1 Ptr NativeTreePath
    arg2)
    {-# LINE 124 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
        (toTreeModelSort self)
        NativeTreePath
    childPath
      IO (Ptr NativeTreePath)
    -> (Ptr NativeTreePath -> IO TreePath) -> IO TreePath
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Ptr NativeTreePath -> IO TreePath
    fromTreePath

    -- | Converts path in the sorted model to a path on the unsorted model on which
    -- the given 'TreeModelSort' is based. That is, the given path points to a
    -- location in the given 'TreeModelSort'. The returned path will point to the
    -- same location in the underlying unsorted model.
    --
    treeModelSortConvertPathToChildPath :: TreeModelSortClass self => self
     -> TreePath
     -> IO TreePath
    treeModelSortConvertPathToChildPath :: forall self.
    TreeModelSortClass self =>
    self -> TreePath -> IO TreePath
    treeModelSortConvertPathToChildPath self
    self [] = TreePath -> IO TreePath
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return []
    treeModelSortConvertPathToChildPath self
    self TreePath
    sortedPath =
      TreePath -> (NativeTreePath -> IO TreePath) -> IO TreePath
    forall a. TreePath -> (NativeTreePath -> IO a) -> IO a
    withTreePath TreePath
    sortedPath ((NativeTreePath -> IO TreePath) -> IO TreePath)
    -> (NativeTreePath -> IO TreePath) -> IO TreePath
    forall a b. (a -> b) -> a -> b
    $ \NativeTreePath
    sortedPath ->
      (\(TreeModelSort ForeignPtr TreeModelSort
    arg1) (NativeTreePath Ptr NativeTreePath
    arg2) -> ForeignPtr TreeModelSort
    -> (Ptr TreeModelSort -> IO (Ptr NativeTreePath))
    -> IO (Ptr NativeTreePath)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr TreeModelSort
    arg1 ((Ptr TreeModelSort -> IO (Ptr NativeTreePath))
     -> IO (Ptr NativeTreePath))
    -> (Ptr TreeModelSort -> IO (Ptr NativeTreePath))
    -> IO (Ptr NativeTreePath)
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeModelSort
    argPtr1 ->Ptr TreeModelSort -> Ptr NativeTreePath -> IO (Ptr NativeTreePath)
    gtk_tree_model_sort_convert_path_to_child_path Ptr TreeModelSort
    argPtr1 Ptr NativeTreePath
    arg2)
    {-# LINE 140 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
        (toTreeModelSort self)
        NativeTreePath
    sortedPath
      IO (Ptr NativeTreePath)
    -> (Ptr NativeTreePath -> IO TreePath) -> IO TreePath
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= Ptr NativeTreePath -> IO TreePath
    fromTreePath

    -- | Return an iterator in the sorted model that points to the row pointed to
    -- by the given iter from the unsorted model.
    --
    treeModelSortConvertChildIterToIter :: TreeModelSortClass self => self
     -> TreeIter
     -> IO TreeIter
    treeModelSortConvertChildIterToIter :: forall self.
    TreeModelSortClass self =>
    self -> TreeIter -> IO TreeIter
    treeModelSortConvertChildIterToIter self
    self TreeIter
    childIter =
      TreeIter -> (Ptr TreeIter -> IO TreeIter) -> IO TreeIter
    forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
    with TreeIter
    childIter ((Ptr TreeIter -> IO TreeIter) -> IO TreeIter)
    -> (Ptr TreeIter -> IO TreeIter) -> IO TreeIter
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeIter
    childIterPtr ->
      (Ptr TreeIter -> IO TreeIter) -> IO TreeIter
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr TreeIter -> IO TreeIter) -> IO TreeIter)
    -> (Ptr TreeIter -> IO TreeIter) -> IO TreeIter
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeIter
    sortIterPtr -> do
      (\(TreeModelSort ForeignPtr TreeModelSort
    arg1) Ptr TreeIter
    arg2 Ptr TreeIter
    arg3 -> ForeignPtr TreeModelSort
    -> (Ptr TreeModelSort -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr TreeModelSort
    arg1 ((Ptr TreeModelSort -> IO CInt) -> IO CInt)
    -> (Ptr TreeModelSort -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeModelSort
    argPtr1 ->Ptr TreeModelSort -> Ptr TreeIter -> Ptr TreeIter -> IO CInt
    gtk_tree_model_sort_convert_child_iter_to_iter Ptr TreeModelSort
    argPtr1 Ptr TreeIter
    arg2 Ptr TreeIter
    arg3)
    {-# LINE 154 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
        (toTreeModelSort self)
        Ptr TreeIter
    sortIterPtr
        Ptr TreeIter
    childIterPtr
      Ptr TreeIter -> IO TreeIter
    forall a. Storable a => Ptr a -> IO a
    peek Ptr TreeIter
    sortIterPtr

    -- | Return an iterator in the unsorted model that points to the row pointed to
    -- by the given iter from the sorted model.
    --
    treeModelSortConvertIterToChildIter :: TreeModelSortClass self => self
     -> TreeIter
     -> IO TreeIter
    treeModelSortConvertIterToChildIter :: forall self.
    TreeModelSortClass self =>
    self -> TreeIter -> IO TreeIter
    treeModelSortConvertIterToChildIter self
    self TreeIter
    sortedIter =
      TreeIter -> (Ptr TreeIter -> IO TreeIter) -> IO TreeIter
    forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
    with TreeIter
    sortedIter ((Ptr TreeIter -> IO TreeIter) -> IO TreeIter)
    -> (Ptr TreeIter -> IO TreeIter) -> IO TreeIter
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeIter
    sortedIterPtr ->
      (Ptr TreeIter -> IO TreeIter) -> IO TreeIter
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr TreeIter -> IO TreeIter) -> IO TreeIter)
    -> (Ptr TreeIter -> IO TreeIter) -> IO TreeIter
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeIter
    childIterPtr -> do
      (\(TreeModelSort ForeignPtr TreeModelSort
    arg1) Ptr TreeIter
    arg2 Ptr TreeIter
    arg3 -> ForeignPtr TreeModelSort -> (Ptr TreeModelSort -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr TreeModelSort
    arg1 ((Ptr TreeModelSort -> IO ()) -> IO ())
    -> (Ptr TreeModelSort -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeModelSort
    argPtr1 ->Ptr TreeModelSort -> Ptr TreeIter -> Ptr TreeIter -> IO ()
    gtk_tree_model_sort_convert_iter_to_child_iter Ptr TreeModelSort
    argPtr1 Ptr TreeIter
    arg2 Ptr TreeIter
    arg3)
    {-# LINE 169 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
        (toTreeModelSort self)
        Ptr TreeIter
    childIterPtr
        Ptr TreeIter
    sortedIterPtr
      Ptr TreeIter -> IO TreeIter
    forall a. Storable a => Ptr a -> IO a
    peek Ptr TreeIter
    childIterPtr

    -- | This resets the default sort function. As a consequence, the order of
    -- this model will be the same order as that of the child model.
    --
    treeModelSortResetDefaultSortFunc :: TreeModelSortClass self => self -> IO ()
    treeModelSortResetDefaultSortFunc :: forall self. TreeModelSortClass self => self -> IO ()
    treeModelSortResetDefaultSortFunc self
    self =
      (\(TreeModelSort ForeignPtr TreeModelSort
    arg1) -> ForeignPtr TreeModelSort -> (Ptr TreeModelSort -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr TreeModelSort
    arg1 ((Ptr TreeModelSort -> IO ()) -> IO ())
    -> (Ptr TreeModelSort -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeModelSort
    argPtr1 ->Ptr TreeModelSort -> IO ()
    gtk_tree_model_sort_reset_default_sort_func Ptr TreeModelSort
    argPtr1)
    {-# LINE 180 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
        (toTreeModelSort self)

    -- | Clear the cache of unref'd iterators.
    --
    -- * This function should almost never be called. It clears the
    -- 'TreeModelSort' of any cached iterators that haven't been reffed with
    -- 'treeModelRefNode'. This might be useful if the child model being sorted is
    -- static (and doesn't change often) and there has been a lot of unreffed
    -- access to nodes. As a side effect of this function, all unreffed iters will
    -- be invalid.
    --
    treeModelSortClearCache :: TreeModelSortClass self => self -> IO ()
    treeModelSortClearCache :: forall self. TreeModelSortClass self => self -> IO ()
    treeModelSortClearCache self
    self =
      (\(TreeModelSort ForeignPtr TreeModelSort
    arg1) -> ForeignPtr TreeModelSort -> (Ptr TreeModelSort -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr TreeModelSort
    arg1 ((Ptr TreeModelSort -> IO ()) -> IO ())
    -> (Ptr TreeModelSort -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeModelSort
    argPtr1 ->Ptr TreeModelSort -> IO ()
    gtk_tree_model_sort_clear_cache Ptr TreeModelSort
    argPtr1)
    {-# LINE 194 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
        (toTreeModelSort self)

    -- | Checks if the given iter is a valid iter for this 'TreeModelSort'.
    --
    -- * WARNING: This function is slow. Only use it for debugging and\/or testing
    -- purposes.
    --
    -- * Available since Gtk+ version 2.2
    --
    treeModelSortIterIsValid :: TreeModelSortClass self => self
     -> TreeIter -- ^ @iter@ - A 'TreeIter'.
     -> IO Bool -- ^ returns @True@ if the iter is valid, @False@ if the iter is
                 -- invalid.
    treeModelSortIterIsValid :: forall self. TreeModelSortClass self => self -> TreeIter -> IO Bool
    treeModelSortIterIsValid self
    self TreeIter
    iter =
      (CInt -> Bool) -> IO CInt -> IO Bool
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM CInt -> Bool
    forall a. (Eq a, Num a) => a -> Bool
    toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
    forall a b. (a -> b) -> a -> b
    $
      TreeIter -> (Ptr TreeIter -> IO CInt) -> IO CInt
    forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
    with TreeIter
    iter ((Ptr TreeIter -> IO CInt) -> IO CInt)
    -> (Ptr TreeIter -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeIter
    iterPtr ->
      (\(TreeModelSort ForeignPtr TreeModelSort
    arg1) Ptr TreeIter
    arg2 -> ForeignPtr TreeModelSort
    -> (Ptr TreeModelSort -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr TreeModelSort
    arg1 ((Ptr TreeModelSort -> IO CInt) -> IO CInt)
    -> (Ptr TreeModelSort -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeModelSort
    argPtr1 ->Ptr TreeModelSort -> Ptr TreeIter -> IO CInt
    gtk_tree_model_sort_iter_is_valid Ptr TreeModelSort
    argPtr1 Ptr TreeIter
    arg2)
    {-# LINE 212 "./Graphics/UI/Gtk/ModelView/TreeModelSort.chs" #-}
        (toTreeModelSort self)
        Ptr TreeIter
    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)))