{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Accelerator maps are used to define runtime configurable accelerators.
-- Functions for manipulating them are are usually used by higher level
-- convenience mechanisms like t'GI.Gtk.Objects.UIManager.UIManager' and are thus considered
-- “low-level”. You’ll want to use them if you’re manually creating menus that
-- should have user-configurable accelerators.
-- 
-- An accelerator is uniquely defined by:
-- 
-- * accelerator path
-- * accelerator key
-- * accelerator modifiers
-- 
-- 
-- The accelerator path must consist of
-- “\<WINDOWTYPE>\/Category1\/Category2\/...\/Action”, where WINDOWTYPE
-- should be a unique application-specific identifier that corresponds
-- to the kind of window the accelerator is being used in, e.g.
-- “Gimp-Image”, “Abiword-Document” or “Gnumeric-Settings”.
-- The “Category1\/...\/Action” portion is most appropriately chosen by
-- the action the accelerator triggers, i.e. for accelerators on menu
-- items, choose the item’s menu path, e.g. “File\/Save As”,
-- “Image\/View\/Zoom” or “Edit\/Select All”. So a full valid accelerator
-- path may look like: “\<Gimp-Toolbox>\/File\/Dialogs\/Tool Options...”.
-- 
-- All accelerators are stored inside one global t'GI.Gtk.Objects.AccelMap.AccelMap' that can
-- be obtained using 'GI.Gtk.Objects.AccelMap.accelMapGet'. See
-- [Monitoring changes][monitoring-changes] for additional
-- details.
-- 
-- = Manipulating accelerators
-- 
-- New accelerators can be added using 'GI.Gtk.Objects.AccelMap.accelMapAddEntry'.
-- To search for specific accelerator, use 'GI.Gtk.Objects.AccelMap.accelMapLookupEntry'.
-- Modifications of existing accelerators should be done using
-- 'GI.Gtk.Objects.AccelMap.accelMapChangeEntry'.
-- 
-- In order to avoid having some accelerators changed, they can be
-- locked using 'GI.Gtk.Objects.AccelMap.accelMapLockPath'. Unlocking is done using
-- 'GI.Gtk.Objects.AccelMap.accelMapUnlockPath'.
-- 
-- = Saving and loading accelerator maps
-- 
-- Accelerator maps can be saved to and loaded from some external
-- resource. For simple saving and loading from file,
-- 'GI.Gtk.Objects.AccelMap.accelMapSave' and 'GI.Gtk.Objects.AccelMap.accelMapLoad' are provided.
-- Saving and loading can also be done by providing file descriptor
-- to 'GI.Gtk.Objects.AccelMap.accelMapSaveFd' and 'GI.Gtk.Objects.AccelMap.accelMapLoadFd'.
-- 
-- = Monitoring changes
-- 
-- t'GI.Gtk.Objects.AccelMap.AccelMap' object is only useful for monitoring changes of
-- accelerators. By connecting to [changed]("GI.Gtk.Objects.AccelMap#g:signal:changed") signal, one
-- can monitor changes of all accelerators. It is also possible to
-- monitor only single accelerator path by using it as a detail of
-- the [changed]("GI.Gtk.Objects.AccelMap#g:signal:changed") signal.

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

module GI.Gtk.Objects.AccelMap
    ( 

-- * Exported types
    AccelMap(..)                            ,
    IsAccelMap                              ,
    toAccelMap                              ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveAccelMapMethod                   ,
#endif

-- ** addEntry #method:addEntry#

    accelMapAddEntry                        ,


-- ** addFilter #method:addFilter#

    accelMapAddFilter                       ,


-- ** changeEntry #method:changeEntry#

    accelMapChangeEntry                     ,


-- ** foreach #method:foreach#

    accelMapForeach                         ,


-- ** foreachUnfiltered #method:foreachUnfiltered#

    accelMapForeachUnfiltered               ,


-- ** get #method:get#

    accelMapGet                             ,


-- ** load #method:load#

    accelMapLoad                            ,


-- ** loadFd #method:loadFd#

    accelMapLoadFd                          ,


-- ** loadScanner #method:loadScanner#

    accelMapLoadScanner                     ,


-- ** lockPath #method:lockPath#

    accelMapLockPath                        ,


-- ** lookupEntry #method:lookupEntry#

    accelMapLookupEntry                     ,


-- ** save #method:save#

    accelMapSave                            ,


-- ** saveFd #method:saveFd#

    accelMapSaveFd                          ,


-- ** unlockPath #method:unlockPath#

    accelMapUnlockPath                      ,




 -- * Signals


-- ** changed #signal:changed#

    AccelMapChangedCallback                 ,
#if defined(ENABLE_OVERLOADING)
    AccelMapChangedSignalInfo               ,
#endif
    C_AccelMapChangedCallback               ,
    afterAccelMapChanged                    ,
    genClosure_AccelMapChanged              ,
    mk_AccelMapChangedCallback              ,
    noAccelMapChangedCallback               ,
    onAccelMapChanged                       ,
    wrap_AccelMapChangedCallback            ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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 GHC.Records as R

import qualified GI.GLib.Structs.Scanner as GLib.Scanner
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gdk.Flags as Gdk.Flags
import qualified GI.Gtk.Callbacks as Gtk.Callbacks
import {-# SOURCE #-} qualified GI.Gtk.Structs.AccelKey as Gtk.AccelKey

-- | Memory-managed wrapper type.
newtype AccelMap = AccelMap (SP.ManagedPtr AccelMap)
    deriving (AccelMap -> AccelMap -> Bool
(AccelMap -> AccelMap -> Bool)
-> (AccelMap -> AccelMap -> Bool) -> Eq AccelMap
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccelMap -> AccelMap -> Bool
$c/= :: AccelMap -> AccelMap -> Bool
== :: AccelMap -> AccelMap -> Bool
$c== :: AccelMap -> AccelMap -> Bool
Eq)

instance SP.ManagedPtrNewtype AccelMap where
    toManagedPtr :: AccelMap -> ManagedPtr AccelMap
toManagedPtr (AccelMap ManagedPtr AccelMap
p) = ManagedPtr AccelMap
p

foreign import ccall "gtk_accel_map_get_type"
    c_gtk_accel_map_get_type :: IO B.Types.GType

instance B.Types.TypedObject AccelMap where
    glibType :: IO GType
glibType = IO GType
c_gtk_accel_map_get_type

instance B.Types.GObject AccelMap

-- | Type class for types which can be safely cast to `AccelMap`, for instance with `toAccelMap`.
class (SP.GObject o, O.IsDescendantOf AccelMap o) => IsAccelMap o
instance (SP.GObject o, O.IsDescendantOf AccelMap o) => IsAccelMap o

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

-- | Cast to `AccelMap`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toAccelMap :: (MIO.MonadIO m, IsAccelMap o) => o -> m AccelMap
toAccelMap :: forall (m :: * -> *) o.
(MonadIO m, IsAccelMap o) =>
o -> m AccelMap
toAccelMap = IO AccelMap -> m AccelMap
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO AccelMap -> m AccelMap)
-> (o -> IO AccelMap) -> o -> m AccelMap
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr AccelMap -> AccelMap) -> o -> IO AccelMap
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr AccelMap -> AccelMap
AccelMap

-- | Convert 'AccelMap' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe AccelMap) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_accel_map_get_type
    gvalueSet_ :: Ptr GValue -> Maybe AccelMap -> IO ()
