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

-- * Exported types
    Editable(..)                            ,
    noEditable                              ,
    EditableK                               ,


 -- * Methods
-- ** editableCopyClipboard
    editableCopyClipboard                   ,


-- ** editableCutClipboard
    editableCutClipboard                    ,


-- ** editableDeleteSelection
    editableDeleteSelection                 ,


-- ** editableDeleteText
    editableDeleteText                      ,


-- ** editableGetChars
    editableGetChars                        ,


-- ** editableGetEditable
    editableGetEditable                     ,


-- ** editableGetPosition
    editableGetPosition                     ,


-- ** editableGetSelectionBounds
    editableGetSelectionBounds              ,


-- ** editableInsertText
    editableInsertText                      ,


-- ** editablePasteClipboard
    editablePasteClipboard                  ,


-- ** editableSelectRegion
    editableSelectRegion                    ,


-- ** editableSetEditable
    editableSetEditable                     ,


-- ** editableSetPosition
    editableSetPosition                     ,




 -- * Signals
-- ** Changed
    EditableChangedCallback                 ,
    EditableChangedCallbackC                ,
    EditableChangedSignalInfo               ,
    afterEditableChanged                    ,
    editableChangedCallbackWrapper          ,
    editableChangedClosure                  ,
    mkEditableChangedCallback               ,
    noEditableChangedCallback               ,
    onEditableChanged                       ,


-- ** DeleteText
    EditableDeleteTextCallback              ,
    EditableDeleteTextCallbackC             ,
    EditableDeleteTextSignalInfo            ,
    afterEditableDeleteText                 ,
    editableDeleteTextCallbackWrapper       ,
    editableDeleteTextClosure               ,
    mkEditableDeleteTextCallback            ,
    noEditableDeleteTextCallback            ,
    onEditableDeleteText                    ,


-- ** InsertText
    EditableInsertTextCallback              ,
    EditableInsertTextCallbackC             ,
    EditableInsertTextSignalInfo            ,
    afterEditableInsertText                 ,
    editableInsertTextCallbackWrapper       ,
    editableInsertTextClosure               ,
    mkEditableInsertTextCallback            ,
    noEditableInsertTextCallback            ,
    onEditableInsertText                    ,




    ) 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

-- interface Editable 

newtype Editable = Editable (ForeignPtr Editable)
noEditable :: Maybe Editable
noEditable = Nothing

-- signal Editable::changed
type EditableChangedCallback =
    IO ()

noEditableChangedCallback :: Maybe EditableChangedCallback
noEditableChangedCallback = Nothing

type EditableChangedCallbackC =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkEditableChangedCallback :: EditableChangedCallbackC -> IO (FunPtr EditableChangedCallbackC)

editableChangedClosure :: EditableChangedCallback -> IO Closure
editableChangedClosure cb = newCClosure =<< mkEditableChangedCallback wrapped
    where wrapped = editableChangedCallbackWrapper cb

editableChangedCallbackWrapper ::
    EditableChangedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
editableChangedCallbackWrapper _cb _ _ = do
    _cb 

onEditableChanged :: (GObject a, MonadIO m) => a -> EditableChangedCallback -> m SignalHandlerId
onEditableChanged obj cb = liftIO $ connectEditableChanged obj cb SignalConnectBefore
afterEditableChanged :: (GObject a, MonadIO m) => a -> EditableChangedCallback -> m SignalHandlerId
afterEditableChanged obj cb = connectEditableChanged obj cb SignalConnectAfter

connectEditableChanged :: (GObject a, MonadIO m) =>
                          a -> EditableChangedCallback -> SignalConnectMode -> m SignalHandlerId
connectEditableChanged obj cb after = liftIO $ do
    cb' <- mkEditableChangedCallback (editableChangedCallbackWrapper cb)
    connectSignalFunPtr obj "changed" cb' after

-- signal Editable::delete-text
type EditableDeleteTextCallback =
    Int32 ->
    Int32 ->
    IO ()

noEditableDeleteTextCallback :: Maybe EditableDeleteTextCallback
noEditableDeleteTextCallback = Nothing

type EditableDeleteTextCallbackC =
    Ptr () ->                               -- object
    Int32 ->
    Int32 ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkEditableDeleteTextCallback :: EditableDeleteTextCallbackC -> IO (FunPtr EditableDeleteTextCallbackC)

editableDeleteTextClosure :: EditableDeleteTextCallback -> IO Closure
editableDeleteTextClosure cb = newCClosure =<< mkEditableDeleteTextCallback wrapped
    where wrapped = editableDeleteTextCallbackWrapper cb

editableDeleteTextCallbackWrapper ::
    EditableDeleteTextCallback ->
    Ptr () ->
    Int32 ->
    Int32 ->
    Ptr () ->
    IO ()
