{- |
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.EntryBuffer
    ( 

-- * Exported types
    EntryBuffer(..)                         ,
    EntryBufferK                            ,
    toEntryBuffer                           ,
    noEntryBuffer                           ,


 -- * Methods
-- ** entryBufferDeleteText
    entryBufferDeleteText                   ,


-- ** entryBufferEmitDeletedText
    entryBufferEmitDeletedText              ,


-- ** entryBufferEmitInsertedText
    entryBufferEmitInsertedText             ,


-- ** entryBufferGetBytes
    entryBufferGetBytes                     ,


-- ** entryBufferGetLength
    entryBufferGetLength                    ,


-- ** entryBufferGetMaxLength
    entryBufferGetMaxLength                 ,


-- ** entryBufferGetText
    entryBufferGetText                      ,


-- ** entryBufferInsertText
    entryBufferInsertText                   ,


-- ** entryBufferNew
    entryBufferNew                          ,


-- ** entryBufferSetMaxLength
    entryBufferSetMaxLength                 ,


-- ** entryBufferSetText
    entryBufferSetText                      ,




 -- * Properties
-- ** Length
    EntryBufferLengthPropertyInfo           ,
    getEntryBufferLength                    ,


-- ** MaxLength
    EntryBufferMaxLengthPropertyInfo        ,
    constructEntryBufferMaxLength           ,
    getEntryBufferMaxLength                 ,
    setEntryBufferMaxLength                 ,


-- ** Text
    EntryBufferTextPropertyInfo             ,
    constructEntryBufferText                ,
    getEntryBufferText                      ,
    setEntryBufferText                      ,




 -- * Signals
-- ** DeletedText
    EntryBufferDeletedTextCallback          ,
    EntryBufferDeletedTextCallbackC         ,
    EntryBufferDeletedTextSignalInfo        ,
    afterEntryBufferDeletedText             ,
    entryBufferDeletedTextCallbackWrapper   ,
    entryBufferDeletedTextClosure           ,
    mkEntryBufferDeletedTextCallback        ,
    noEntryBufferDeletedTextCallback        ,
    onEntryBufferDeletedText                ,


-- ** InsertedText
    EntryBufferInsertedTextCallback         ,
    EntryBufferInsertedTextCallbackC        ,
    EntryBufferInsertedTextSignalInfo       ,
    afterEntryBufferInsertedText            ,
    entryBufferInsertedTextCallbackWrapper  ,
    entryBufferInsertedTextClosure          ,
    mkEntryBufferInsertedTextCallback       ,
    noEntryBufferInsertedTextCallback       ,
    onEntryBufferInsertedText               ,




    ) 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 EntryBuffer = EntryBuffer (ForeignPtr EntryBuffer)
foreign import ccall "gtk_entry_buffer_get_type"
    c_gtk_entry_buffer_get_type :: IO GType

type instance ParentTypes EntryBuffer = EntryBufferParentTypes
type EntryBufferParentTypes = '[GObject.Object]

instance GObject EntryBuffer where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_entry_buffer_get_type
    

class GObject o => EntryBufferK o
instance (GObject o, IsDescendantOf EntryBuffer o) => EntryBufferK o

toEntryBuffer :: EntryBufferK o => o -> IO EntryBuffer
toEntryBuffer = unsafeCastTo EntryBuffer

noEntryBuffer :: Maybe EntryBuffer
noEntryBuffer = Nothing

-- signal EntryBuffer::deleted-text
type EntryBufferDeletedTextCallback =
    Word32 ->
    Word32 ->
    IO ()

noEntryBufferDeletedTextCallback :: Maybe EntryBufferDeletedTextCallback
noEntryBufferDeletedTextCallback = Nothing

type EntryBufferDeletedTextCallbackC =
    Ptr () ->                               -- object
    Word32 ->
    Word32 ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkEntryBufferDeletedTextCallback :: EntryBufferDeletedTextCallbackC -> IO (FunPtr EntryBufferDeletedTextCallbackC)

entryBufferDeletedTextClosure :: EntryBufferDeletedTextCallback -> IO Closure
entryBufferDeletedTextClosure cb = newCClosure =<< mkEntryBufferDeletedTextCallback wrapped
    where wrapped = entryBufferDeletedTextCallbackWrapper cb

entryBufferDeletedTextCallbackWrapper ::
    EntryBufferDeletedTextCallback ->
    Ptr () ->
    Word32 ->
    Word32 ->
    Ptr () ->
    IO ()
entryBufferDeletedTextCallbackWrapper _cb _ position n_chars _ = do
    _cb  position n_chars

onEntryBufferDeletedText :: (GObject a, MonadIO m) => a -> EntryBufferDeletedTextCallback -> m SignalHandlerId
onEntryBufferDeletedText obj cb = liftIO $ connectEntryBufferDeletedText obj cb SignalConnectBefore
afterEntryBufferDeletedText :: (GObject a, MonadIO m) => a -> EntryBufferDeletedTextCallback -> m SignalHandlerId
afterEntryBufferDeletedText obj cb = connectEntryBufferDeletedText obj cb SignalConnectAfter

connectEntryBufferDeletedText :: (GObject a, MonadIO m) =>
                                 a -> EntryBufferDeletedTextCallback -> SignalConnectMode -> m SignalHandlerId
connectEntryBufferDeletedText obj cb after = liftIO $ do
    cb' <- mkEntryBufferDeletedTextCallback (entryBufferDeletedTextCallbackWrapper cb)
    connectSignalFunPtr obj "deleted-text" cb' after

-- signal EntryBuffer::inserted-text
type EntryBufferInsertedTextCallback =
    Word32 ->
    T.Text ->
    Word32 ->
    IO ()

noEntryBufferInsertedTextCallback :: Maybe EntryBufferInsertedTextCallback
noEntryBufferInsertedTextCallback = Nothing

type EntryBufferInsertedTextCallbackC =
    Ptr () ->                               -- object
    Word32 ->
    CString ->
    Word32 ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkEntryBufferInsertedTextCallback :: EntryBufferInsertedTextCallbackC -> IO (FunPtr EntryBufferInsertedTextCallbackC)

entryBufferInsertedTextClosure :: EntryBufferInsertedTextCallback -> IO Closure
entryBufferInsertedTextClosure cb = newCClosure =<< mkEntryBufferInsertedTextCallback wrapped
    where wrapped = entryBufferInsertedTextCallbackWrapper cb

entryBufferInsertedTextCallbackWrapper ::
    EntryBufferInsertedTextCallback ->
    Ptr () ->
    Word32 ->
    CString ->
    Word32 ->
    Ptr () ->
    IO ()
entryBufferInsertedTextCallbackWrapper _cb _ position chars n_chars _ = do
    chars' <- cstringToText chars
    _cb  position chars' n_chars

onEntryBufferInsertedText :: (GObject a, MonadIO m) => a -> EntryBufferInsertedTextCallback -> m SignalHandlerId
onEntryBufferInsertedText obj cb = liftIO $ connectEntryBufferInsertedText obj cb SignalConnectBefore
afterEntryBufferInsertedText :: (GObject a, MonadIO m) => a -> EntryBufferInsertedTextCallback -> m SignalHandlerId
afterEntryBufferInsertedText obj cb = connectEntryBufferInsertedText obj cb SignalConnectAfter

connectEntryBufferInsertedText :: (GObject a, MonadIO m) =>
                                  a -> EntryBufferInsertedTextCallback -> SignalConnectMode -> m SignalHandlerId
connectEntryBufferInsertedText obj cb after = liftIO $ do
    cb' <- mkEntryBufferInsertedTextCallback (entryBufferInsertedTextCallbackWrapper cb)
    connectSignalFunPtr obj "inserted-text" cb' after

-- VVV Prop "length"
   -- Type: TBasicType TUInt32
   -- Flags: [PropertyReadable]

getEntryBufferLength :: (MonadIO m, EntryBufferK o) => o -> m Word32
getEntryBufferLength obj = liftIO $ getObjectPropertyCUInt obj "length"

data EntryBufferLengthPropertyInfo
instance AttrInfo EntryBufferLengthPropertyInfo where
    type AttrAllowedOps EntryBufferLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint EntryBufferLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint EntryBufferLengthPropertyInfo = EntryBufferK
    type AttrGetType EntryBufferLengthPropertyInfo = Word32
    type AttrLabel EntryBufferLengthPropertyInfo = "EntryBuffer::length"
    attrGet _ = getEntryBufferLength
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "max-length"
   -- Type: TBasicType TInt32
   -- Flags: [PropertyReadable,PropertyWritable]

getEntryBufferMaxLength :: (MonadIO m, EntryBufferK o) => o -> m Int32
getEntryBufferMaxLength obj = liftIO $ getObjectPropertyCInt obj "max-length"

setEntryBufferMaxLength :: (MonadIO m, EntryBufferK o) => o -> Int32 -> m ()
setEntryBufferMaxLength obj val = liftIO $ setObjectPropertyCInt obj "max-length" val

constructEntryBufferMaxLength :: Int32 -> IO ([Char], GValue)
constructEntryBufferMaxLength val = constructObjectPropertyCInt "max-length" val

data EntryBufferMaxLengthPropertyInfo
instance AttrInfo EntryBufferMaxLengthPropertyInfo where
    type AttrAllowedOps EntryBufferMaxLengthPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint EntryBufferMaxLengthPropertyInfo = (~) Int32
    type AttrBaseTypeConstraint EntryBufferMaxLengthPropertyInfo = EntryBufferK
    type AttrGetType EntryBufferMaxLengthPropertyInfo = Int32
    type AttrLabel EntryBufferMaxLengthPropertyInfo = "EntryBuffer::max-length"
    attrGet _ = getEntryBufferMaxLength
    attrSet _ = setEntryBufferMaxLength
    attrConstruct _ = constructEntryBufferMaxLength

-- VVV Prop "text"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]