gvalueSet_ Ptr GValue
gv Maybe AccelMap
P.Nothing = Ptr GValue -> Ptr AccelMap -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr AccelMap
forall a. Ptr a
FP.nullPtr :: FP.Ptr AccelMap)
    gvalueSet_ Ptr GValue
gv (P.Just AccelMap
obj) = AccelMap -> (Ptr AccelMap -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr AccelMap
obj (Ptr GValue -> Ptr AccelMap -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe AccelMap)
gvalueGet_ Ptr GValue
gv = do
        Ptr AccelMap
ptr <- Ptr GValue -> IO (Ptr AccelMap)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr AccelMap)
        if Ptr AccelMap
ptr Ptr AccelMap -> Ptr AccelMap -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr AccelMap
forall a. Ptr a
FP.nullPtr
        then AccelMap -> Maybe AccelMap
forall a. a -> Maybe a
P.Just (AccelMap -> Maybe AccelMap) -> IO AccelMap -> IO (Maybe AccelMap)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr AccelMap -> AccelMap) -> Ptr AccelMap -> IO AccelMap
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr AccelMap -> AccelMap
AccelMap Ptr AccelMap
ptr
        else Maybe AccelMap -> IO (Maybe AccelMap)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe AccelMap
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveAccelMapMethod (t :: Symbol) (o :: *) :: * where
    ResolveAccelMapMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveAccelMapMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveAccelMapMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveAccelMapMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveAccelMapMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveAccelMapMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveAccelMapMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveAccelMapMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveAccelMapMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveAccelMapMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveAccelMapMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveAccelMapMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveAccelMapMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveAccelMapMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveAccelMapMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveAccelMapMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveAccelMapMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveAccelMapMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveAccelMapMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveAccelMapMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveAccelMapMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveAccelMapMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveAccelMapMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveAccelMapMethod t AccelMap, O.OverloadedMethod info AccelMap p) => OL.IsLabel t (AccelMap -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveAccelMapMethod t AccelMap, O.OverloadedMethod info AccelMap p, R.HasField t AccelMap p) => R.HasField t AccelMap p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveAccelMapMethod t AccelMap, O.OverloadedMethodInfo info AccelMap) => OL.IsLabel t (O.MethodProxy info AccelMap) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- signal AccelMap::changed