editableDeleteTextCallbackWrapper _cb _ start_pos end_pos _ = do
    _cb  start_pos end_pos

onEditableDeleteText :: (GObject a, MonadIO m) => a -> EditableDeleteTextCallback -> m SignalHandlerId
onEditableDeleteText obj cb = liftIO $ connectEditableDeleteText obj cb SignalConnectBefore
afterEditableDeleteText :: (GObject a, MonadIO m) => a -> EditableDeleteTextCallback -> m SignalHandlerId
afterEditableDeleteText obj cb = connectEditableDeleteText obj cb SignalConnectAfter

connectEditableDeleteText :: (GObject a, MonadIO m) =>
                             a -> EditableDeleteTextCallback -> SignalConnectMode -> m SignalHandlerId
connectEditableDeleteText obj cb after = liftIO $ do
    cb' <- mkEditableDeleteTextCallback (editableDeleteTextCallbackWrapper cb)
    connectSignalFunPtr obj "delete-text" cb' after

-- signal Editable::insert-text
type EditableInsertTextCallback =
    T.Text ->
    Int32 ->
    Int32 ->
    IO (Int32)

noEditableInsertTextCallback :: Maybe EditableInsertTextCallback
noEditableInsertTextCallback = Nothing

type EditableInsertTextCallbackC =
    Ptr () ->                               -- object
    CString ->
    Int32 ->
    Ptr Int32 ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkEditableInsertTextCallback :: EditableInsertTextCallbackC -> IO (FunPtr EditableInsertTextCallbackC)

editableInsertTextClosure :: EditableInsertTextCallback -> IO Closure
editableInsertTextClosure cb = newCClosure =<< mkEditableInsertTextCallback wrapped
    where wrapped = editableInsertTextCallbackWrapper cb

editableInsertTextCallbackWrapper ::
    EditableInsertTextCallback ->
    Ptr () ->
    CString ->
    Int32 ->
    Ptr Int32 ->
    Ptr () ->
    IO ()
editableInsertTextCallbackWrapper _cb _ new_text new_text_length position _ = do
    new_text' <- cstringToText new_text
    position' <- peek position
    outposition <- _cb  new_text' new_text_length position'
    poke position outposition

onEditableInsertText :: (GObject a, MonadIO m) => a -> EditableInsertTextCallback -> m SignalHandlerId
onEditableInsertText obj cb = liftIO $ connectEditableInsertText obj cb SignalConnectBefore
afterEditableInsertText :: (GObject a, MonadIO m) => a -> EditableInsertTextCallback -> m SignalHandlerId
afterEditableInsertText obj cb = connectEditableInsertText obj cb SignalConnectAfter

connectEditableInsertText :: (GObject a, MonadIO m) =>
                             a -> EditableInsertTextCallback -> SignalConnectMode -> m SignalHandlerId
connectEditableInsertText obj cb after = liftIO $ do
    cb' <- mkEditableInsertTextCallback (editableInsertTextCallbackWrapper cb)
    connectSignalFunPtr obj "insert-text" cb' after

type instance AttributeList Editable = EditableAttributeList
type EditableAttributeList = ('[ ] :: [(Symbol, *)])

data EditableChangedSignalInfo
instance SignalInfo EditableChangedSignalInfo where
    type HaskellCallbackType EditableChangedSignalInfo = EditableChangedCallback
    connectSignal _ = connectEditableChanged

data EditableDeleteTextSignalInfo
instance SignalInfo EditableDeleteTextSignalInfo where
    type HaskellCallbackType EditableDeleteTextSignalInfo = EditableDeleteTextCallback
    connectSignal _ = connectEditableDeleteText

data EditableInsertTextSignalInfo
instance SignalInfo EditableInsertTextSignalInfo where
    type HaskellCallbackType EditableInsertTextSignalInfo = EditableInsertTextCallback
    connectSignal _ = connectEditableInsertText

type instance SignalList Editable = EditableSignalList
type EditableSignalList = ('[ '("changed", EditableChangedSignalInfo), '("delete-text", EditableDeleteTextSignalInfo), '("insert-text", EditableInsertTextSignalInfo)] :: [(Symbol, *)])

class ForeignPtrNewtype a => EditableK a
instance (ForeignPtrNewtype o, IsDescendantOf Editable o) => EditableK o
type instance ParentTypes Editable = EditableParentTypes
type EditableParentTypes = '[]

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

foreign import ccall "gtk_editable_copy_clipboard" gtk_editable_copy_clipboard :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    IO ()


editableCopyClipboard ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    m ()
editableCopyClipboard _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_editable_copy_clipboard _obj'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "gtk_editable_cut_clipboard" gtk_editable_cut_clipboard :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    IO ()


editableCutClipboard ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    m ()
editableCutClipboard _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_editable_cut_clipboard _obj'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "gtk_editable_delete_selection" gtk_editable_delete_selection :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    IO ()