getEntryBufferText :: (MonadIO m, EntryBufferK o) => o -> m T.Text
getEntryBufferText obj = liftIO $ getObjectPropertyString obj "text"

setEntryBufferText :: (MonadIO m, EntryBufferK o) => o -> T.Text -> m ()
setEntryBufferText obj val = liftIO $ setObjectPropertyString obj "text" val

constructEntryBufferText :: T.Text -> IO ([Char], GValue)
constructEntryBufferText val = constructObjectPropertyString "text" val

data EntryBufferTextPropertyInfo
instance AttrInfo EntryBufferTextPropertyInfo where
    type AttrAllowedOps EntryBufferTextPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint EntryBufferTextPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint EntryBufferTextPropertyInfo = EntryBufferK
    type AttrGetType EntryBufferTextPropertyInfo = T.Text
    type AttrLabel EntryBufferTextPropertyInfo = "EntryBuffer::text"
    attrGet _ = getEntryBufferText
    attrSet _ = setEntryBufferText
    attrConstruct _ = constructEntryBufferText

type instance AttributeList EntryBuffer = EntryBufferAttributeList
type EntryBufferAttributeList = ('[ '("length", EntryBufferLengthPropertyInfo), '("max-length", EntryBufferMaxLengthPropertyInfo), '("text", EntryBufferTextPropertyInfo)] :: [(Symbol, *)])

