{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.GtkSource.Interfaces.CompletionProposal
    (

-- * Exported types
    CompletionProposal(..)                  ,
    noCompletionProposal                    ,
    IsCompletionProposal                    ,
    toCompletionProposal                    ,


 -- * Methods
-- ** changed #method:changed#

#if ENABLE_OVERLOADING
    CompletionProposalChangedMethodInfo     ,
#endif
    completionProposalChanged               ,


-- ** equal #method:equal#

#if ENABLE_OVERLOADING
    CompletionProposalEqualMethodInfo       ,
#endif
    completionProposalEqual                 ,


-- ** getGicon #method:getGicon#

#if ENABLE_OVERLOADING
    CompletionProposalGetGiconMethodInfo    ,
#endif
    completionProposalGetGicon              ,


-- ** getIcon #method:getIcon#

#if ENABLE_OVERLOADING
    CompletionProposalGetIconMethodInfo     ,
#endif
    completionProposalGetIcon               ,


-- ** getIconName #method:getIconName#

#if ENABLE_OVERLOADING
    CompletionProposalGetIconNameMethodInfo ,
#endif
    completionProposalGetIconName           ,


-- ** getInfo #method:getInfo#

#if ENABLE_OVERLOADING
    CompletionProposalGetInfoMethodInfo     ,
#endif
    completionProposalGetInfo               ,


-- ** getLabel #method:getLabel#

#if ENABLE_OVERLOADING
    CompletionProposalGetLabelMethodInfo    ,
#endif
    completionProposalGetLabel              ,


-- ** getMarkup #method:getMarkup#

#if ENABLE_OVERLOADING
    CompletionProposalGetMarkupMethodInfo   ,
#endif
    completionProposalGetMarkup             ,


-- ** getText #method:getText#

#if ENABLE_OVERLOADING
    CompletionProposalGetTextMethodInfo     ,
#endif
    completionProposalGetText               ,


-- ** hash #method:hash#

#if ENABLE_OVERLOADING
    CompletionProposalHashMethodInfo        ,
#endif
    completionProposalHash                  ,




 -- * Signals
-- ** changed #signal:changed#

    C_CompletionProposalChangedCallback     ,
    CompletionProposalChangedCallback       ,
#if ENABLE_OVERLOADING
    CompletionProposalChangedSignalInfo     ,
#endif
    afterCompletionProposalChanged          ,
    genClosure_CompletionProposalChanged    ,
    mk_CompletionProposalChangedCallback    ,
    noCompletionProposalChangedCallback     ,
    onCompletionProposalChanged             ,
    wrap_CompletionProposalChangedCallback  ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.GdkPixbuf.Objects.Pixbuf as GdkPixbuf.Pixbuf
import qualified GI.Gio.Interfaces.Icon as Gio.Icon

-- interface CompletionProposal 
-- | Memory-managed wrapper type.
newtype CompletionProposal = CompletionProposal (ManagedPtr CompletionProposal)
-- | A convenience alias for `Nothing` :: `Maybe` `CompletionProposal`.
noCompletionProposal :: Maybe CompletionProposal
noCompletionProposal = Nothing

-- signal CompletionProposal::changed
{- |
Emitted when the proposal has changed. The completion popup
will react to this by updating the shown information.
-}
type CompletionProposalChangedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `CompletionProposalChangedCallback`@.
noCompletionProposalChangedCallback :: Maybe CompletionProposalChangedCallback
noCompletionProposalChangedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_CompletionProposalChangedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_CompletionProposalChangedCallback`.
foreign import ccall "wrapper"
    mk_CompletionProposalChangedCallback :: C_CompletionProposalChangedCallback -> IO (FunPtr C_CompletionProposalChangedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_CompletionProposalChanged :: MonadIO m => CompletionProposalChangedCallback -> m (GClosure C_CompletionProposalChangedCallback)
genClosure_CompletionProposalChanged cb = liftIO $ do
    let cb' = wrap_CompletionProposalChangedCallback cb
    mk_CompletionProposalChangedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `CompletionProposalChangedCallback` into a `C_CompletionProposalChangedCallback`.
wrap_CompletionProposalChangedCallback ::
    CompletionProposalChangedCallback ->
    C_CompletionProposalChangedCallback
wrap_CompletionProposalChangedCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@changed@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' completionProposal #changed callback
@
-}
onCompletionProposalChanged :: (IsCompletionProposal a, MonadIO m) => a -> CompletionProposalChangedCallback -> m SignalHandlerId
onCompletionProposalChanged obj cb = liftIO $ do
    let cb' = wrap_CompletionProposalChangedCallback cb
    cb'' <- mk_CompletionProposalChangedCallback cb'
    connectSignalFunPtr obj "changed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@changed@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' completionProposal #changed callback
@
-}
afterCompletionProposalChanged :: (IsCompletionProposal a, MonadIO m) => a -> CompletionProposalChangedCallback -> m SignalHandlerId
afterCompletionProposalChanged obj cb = liftIO $ do
    let cb' = wrap_CompletionProposalChangedCallback cb
    cb'' <- mk_CompletionProposalChangedCallback cb'
    connectSignalFunPtr obj "changed" cb'' SignalConnectAfter


#if ENABLE_OVERLOADING
data CompletionProposalChangedSignalInfo
instance SignalInfo CompletionProposalChangedSignalInfo where
    type HaskellCallbackType CompletionProposalChangedSignalInfo = CompletionProposalChangedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_CompletionProposalChangedCallback cb
        cb'' <- mk_CompletionProposalChangedCallback cb'
        connectSignalFunPtr obj "changed" cb'' connectMode

type instance O.SignalList CompletionProposal = CompletionProposalSignalList
type CompletionProposalSignalList = ('[ '("changed", CompletionProposalChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

foreign import ccall "gtk_source_completion_proposal_get_type"
    c_gtk_source_completion_proposal_get_type :: IO GType

instance GObject CompletionProposal where
    gobjectType = c_gtk_source_completion_proposal_get_type


-- | Type class for types which can be safely cast to `CompletionProposal`, for instance with `toCompletionProposal`.
class (GObject o, O.IsDescendantOf CompletionProposal o) => IsCompletionProposal o
instance (GObject o, O.IsDescendantOf CompletionProposal o) => IsCompletionProposal o

instance O.HasParentTypes CompletionProposal
type instance O.ParentTypes CompletionProposal = '[GObject.Object.Object]

-- | Cast to `CompletionProposal`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toCompletionProposal :: (MonadIO m, IsCompletionProposal o) => o -> m CompletionProposal
toCompletionProposal = liftIO . unsafeCastTo CompletionProposal

#if ENABLE_OVERLOADING
instance O.HasAttributeList CompletionProposal
type instance O.AttributeList CompletionProposal = CompletionProposalAttributeList
type CompletionProposalAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveCompletionProposalMethod (t :: Symbol) (o :: *) :: * where
    ResolveCompletionProposalMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveCompletionProposalMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveCompletionProposalMethod "changed" o = CompletionProposalChangedMethodInfo
    ResolveCompletionProposalMethod "equal" o = CompletionProposalEqualMethodInfo
    ResolveCompletionProposalMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveCompletionProposalMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveCompletionProposalMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveCompletionProposalMethod "hash" o = CompletionProposalHashMethodInfo
    ResolveCompletionProposalMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveCompletionProposalMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveCompletionProposalMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveCompletionProposalMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveCompletionProposalMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveCompletionProposalMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveCompletionProposalMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveCompletionProposalMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveCompletionProposalMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveCompletionProposalMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveCompletionProposalMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveCompletionProposalMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveCompletionProposalMethod "getGicon" o = CompletionProposalGetGiconMethodInfo
    ResolveCompletionProposalMethod "getIcon" o = CompletionProposalGetIconMethodInfo
    ResolveCompletionProposalMethod "getIconName" o = CompletionProposalGetIconNameMethodInfo
    ResolveCompletionProposalMethod "getInfo" o = CompletionProposalGetInfoMethodInfo
    ResolveCompletionProposalMethod "getLabel" o = CompletionProposalGetLabelMethodInfo
    ResolveCompletionProposalMethod "getMarkup" o = CompletionProposalGetMarkupMethodInfo
    ResolveCompletionProposalMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveCompletionProposalMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveCompletionProposalMethod "getText" o = CompletionProposalGetTextMethodInfo
    ResolveCompletionProposalMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveCompletionProposalMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveCompletionProposalMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveCompletionProposalMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveCompletionProposalMethod t CompletionProposal, O.MethodInfo info CompletionProposal p) => OL.IsLabel t (CompletionProposal -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- method CompletionProposal::changed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proposal", argType = TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceCompletionProposal.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_completion_proposal_changed" gtk_source_completion_proposal_changed ::
    Ptr CompletionProposal ->               -- proposal : TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"})
    IO ()

{- |
Emits the \"changed\" signal on /@proposal@/. This should be called by
implementations whenever the name, icon or info of the proposal has
changed.
-}
completionProposalChanged ::
    (B.CallStack.HasCallStack, MonadIO m, IsCompletionProposal a) =>
    a
    {- ^ /@proposal@/: a 'GI.GtkSource.Interfaces.CompletionProposal.CompletionProposal'. -}
    -> m ()
completionProposalChanged proposal = liftIO $ do
    proposal' <- unsafeManagedPtrCastPtr proposal
    gtk_source_completion_proposal_changed proposal'
    touchManagedPtr proposal
    return ()

#if ENABLE_OVERLOADING
data CompletionProposalChangedMethodInfo
instance (signature ~ (m ()), MonadIO m, IsCompletionProposal a) => O.MethodInfo CompletionProposalChangedMethodInfo a signature where
    overloadedMethod _ = completionProposalChanged

#endif

-- method CompletionProposal::equal
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proposal", argType = TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceCompletionProposal.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "other", argType = TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceCompletionProposal.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_completion_proposal_equal" gtk_source_completion_proposal_equal ::
    Ptr CompletionProposal ->               -- proposal : TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"})
    Ptr CompletionProposal ->               -- other : TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"})
    IO CInt

{- |
Get whether two proposal objects are the same.  This is used to (together
with 'GI.GtkSource.Interfaces.CompletionProposal.completionProposalHash') to match proposals in the
completion model. By default, it uses direct equality ('GI.GLib.Functions.directEqual').
-}
completionProposalEqual ::
    (B.CallStack.HasCallStack, MonadIO m, IsCompletionProposal a, IsCompletionProposal b) =>
    a
    {- ^ /@proposal@/: a 'GI.GtkSource.Interfaces.CompletionProposal.CompletionProposal'. -}
    -> b
    {- ^ /@other@/: a 'GI.GtkSource.Interfaces.CompletionProposal.CompletionProposal'. -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@proposal@/ and /@object@/ are the same proposal -}
completionProposalEqual proposal other = liftIO $ do
    proposal' <- unsafeManagedPtrCastPtr proposal
    other' <- unsafeManagedPtrCastPtr other
    result <- gtk_source_completion_proposal_equal proposal' other'
    let result' = (/= 0) result
    touchManagedPtr proposal
    touchManagedPtr other
    return result'

#if ENABLE_OVERLOADING
data CompletionProposalEqualMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsCompletionProposal a, IsCompletionProposal b) => O.MethodInfo CompletionProposalEqualMethodInfo a signature where
    overloadedMethod _ = completionProposalEqual

#endif

-- method CompletionProposal::get_gicon
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proposal", argType = TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceCompletionProposal.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "Icon"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_completion_proposal_get_gicon" gtk_source_completion_proposal_get_gicon ::
    Ptr CompletionProposal ->               -- proposal : TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"})
    IO (Ptr Gio.Icon.Icon)

{- |
Gets the 'GI.Gio.Interfaces.Icon.Icon' for the icon of /@proposal@/.

/Since: 3.18/
-}
completionProposalGetGicon ::
    (B.CallStack.HasCallStack, MonadIO m, IsCompletionProposal a) =>
    a
    {- ^ /@proposal@/: a 'GI.GtkSource.Interfaces.CompletionProposal.CompletionProposal'. -}
    -> m (Maybe Gio.Icon.Icon)
    {- ^ __Returns:__ A 'GI.Gio.Interfaces.Icon.Icon' with the icon of /@proposal@/. -}
completionProposalGetGicon proposal = liftIO $ do
    proposal' <- unsafeManagedPtrCastPtr proposal
    result <- gtk_source_completion_proposal_get_gicon proposal'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Gio.Icon.Icon) result'
        return result''
    touchManagedPtr proposal
    return maybeResult

#if ENABLE_OVERLOADING
data CompletionProposalGetGiconMethodInfo
instance (signature ~ (m (Maybe Gio.Icon.Icon)), MonadIO m, IsCompletionProposal a) => O.MethodInfo CompletionProposalGetGiconMethodInfo a signature where
    overloadedMethod _ = completionProposalGetGicon

#endif

-- method CompletionProposal::get_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proposal", argType = TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceCompletionProposal.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GdkPixbuf", name = "Pixbuf"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_completion_proposal_get_icon" gtk_source_completion_proposal_get_icon ::
    Ptr CompletionProposal ->               -- proposal : TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"})
    IO (Ptr GdkPixbuf.Pixbuf.Pixbuf)

{- |
Gets the 'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf' for the icon of /@proposal@/.
-}
completionProposalGetIcon ::
    (B.CallStack.HasCallStack, MonadIO m, IsCompletionProposal a) =>
    a
    {- ^ /@proposal@/: a 'GI.GtkSource.Interfaces.CompletionProposal.CompletionProposal'. -}
    -> m (Maybe GdkPixbuf.Pixbuf.Pixbuf)
    {- ^ __Returns:__ A 'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf' with the icon of /@proposal@/. -}
completionProposalGetIcon proposal = liftIO $ do
    proposal' <- unsafeManagedPtrCastPtr proposal
    result <- gtk_source_completion_proposal_get_icon proposal'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject GdkPixbuf.Pixbuf.Pixbuf) result'
        return result''
    touchManagedPtr proposal
    return maybeResult

#if ENABLE_OVERLOADING
data CompletionProposalGetIconMethodInfo
instance (signature ~ (m (Maybe GdkPixbuf.Pixbuf.Pixbuf)), MonadIO m, IsCompletionProposal a) => O.MethodInfo CompletionProposalGetIconMethodInfo a signature where
    overloadedMethod _ = completionProposalGetIcon

#endif

-- method CompletionProposal::get_icon_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proposal", argType = TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceCompletionProposal.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_completion_proposal_get_icon_name" gtk_source_completion_proposal_get_icon_name ::
    Ptr CompletionProposal ->               -- proposal : TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"})
    IO CString

{- |
Gets the icon name of /@proposal@/.

/Since: 3.18/
-}
completionProposalGetIconName ::
    (B.CallStack.HasCallStack, MonadIO m, IsCompletionProposal a) =>
    a
    {- ^ /@proposal@/: a 'GI.GtkSource.Interfaces.CompletionProposal.CompletionProposal'. -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ The icon name of /@proposal@/. -}
completionProposalGetIconName proposal = liftIO $ do
    proposal' <- unsafeManagedPtrCastPtr proposal
    result <- gtk_source_completion_proposal_get_icon_name proposal'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr proposal
    return maybeResult

#if ENABLE_OVERLOADING
data CompletionProposalGetIconNameMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsCompletionProposal a) => O.MethodInfo CompletionProposalGetIconNameMethodInfo a signature where
    overloadedMethod _ = completionProposalGetIconName

#endif

-- method CompletionProposal::get_info
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proposal", argType = TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceCompletionProposal.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_completion_proposal_get_info" gtk_source_completion_proposal_get_info ::
    Ptr CompletionProposal ->               -- proposal : TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"})
    IO CString

{- |
Gets extra information associated to the proposal. This information will be
used to present the user with extra, detailed information about the
selected proposal. The returned string must be freed with 'GI.GLib.Functions.free'.
-}
completionProposalGetInfo ::
    (B.CallStack.HasCallStack, MonadIO m, IsCompletionProposal a) =>
    a
    {- ^ /@proposal@/: a 'GI.GtkSource.Interfaces.CompletionProposal.CompletionProposal'. -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ a newly-allocated string containing
extra information of /@proposal@/ or 'Nothing' if no extra information is associated
to /@proposal@/. -}
completionProposalGetInfo proposal = liftIO $ do
    proposal' <- unsafeManagedPtrCastPtr proposal
    result <- gtk_source_completion_proposal_get_info proposal'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    touchManagedPtr proposal
    return maybeResult

#if ENABLE_OVERLOADING
data CompletionProposalGetInfoMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsCompletionProposal a) => O.MethodInfo CompletionProposalGetInfoMethodInfo a signature where
    overloadedMethod _ = completionProposalGetInfo

#endif

-- method CompletionProposal::get_label
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proposal", argType = TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceCompletionProposal.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_completion_proposal_get_label" gtk_source_completion_proposal_get_label ::
    Ptr CompletionProposal ->               -- proposal : TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"})
    IO CString

{- |
Gets the label of /@proposal@/. The label is shown in the list of proposals as
plain text. If you need any markup (such as bold or italic text), you have
to implement 'GI.GtkSource.Interfaces.CompletionProposal.completionProposalGetMarkup'. The returned string
must be freed with 'GI.GLib.Functions.free'.
-}
completionProposalGetLabel ::
    (B.CallStack.HasCallStack, MonadIO m, IsCompletionProposal a) =>
    a
    {- ^ /@proposal@/: a 'GI.GtkSource.Interfaces.CompletionProposal.CompletionProposal'. -}
    -> m T.Text
    {- ^ __Returns:__ a new string containing the label of /@proposal@/. -}
completionProposalGetLabel proposal = liftIO $ do
    proposal' <- unsafeManagedPtrCastPtr proposal
    result <- gtk_source_completion_proposal_get_label proposal'
    checkUnexpectedReturnNULL "completionProposalGetLabel" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr proposal
    return result'

#if ENABLE_OVERLOADING
data CompletionProposalGetLabelMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsCompletionProposal a) => O.MethodInfo CompletionProposalGetLabelMethodInfo a signature where
    overloadedMethod _ = completionProposalGetLabel

#endif

-- method CompletionProposal::get_markup
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proposal", argType = TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceCompletionProposal.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_completion_proposal_get_markup" gtk_source_completion_proposal_get_markup ::
    Ptr CompletionProposal ->               -- proposal : TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"})
    IO CString

{- |
Gets the label of /@proposal@/ with markup. The label is shown in the list of
proposals and may contain markup. This will be used instead of
'GI.GtkSource.Interfaces.CompletionProposal.completionProposalGetLabel' if implemented. The returned string
must be freed with 'GI.GLib.Functions.free'.
-}
completionProposalGetMarkup ::
    (B.CallStack.HasCallStack, MonadIO m, IsCompletionProposal a) =>
    a
    {- ^ /@proposal@/: a 'GI.GtkSource.Interfaces.CompletionProposal.CompletionProposal'. -}
    -> m T.Text
    {- ^ __Returns:__ a new string containing the label of /@proposal@/ with markup. -}
completionProposalGetMarkup proposal = liftIO $ do
    proposal' <- unsafeManagedPtrCastPtr proposal
    result <- gtk_source_completion_proposal_get_markup proposal'
    checkUnexpectedReturnNULL "completionProposalGetMarkup" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr proposal
    return result'

#if ENABLE_OVERLOADING
data CompletionProposalGetMarkupMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsCompletionProposal a) => O.MethodInfo CompletionProposalGetMarkupMethodInfo a signature where
    overloadedMethod _ = completionProposalGetMarkup

#endif

-- method CompletionProposal::get_text
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proposal", argType = TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceCompletionProposal.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_completion_proposal_get_text" gtk_source_completion_proposal_get_text ::
    Ptr CompletionProposal ->               -- proposal : TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"})
    IO CString

{- |
Gets the text of /@proposal@/. The text that is inserted into
the text buffer when the proposal is activated by the default activation.
You are free to implement a custom activation handler in the provider and
not implement this function. For more information, see
'GI.GtkSource.Interfaces.CompletionProvider.completionProviderActivateProposal'. The returned string must
be freed with 'GI.GLib.Functions.free'.
-}
completionProposalGetText ::
    (B.CallStack.HasCallStack, MonadIO m, IsCompletionProposal a) =>
    a
    {- ^ /@proposal@/: a 'GI.GtkSource.Interfaces.CompletionProposal.CompletionProposal'. -}
    -> m T.Text
    {- ^ __Returns:__ a new string containing the text of /@proposal@/. -}
completionProposalGetText proposal = liftIO $ do
    proposal' <- unsafeManagedPtrCastPtr proposal
    result <- gtk_source_completion_proposal_get_text proposal'
    checkUnexpectedReturnNULL "completionProposalGetText" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr proposal
    return result'

#if ENABLE_OVERLOADING
data CompletionProposalGetTextMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsCompletionProposal a) => O.MethodInfo CompletionProposalGetTextMethodInfo a signature where
    overloadedMethod _ = completionProposalGetText

#endif

-- method CompletionProposal::hash
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "proposal", argType = TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceCompletionProposal.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_completion_proposal_hash" gtk_source_completion_proposal_hash ::
    Ptr CompletionProposal ->               -- proposal : TInterface (Name {namespace = "GtkSource", name = "CompletionProposal"})
    IO Word32

{- |
Get the hash value of /@proposal@/. This is used to (together with
'GI.GtkSource.Interfaces.CompletionProposal.completionProposalEqual') to match proposals in the completion
model. By default, it uses a direct hash ('GI.GLib.Functions.directHash').
-}
completionProposalHash ::
    (B.CallStack.HasCallStack, MonadIO m, IsCompletionProposal a) =>
    a
    {- ^ /@proposal@/: a 'GI.GtkSource.Interfaces.CompletionProposal.CompletionProposal'. -}
    -> m Word32
    {- ^ __Returns:__ The hash value of /@proposal@/. -}
completionProposalHash proposal = liftIO $ do
    proposal' <- unsafeManagedPtrCastPtr proposal
    result <- gtk_source_completion_proposal_hash proposal'
    touchManagedPtr proposal
    return result

#if ENABLE_OVERLOADING
data CompletionProposalHashMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsCompletionProposal a) => O.MethodInfo CompletionProposalHashMethodInfo a signature where
    overloadedMethod _ = completionProposalHash

#endif