{-# LINE 2 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
module Graphics.UI.Gtk.ActionMenuToolbar.ToggleAction (
ToggleAction,
ToggleActionClass,
castToToggleAction, gTypeToggleAction,
toToggleAction,
toggleActionNew,
toggleActionToggled,
toggleActionSetActive,
toggleActionGetActive,
toggleActionSetDrawAsRadio,
toggleActionGetDrawAsRadio,
toggleActionDrawAsRadio,
toggleActionActive,
actionToggled,
onActionToggled,
afterActionToggled,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Types
{-# LINE 87 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
import Graphics.UI.Gtk.Signals
{-# LINE 88 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
import Graphics.UI.Gtk.General.StockItems
{-# LINE 91 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
toggleActionNew :: GlibString string
=> string
-> string
-> Maybe string
-> Maybe StockId
-> IO ToggleAction
toggleActionNew :: forall string.
GlibString string =>
string
-> string -> Maybe string -> Maybe StockId -> IO ToggleAction
toggleActionNew string
name string
label Maybe string
tooltip Maybe StockId
stockId =
(ForeignPtr ToggleAction -> ToggleAction,
FinalizerPtr ToggleAction)
-> IO (Ptr ToggleAction) -> IO ToggleAction
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr ToggleAction -> ToggleAction,
FinalizerPtr ToggleAction)
forall {a}.
(ForeignPtr ToggleAction -> ToggleAction, FinalizerPtr a)
mkToggleAction (IO (Ptr ToggleAction) -> IO ToggleAction)
-> IO (Ptr ToggleAction) -> IO ToggleAction
forall a b. (a -> b) -> a -> b
$
(StockId
-> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
-> Maybe StockId
-> (Ptr CChar -> IO (Ptr ToggleAction))
-> IO (Ptr ToggleAction)
forall a b c.
(a -> (Ptr b -> IO c) -> IO c)
-> Maybe a -> (Ptr b -> IO c) -> IO c
maybeWith StockId
-> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
forall a. StockId -> (Ptr CChar -> IO a) -> IO a
withUTFString Maybe StockId
stockId ((Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
-> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
stockIdPtr ->
(string
-> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
-> Maybe string
-> (Ptr CChar -> IO (Ptr ToggleAction))
-> IO (Ptr ToggleAction)
forall a b c.
(a -> (Ptr b -> IO c) -> IO c)
-> Maybe a -> (Ptr b -> IO c) -> IO c
maybeWith string
-> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
forall a. string -> (Ptr CChar -> IO a) -> IO a
forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
withUTFString Maybe string
tooltip ((Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
-> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
tooltipPtr ->
string
-> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
forall a. string -> (Ptr CChar -> IO a) -> IO a
forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
withUTFString string
label ((Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
-> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
labelPtr ->
string
-> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
forall a. string -> (Ptr CChar -> IO a) -> IO a
forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
withUTFString string
name ((Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
-> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
namePtr ->
Ptr CChar
-> Ptr CChar -> Ptr CChar -> Ptr CChar -> IO (Ptr ToggleAction)
gtk_toggle_action_new
{-# LINE 115 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
namePtr
Ptr CChar
labelPtr
Ptr CChar
tooltipPtr
Ptr CChar
stockIdPtr
toggleActionToggled :: ToggleActionClass self => self -> IO ()
toggleActionToggled :: forall self. ToggleActionClass self => self -> IO ()
toggleActionToggled self
self =
(\(ToggleAction ForeignPtr ToggleAction
arg1) -> ForeignPtr ToggleAction -> (Ptr ToggleAction -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ToggleAction
arg1 ((Ptr ToggleAction -> IO ()) -> IO ())
-> (Ptr ToggleAction -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ToggleAction
argPtr1 ->Ptr ToggleAction -> IO ()
gtk_toggle_action_toggled Ptr ToggleAction
argPtr1)
{-# LINE 128 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
(toToggleAction self)
toggleActionSetActive :: ToggleActionClass self => self
-> Bool
-> IO ()
toggleActionSetActive :: forall self. ToggleActionClass self => self -> Bool -> IO ()
toggleActionSetActive self
self Bool
isActive =
(\(ToggleAction ForeignPtr ToggleAction
arg1) CInt
arg2 -> ForeignPtr ToggleAction -> (Ptr ToggleAction -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ToggleAction
arg1 ((Ptr ToggleAction -> IO ()) -> IO ())
-> (Ptr ToggleAction -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ToggleAction
argPtr1 ->Ptr ToggleAction -> CInt -> IO ()
gtk_toggle_action_set_active Ptr ToggleAction
argPtr1 CInt
arg2)
{-# LINE 137 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
(toToggleAction self)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
isActive)
toggleActionGetActive :: ToggleActionClass self => self -> IO Bool
toggleActionGetActive :: forall self. ToggleActionClass self => self -> IO Bool
toggleActionGetActive self
self =
(CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
(\(ToggleAction ForeignPtr ToggleAction
arg1) -> ForeignPtr ToggleAction -> (Ptr ToggleAction -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ToggleAction
arg1 ((Ptr ToggleAction -> IO CInt) -> IO CInt)
-> (Ptr ToggleAction -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr ToggleAction
argPtr1 ->Ptr ToggleAction -> IO CInt
gtk_toggle_action_get_active Ptr ToggleAction
argPtr1)
{-# LINE 146 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
(toToggleAction self)
toggleActionSetDrawAsRadio :: ToggleActionClass self => self -> Bool -> IO ()
toggleActionSetDrawAsRadio :: forall self. ToggleActionClass self => self -> Bool -> IO ()
toggleActionSetDrawAsRadio self
self Bool
drawAsRadio =
(\(ToggleAction ForeignPtr ToggleAction
arg1) CInt
arg2 -> ForeignPtr ToggleAction -> (Ptr ToggleAction -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ToggleAction
arg1 ((Ptr ToggleAction -> IO ()) -> IO ())
-> (Ptr ToggleAction -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ToggleAction
argPtr1 ->Ptr ToggleAction -> CInt -> IO ()
gtk_toggle_action_set_draw_as_radio Ptr ToggleAction
argPtr1 CInt
arg2)
{-# LINE 153 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
(toToggleAction self)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
drawAsRadio)
toggleActionGetDrawAsRadio :: ToggleActionClass self => self -> IO Bool
toggleActionGetDrawAsRadio :: forall self. ToggleActionClass self => self -> IO Bool
toggleActionGetDrawAsRadio self
self =
(CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
(\(ToggleAction ForeignPtr ToggleAction
arg1) -> ForeignPtr ToggleAction -> (Ptr ToggleAction -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr ToggleAction
arg1 ((Ptr ToggleAction -> IO CInt) -> IO CInt)
-> (Ptr ToggleAction -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr ToggleAction
argPtr1 ->Ptr ToggleAction -> IO CInt
gtk_toggle_action_get_draw_as_radio Ptr ToggleAction
argPtr1)
{-# LINE 162 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
(toToggleAction self)
toggleActionDrawAsRadio :: ToggleActionClass self => Attr self Bool
toggleActionDrawAsRadio :: forall self. ToggleActionClass self => Attr self Bool
toggleActionDrawAsRadio = (self -> IO Bool)
-> (self -> Bool -> IO ()) -> ReadWriteAttr self Bool Bool
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
self -> IO Bool
forall self. ToggleActionClass self => self -> IO Bool
toggleActionGetDrawAsRadio
self -> Bool -> IO ()
forall self. ToggleActionClass self => self -> Bool -> IO ()
toggleActionSetDrawAsRadio
toggleActionActive :: ToggleActionClass self => Attr self Bool
toggleActionActive :: forall self. ToggleActionClass self => Attr self Bool
toggleActionActive = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"active"
actionToggled :: ToggleActionClass self => Signal self (IO ())
actionToggled :: forall self. ToggleActionClass self => Signal self (IO ())
actionToggled = (Bool -> self -> IO () -> IO (ConnectId self))
-> Signal self (IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String -> Bool -> self -> IO () -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
String -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE String
"toggled")
onActionToggled :: ToggleActionClass self => self
-> IO ()
-> IO (ConnectId self)
onActionToggled :: forall self.
ToggleActionClass self =>
self -> IO () -> IO (ConnectId self)
onActionToggled = String -> Bool -> self -> IO () -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
String -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE String
"toggled" Bool
False
{-# DEPRECATED onActionToggled "instead of 'onActionToggled obj' use 'on obj actionToggled'" #-}
afterActionToggled :: ToggleActionClass self => self
-> IO ()
-> IO (ConnectId self)
afterActionToggled :: forall self.
ToggleActionClass self =>
self -> IO () -> IO (ConnectId self)
afterActionToggled = String -> Bool -> self -> IO () -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
String -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE String
"toggled" Bool
True
{-# DEPRECATED afterActionToggled "instead of 'afterActionToggled obj' use 'after obj actionToggled'" #-}
foreign import ccall safe "gtk_toggle_action_new"
gtk_toggle_action_new :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (IO (Ptr ToggleAction))))))
foreign import ccall safe "gtk_toggle_action_toggled"
gtk_toggle_action_toggled :: ((Ptr ToggleAction) -> (IO ()))
foreign import ccall safe "gtk_toggle_action_set_active"
gtk_toggle_action_set_active :: ((Ptr ToggleAction) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_toggle_action_get_active"
gtk_toggle_action_get_active :: ((Ptr ToggleAction) -> (IO CInt))
foreign import ccall safe "gtk_toggle_action_set_draw_as_radio"
gtk_toggle_action_set_draw_as_radio :: ((Ptr ToggleAction) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_toggle_action_get_draw_as_radio"
gtk_toggle_action_get_draw_as_radio :: ((Ptr ToggleAction) -> (IO CInt))