{- |
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.Atk.Interfaces.EditableText
    ( 

-- * Exported types
    EditableText(..)                        ,
    noEditableText                          ,
    EditableTextK                           ,


 -- * Methods
-- ** editableTextCopyText
    editableTextCopyText                    ,


-- ** editableTextCutText
    editableTextCutText                     ,


-- ** editableTextDeleteText
    editableTextDeleteText                  ,


-- ** editableTextInsertText
    editableTextInsertText                  ,


-- ** editableTextPasteText
    editableTextPasteText                   ,


-- ** editableTextSetRunAttributes
    editableTextSetRunAttributes            ,


-- ** editableTextSetTextContents
    editableTextSetTextContents             ,




    ) 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.Atk.Types
import GI.Atk.Callbacks

-- interface EditableText 

newtype EditableText = EditableText (ForeignPtr EditableText)
noEditableText :: Maybe EditableText
noEditableText = Nothing

type instance AttributeList EditableText = EditableTextAttributeList
type EditableTextAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList EditableText = EditableTextSignalList
type EditableTextSignalList = ('[ ] :: [(Symbol, *)])

class ForeignPtrNewtype a => EditableTextK a
instance (ForeignPtrNewtype o, IsDescendantOf EditableText o) => EditableTextK o
type instance ParentTypes EditableText = EditableTextParentTypes
type EditableTextParentTypes = '[]

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

foreign import ccall "atk_editable_text_copy_text" atk_editable_text_copy_text :: 
    Ptr EditableText ->                     -- _obj : TInterface "Atk" "EditableText"
    Int32 ->                                -- start_pos : TBasicType TInt32
    Int32 ->                                -- end_pos : TBasicType TInt32
    IO ()


editableTextCopyText ::
    (MonadIO m, EditableTextK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- start_pos
    Int32 ->                                -- end_pos
    m ()
editableTextCopyText _obj start_pos end_pos = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    atk_editable_text_copy_text _obj' start_pos end_pos
    touchManagedPtr _obj
    return ()

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

foreign import ccall "atk_editable_text_cut_text" atk_editable_text_cut_text :: 
    Ptr EditableText ->                     -- _obj : TInterface "Atk" "EditableText"
    Int32 ->                                -- start_pos : TBasicType TInt32
    Int32 ->                                -- end_pos : TBasicType TInt32
    IO ()


editableTextCutText ::
    (MonadIO m, EditableTextK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- start_pos
    Int32 ->                                -- end_pos
    m ()
editableTextCutText _obj start_pos end_pos = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    atk_editable_text_cut_text _obj' start_pos end_pos
    touchManagedPtr _obj
    return ()

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

foreign import ccall "atk_editable_text_delete_text" atk_editable_text_delete_text :: 
    Ptr EditableText ->                     -- _obj : TInterface "Atk" "EditableText"
    Int32 ->                                -- start_pos : TBasicType TInt32
    Int32 ->                                -- end_pos : TBasicType TInt32
    IO ()


editableTextDeleteText ::
    (MonadIO m, EditableTextK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- start_pos
    Int32 ->                                -- end_pos
    m ()
editableTextDeleteText _obj start_pos end_pos = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    atk_editable_text_delete_text _obj' start_pos end_pos
    touchManagedPtr _obj
    return ()

-- method EditableText::insert_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "EditableText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "EditableText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "atk_editable_text_insert_text" atk_editable_text_insert_text :: 
    Ptr EditableText ->                     -- _obj : TInterface "Atk" "EditableText"
    CString ->                              -- string : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt32
    Int32 ->                                -- position : TBasicType TInt32
    IO ()


editableTextInsertText ::
    (MonadIO m, EditableTextK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- string
    Int32 ->                                -- length
    Int32 ->                                -- position
    m ()
editableTextInsertText _obj string length_ position = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    string' <- textToCString string
    atk_editable_text_insert_text _obj' string' length_ position
    touchManagedPtr _obj
    freeMem string'
    return ()

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

foreign import ccall "atk_editable_text_paste_text" atk_editable_text_paste_text :: 
    Ptr EditableText ->                     -- _obj : TInterface "Atk" "EditableText"
    Int32 ->                                -- position : TBasicType TInt32
    IO ()


editableTextPasteText ::
    (MonadIO m, EditableTextK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- position
    m ()
editableTextPasteText _obj position = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    atk_editable_text_paste_text _obj' position
    touchManagedPtr _obj
    return ()

-- method EditableText::set_run_attributes
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "EditableText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attrib_set", argType = TGSList (TBasicType TVoid), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "start_offset", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "end_offset", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "EditableText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attrib_set", argType = TGSList (TBasicType TVoid), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "start_offset", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "end_offset", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "atk_editable_text_set_run_attributes" atk_editable_text_set_run_attributes :: 
    Ptr EditableText ->                     -- _obj : TInterface "Atk" "EditableText"
    Ptr (GSList (Ptr ())) ->                -- attrib_set : TGSList (TBasicType TVoid)
    Int32 ->                                -- start_offset : TBasicType TInt32
    Int32 ->                                -- end_offset : TBasicType TInt32
    IO CInt


editableTextSetRunAttributes ::
    (MonadIO m, EditableTextK a) =>
    a ->                                    -- _obj
    [Ptr ()] ->                             -- attrib_set
    Int32 ->                                -- start_offset
    Int32 ->                                -- end_offset
    m Bool
editableTextSetRunAttributes _obj attrib_set start_offset end_offset = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    attrib_set' <- packGSList attrib_set
    result <- atk_editable_text_set_run_attributes _obj' attrib_set' start_offset end_offset
    let result' = (/= 0) result
    touchManagedPtr _obj
    g_slist_free attrib_set'
    return result'

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

foreign import ccall "atk_editable_text_set_text_contents" atk_editable_text_set_text_contents :: 
    Ptr EditableText ->                     -- _obj : TInterface "Atk" "EditableText"
    CString ->                              -- string : TBasicType TUTF8
    IO ()


editableTextSetTextContents ::
    (MonadIO m, EditableTextK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- string
    m ()
editableTextSetTextContents _obj string = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    string' <- textToCString string
    atk_editable_text_set_text_contents _obj' string'
    touchManagedPtr _obj
    freeMem string'
    return ()