gi-gtk-0.3.18.13: GI/Gtk/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)
#GtkActionEntry structs are used with gtk_action_group_add_actions() to
construct actions.
-}
module GI.Gtk.Structs.ActionEntry
(
-- * Exported types
ActionEntry(..) ,
newZeroActionEntry ,
noActionEntry ,
-- * Properties
-- ** Accelerator
actionEntryReadAccelerator ,
-- ** Label
actionEntryReadLabel ,
-- ** Name
actionEntryReadName ,
-- ** StockId
actionEntryReadStockId ,
-- ** Tooltip
actionEntryReadTooltip ,
) 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
newtype ActionEntry = ActionEntry (ForeignPtr ActionEntry)
-- | Construct a `ActionEntry` struct initialized to zero.
newZeroActionEntry :: MonadIO m => m ActionEntry
newZeroActionEntry = liftIO $ callocBytes 48 >>= 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'
actionEntryReadStockId :: ActionEntry -> IO T.Text
actionEntryReadStockId s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
val' <- cstringToText val
return val'
actionEntryReadLabel :: ActionEntry -> IO T.Text
actionEntryReadLabel s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CString
val' <- cstringToText val
return val'
actionEntryReadAccelerator :: ActionEntry -> IO T.Text
actionEntryReadAccelerator s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO CString
val' <- cstringToText val
return val'
actionEntryReadTooltip :: ActionEntry -> IO T.Text
actionEntryReadTooltip s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 32) :: IO CString
val' <- cstringToText val
return val'
-- XXX Skipped getter for "ActionEntry:callback" :: 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