editableDeleteSelection ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    m ()
editableDeleteSelection _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_editable_delete_selection _obj'
    touchManagedPtr _obj
    return ()

-- method Editable::delete_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Editable", 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 "Gtk" "Editable", 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 "gtk_editable_delete_text" gtk_editable_delete_text :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    Int32 ->                                -- start_pos : TBasicType TInt32
    Int32 ->                                -- end_pos : TBasicType TInt32
    IO ()


editableDeleteText ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- start_pos
    Int32 ->                                -- end_pos
    m ()
editableDeleteText _obj start_pos end_pos = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_editable_delete_text _obj' start_pos end_pos
    touchManagedPtr _obj
    return ()

-- method Editable::get_chars
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Editable", 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 "Gtk" "Editable", 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 TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "gtk_editable_get_chars" gtk_editable_get_chars :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    Int32 ->                                -- start_pos : TBasicType TInt32
    Int32 ->                                -- end_pos : TBasicType TInt32
    IO CString


editableGetChars ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- start_pos
    Int32 ->                                -- end_pos
    m T.Text
editableGetChars _obj start_pos end_pos = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_editable_get_chars _obj' start_pos end_pos
    checkUnexpectedReturnNULL "gtk_editable_get_chars" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_editable_get_editable" gtk_editable_get_editable :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    IO CInt


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

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

foreign import ccall "gtk_editable_get_position" gtk_editable_get_position :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    IO Int32


editableGetPosition ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    m Int32
editableGetPosition _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_editable_get_position _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "gtk_editable_get_selection_bounds" gtk_editable_get_selection_bounds :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    Ptr Int32 ->                            -- start_pos : TBasicType TInt32
    Ptr Int32 ->                            -- end_pos : TBasicType TInt32
    IO CInt


editableGetSelectionBounds ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    m (Bool,Int32,Int32)
editableGetSelectionBounds _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    start_pos <- allocMem :: IO (Ptr Int32)
    end_pos <- allocMem :: IO (Ptr Int32)
    result <- gtk_editable_get_selection_bounds _obj' start_pos end_pos
    let result' = (/= 0) result
    start_pos' <- peek start_pos
    end_pos' <- peek end_pos
    touchManagedPtr _obj
    freeMem start_pos
    freeMem end_pos
    return (result', start_pos', end_pos')

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

foreign import ccall "gtk_editable_insert_text" gtk_editable_insert_text :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    CString ->                              -- new_text : TBasicType TUTF8
    Int32 ->                                -- new_text_length : TBasicType TInt32
    Ptr Int32 ->                            -- position : TBasicType TInt32
    IO ()


editableInsertText ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- new_text
    Int32 ->                                -- new_text_length
    Int32 ->                                -- position
    m (Int32)
editableInsertText _obj new_text new_text_length position = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    new_text' <- textToCString new_text
    position' <- allocMem :: IO (Ptr Int32)
    poke position' position
    gtk_editable_insert_text _obj' new_text' new_text_length position'
    position'' <- peek position'
    touchManagedPtr _obj
    freeMem new_text'
    freeMem position'
    return position''

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

foreign import ccall "gtk_editable_paste_clipboard" gtk_editable_paste_clipboard :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    IO ()


editablePasteClipboard ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    m ()
editablePasteClipboard _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_editable_paste_clipboard _obj'
    touchManagedPtr _obj
    return ()

-- method Editable::select_region
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Editable", 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 "Gtk" "Editable", 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 "gtk_editable_select_region" gtk_editable_select_region :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    Int32 ->                                -- start_pos : TBasicType TInt32
    Int32 ->                                -- end_pos : TBasicType TInt32
    IO ()


editableSelectRegion ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- start_pos
    Int32 ->                                -- end_pos
    m ()
editableSelectRegion _obj start_pos end_pos = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_editable_select_region _obj' start_pos end_pos
    touchManagedPtr _obj
    return ()

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

foreign import ccall "gtk_editable_set_editable" gtk_editable_set_editable :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    CInt ->                                 -- is_editable : TBasicType TBoolean
    IO ()


editableSetEditable ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- is_editable
    m ()
editableSetEditable _obj is_editable = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let is_editable' = (fromIntegral . fromEnum) is_editable
    gtk_editable_set_editable _obj' is_editable'
    touchManagedPtr _obj
    return ()

-- method Editable::set_position
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Editable", 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 "Gtk" "Editable", 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 "gtk_editable_set_position" gtk_editable_set_position :: 
    Ptr Editable ->                         -- _obj : TInterface "Gtk" "Editable"
    Int32 ->                                -- position : TBasicType TInt32
    IO ()


editableSetPosition ::
    (MonadIO m, EditableK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- position
    m ()
editableSetPosition _obj position = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_editable_set_position _obj' position
    touchManagedPtr _obj
    return ()