-- | Notifies of a change in the global accelerator map.
-- The path is also used as the detail for the signal,
-- so it is possible to connect to
-- changed::@accel_path@.
-- 
-- /Since: 2.4/
type AccelMapChangedCallback =
    T.Text
    -- ^ /@accelPath@/: the path of the accelerator that changed
    -> Word32
    -- ^ /@accelKey@/: the key value for the new accelerator
    -> [Gdk.Flags.ModifierType]
    -- ^ /@accelMods@/: the modifier mask for the new accelerator
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `AccelMapChangedCallback`@.
noAccelMapChangedCallback :: Maybe AccelMapChangedCallback
noAccelMapChangedCallback :: Maybe AccelMapChangedCallback
noAccelMapChangedCallback = Maybe AccelMapChangedCallback
forall a. Maybe a
Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_AccelMapChanged :: MonadIO m => AccelMapChangedCallback -> m (GClosure C_AccelMapChangedCallback)
genClosure_AccelMapChanged :: forall (m :: * -> *).
MonadIO m =>
AccelMapChangedCallback -> m (GClosure C_AccelMapChangedCallback)
genClosure_AccelMapChanged AccelMapChangedCallback
cb = IO (GClosure C_AccelMapChangedCallback)
-> m (GClosure C_AccelMapChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_AccelMapChangedCallback)
 -> m (GClosure C_AccelMapChangedCallback))
