gi-gio-0.2.46.13: GI/Gio/Structs/ActionEntry.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
This struct defines a single action. It is for use with
g_action_map_add_action_entries().
The order of the items in the structure are intended to reflect
frequency of use. It is permissible to use an incomplete initialiser
in order to leave some of the later values as %NULL. All values
after @name are optional. Additional optional fields may be added in
the future.
See g_action_map_add_action_entries() for an example.
-}
module GI.Gio.Structs.ActionEntry
(
-- * Exported types
ActionEntry(..) ,
newZeroActionEntry ,
noActionEntry ,
-- * Properties
-- ** Name
actionEntryReadName ,
-- ** ParameterType
actionEntryReadParameterType ,
-- ** State
actionEntryReadState ,
) 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.Gio.Types
import GI.Gio.Callbacks
newtype ActionEntry = ActionEntry (ForeignPtr ActionEntry)
-- | Construct a `ActionEntry` struct initialized to zero.
newZeroActionEntry :: MonadIO m => m ActionEntry
newZeroActionEntry = liftIO $ callocBytes 64 >>= wrapPtr ActionEntry
noActionEntry :: Maybe ActionEntry
noActionEntry = Nothing
actionEntryReadName :: ActionEntry -> IO T.Text
actionEntryReadName s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CString
val' <- cstringToText val
return val'
-- XXX Skipped getter for "ActionEntry:activate" :: Not implemented: "Wrapping foreign callbacks is not supported yet"
actionEntryReadParameterType :: ActionEntry -> IO T.Text
actionEntryReadParameterType s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CString
val' <- cstringToText val
return val'
actionEntryReadState :: ActionEntry -> IO T.Text
actionEntryReadState s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO CString
val' <- cstringToText val
return val'
-- XXX Skipped getter for "ActionEntry:change_state" :: Not implemented: "Wrapping foreign callbacks is not supported yet"
type family ResolveActionEntryMethod (t :: Symbol) (o :: *) :: * where
ResolveActionEntryMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveActionEntryMethod t ActionEntry, MethodInfo info ActionEntry p) => IsLabelProxy t (ActionEntry -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveActionEntryMethod t ActionEntry, MethodInfo info ActionEntry p) => IsLabel t (ActionEntry -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif