{-# LINE 2 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
module Graphics.UI.Gtk.ModelView.TreeModelFilter (
  TreeModelFilter,
  TypedTreeModelFilter,
  TreeModelFilterClass,
  castToTreeModelFilter, gTypeTreeModelFilter,
  toTreeModelFilter,
  treeModelFilterNew,
  treeModelFilterSetVisibleFunc,
  treeModelFilterSetVisibleColumn,
  treeModelFilterGetModel,
  treeModelFilterConvertChildIterToIter,
  treeModelFilterConvertIterToChildIter,
  treeModelFilterConvertChildPathToPath,
  treeModelFilterConvertPathToChildPath,
  treeModelFilterRefilter,
  treeModelFilterClearCache,
  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" #-}
instance TreeModelClass (TypedTreeModelFilter a)
instance TreeModelFilterClass (TypedTreeModelFilter a)
instance GObjectClass (TypedTreeModelFilter a) where
  toGObject (TypedTreeModelFilter tm) = GObject (castForeignPtr tm)
  unsafeCastGObject = TypedTreeModelFilter . castForeignPtr . unGObject
treeModelFilterNew :: (TreeModelClass (childModel row),
                       TypedTreeModelClass childModel) =>
    childModel row 
 -> TreePath 
 -> IO (TypedTreeModelFilter row)
treeModelFilterNew childModel [] =
  liftM unsafeTreeModelFilterToGeneric $
  wrapNewGObject mkTreeModelFilter $
  liftM (castPtr :: Ptr TreeModel -> Ptr TreeModelFilter) $
  (\(TreeModel arg1) (NativeTreePath arg2) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_filter_new argPtr1 arg2)
{-# LINE 122 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModel childModel)
    (NativeTreePath nullPtr)
treeModelFilterNew childModel root =
  liftM unsafeTreeModelFilterToGeneric $
  wrapNewGObject mkTreeModelFilter $
  liftM (castPtr :: Ptr TreeModel -> Ptr TreeModelFilter) $
  withTreePath root $ \root ->
  (\(TreeModel arg1) (NativeTreePath arg2) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_filter_new argPtr1 arg2)
{-# LINE 130 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModel childModel)
    root
treeModelFilterSetVisibleFunc :: TreeModelFilterClass self => self
 -> (TreeIter -> IO Bool) 
 -> IO ()
treeModelFilterSetVisibleFunc self func = do
  funcPtr <- mkTreeModelFilterVisibleFunc $ \_ tiPtr _ -> do
    ti <- peekTreeIter tiPtr
    liftM fromBool $ func ti
  (\(TreeModelFilter arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_filter_set_visible_func argPtr1 arg2 arg3 arg4)
{-# LINE 158 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self) funcPtr (castFunPtrToPtr funcPtr) 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
treeModelFilterSetVisibleColumn ::
 (TreeModelFilterClass (self row),
  TypedTreeModelClass self)
 => self row
 -> ColumnId row Bool 
                      
 -> IO ()
treeModelFilterSetVisibleColumn self col =
  (\(TreeModelFilter arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_filter_set_visible_column argPtr1 arg2)
{-# LINE 180 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
    ((fromIntegral . columnIdToNumber) col)
treeModelFilterGetModel :: TreeModelFilterClass self => self
 -> IO (Maybe TreeModel) 
treeModelFilterGetModel self =
  maybeNull (makeNewGObject mkTreeModel) $
  (\(TreeModelFilter arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_filter_get_model argPtr1)
{-# LINE 191 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
treeModelFilterConvertChildIterToIter :: TreeModelFilterClass self => self
 -> TreeIter
 -> IO TreeIter
treeModelFilterConvertChildIterToIter self childIter =
  with childIter $ \childIterPtr ->
  alloca $ \filterIterPtr -> do
  (\(TreeModelFilter arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_filter_convert_child_iter_to_iter argPtr1 arg2 arg3)
{-# LINE 204 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
    filterIterPtr
    childIterPtr
  peek filterIterPtr
treeModelFilterConvertIterToChildIter :: TreeModelFilterClass self => self
 -> TreeIter
 -> IO TreeIter
treeModelFilterConvertIterToChildIter self filteredIter =
  with filteredIter $ \filteredIterPtr ->
  alloca $ \childIterPtr -> do
  (\(TreeModelFilter arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_filter_convert_iter_to_child_iter argPtr1 arg2 arg3)
{-# LINE 220 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
    childIterPtr
    filteredIterPtr
  peek childIterPtr
treeModelFilterConvertChildPathToPath :: TreeModelFilterClass self => self
 -> TreePath
 -> IO TreePath
treeModelFilterConvertChildPathToPath self [] = return []
treeModelFilterConvertChildPathToPath self childPath =
  withTreePath childPath $ \childPath ->
  (\(TreeModelFilter arg1) (NativeTreePath arg2) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_filter_convert_child_path_to_path argPtr1 arg2)
{-# LINE 238 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
    childPath
  >>= fromTreePath
treeModelFilterConvertPathToChildPath :: TreeModelFilterClass self => self
 -> TreePath
 -> IO TreePath
treeModelFilterConvertPathToChildPath self [] = return []
treeModelFilterConvertPathToChildPath self filteredPath =
  withTreePath filteredPath $ \filteredPath ->
  (\(TreeModelFilter arg1) (NativeTreePath arg2) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_filter_convert_path_to_child_path argPtr1 arg2)
{-# LINE 255 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
    filteredPath
  >>= fromTreePath
treeModelFilterRefilter :: TreeModelFilterClass self => self -> IO ()
treeModelFilterRefilter self =
  (\(TreeModelFilter arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_filter_refilter argPtr1)
{-# LINE 266 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
treeModelFilterClearCache :: TreeModelFilterClass self
 => self 
 -> IO ()
treeModelFilterClearCache self =
  (\(TreeModelFilter arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_tree_model_filter_clear_cache argPtr1)
{-# LINE 280 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
    (toTreeModelFilter self)
treeModelFilterChildModel :: TreeModelFilterClass self => ReadAttr self TreeModel
treeModelFilterChildModel = readAttrFromObjectProperty "child-model"
                              gtk_tree_model_get_type
{-# LINE 291 "./Graphics/UI/Gtk/ModelView/TreeModelFilter.chs" #-}
treeModelFilterVirtualRoot :: TreeModelFilterClass self => ReadAttr self TreePath
treeModelFilterVirtualRoot = readAttrFromBoxedOpaqueProperty (peekTreePath . castPtr)
                             "virtual-root"
                             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 :: CULong
foreign import ccall unsafe "gtk_tree_path_get_type"
  gtk_tree_path_get_type :: CULong