-> IO (GClosure C_AccelMapChangedCallback)
-> m (GClosure C_AccelMapChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_AccelMapChangedCallback
cb' = AccelMapChangedCallback -> C_AccelMapChangedCallback
wrap_AccelMapChangedCallback AccelMapChangedCallback
cb
    C_AccelMapChangedCallback -> IO (FunPtr C_AccelMapChangedCallback)
mk_AccelMapChangedCallback C_AccelMapChangedCallback
cb' IO (FunPtr C_AccelMapChangedCallback)
-> (FunPtr C_AccelMapChangedCallback
    -> IO (GClosure C_AccelMapChangedCallback))
-> IO (GClosure C_AccelMapChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_AccelMapChangedCallback
-> IO (GClosure C_AccelMapChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `AccelMapChangedCallback` into a `C_AccelMapChangedCallback`.
wrap_AccelMapChangedCallback ::
    AccelMapChangedCallback ->
    C_AccelMapChangedCallback
wrap_AccelMapChangedCallback :: AccelMapChangedCallback -> C_AccelMapChangedCallback
wrap_AccelMapChangedCallback AccelMapChangedCallback
_cb Ptr ()
_ CString
accelPath Word32
accelKey CUInt
accelMods Ptr ()
_ = do
    Text
accelPath' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
accelPath
    let accelMods' :: [ModifierType]
accelMods' = CUInt -> [ModifierType]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
accelMods
    AccelMapChangedCallback
_cb  Text
accelPath' Word32
accelKey [ModifierType]
accelMods'


-- | Connect a signal handler for the [changed](#signal: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' accelMap #changed callback
-- @
-- 
-- This signal admits a optional parameter @detail@.
-- If it's not @Nothing@, we will connect to “@changed::detail@” instead.
-- 
onAccelMapChanged :: (IsAccelMap a, MonadIO m) => a -> P.Maybe T.Text -> AccelMapChangedCallback -> m SignalHandlerId
onAccelMapChanged :: forall a (m :: * -> *).
(IsAccelMap a, MonadIO m) =>
a -> Maybe Text -> AccelMapChangedCallback -> m SignalHandlerId
onAccelMapChanged a
obj Maybe Text
detail AccelMapChangedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_AccelMapChangedCallback
cb' = AccelMapChangedCallback -> C_AccelMapChangedCallback
wrap_AccelMapChangedCallback AccelMapChangedCallback
cb
    FunPtr C_AccelMapChangedCallback
cb'' <- C_AccelMapChangedCallback -> IO (FunPtr C_AccelMapChangedCallback)
mk_AccelMapChangedCallback C_AccelMapChangedCallback
cb'
    a
-> Text
-> FunPtr C_AccelMapChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"changed" FunPtr C_AccelMapChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
detail

-- | Connect a signal handler for the [changed](#signal: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' accelMap #changed callback
-- @
-- 
-- This signal admits a optional parameter @detail@.
-- If it's not @Nothing@, we will connect to “@changed::detail@” instead.
-- 
afterAccelMapChanged :: (IsAccelMap a, MonadIO m) => a -> P.Maybe T.Text -> AccelMapChangedCallback -> m SignalHandlerId
afterAccelMapChanged :: forall a (m :: * -> *).
(IsAccelMap a, MonadIO m) =>
a -> Maybe Text -> AccelMapChangedCallback -> m SignalHandlerId
afterAccelMapChanged a
obj Maybe Text
detail AccelMapChangedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_AccelMapChangedCallback
cb' = AccelMapChangedCallback -> C_AccelMapChangedCallback
wrap_AccelMapChangedCallback AccelMapChangedCallback
cb
    FunPtr C_AccelMapChangedCallback
cb'' <- C_AccelMapChangedCallback -> IO (FunPtr C_AccelMapChangedCallback)
mk_AccelMapChangedCallback C_AccelMapChangedCallback
cb'
    a
-> Text
-> FunPtr C_AccelMapChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"changed" FunPtr C_AccelMapChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
detail


#if defined(ENABLE_OVERLOADING)
data AccelMapChangedSignalInfo
instance SignalInfo AccelMapChangedSignalInfo where
    type HaskellCallbackType AccelMapChangedSignalInfo = AccelMapChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_AccelMapChangedCallback cb
        cb'' <- mk_AccelMapChangedCallback cb'
        connectSignalFunPtr obj "changed" cb'' connectMode detail

#endif

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

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList AccelMap = AccelMapSignalList
type AccelMapSignalList = ('[ '("changed", AccelMapChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method AccelMap::add_entry
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "accel_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "valid accelerator path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "accel_key"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the accelerator key"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "accel_mods"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ModifierType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the accelerator modifiers"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_add_entry" gtk_accel_map_add_entry :: 
    CString ->                              -- accel_path : TBasicType TUTF8
    Word32 ->                               -- accel_key : TBasicType TUInt
    CUInt ->                                -- accel_mods : TInterface (Name {namespace = "Gdk", name = "ModifierType"})
    IO ()

-- | Registers a new accelerator with the global accelerator map.
-- This function should only be called once per /@accelPath@/
-- with the canonical /@accelKey@/ and /@accelMods@/ for this path.
-- To change the accelerator during runtime programatically, use
-- 'GI.Gtk.Objects.AccelMap.accelMapChangeEntry'.
-- 
-- Set /@accelKey@/ and /@accelMods@/ to 0 to request a removal of
-- the accelerator.
-- 
-- Note that /@accelPath@/ string will be stored in a @/GQuark/@. Therefore, if you
-- pass a static string, you can save some memory by interning it first with
-- 'GI.GLib.Functions.internStaticString'.
accelMapAddEntry ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@accelPath@/: valid accelerator path
    -> Word32
    -- ^ /@accelKey@/: the accelerator key
    -> [Gdk.Flags.ModifierType]
    -- ^ /@accelMods@/: the accelerator modifiers
    -> m ()
accelMapAddEntry :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Word32 -> [ModifierType] -> m ()
accelMapAddEntry Text
accelPath Word32
accelKey [ModifierType]
accelMods = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
accelPath' <- Text -> IO CString
textToCString Text
accelPath
    let accelMods' :: CUInt
accelMods' = [ModifierType] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ModifierType]
accelMods
    CString -> Word32 -> CUInt -> IO ()
gtk_accel_map_add_entry CString
accelPath' Word32
accelKey CUInt
accelMods'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
accelPath'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::add_filter
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "filter_pattern"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a pattern (see #GPatternSpec)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_add_filter" gtk_accel_map_add_filter :: 
    CString ->                              -- filter_pattern : TBasicType TUTF8
    IO ()

-- | Adds a filter to the global list of accel path filters.
-- 
-- Accel map entries whose accel path matches one of the filters
-- are skipped by 'GI.Gtk.Objects.AccelMap.accelMapForeach'.
-- 
-- This function is intended for GTK+ modules that create their own
-- menus, but don’t want them to be saved into the applications accelerator
-- map dump.
accelMapAddFilter ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@filterPattern@/: a pattern (see t'GI.GLib.Structs.PatternSpec.PatternSpec')
    -> m ()
accelMapAddFilter :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
accelMapAddFilter Text
filterPattern = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
filterPattern' <- Text -> IO CString
textToCString Text
filterPattern
    CString -> IO ()
gtk_accel_map_add_filter CString
filterPattern'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filterPattern'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::change_entry
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "accel_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a valid accelerator path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "accel_key"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the new accelerator key"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "accel_mods"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "ModifierType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the new accelerator modifiers"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "replace"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "%TRUE if other accelerators may be deleted upon conflicts"
--                 , 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_accel_map_change_entry" gtk_accel_map_change_entry :: 
    CString ->                              -- accel_path : TBasicType TUTF8
    Word32 ->                               -- accel_key : TBasicType TUInt
    CUInt ->                                -- accel_mods : TInterface (Name {namespace = "Gdk", name = "ModifierType"})
    CInt ->                                 -- replace : TBasicType TBoolean
    IO CInt

-- | Changes the /@accelKey@/ and /@accelMods@/ currently associated with /@accelPath@/.
-- Due to conflicts with other accelerators, a change may not always be possible,
-- /@replace@/ indicates whether other accelerators may be deleted to resolve such
-- conflicts. A change will only occur if all conflicts could be resolved (which
-- might not be the case if conflicting accelerators are locked). Successful
-- changes are indicated by a 'P.True' return value.
-- 
-- Note that /@accelPath@/ string will be stored in a @/GQuark/@. Therefore, if you
-- pass a static string, you can save some memory by interning it first with
-- 'GI.GLib.Functions.internStaticString'.
accelMapChangeEntry ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@accelPath@/: a valid accelerator path
    -> Word32
    -- ^ /@accelKey@/: the new accelerator key
    -> [Gdk.Flags.ModifierType]
    -- ^ /@accelMods@/: the new accelerator modifiers
    -> Bool
    -- ^ /@replace@/: 'P.True' if other accelerators may be deleted upon conflicts
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the accelerator could be changed, 'P.False' otherwise
accelMapChangeEntry :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Word32 -> [ModifierType] -> Bool -> m Bool
accelMapChangeEntry Text
accelPath Word32
accelKey [ModifierType]
accelMods Bool
replace = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
accelPath' <- Text -> IO CString
textToCString Text
accelPath
    let accelMods' :: CUInt
accelMods' = [ModifierType] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ModifierType]
accelMods
    let replace' :: CInt
replace' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
replace
    CInt
result <- CString -> Word32 -> CUInt -> CInt -> IO CInt
gtk_accel_map_change_entry CString
accelPath' Word32
accelKey CUInt
accelMods' CInt
replace'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
accelPath'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::foreach
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data to be passed into @foreach_func"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "foreach_func"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "AccelMapForeach" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "function to be executed for each accel\n               map entry which is not filtered out"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeCall
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_foreach" gtk_accel_map_foreach :: 
    Ptr () ->                               -- data : TBasicType TPtr
    FunPtr Gtk.Callbacks.C_AccelMapForeach -> -- foreach_func : TInterface (Name {namespace = "Gtk", name = "AccelMapForeach"})
    IO ()

-- | Loops over the entries in the accelerator map whose accel path
-- doesn’t match any of the filters added with 'GI.Gtk.Objects.AccelMap.accelMapAddFilter',
-- and execute /@foreachFunc@/ on each. The signature of /@foreachFunc@/ is
-- that of t'GI.Gtk.Callbacks.AccelMapForeach', the /@changed@/ parameter indicates whether
-- this accelerator was changed during runtime (thus, would need
-- saving during an accelerator map dump).
accelMapForeach ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@data@/: data to be passed into /@foreachFunc@/
    -> Gtk.Callbacks.AccelMapForeach
    -- ^ /@foreachFunc@/: function to be executed for each accel
    --                map entry which is not filtered out
    -> m ()
accelMapForeach :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ptr () -> AccelMapForeach -> m ()
accelMapForeach Ptr ()
data_ AccelMapForeach
foreachFunc = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    FunPtr C_AccelMapForeach
foreachFunc' <- C_AccelMapForeach -> IO (FunPtr C_AccelMapForeach)
Gtk.Callbacks.mk_AccelMapForeach (Maybe (Ptr (FunPtr C_AccelMapForeach))
-> AccelMapForeach -> C_AccelMapForeach
Gtk.Callbacks.wrap_AccelMapForeach Maybe (Ptr (FunPtr C_AccelMapForeach))
forall a. Maybe a
Nothing AccelMapForeach
foreachFunc)
    Ptr () -> FunPtr C_AccelMapForeach -> IO ()
gtk_accel_map_foreach Ptr ()
data_ FunPtr C_AccelMapForeach
foreachFunc'
    Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_AccelMapForeach -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_AccelMapForeach
foreachFunc'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::foreach_unfiltered
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data to be passed into @foreach_func"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "foreach_func"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "AccelMapForeach" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "function to be executed for each accel\n               map entry"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeCall
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_foreach_unfiltered" gtk_accel_map_foreach_unfiltered :: 
    Ptr () ->                               -- data : TBasicType TPtr
    FunPtr Gtk.Callbacks.C_AccelMapForeach -> -- foreach_func : TInterface (Name {namespace = "Gtk", name = "AccelMapForeach"})
    IO ()

-- | Loops over all entries in the accelerator map, and execute
-- /@foreachFunc@/ on each. The signature of /@foreachFunc@/ is that of
-- t'GI.Gtk.Callbacks.AccelMapForeach', the /@changed@/ parameter indicates whether
-- this accelerator was changed during runtime (thus, would need
-- saving during an accelerator map dump).
accelMapForeachUnfiltered ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@data@/: data to be passed into /@foreachFunc@/
    -> Gtk.Callbacks.AccelMapForeach
    -- ^ /@foreachFunc@/: function to be executed for each accel
    --                map entry
    -> m ()
accelMapForeachUnfiltered :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Ptr () -> AccelMapForeach -> m ()
accelMapForeachUnfiltered Ptr ()
data_ AccelMapForeach
foreachFunc = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    FunPtr C_AccelMapForeach
foreachFunc' <- C_AccelMapForeach -> IO (FunPtr C_AccelMapForeach)
Gtk.Callbacks.mk_AccelMapForeach (Maybe (Ptr (FunPtr C_AccelMapForeach))
-> AccelMapForeach -> C_AccelMapForeach
Gtk.Callbacks.wrap_AccelMapForeach Maybe (Ptr (FunPtr C_AccelMapForeach))
forall a. Maybe a
Nothing AccelMapForeach
foreachFunc)
    Ptr () -> FunPtr C_AccelMapForeach -> IO ()
gtk_accel_map_foreach_unfiltered Ptr ()
data_ FunPtr C_AccelMapForeach
foreachFunc'
    Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_AccelMapForeach -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_AccelMapForeach
foreachFunc'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::get
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "AccelMap" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_get" gtk_accel_map_get :: 
    IO (Ptr AccelMap)

-- | Gets the singleton global t'GI.Gtk.Objects.AccelMap.AccelMap' object. This object
-- is useful only for notification of changes to the accelerator
-- map via the [changed](#g:signal:changed) signal; it isn’t a parameter to the
-- other accelerator map functions.
-- 
-- /Since: 2.4/
accelMapGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m AccelMap
    -- ^ __Returns:__ the global t'GI.Gtk.Objects.AccelMap.AccelMap' object
accelMapGet :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m AccelMap
accelMapGet  = IO AccelMap -> m AccelMap
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AccelMap -> m AccelMap) -> IO AccelMap -> m AccelMap
forall a b. (a -> b) -> a -> b
$ do
    Ptr AccelMap
result <- IO (Ptr AccelMap)
gtk_accel_map_get
    Text -> Ptr AccelMap -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"accelMapGet" Ptr AccelMap
result
    AccelMap
result' <- ((ManagedPtr AccelMap -> AccelMap) -> Ptr AccelMap -> IO AccelMap
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr AccelMap -> AccelMap
AccelMap) Ptr AccelMap
result
    AccelMap -> IO AccelMap
forall (m :: * -> *) a. Monad m => a -> m a
return AccelMap
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::load
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "file_name"
--           , argType = TBasicType TFileName
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a file containing accelerator specifications,\n  in the GLib file name encoding"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_load" gtk_accel_map_load :: 
    CString ->                              -- file_name : TBasicType TFileName
    IO ()

-- | Parses a file previously saved with 'GI.Gtk.Objects.AccelMap.accelMapSave' for
-- accelerator specifications, and propagates them accordingly.
accelMapLoad ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Char]
    -- ^ /@fileName@/: a file containing accelerator specifications,
    --   in the GLib file name encoding
    -> m ()
accelMapLoad :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Char] -> m ()
accelMapLoad [Char]
fileName = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
fileName' <- [Char] -> IO CString
stringToCString [Char]
fileName
    CString -> IO ()
gtk_accel_map_load CString
fileName'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
fileName'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::load_fd
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "fd"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a valid readable file descriptor"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_load_fd" gtk_accel_map_load_fd :: 
    Int32 ->                                -- fd : TBasicType TInt
    IO ()

-- | Filedescriptor variant of 'GI.Gtk.Objects.AccelMap.accelMapLoad'.
-- 
-- Note that the file descriptor will not be closed by this function.
accelMapLoadFd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@fd@/: a valid readable file descriptor
    -> m ()
accelMapLoadFd :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> m ()
accelMapLoadFd Int32
fd = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Int32 -> IO ()
gtk_accel_map_load_fd Int32
fd
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::load_scanner
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "scanner"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "Scanner" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a #GScanner which has already been provided with an input file"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_load_scanner" gtk_accel_map_load_scanner :: 
    Ptr GLib.Scanner.Scanner ->             -- scanner : TInterface (Name {namespace = "GLib", name = "Scanner"})
    IO ()

-- | t'GI.GLib.Structs.Scanner.Scanner' variant of 'GI.Gtk.Objects.AccelMap.accelMapLoad'.
accelMapLoadScanner ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Scanner.Scanner
    -- ^ /@scanner@/: a t'GI.GLib.Structs.Scanner.Scanner' which has already been provided with an input file
    -> m ()
accelMapLoadScanner :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Scanner -> m ()
accelMapLoadScanner Scanner
scanner = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Scanner
scanner' <- Scanner -> IO (Ptr Scanner)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Scanner
scanner
    Ptr Scanner -> IO ()
gtk_accel_map_load_scanner Ptr Scanner
scanner'
    Scanner -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Scanner
scanner
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::lock_path
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "accel_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a valid accelerator path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_lock_path" gtk_accel_map_lock_path :: 
    CString ->                              -- accel_path : TBasicType TUTF8
    IO ()

-- | Locks the given accelerator path. If the accelerator map doesn’t yet contain
-- an entry for /@accelPath@/, a new one is created.
-- 
-- Locking an accelerator path prevents its accelerator from being changed
-- during runtime. A locked accelerator path can be unlocked by
-- 'GI.Gtk.Objects.AccelMap.accelMapUnlockPath'. Refer to 'GI.Gtk.Objects.AccelMap.accelMapChangeEntry'
-- for information about runtime accelerator changes.
-- 
-- If called more than once, /@accelPath@/ remains locked until
-- 'GI.Gtk.Objects.AccelMap.accelMapUnlockPath' has been called an equivalent number
-- of times.
-- 
-- Note that locking of individual accelerator paths is independent from
-- locking the t'GI.Gtk.Objects.AccelGroup.AccelGroup' containing them. For runtime accelerator
-- changes to be possible, both the accelerator path and its t'GI.Gtk.Objects.AccelGroup.AccelGroup'
-- have to be unlocked.
-- 
-- /Since: 2.4/
accelMapLockPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@accelPath@/: a valid accelerator path
    -> m ()
accelMapLockPath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
accelMapLockPath Text
accelPath = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
accelPath' <- Text -> IO CString
textToCString Text
accelPath
    CString -> IO ()
gtk_accel_map_lock_path CString
accelPath'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
accelPath'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::lookup_entry
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "accel_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a valid accelerator path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "key"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "AccelKey" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the accelerator key to be filled in (optional)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_lookup_entry" gtk_accel_map_lookup_entry :: 
    CString ->                              -- accel_path : TBasicType TUTF8
    Ptr Gtk.AccelKey.AccelKey ->            -- key : TInterface (Name {namespace = "Gtk", name = "AccelKey"})
    IO CInt

-- | Looks up the accelerator entry for /@accelPath@/ and fills in /@key@/.
accelMapLookupEntry ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@accelPath@/: a valid accelerator path
    -> m ((Bool, Gtk.AccelKey.AccelKey))
    -- ^ __Returns:__ 'P.True' if /@accelPath@/ is known, 'P.False' otherwise
accelMapLookupEntry :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m (Bool, AccelKey)
accelMapLookupEntry Text
accelPath = IO (Bool, AccelKey) -> m (Bool, AccelKey)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, AccelKey) -> m (Bool, AccelKey))
-> IO (Bool, AccelKey) -> m (Bool, AccelKey)
forall a b. (a -> b) -> a -> b
$ do
    CString
accelPath' <- Text -> IO CString
textToCString Text
accelPath
    Ptr AccelKey
key <- Int -> IO (Ptr AccelKey)
forall a. Int -> IO (Ptr a)
SP.callocBytes Int
12 :: IO (Ptr Gtk.AccelKey.AccelKey)
    CInt
result <- CString -> Ptr AccelKey -> IO CInt
gtk_accel_map_lookup_entry CString
accelPath' Ptr AccelKey
key
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    AccelKey
key' <- ((ManagedPtr AccelKey -> AccelKey) -> Ptr AccelKey -> IO AccelKey
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr AccelKey -> AccelKey
Gtk.AccelKey.AccelKey) Ptr AccelKey
key
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
accelPath'
    (Bool, AccelKey) -> IO (Bool, AccelKey)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', AccelKey
key')

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::save
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "file_name"
--           , argType = TBasicType TFileName
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the name of the file to contain\n  accelerator specifications, in the GLib file name encoding"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_save" gtk_accel_map_save :: 
    CString ->                              -- file_name : TBasicType TFileName
    IO ()

-- | Saves current accelerator specifications (accelerator path, key
-- and modifiers) to /@fileName@/.
-- The file is written in a format suitable to be read back in by
-- 'GI.Gtk.Objects.AccelMap.accelMapLoad'.
accelMapSave ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Char]
    -- ^ /@fileName@/: the name of the file to contain
    --   accelerator specifications, in the GLib file name encoding
    -> m ()
accelMapSave :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Char] -> m ()
accelMapSave [Char]
fileName = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
fileName' <- [Char] -> IO CString
stringToCString [Char]
fileName
    CString -> IO ()
