{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

A GtkTreeRowReference tracks model changes so that it always refers to the
same row (a #GtkTreePath refers to a position, not a fixed row). Create a
new GtkTreeRowReference with gtk_tree_row_reference_new().
-}

module GI.Gtk.Structs.TreeRowReference
    ( 

-- * Exported types
    TreeRowReference(..)                    ,
    noTreeRowReference                      ,


 -- * Methods
-- ** treeRowReferenceCopy
    treeRowReferenceCopy                    ,


-- ** treeRowReferenceFree
    treeRowReferenceFree                    ,


-- ** treeRowReferenceGetModel
    treeRowReferenceGetModel                ,


-- ** treeRowReferenceGetPath
    treeRowReferenceGetPath                 ,


-- ** treeRowReferenceNew
    treeRowReferenceNew                     ,


-- ** treeRowReferenceNewProxy
    treeRowReferenceNewProxy                ,


-- ** treeRowReferenceValid
    treeRowReferenceValid                   ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gtk.Types
import GI.Gtk.Callbacks
import qualified GI.GObject as GObject

newtype TreeRowReference = TreeRowReference (ForeignPtr TreeRowReference)
foreign import ccall "gtk_tree_row_reference_get_type" c_gtk_tree_row_reference_get_type :: 
    IO GType

instance BoxedObject TreeRowReference where
    boxedType _ = c_gtk_tree_row_reference_get_type

noTreeRowReference :: Maybe TreeRowReference
noTreeRowReference = Nothing

-- method TreeRowReference::new
-- method type : Constructor
-- Args : [Arg {argName = "model", argType = TInterface "Gtk" "TreeModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TInterface "Gtk" "TreePath", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "model", argType = TInterface "Gtk" "TreeModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TInterface "Gtk" "TreePath", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "TreeRowReference"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_tree_row_reference_new" gtk_tree_row_reference_new :: 
    Ptr TreeModel ->                        -- model : TInterface "Gtk" "TreeModel"
    Ptr TreePath ->                         -- path : TInterface "Gtk" "TreePath"
    IO (Ptr TreeRowReference)


treeRowReferenceNew ::
    (MonadIO m, TreeModelK a) =>
    a ->                                    -- model
    TreePath ->                             -- path
    m TreeRowReference
treeRowReferenceNew model path = liftIO $ do
    let model' = unsafeManagedPtrCastPtr model
    let path' = unsafeManagedPtrGetPtr path
    result <- gtk_tree_row_reference_new model' path'
    checkUnexpectedReturnNULL "gtk_tree_row_reference_new" result
    result' <- (wrapBoxed TreeRowReference) result
    touchManagedPtr model
    touchManagedPtr path
    return result'

-- method TreeRowReference::new_proxy
-- method type : Constructor
-- Args : [Arg {argName = "proxy", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "model", argType = TInterface "Gtk" "TreeModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TInterface "Gtk" "TreePath", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "proxy", argType = TInterface "GObject" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "model", argType = TInterface "Gtk" "TreeModel", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TInterface "Gtk" "TreePath", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "TreeRowReference"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_tree_row_reference_new_proxy" gtk_tree_row_reference_new_proxy :: 
    Ptr GObject.Object ->                   -- proxy : TInterface "GObject" "Object"
    Ptr TreeModel ->                        -- model : TInterface "Gtk" "TreeModel"
    Ptr TreePath ->                         -- path : TInterface "Gtk" "TreePath"
    IO (Ptr TreeRowReference)


treeRowReferenceNewProxy ::
    (MonadIO m, GObject.ObjectK a, TreeModelK b) =>
    a ->                                    -- proxy
    b ->                                    -- model
    TreePath ->                             -- path
    m TreeRowReference
treeRowReferenceNewProxy proxy model path = liftIO $ do
    let proxy' = unsafeManagedPtrCastPtr proxy
    let model' = unsafeManagedPtrCastPtr model
    let path' = unsafeManagedPtrGetPtr path
    result <- gtk_tree_row_reference_new_proxy proxy' model' path'
    checkUnexpectedReturnNULL "gtk_tree_row_reference_new_proxy" result
    result' <- (wrapBoxed TreeRowReference) result
    touchManagedPtr proxy
    touchManagedPtr model
    touchManagedPtr path
    return result'

-- method TreeRowReference::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "TreeRowReference", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "TreeRowReference", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "TreeRowReference"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_tree_row_reference_copy" gtk_tree_row_reference_copy :: 
    Ptr TreeRowReference ->                 -- _obj : TInterface "Gtk" "TreeRowReference"
    IO (Ptr TreeRowReference)


treeRowReferenceCopy ::
    (MonadIO m) =>
    TreeRowReference ->                     -- _obj
    m TreeRowReference
treeRowReferenceCopy _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_tree_row_reference_copy _obj'
    checkUnexpectedReturnNULL "gtk_tree_row_reference_copy" result
    result' <- (wrapBoxed TreeRowReference) result
    touchManagedPtr _obj
    return result'

-- method TreeRowReference::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "TreeRowReference", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "TreeRowReference", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_tree_row_reference_free" gtk_tree_row_reference_free :: 
    Ptr TreeRowReference ->                 -- _obj : TInterface "Gtk" "TreeRowReference"
    IO ()


treeRowReferenceFree ::
    (MonadIO m) =>
    TreeRowReference ->                     -- _obj
    m ()
treeRowReferenceFree _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    gtk_tree_row_reference_free _obj'
    touchManagedPtr _obj
    return ()

-- method TreeRowReference::get_model
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "TreeRowReference", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "TreeRowReference", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "TreeModel"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_tree_row_reference_get_model" gtk_tree_row_reference_get_model :: 
    Ptr TreeRowReference ->                 -- _obj : TInterface "Gtk" "TreeRowReference"
    IO (Ptr TreeModel)


treeRowReferenceGetModel ::
    (MonadIO m) =>
    TreeRowReference ->                     -- _obj
    m TreeModel
treeRowReferenceGetModel _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_tree_row_reference_get_model _obj'
    checkUnexpectedReturnNULL "gtk_tree_row_reference_get_model" result
    result' <- (newObject TreeModel) result
    touchManagedPtr _obj
    return result'

-- method TreeRowReference::get_path
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "TreeRowReference", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "TreeRowReference", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "TreePath"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_tree_row_reference_get_path" gtk_tree_row_reference_get_path :: 
    Ptr TreeRowReference ->                 -- _obj : TInterface "Gtk" "TreeRowReference"
    IO (Ptr TreePath)


treeRowReferenceGetPath ::
    (MonadIO m) =>
    TreeRowReference ->                     -- _obj
    m TreePath
treeRowReferenceGetPath _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_tree_row_reference_get_path _obj'
    checkUnexpectedReturnNULL "gtk_tree_row_reference_get_path" result
    result' <- (wrapBoxed TreePath) result
    touchManagedPtr _obj
    return result'

-- method TreeRowReference::valid
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "TreeRowReference", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "TreeRowReference", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_tree_row_reference_valid" gtk_tree_row_reference_valid :: 
    Ptr TreeRowReference ->                 -- _obj : TInterface "Gtk" "TreeRowReference"
    IO CInt


treeRowReferenceValid ::
    (MonadIO m) =>
    TreeRowReference ->                     -- _obj
    m Bool
treeRowReferenceValid _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_tree_row_reference_valid _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'