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

-- * Exported types
    IMMulticontext(..)                      ,
    IMMulticontextK                         ,
    toIMMulticontext                        ,
    noIMMulticontext                        ,


 -- * Methods
-- ** iMMulticontextAppendMenuitems
    iMMulticontextAppendMenuitems           ,


-- ** iMMulticontextGetContextId
    iMMulticontextGetContextId              ,


-- ** iMMulticontextNew
    iMMulticontextNew                       ,


-- ** iMMulticontextSetContextId
    iMMulticontextSetContextId              ,




    ) 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 IMMulticontext = IMMulticontext (ForeignPtr IMMulticontext)
foreign import ccall "gtk_im_multicontext_get_type"
    c_gtk_im_multicontext_get_type :: IO GType

type instance ParentTypes IMMulticontext = IMMulticontextParentTypes
type IMMulticontextParentTypes = '[IMContext, GObject.Object]

instance GObject IMMulticontext where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_im_multicontext_get_type
    

class GObject o => IMMulticontextK o
instance (GObject o, IsDescendantOf IMMulticontext o) => IMMulticontextK o

toIMMulticontext :: IMMulticontextK o => o -> IO IMMulticontext
toIMMulticontext = unsafeCastTo IMMulticontext

noIMMulticontext :: Maybe IMMulticontext
noIMMulticontext = Nothing

type instance AttributeList IMMulticontext = IMMulticontextAttributeList
type IMMulticontextAttributeList = ('[ '("input-hints", IMContextInputHintsPropertyInfo), '("input-purpose", IMContextInputPurposePropertyInfo)] :: [(Symbol, *)])

type instance SignalList IMMulticontext = IMMulticontextSignalList
type IMMulticontextSignalList = ('[ '("commit", IMContextCommitSignalInfo), '("delete-surrounding", IMContextDeleteSurroundingSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("preedit-changed", IMContextPreeditChangedSignalInfo), '("preedit-end", IMContextPreeditEndSignalInfo), '("preedit-start", IMContextPreeditStartSignalInfo), '("retrieve-surrounding", IMContextRetrieveSurroundingSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method IMMulticontext::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gtk" "IMMulticontext"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_im_multicontext_new" gtk_im_multicontext_new :: 
    IO (Ptr IMMulticontext)


iMMulticontextNew ::
    (MonadIO m) =>
    m IMMulticontext
iMMulticontextNew  = liftIO $ do
    result <- gtk_im_multicontext_new
    checkUnexpectedReturnNULL "gtk_im_multicontext_new" result
    result' <- (wrapObject IMMulticontext) result
    return result'

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

foreign import ccall "gtk_im_multicontext_append_menuitems" gtk_im_multicontext_append_menuitems :: 
    Ptr IMMulticontext ->                   -- _obj : TInterface "Gtk" "IMMulticontext"
    Ptr MenuShell ->                        -- menushell : TInterface "Gtk" "MenuShell"
    IO ()

{-# DEPRECATED iMMulticontextAppendMenuitems ["(Since version 3.10)","It is better to use the system-wide input","    method framework for changing input methods. Modern","    desktop shells offer on-screen displays for this that","    can triggered with a keyboard shortcut, e.g. Super-Space."]#-}
iMMulticontextAppendMenuitems ::
    (MonadIO m, IMMulticontextK a, MenuShellK b) =>
    a ->                                    -- _obj
    b ->                                    -- menushell
    m ()
iMMulticontextAppendMenuitems _obj menushell = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let menushell' = unsafeManagedPtrCastPtr menushell
    gtk_im_multicontext_append_menuitems _obj' menushell'
    touchManagedPtr _obj
    touchManagedPtr menushell
    return ()

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

foreign import ccall "gtk_im_multicontext_get_context_id" gtk_im_multicontext_get_context_id :: 
    Ptr IMMulticontext ->                   -- _obj : TInterface "Gtk" "IMMulticontext"
    IO CString


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

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


iMMulticontextSetContextId ::
    (MonadIO m, IMMulticontextK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- context_id
    m ()
iMMulticontextSetContextId _obj context_id = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    context_id' <- textToCString context_id
    gtk_im_multicontext_set_context_id _obj' context_id'
    touchManagedPtr _obj
    freeMem context_id'
    return ()