gtk_accel_map_save CString
fileName'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
fileName'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::save_fd
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "fd"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a valid writable file descriptor"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_save_fd" gtk_accel_map_save_fd :: 
    Int32 ->                                -- fd : TBasicType TInt
    IO ()

-- | Filedescriptor variant of 'GI.Gtk.Objects.AccelMap.accelMapSave'.
-- 
-- Note that the file descriptor will not be closed by this function.
accelMapSaveFd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@fd@/: a valid writable file descriptor
    -> m ()
accelMapSaveFd :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> m ()
accelMapSaveFd Int32
fd = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Int32 -> IO ()
gtk_accel_map_save_fd Int32
fd
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif

-- method AccelMap::unlock_path
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "accel_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a valid accelerator path"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_accel_map_unlock_path" gtk_accel_map_unlock_path :: 
    CString ->                              -- accel_path : TBasicType TUTF8
    IO ()

-- | Undoes the last call to 'GI.Gtk.Objects.AccelMap.accelMapLockPath' on this /@accelPath@/.
-- Refer to 'GI.Gtk.Objects.AccelMap.accelMapLockPath' for information about accelerator path locking.
-- 
-- /Since: 2.4/
accelMapUnlockPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@accelPath@/: a valid accelerator path
    -> m ()
accelMapUnlockPath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
accelMapUnlockPath Text
accelPath = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
accelPath' <- Text -> IO CString
textToCString Text
accelPath
    CString -> IO ()
gtk_accel_map_unlock_path CString
accelPath'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
accelPath'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
#endif