{- |
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.Poppler.Objects.FormField
    ( 

-- * Exported types
    FormField(..)                           ,
    FormFieldK                              ,
    toFormField                             ,
    noFormField                             ,


 -- * Methods
-- ** formFieldButtonGetButtonType
    formFieldButtonGetButtonType            ,


-- ** formFieldButtonGetState
    formFieldButtonGetState                 ,


-- ** formFieldButtonSetState
    formFieldButtonSetState                 ,


-- ** formFieldChoiceCanSelectMultiple
    formFieldChoiceCanSelectMultiple        ,


-- ** formFieldChoiceCommitOnChange
    formFieldChoiceCommitOnChange           ,


-- ** formFieldChoiceDoSpellCheck
    formFieldChoiceDoSpellCheck             ,


-- ** formFieldChoiceGetChoiceType
    formFieldChoiceGetChoiceType            ,


-- ** formFieldChoiceGetItem
    formFieldChoiceGetItem                  ,


-- ** formFieldChoiceGetNItems
    formFieldChoiceGetNItems                ,


-- ** formFieldChoiceGetText
    formFieldChoiceGetText                  ,


-- ** formFieldChoiceIsEditable
    formFieldChoiceIsEditable               ,


-- ** formFieldChoiceIsItemSelected
    formFieldChoiceIsItemSelected           ,


-- ** formFieldChoiceSelectItem
    formFieldChoiceSelectItem               ,


-- ** formFieldChoiceSetText
    formFieldChoiceSetText                  ,


-- ** formFieldChoiceToggleItem
    formFieldChoiceToggleItem               ,


-- ** formFieldChoiceUnselectAll
    formFieldChoiceUnselectAll              ,


-- ** formFieldGetAction
    formFieldGetAction                      ,


-- ** formFieldGetFieldType
    formFieldGetFieldType                   ,


-- ** formFieldGetFontSize
    formFieldGetFontSize                    ,


-- ** formFieldGetId
    formFieldGetId                          ,


-- ** formFieldGetMappingName
    formFieldGetMappingName                 ,


-- ** formFieldGetName
    formFieldGetName                        ,


-- ** formFieldGetPartialName
    formFieldGetPartialName                 ,


-- ** formFieldIsReadOnly
    formFieldIsReadOnly                     ,


-- ** formFieldTextDoScroll
    formFieldTextDoScroll                   ,


-- ** formFieldTextDoSpellCheck
    formFieldTextDoSpellCheck               ,


-- ** formFieldTextGetMaxLen
    formFieldTextGetMaxLen                  ,


-- ** formFieldTextGetText
    formFieldTextGetText                    ,


-- ** formFieldTextGetTextType
    formFieldTextGetTextType                ,


-- ** formFieldTextIsPassword
    formFieldTextIsPassword                 ,


-- ** formFieldTextIsRichText
    formFieldTextIsRichText                 ,


-- ** formFieldTextSetText
    formFieldTextSetText                    ,




    ) 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.Poppler.Types
import GI.Poppler.Callbacks
import qualified GI.GObject as GObject

newtype FormField = FormField (ForeignPtr FormField)
foreign import ccall "poppler_form_field_get_type"
    c_poppler_form_field_get_type :: IO GType

type instance ParentTypes FormField = FormFieldParentTypes
type FormFieldParentTypes = '[GObject.Object]

instance GObject FormField where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_poppler_form_field_get_type
    

class GObject o => FormFieldK o
instance (GObject o, IsDescendantOf FormField o) => FormFieldK o

toFormField :: FormFieldK o => o -> IO FormField
toFormField = unsafeCastTo FormField

noFormField :: Maybe FormField
noFormField = Nothing

type instance AttributeList FormField = FormFieldAttributeList
type FormFieldAttributeList = ('[ ] :: [(Symbol, *)])

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

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

foreign import ccall "poppler_form_field_button_get_button_type" poppler_form_field_button_get_button_type :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CUInt


formFieldButtonGetButtonType ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m FormButtonType
formFieldButtonGetButtonType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_button_get_button_type _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_form_field_button_get_state" poppler_form_field_button_get_state :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CInt


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

-- method FormField::button_set_state
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "FormField", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "FormField", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state", 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 "poppler_form_field_button_set_state" poppler_form_field_button_set_state :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    CInt ->                                 -- state : TBasicType TBoolean
    IO ()


formFieldButtonSetState ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- state
    m ()
formFieldButtonSetState _obj state = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let state' = (fromIntegral . fromEnum) state
    poppler_form_field_button_set_state _obj' state'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "poppler_form_field_choice_can_select_multiple" poppler_form_field_choice_can_select_multiple :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CInt


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

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

foreign import ccall "poppler_form_field_choice_commit_on_change" poppler_form_field_choice_commit_on_change :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CInt


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

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

foreign import ccall "poppler_form_field_choice_do_spell_check" poppler_form_field_choice_do_spell_check :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CInt


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

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

foreign import ccall "poppler_form_field_choice_get_choice_type" poppler_form_field_choice_get_choice_type :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CUInt


formFieldChoiceGetChoiceType ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m FormChoiceType
formFieldChoiceGetChoiceType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_choice_get_choice_type _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method FormField::choice_get_item
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "FormField", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "FormField", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index", 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 "poppler_form_field_choice_get_item" poppler_form_field_choice_get_item :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    Int32 ->                                -- index : TBasicType TInt32
    IO CString


formFieldChoiceGetItem ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- index
    m T.Text
formFieldChoiceGetItem _obj index = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_choice_get_item _obj' index
    checkUnexpectedReturnNULL "poppler_form_field_choice_get_item" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_form_field_choice_get_n_items" poppler_form_field_choice_get_n_items :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO Int32


formFieldChoiceGetNItems ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m Int32
formFieldChoiceGetNItems _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_choice_get_n_items _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "poppler_form_field_choice_get_text" poppler_form_field_choice_get_text :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CString


formFieldChoiceGetText ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m T.Text
formFieldChoiceGetText _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_choice_get_text _obj'
    checkUnexpectedReturnNULL "poppler_form_field_choice_get_text" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_form_field_choice_is_editable" poppler_form_field_choice_is_editable :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CInt


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

-- method FormField::choice_is_item_selected
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "FormField", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "FormField", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index", 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 "poppler_form_field_choice_is_item_selected" poppler_form_field_choice_is_item_selected :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    Int32 ->                                -- index : TBasicType TInt32
    IO CInt


formFieldChoiceIsItemSelected ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- index
    m Bool
formFieldChoiceIsItemSelected _obj index = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_choice_is_item_selected _obj' index
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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


formFieldChoiceSelectItem ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- index
    m ()
formFieldChoiceSelectItem _obj index = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    poppler_form_field_choice_select_item _obj' index
    touchManagedPtr _obj
    return ()

-- method FormField::choice_set_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "FormField", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "FormField", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", 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 "poppler_form_field_choice_set_text" poppler_form_field_choice_set_text :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    CString ->                              -- text : TBasicType TUTF8
    IO ()


formFieldChoiceSetText ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- text
    m ()
formFieldChoiceSetText _obj text = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    text' <- textToCString text
    poppler_form_field_choice_set_text _obj' text'
    touchManagedPtr _obj
    freeMem text'
    return ()

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


formFieldChoiceToggleItem ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- index
    m ()
formFieldChoiceToggleItem _obj index = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    poppler_form_field_choice_toggle_item _obj' index
    touchManagedPtr _obj
    return ()

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

foreign import ccall "poppler_form_field_choice_unselect_all" poppler_form_field_choice_unselect_all :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO ()


formFieldChoiceUnselectAll ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m ()
formFieldChoiceUnselectAll _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    poppler_form_field_choice_unselect_all _obj'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "poppler_form_field_get_action" poppler_form_field_get_action :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO (Ptr Action)


formFieldGetAction ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m Action
formFieldGetAction _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_get_action _obj'
    checkUnexpectedReturnNULL "poppler_form_field_get_action" result
    result' <- (newBoxed Action) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_form_field_get_field_type" poppler_form_field_get_field_type :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CUInt


formFieldGetFieldType ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m FormFieldType
formFieldGetFieldType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_get_field_type _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_form_field_get_font_size" poppler_form_field_get_font_size :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CDouble


formFieldGetFontSize ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m Double
formFieldGetFontSize _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_get_font_size _obj'
    let result' = realToFrac result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_form_field_get_id" poppler_form_field_get_id :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO Int32


formFieldGetId ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m Int32
formFieldGetId _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_get_id _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "poppler_form_field_get_mapping_name" poppler_form_field_get_mapping_name :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CString


formFieldGetMappingName ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m T.Text
formFieldGetMappingName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_get_mapping_name _obj'
    checkUnexpectedReturnNULL "poppler_form_field_get_mapping_name" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_form_field_get_name" poppler_form_field_get_name :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CString


formFieldGetName ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m T.Text
formFieldGetName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_get_name _obj'
    checkUnexpectedReturnNULL "poppler_form_field_get_name" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_form_field_get_partial_name" poppler_form_field_get_partial_name :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CString


formFieldGetPartialName ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m T.Text
formFieldGetPartialName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_get_partial_name _obj'
    checkUnexpectedReturnNULL "poppler_form_field_get_partial_name" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_form_field_is_read_only" poppler_form_field_is_read_only :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CInt


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

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

foreign import ccall "poppler_form_field_text_do_scroll" poppler_form_field_text_do_scroll :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CInt


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

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

foreign import ccall "poppler_form_field_text_do_spell_check" poppler_form_field_text_do_spell_check :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CInt


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

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

foreign import ccall "poppler_form_field_text_get_max_len" poppler_form_field_text_get_max_len :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO Int32


formFieldTextGetMaxLen ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m Int32
formFieldTextGetMaxLen _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_text_get_max_len _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "poppler_form_field_text_get_text" poppler_form_field_text_get_text :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CString


formFieldTextGetText ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m T.Text
formFieldTextGetText _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_text_get_text _obj'
    checkUnexpectedReturnNULL "poppler_form_field_text_get_text" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_form_field_text_get_text_type" poppler_form_field_text_get_text_type :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CUInt


formFieldTextGetTextType ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    m FormTextType
formFieldTextGetTextType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_form_field_text_get_text_type _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_form_field_text_is_password" poppler_form_field_text_is_password :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CInt


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

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

foreign import ccall "poppler_form_field_text_is_rich_text" poppler_form_field_text_is_rich_text :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    IO CInt


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

-- method FormField::text_set_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "FormField", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "FormField", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", 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 "poppler_form_field_text_set_text" poppler_form_field_text_set_text :: 
    Ptr FormField ->                        -- _obj : TInterface "Poppler" "FormField"
    CString ->                              -- text : TBasicType TUTF8
    IO ()


formFieldTextSetText ::
    (MonadIO m, FormFieldK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- text
    m ()
formFieldTextSetText _obj text = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    text' <- textToCString text
    poppler_form_field_text_set_text _obj' text'
    touchManagedPtr _obj
    freeMem text'
    return ()