{-# LINE 2 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
-- -*-haskell-*-
-- GIMP Toolkit (GTK) Widget TreeModelFilter
--
-- Author : Axel Simon
--
-- Created: 14 January 2008
--
-- Copyright (C) 2008 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 hides parts of an underlying tree model
--
-- * Module available since Gtk+ version 2.4
--
module Graphics.UI.Gtk.ModelView.TreeModelFilter (

-- * Detail
--
-- | A 'TreeModelFilter' is a tree model which wraps another tree model, and
-- can do the following things:
--
-- * Filter specific rows, based on a function that examines each row
-- indicating whether the row should be shown or not, or
-- based on the return value of a visibility function, which is passed
-- the 'TreeIter' of the row and returns a Boolean indicating whether the row should
-- be shown or not.
--
-- * Set a different root node, also known as a \"virtual root\". You can
-- pass in a 'TreePath' indicating the root node for the filter at construction
-- time.

-- * Class Hierarchy
--
-- |
-- @
-- | 'GObject'
-- | +----TreeModelFilter
-- | +----TypedTreeModelFilter
-- @


-- * Types
  TreeModelFilter,
  TypedTreeModelFilter,
  TreeModelFilterClass,
  castToTreeModelFilter, gTypeTreeModelFilter,
  toTreeModelFilter,

-- * Constructors
  treeModelFilterNew,

-- * Methods
  treeModelFilterSetVisibleFunc,
  treeModelFilterSetVisibleColumn,
  treeModelFilterGetModel,
  treeModelFilterConvertChildIterToIter,
  treeModelFilterConvertIterToChildIter,
  treeModelFilterConvertChildPathToPath,
  treeModelFilterConvertPathToChildPath,
  treeModelFilterRefilter,
  treeModelFilterClearCache,

-- * Attributes
  treeModelFilterChildModel,
  treeModelFilterVirtualRoot,

  ) where

import Control.Monad (liftM)

import System.Glib.FFI
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Types
{-# LINE 90 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
import Graphics.UI.Gtk.ModelView.TreeModel
{-# LINE 91 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
import Graphics.UI.Gtk.ModelView.Types
{-# LINE 92 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}


{-# LINE 94 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}


--------------------
-- Interfaces

instance TreeModelClass (TypedTreeModelFilter a)
instance TreeModelFilterClass (TypedTreeModelFilter a)
instance GObjectClass (TypedTreeModelFilter a) where
  toGObject :: TypedTreeModelFilter a -> GObject
toGObject (TypedTreeModelFilter ForeignPtr (TypedTreeModelFilter a)
tm) = ForeignPtr GObject -> GObject
GObject (ForeignPtr (TypedTreeModelFilter a) -> ForeignPtr GObject
forall a b. ForeignPtr a -> ForeignPtr b
castForeignPtr ForeignPtr (TypedTreeModelFilter a)
tm)
  unsafeCastGObject :: GObject -> TypedTreeModelFilter a
unsafeCastGObject = ForeignPtr (TypedTreeModelFilter a) -> TypedTreeModelFilter a
forall row.
ForeignPtr (TypedTreeModelFilter row) -> TypedTreeModelFilter row
TypedTreeModelFilter (ForeignPtr (TypedTreeModelFilter a) -> TypedTreeModelFilter a)
-> (GObject -> ForeignPtr (TypedTreeModelFilter a))
-> GObject
-> TypedTreeModelFilter a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ForeignPtr GObject -> ForeignPtr (TypedTreeModelFilter a)
forall a b. ForeignPtr a -> ForeignPtr b
castForeignPtr (ForeignPtr GObject -> ForeignPtr (TypedTreeModelFilter a))
-> (GObject -> ForeignPtr GObject)
-> GObject
-> ForeignPtr (TypedTreeModelFilter a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GObject -> ForeignPtr GObject
unGObject

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

-- %hash c:81e3 d:42cf
-- | Creates a new 'TreeModel', with @childModel@ as the child model and
-- @root@ as the virtual root.
--
treeModelFilterNew :: (TreeModelClass (childModel row),
                       TypedTreeModelClass childModel) =>
    childModel row -- ^ @childModel@ - A 'TreeModel'.
 -> TreePath -- ^ @root@ - A 'TreePath' or @[]@.
 -> IO (TypedTreeModelFilter row)
treeModelFilterNew :: forall (childModel :: * -> *) row.
(TreeModelClass (childModel row),
 TypedTreeModelClass childModel) =>
childModel row -> TreePath -> IO (TypedTreeModelFilter row)
treeModelFilterNew childModel row
childModel [] =
  (TreeModelFilter -> TypedTreeModelFilter row)
-> IO TreeModelFilter -> IO (TypedTreeModelFilter row)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TreeModelFilter -> TypedTreeModelFilter row
forall row. TreeModelFilter -> TypedTreeModelFilter row
unsafeTreeModelFilterToGeneric (IO TreeModelFilter -> IO (TypedTreeModelFilter row))
-> IO TreeModelFilter -> IO (TypedTreeModelFilter row)
forall a b. (a -> b) -> a -> b
$
  (ForeignPtr TreeModelFilter -> TreeModelFilter,
 FinalizerPtr TreeModelFilter)
-> IO (Ptr TreeModelFilter) -> IO TreeModelFilter
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr TreeModelFilter -> TreeModelFilter,
 FinalizerPtr TreeModelFilter)
forall {a}.
(ForeignPtr TreeModelFilter -> TreeModelFilter, FinalizerPtr a)
mkTreeModelFilter (IO (Ptr TreeModelFilter) -> IO TreeModelFilter)
-> IO (Ptr TreeModelFilter) -> IO TreeModelFilter
forall a b. (a -> b) -> a -> b
$
  (Ptr TreeModel -> Ptr TreeModelFilter)
-> IO (Ptr TreeModel) -> IO (Ptr TreeModelFilter)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr TreeModel -> Ptr TreeModelFilter
forall a b. Ptr a -> Ptr b
castPtr :: Ptr TreeModel -> Ptr TreeModelFilter) (IO (Ptr TreeModel) -> IO (Ptr TreeModelFilter))
-> IO (Ptr TreeModel) -> IO (Ptr TreeModelFilter)
forall a b. (a -> b) -> a -> b
$
  (\(TreeModel ForeignPtr TreeModel
arg1) (NativeTreePath Ptr NativeTreePath
arg2) -> 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 -> Ptr NativeTreePath -> IO (Ptr TreeModel)
gtk_tree_model_filter_new Ptr TreeModel
argPtr1 Ptr NativeTreePath
arg2)
{-# LINE 122 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModel childModel)
    (Ptr NativeTreePath -> NativeTreePath
NativeTreePath Ptr NativeTreePath
forall a. Ptr a
nullPtr)
treeModelFilterNew childModel row
childModel TreePath
root =
  (TreeModelFilter -> TypedTreeModelFilter row)
-> IO TreeModelFilter -> IO (TypedTreeModelFilter row)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM TreeModelFilter -> TypedTreeModelFilter row
forall row. TreeModelFilter -> TypedTreeModelFilter row
unsafeTreeModelFilterToGeneric (IO TreeModelFilter -> IO (TypedTreeModelFilter row))
-> IO TreeModelFilter -> IO (TypedTreeModelFilter row)
forall a b. (a -> b) -> a -> b
$
  (ForeignPtr TreeModelFilter -> TreeModelFilter,
 FinalizerPtr TreeModelFilter)
-> IO (Ptr TreeModelFilter) -> IO TreeModelFilter
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr TreeModelFilter -> TreeModelFilter,
 FinalizerPtr TreeModelFilter)
forall {a}.
(ForeignPtr TreeModelFilter -> TreeModelFilter, FinalizerPtr a)
mkTreeModelFilter (IO (Ptr TreeModelFilter) -> IO TreeModelFilter)
-> IO (Ptr TreeModelFilter) -> IO TreeModelFilter
forall a b. (a -> b) -> a -> b
$
  (Ptr TreeModel -> Ptr TreeModelFilter)
-> IO (Ptr TreeModel) -> IO (Ptr TreeModelFilter)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr TreeModel -> Ptr TreeModelFilter
forall a b. Ptr a -> Ptr b
castPtr :: Ptr TreeModel -> Ptr TreeModelFilter) (IO (Ptr TreeModel) -> IO (Ptr TreeModelFilter))
-> IO (Ptr TreeModel) -> IO (Ptr TreeModelFilter)
forall a b. (a -> b) -> a -> b
$
  TreePath
-> (NativeTreePath -> IO (Ptr TreeModel)) -> IO (Ptr TreeModel)
forall a. TreePath -> (NativeTreePath -> IO a) -> IO a
withTreePath TreePath
root ((NativeTreePath -> IO (Ptr TreeModel)) -> IO (Ptr TreeModel))
-> (NativeTreePath -> IO (Ptr TreeModel)) -> IO (Ptr TreeModel)
forall a b. (a -> b) -> a -> b
$ \NativeTreePath
root ->
  (\(TreeModel ForeignPtr TreeModel
arg1) (NativeTreePath Ptr NativeTreePath
arg2) -> 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 -> Ptr NativeTreePath -> IO (Ptr TreeModel)
gtk_tree_model_filter_new Ptr TreeModel
argPtr1 Ptr NativeTreePath
arg2)
{-# LINE 130 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModel childModel)
    NativeTreePath
root



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

-- %hash c:2349 d:864a
-- | Sets the visible function used when filtering the rows to be @func@.
-- The function should return @True@ if the given row should be visible and
-- @False@ otherwise. The passed-in iterator is an iterator of the child
-- model, not of the 'TreeModelFilter' model that is passed in as the first
-- argument to this function.
--
-- If the condition calculated by the function changes over time (e.g.
-- because it depends on some global parameters), you must call
-- 'treeModelFilterRefilter' to keep the visibility information of the model
-- up to date.
--
treeModelFilterSetVisibleFunc :: TreeModelFilterClass self => self
 -> (TreeIter -> IO Bool) -- ^ @func@ - The visible function
 -> IO ()
treeModelFilterSetVisibleFunc :: forall self.
TreeModelFilterClass self =>
self -> (TreeIter -> IO Bool) -> IO ()
treeModelFilterSetVisibleFunc self
self TreeIter -> IO Bool
func = do
  TreeModelFilterVisibleFunc
funcPtr <- (Ptr TreeModel -> Ptr TreeIter -> Ptr () -> IO CInt)
-> IO TreeModelFilterVisibleFunc
mkTreeModelFilterVisibleFunc ((Ptr TreeModel -> Ptr TreeIter -> Ptr () -> IO CInt)
 -> IO TreeModelFilterVisibleFunc)
-> (Ptr TreeModel -> Ptr TreeIter -> Ptr () -> IO CInt)
-> IO TreeModelFilterVisibleFunc
forall a b. (a -> b) -> a -> b
$ \Ptr TreeModel
_ Ptr TreeIter
tiPtr Ptr ()
_ -> do
    TreeIter
ti <- Ptr TreeIter -> IO TreeIter
peekTreeIter Ptr TreeIter
tiPtr
    (Bool -> CInt) -> IO Bool -> IO CInt
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Bool -> CInt
forall a. Num a => Bool -> a
fromBool (IO Bool -> IO CInt) -> IO Bool -> IO CInt
forall a b. (a -> b) -> a -> b
$ TreeIter -> IO Bool
func TreeIter
ti
  (\(TreeModelFilter ForeignPtr TreeModelFilter
arg1) TreeModelFilterVisibleFunc
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4 -> ForeignPtr TreeModelFilter
-> (Ptr TreeModelFilter -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TreeModelFilter
arg1 ((Ptr TreeModelFilter -> IO ()) -> IO ())
-> (Ptr TreeModelFilter -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr TreeModelFilter
argPtr1 ->Ptr TreeModelFilter
-> TreeModelFilterVisibleFunc
-> Ptr ()
-> FunPtr (Ptr () -> IO ())
-> IO ()
gtk_tree_model_filter_set_visible_func Ptr TreeModelFilter
argPtr1 TreeModelFilterVisibleFunc
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4)
{-# LINE 158 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self) TreeModelFilterVisibleFunc
funcPtr (TreeModelFilterVisibleFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr TreeModelFilterVisibleFunc
funcPtr) FunPtr (Ptr () -> IO ())
destroyFunPtr

type TreeModelFilterVisibleFunc = FunPtr (((Ptr TreeModel) -> ((Ptr TreeIter) -> ((Ptr ()) -> (IO CInt)))))
{-# LINE 161 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}

foreign import ccall "wrapper" mkTreeModelFilterVisibleFunc ::
  (Ptr TreeModel -> Ptr TreeIter -> Ptr () -> IO (CInt)) ->
  IO TreeModelFilterVisibleFunc

-- %hash c:a56d d:b42e
-- | Sets @column@ of the child model to be the column where the filter model
-- should look for visibility information. A row containing @True@ means
-- that this row should be shown.
--
treeModelFilterSetVisibleColumn ::
 (TreeModelFilterClass (self row),
  TypedTreeModelClass self)
 => self row
 -> ColumnId row Bool -- ^ @column@ - A column of Booleans that determines
                      -- if a row is visible
 -> IO ()
treeModelFilterSetVisibleColumn :: forall (self :: * -> *) row.
(TreeModelFilterClass (self row), TypedTreeModelClass self) =>
self row -> ColumnId row Bool -> IO ()
treeModelFilterSetVisibleColumn self row
self ColumnId row Bool
col =
  (\(TreeModelFilter ForeignPtr TreeModelFilter
arg1) CInt
arg2 -> ForeignPtr TreeModelFilter
-> (Ptr TreeModelFilter -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TreeModelFilter
arg1 ((Ptr TreeModelFilter -> IO ()) -> IO ())
-> (Ptr TreeModelFilter -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr TreeModelFilter
argPtr1 ->Ptr TreeModelFilter -> CInt -> IO ()
gtk_tree_model_filter_set_visible_column Ptr TreeModelFilter
argPtr1 CInt
arg2)
{-# LINE 180 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
    ((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> (ColumnId row Bool -> Int) -> ColumnId row Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ColumnId row Bool -> Int
forall row ty. ColumnId row ty -> Int
columnIdToNumber) ColumnId row Bool
col)

-- %hash c:85fb d:a36
-- | Returns a pointer to the child model of @filter@.
--
treeModelFilterGetModel :: TreeModelFilterClass self => self
 -> IO (Maybe TreeModel) -- ^ returns a 'TreeModel'.
treeModelFilterGetModel :: forall self.
TreeModelFilterClass self =>
self -> IO (Maybe TreeModel)
treeModelFilterGetModel self
self =
  (IO (Ptr TreeModel) -> IO TreeModel)
-> IO (Ptr TreeModel) -> IO (Maybe TreeModel)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((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 (Maybe TreeModel))
-> IO (Ptr TreeModel) -> IO (Maybe TreeModel)
forall a b. (a -> b) -> a -> b
$
  (\(TreeModelFilter ForeignPtr TreeModelFilter
arg1) -> ForeignPtr TreeModelFilter
-> (Ptr TreeModelFilter -> IO (Ptr TreeModel))
-> IO (Ptr TreeModel)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TreeModelFilter
arg1 ((Ptr TreeModelFilter -> IO (Ptr TreeModel)) -> IO (Ptr TreeModel))
-> (Ptr TreeModelFilter -> IO (Ptr TreeModel))
-> IO (Ptr TreeModel)
forall a b. (a -> b) -> a -> b
$ \Ptr TreeModelFilter
argPtr1 ->Ptr TreeModelFilter -> IO (Ptr TreeModel)
gtk_tree_model_filter_get_model Ptr TreeModelFilter
argPtr1)
{-# LINE 191 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)

-- %hash c:1b93 d:5689
-- | Return an iterator in the sorted model that points to the row pointed to
-- by the given iter from the unfiltered model.
--
treeModelFilterConvertChildIterToIter :: TreeModelFilterClass self => self
 -> TreeIter
 -> IO TreeIter
treeModelFilterConvertChildIterToIter :: forall self.
TreeModelFilterClass self =>
self -> TreeIter -> IO TreeIter
treeModelFilterConvertChildIterToIter 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
filterIterPtr -> do
  (\(TreeModelFilter ForeignPtr TreeModelFilter
arg1) Ptr TreeIter
arg2 Ptr TreeIter
arg3 -> ForeignPtr TreeModelFilter
-> (Ptr TreeModelFilter -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TreeModelFilter
arg1 ((Ptr TreeModelFilter -> IO CInt) -> IO CInt)
-> (Ptr TreeModelFilter -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr TreeModelFilter
argPtr1 ->Ptr TreeModelFilter -> Ptr TreeIter -> Ptr TreeIter -> IO CInt
gtk_tree_model_filter_convert_child_iter_to_iter Ptr TreeModelFilter
argPtr1 Ptr TreeIter
arg2 Ptr TreeIter
arg3)
{-# LINE 204 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
    Ptr TreeIter
filterIterPtr
    Ptr TreeIter
childIterPtr
  Ptr TreeIter -> IO TreeIter
forall a. Storable a => Ptr a -> IO a
peek Ptr TreeIter
filterIterPtr

-- %hash c:c754 d:c058
-- | Return an iterator in the unfiltered model that points to the row pointed to
-- by the given iter from the filtered model.
--
treeModelFilterConvertIterToChildIter :: TreeModelFilterClass self => self
 -> TreeIter
 -> IO TreeIter
treeModelFilterConvertIterToChildIter :: forall self.
TreeModelFilterClass self =>
self -> TreeIter -> IO TreeIter
treeModelFilterConvertIterToChildIter self
self TreeIter
filteredIter =
  TreeIter -> (Ptr TreeIter -> IO TreeIter) -> IO TreeIter
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with TreeIter
filteredIter ((Ptr TreeIter -> IO TreeIter) -> IO TreeIter)
-> (Ptr TreeIter -> IO TreeIter) -> IO TreeIter
forall a b. (a -> b) -> a -> b
$ \Ptr TreeIter
filteredIterPtr ->
  (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
  (\(TreeModelFilter ForeignPtr TreeModelFilter
arg1) Ptr TreeIter
arg2 Ptr TreeIter
arg3 -> ForeignPtr TreeModelFilter
-> (Ptr TreeModelFilter -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TreeModelFilter
arg1 ((Ptr TreeModelFilter -> IO ()) -> IO ())
-> (Ptr TreeModelFilter -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr TreeModelFilter
argPtr1 ->Ptr TreeModelFilter -> Ptr TreeIter -> Ptr TreeIter -> IO ()
gtk_tree_model_filter_convert_iter_to_child_iter Ptr TreeModelFilter
argPtr1 Ptr TreeIter
arg2 Ptr TreeIter
arg3)
{-# LINE 220 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
    Ptr TreeIter
childIterPtr
    Ptr TreeIter
filteredIterPtr
  Ptr TreeIter -> IO TreeIter
forall a. Storable a => Ptr a -> IO a
peek Ptr TreeIter
childIterPtr

-- %hash c:e4e3 d:57be
-- | Converts the given path to a path relative to the given filtered model.
--
-- * The given path points to a row in the child model. The returned path will
-- point to the same row in the filtered model.
--
treeModelFilterConvertChildPathToPath :: TreeModelFilterClass self => self
 -> TreePath
 -> IO TreePath
treeModelFilterConvertChildPathToPath :: forall self.
TreeModelFilterClass self =>
self -> TreePath -> IO TreePath
treeModelFilterConvertChildPathToPath self
self [] = TreePath -> IO TreePath
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return []
treeModelFilterConvertChildPathToPath 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 ->
  (\(TreeModelFilter ForeignPtr TreeModelFilter
arg1) (NativeTreePath Ptr NativeTreePath
arg2) -> ForeignPtr TreeModelFilter
-> (Ptr TreeModelFilter -> IO (Ptr NativeTreePath))
-> IO (Ptr NativeTreePath)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TreeModelFilter
arg1 ((Ptr TreeModelFilter -> IO (Ptr NativeTreePath))
 -> IO (Ptr NativeTreePath))
-> (Ptr TreeModelFilter -> IO (Ptr NativeTreePath))
-> IO (Ptr NativeTreePath)
forall a b. (a -> b) -> a -> b
$ \Ptr TreeModelFilter
argPtr1 ->Ptr TreeModelFilter
-> Ptr NativeTreePath -> IO (Ptr NativeTreePath)
gtk_tree_model_filter_convert_child_path_to_path Ptr TreeModelFilter
argPtr1 Ptr NativeTreePath
arg2)
{-# LINE 238 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter 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

-- %hash c:446d d:db70
-- | Converts path in the filtered model to a path on the unfiltered model on which
-- the given 'TreeModelFilter' is based. That is, the given path points to a
-- location in the given 'TreeModelFilter'. The returned path will point to the
-- same location in the underlying unfiltered model.
--
treeModelFilterConvertPathToChildPath :: TreeModelFilterClass self => self
 -> TreePath
 -> IO TreePath
treeModelFilterConvertPathToChildPath :: forall self.
TreeModelFilterClass self =>
self -> TreePath -> IO TreePath
treeModelFilterConvertPathToChildPath self
self [] = TreePath -> IO TreePath
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return []
treeModelFilterConvertPathToChildPath self
self TreePath
filteredPath =
  TreePath -> (NativeTreePath -> IO TreePath) -> IO TreePath
forall a. TreePath -> (NativeTreePath -> IO a) -> IO a
withTreePath TreePath
filteredPath ((NativeTreePath -> IO TreePath) -> IO TreePath)
-> (NativeTreePath -> IO TreePath) -> IO TreePath
forall a b. (a -> b) -> a -> b
$ \NativeTreePath
filteredPath ->
  (\(TreeModelFilter ForeignPtr TreeModelFilter
arg1) (NativeTreePath Ptr NativeTreePath
arg2) -> ForeignPtr TreeModelFilter
-> (Ptr TreeModelFilter -> IO (Ptr NativeTreePath))
-> IO (Ptr NativeTreePath)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TreeModelFilter
arg1 ((Ptr TreeModelFilter -> IO (Ptr NativeTreePath))
 -> IO (Ptr NativeTreePath))
-> (Ptr TreeModelFilter -> IO (Ptr NativeTreePath))
-> IO (Ptr NativeTreePath)
forall a b. (a -> b) -> a -> b
$ \Ptr TreeModelFilter
argPtr1 ->Ptr TreeModelFilter
-> Ptr NativeTreePath -> IO (Ptr NativeTreePath)
gtk_tree_model_filter_convert_path_to_child_path Ptr TreeModelFilter
argPtr1 Ptr NativeTreePath
arg2)
{-# LINE 255 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
    NativeTreePath
filteredPath
  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

-- %hash c:ed0b d:1a19
-- | Emits 'rowChanged' for each row in the child model, which causes the
-- filter to re-evaluate whether a row is visible or not.
--
treeModelFilterRefilter :: TreeModelFilterClass self => self -> IO ()
treeModelFilterRefilter :: forall self. TreeModelFilterClass self => self -> IO ()
treeModelFilterRefilter self
self =
  (\(TreeModelFilter ForeignPtr TreeModelFilter
arg1) -> ForeignPtr TreeModelFilter
-> (Ptr TreeModelFilter -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TreeModelFilter
arg1 ((Ptr TreeModelFilter -> IO ()) -> IO ())
-> (Ptr TreeModelFilter -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr TreeModelFilter
argPtr1 ->Ptr TreeModelFilter -> IO ()
gtk_tree_model_filter_refilter Ptr TreeModelFilter
argPtr1)
{-# LINE 266 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)

-- %hash c:ae64 d:a3b3
-- | This function should almost never be called. It clears the @filter@ of
-- any cached iterators that haven't been reffed with 'treeModelRefNode'. This
-- might be useful if the child model being filtered 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.
--
treeModelFilterClearCache :: TreeModelFilterClass self
 => self -- ^ @filter@ - the filter model
 -> IO ()
treeModelFilterClearCache :: forall self. TreeModelFilterClass self => self -> IO ()
treeModelFilterClearCache self
self =
  (\(TreeModelFilter ForeignPtr TreeModelFilter
arg1) -> ForeignPtr TreeModelFilter
-> (Ptr TreeModelFilter -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TreeModelFilter
arg1 ((Ptr TreeModelFilter -> IO ()) -> IO ())
-> (Ptr TreeModelFilter -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr TreeModelFilter
argPtr1 ->Ptr TreeModelFilter -> IO ()
gtk_tree_model_filter_clear_cache Ptr TreeModelFilter
argPtr1)
{-# LINE 280 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)

--------------------
-- Attributes

-- %hash c:8630 d:81a7
-- | The model for the filtermodel to filter.
--
treeModelFilterChildModel :: TreeModelFilterClass self => ReadAttr self TreeModel
treeModelFilterChildModel :: forall self. TreeModelFilterClass self => ReadAttr self TreeModel
treeModelFilterChildModel = String -> GType -> ReadAttr self TreeModel
forall gobj gobj'.
(GObjectClass gobj, GObjectClass gobj') =>
String -> GType -> ReadAttr gobj gobj'
readAttrFromObjectProperty String
"child-model"
                              GType
gtk_tree_model_get_type
{-# LINE 291 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}

-- %hash c:263d d:2dd5
-- | The virtual root (relative to the child model) for this filtermodel.
--
treeModelFilterVirtualRoot :: TreeModelFilterClass self => ReadAttr self TreePath
treeModelFilterVirtualRoot :: forall self. TreeModelFilterClass self => ReadAttr self TreePath
treeModelFilterVirtualRoot = (Ptr TreePath -> IO TreePath)
-> String -> GType -> ReadAttr self TreePath
forall gobj boxed.
GObjectClass gobj =>
(Ptr boxed -> IO boxed) -> String -> GType -> ReadAttr gobj boxed
readAttrFromBoxedOpaqueProperty (Ptr NativeTreePath -> IO TreePath
peekTreePath (Ptr NativeTreePath -> IO TreePath)
-> (Ptr TreePath -> Ptr NativeTreePath)
-> Ptr TreePath
-> IO TreePath
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr TreePath -> Ptr NativeTreePath
forall a b. Ptr a -> Ptr b
castPtr)
                             String
"virtual-root"
                             GType
gtk_tree_path_get_type
{-# LINE 299 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}

foreign import ccall safe "gtk_tree_model_filter_new"
  gtk_tree_model_filter_new :: ((Ptr TreeModel) -> ((Ptr NativeTreePath) -> (IO (Ptr TreeModel))))

foreign import ccall safe "gtk_tree_model_filter_set_visible_func"
  gtk_tree_model_filter_set_visible_func :: ((Ptr TreeModelFilter) -> ((FunPtr ((Ptr TreeModel) -> ((Ptr TreeIter) -> ((Ptr ()) -> (IO CInt))))) -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO ())))))

foreign import ccall safe "gtk_tree_model_filter_set_visible_column"
  gtk_tree_model_filter_set_visible_column :: ((Ptr TreeModelFilter) -> (CInt -> (IO ())))

foreign import ccall safe "gtk_tree_model_filter_get_model"
  gtk_tree_model_filter_get_model :: ((Ptr TreeModelFilter) -> (IO (Ptr TreeModel)))

foreign import ccall safe "gtk_tree_model_filter_convert_child_iter_to_iter"
  gtk_tree_model_filter_convert_child_iter_to_iter :: ((Ptr TreeModelFilter) -> ((Ptr TreeIter) -> ((Ptr TreeIter) -> (IO CInt))))

foreign import ccall safe "gtk_tree_model_filter_convert_iter_to_child_iter"
  gtk_tree_model_filter_convert_iter_to_child_iter :: ((Ptr TreeModelFilter) -> ((Ptr TreeIter) -> ((Ptr TreeIter) -> (IO ()))))

foreign import ccall unsafe "gtk_tree_model_filter_convert_child_path_to_path"
  gtk_tree_model_filter_convert_child_path_to_path :: ((Ptr TreeModelFilter) -> ((Ptr NativeTreePath) -> (IO (Ptr NativeTreePath))))

foreign import ccall safe "gtk_tree_model_filter_convert_path_to_child_path"
  gtk_tree_model_filter_convert_path_to_child_path :: ((Ptr TreeModelFilter) -> ((Ptr NativeTreePath) -> (IO (Ptr NativeTreePath))))

foreign import ccall safe "gtk_tree_model_filter_refilter"
  gtk_tree_model_filter_refilter :: ((Ptr TreeModelFilter) -> (IO ()))

foreign import ccall safe "gtk_tree_model_filter_clear_cache"
  gtk_tree_model_filter_clear_cache :: ((Ptr TreeModelFilter) -> (IO ()))

foreign import ccall unsafe "gtk_tree_model_get_type"
  gtk_tree_model_get_type :: CUInt

foreign import ccall unsafe "gtk_tree_path_get_type"
  gtk_tree_path_get_type :: CUInt