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

module GI.Gtk.Objects.TextChildAnchor
    ( 

-- * Exported types
    TextChildAnchor(..)                     ,
    TextChildAnchorK                        ,
    toTextChildAnchor                       ,
    noTextChildAnchor                       ,


 -- * Methods
-- ** textChildAnchorGetDeleted
    textChildAnchorGetDeleted               ,


-- ** textChildAnchorGetWidgets
    textChildAnchorGetWidgets               ,


-- ** textChildAnchorNew
    textChildAnchorNew                      ,




    ) 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 TextChildAnchor = TextChildAnchor (ForeignPtr TextChildAnchor)
foreign import ccall "gtk_text_child_anchor_get_type"
    c_gtk_text_child_anchor_get_type :: IO GType

type instance ParentTypes TextChildAnchor = TextChildAnchorParentTypes
type TextChildAnchorParentTypes = '[GObject.Object]

instance GObject TextChildAnchor where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_text_child_anchor_get_type
    

class GObject o => TextChildAnchorK o
instance (GObject o, IsDescendantOf TextChildAnchor o) => TextChildAnchorK o

toTextChildAnchor :: TextChildAnchorK o => o -> IO TextChildAnchor
toTextChildAnchor = unsafeCastTo TextChildAnchor

noTextChildAnchor :: Maybe TextChildAnchor
noTextChildAnchor = Nothing

type instance AttributeList TextChildAnchor = TextChildAnchorAttributeList
type TextChildAnchorAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList TextChildAnchor = TextChildAnchorSignalList
type TextChildAnchorSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method TextChildAnchor::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gtk" "TextChildAnchor"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_text_child_anchor_new" gtk_text_child_anchor_new :: 
    IO (Ptr TextChildAnchor)


textChildAnchorNew ::
    (MonadIO m) =>
    m TextChildAnchor
textChildAnchorNew  = liftIO $ do
    result <- gtk_text_child_anchor_new
    checkUnexpectedReturnNULL "gtk_text_child_anchor_new" result
    result' <- (wrapObject TextChildAnchor) result
    return result'

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

foreign import ccall "gtk_text_child_anchor_get_deleted" gtk_text_child_anchor_get_deleted :: 
    Ptr TextChildAnchor ->                  -- _obj : TInterface "Gtk" "TextChildAnchor"
    IO CInt


textChildAnchorGetDeleted ::
    (MonadIO m, TextChildAnchorK a) =>
    a ->                                    -- _obj
    m Bool
textChildAnchorGetDeleted _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_text_child_anchor_get_deleted _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_text_child_anchor_get_widgets" gtk_text_child_anchor_get_widgets :: 
    Ptr TextChildAnchor ->                  -- _obj : TInterface "Gtk" "TextChildAnchor"
    IO (Ptr (GList (Ptr Widget)))


textChildAnchorGetWidgets ::
    (MonadIO m, TextChildAnchorK a) =>
    a ->                                    -- _obj
    m [Widget]
textChildAnchorGetWidgets _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_text_child_anchor_get_widgets _obj'
    checkUnexpectedReturnNULL "gtk_text_child_anchor_get_widgets" result
    result' <- unpackGList result
    result'' <- mapM (newObject Widget) result'
    g_list_free result
    touchManagedPtr _obj
    return result''