data EntryBufferDeletedTextSignalInfo
instance SignalInfo EntryBufferDeletedTextSignalInfo where
    type HaskellCallbackType EntryBufferDeletedTextSignalInfo = EntryBufferDeletedTextCallback
    connectSignal _ = connectEntryBufferDeletedText

data EntryBufferInsertedTextSignalInfo
instance SignalInfo EntryBufferInsertedTextSignalInfo where
    type HaskellCallbackType EntryBufferInsertedTextSignalInfo = EntryBufferInsertedTextCallback
    connectSignal _ = connectEntryBufferInsertedText

type instance SignalList EntryBuffer = EntryBufferSignalList
type EntryBufferSignalList = ('[ '("deleted-text", EntryBufferDeletedTextSignalInfo), '("inserted-text", EntryBufferInsertedTextSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method EntryBuffer::new
-- method type : Constructor
-- Args : [Arg {argName = "initial_chars", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_initial_chars", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "initial_chars", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_initial_chars", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "EntryBuffer"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_entry_buffer_new" gtk_entry_buffer_new :: 
    CString ->                              -- initial_chars : TBasicType TUTF8
    Int32 ->                                -- n_initial_chars : TBasicType TInt32
    IO (Ptr EntryBuffer)


entryBufferNew ::
    (MonadIO m) =>
    Maybe (T.Text) ->                       -- initial_chars
    Int32 ->                                -- n_initial_chars
    m EntryBuffer
entryBufferNew initial_chars n_initial_chars = liftIO $ do
    maybeInitial_chars <- case initial_chars of
        Nothing -> return nullPtr
        Just jInitial_chars -> do
            jInitial_chars' <- textToCString jInitial_chars
            return jInitial_chars'
    result <- gtk_entry_buffer_new maybeInitial_chars n_initial_chars
    checkUnexpectedReturnNULL "gtk_entry_buffer_new" result
    result' <- (wrapObject EntryBuffer) result
    freeMem maybeInitial_chars
    return result'

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

foreign import ccall "gtk_entry_buffer_delete_text" gtk_entry_buffer_delete_text :: 
    Ptr EntryBuffer ->                      -- _obj : TInterface "Gtk" "EntryBuffer"
    Word32 ->                               -- position : TBasicType TUInt32
    Int32 ->                                -- n_chars : TBasicType TInt32
    IO Word32


entryBufferDeleteText ::
    (MonadIO m, EntryBufferK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- position
    Int32 ->                                -- n_chars
    m Word32
entryBufferDeleteText _obj position n_chars = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_entry_buffer_delete_text _obj' position n_chars
    touchManagedPtr _obj
    return result

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

foreign import ccall "gtk_entry_buffer_emit_deleted_text" gtk_entry_buffer_emit_deleted_text :: 
    Ptr EntryBuffer ->                      -- _obj : TInterface "Gtk" "EntryBuffer"
    Word32 ->                               -- position : TBasicType TUInt32
    Word32 ->                               -- n_chars : TBasicType TUInt32
    IO ()


entryBufferEmitDeletedText ::
    (MonadIO m, EntryBufferK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- position
    Word32 ->                               -- n_chars
    m ()
entryBufferEmitDeletedText _obj position n_chars = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_entry_buffer_emit_deleted_text _obj' position n_chars
    touchManagedPtr _obj
    return ()

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

foreign import ccall "gtk_entry_buffer_emit_inserted_text" gtk_entry_buffer_emit_inserted_text :: 
    Ptr EntryBuffer ->                      -- _obj : TInterface "Gtk" "EntryBuffer"
    Word32 ->                               -- position : TBasicType TUInt32
    CString ->                              -- chars : TBasicType TUTF8
    Word32 ->                               -- n_chars : TBasicType TUInt32
    IO ()


entryBufferEmitInsertedText ::
    (MonadIO m, EntryBufferK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- position
    T.Text ->                               -- chars
    Word32 ->                               -- n_chars
    m ()
entryBufferEmitInsertedText _obj position chars n_chars = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    chars' <- textToCString chars
    gtk_entry_buffer_emit_inserted_text _obj' position chars' n_chars
    touchManagedPtr _obj
    freeMem chars'
    return ()

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

foreign import ccall "gtk_entry_buffer_get_bytes" gtk_entry_buffer_get_bytes :: 
    Ptr EntryBuffer ->                      -- _obj : TInterface "Gtk" "EntryBuffer"
    IO Word64


entryBufferGetBytes ::
    (MonadIO m, EntryBufferK a) =>
    a ->                                    -- _obj
    m Word64
entryBufferGetBytes _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_entry_buffer_get_bytes _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "gtk_entry_buffer_get_length" gtk_entry_buffer_get_length :: 
    Ptr EntryBuffer ->                      -- _obj : TInterface "Gtk" "EntryBuffer"
    IO Word32


entryBufferGetLength ::
    (MonadIO m, EntryBufferK a) =>
    a ->                                    -- _obj
    m Word32
entryBufferGetLength _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_entry_buffer_get_length _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "gtk_entry_buffer_get_max_length" gtk_entry_buffer_get_max_length :: 
    Ptr EntryBuffer ->                      -- _obj : TInterface "Gtk" "EntryBuffer"
    IO Int32


entryBufferGetMaxLength ::
    (MonadIO m, EntryBufferK a) =>
    a ->                                    -- _obj
    m Int32
entryBufferGetMaxLength _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_entry_buffer_get_max_length _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "gtk_entry_buffer_get_text" gtk_entry_buffer_get_text :: 
    Ptr EntryBuffer ->                      -- _obj : TInterface "Gtk" "EntryBuffer"
    IO CString


entryBufferGetText ::
    (MonadIO m, EntryBufferK a) =>
    a ->                                    -- _obj
    m T.Text
entryBufferGetText _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_entry_buffer_get_text _obj'
    checkUnexpectedReturnNULL "gtk_entry_buffer_get_text" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_entry_buffer_insert_text" gtk_entry_buffer_insert_text :: 
    Ptr EntryBuffer ->                      -- _obj : TInterface "Gtk" "EntryBuffer"
    Word32 ->                               -- position : TBasicType TUInt32
    CString ->                              -- chars : TBasicType TUTF8
    Int32 ->                                -- n_chars : TBasicType TInt32
    IO Word32


entryBufferInsertText ::
    (MonadIO m, EntryBufferK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- position
    T.Text ->                               -- chars
    Int32 ->                                -- n_chars
    m Word32
entryBufferInsertText _obj position chars n_chars = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    chars' <- textToCString chars
    result <- gtk_entry_buffer_insert_text _obj' position chars' n_chars
    touchManagedPtr _obj
    freeMem chars'
    return result

-- method EntryBuffer::set_max_length
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "EntryBuffer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "max_length", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "EntryBuffer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "max_length", 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_entry_buffer_set_max_length" gtk_entry_buffer_set_max_length :: 
    Ptr EntryBuffer ->                      -- _obj : TInterface "Gtk" "EntryBuffer"
    Int32 ->                                -- max_length : TBasicType TInt32
    IO ()


entryBufferSetMaxLength ::
    (MonadIO m, EntryBufferK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- max_length
    m ()
entryBufferSetMaxLength _obj max_length = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_entry_buffer_set_max_length _obj' max_length
    touchManagedPtr _obj
    return ()

-- method EntryBuffer::set_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "EntryBuffer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "chars", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_chars", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "EntryBuffer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "chars", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_chars", 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_entry_buffer_set_text" gtk_entry_buffer_set_text :: 
    Ptr EntryBuffer ->                      -- _obj : TInterface "Gtk" "EntryBuffer"
    CString ->                              -- chars : TBasicType TUTF8
    Int32 ->                                -- n_chars : TBasicType TInt32
    IO ()


entryBufferSetText ::
    (MonadIO m, EntryBufferK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- chars
    Int32 ->                                -- n_chars
    m ()
entryBufferSetText _obj chars n_chars = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    chars' <- textToCString chars
    gtk_entry_buffer_set_text _obj' chars' n_chars
    touchManagedPtr _obj
    freeMem chars'
    return ()