{-# LINE 2 "./Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs" #-}
module Graphics.UI.Gtk.ActionMenuToolbar.RadioAction (
RadioAction,
RadioActionClass,
castToRadioAction, gTypeRadioAction,
toRadioAction,
radioActionNew,
radioActionGetGroup,
radioActionSetGroup,
radioActionGetCurrentValue,
radioActionValueAttr,
radioActionGroup,
radioActionCurrentValue,
radioActionChanged,
onRadioActionChanged,
afterRadioActionChanged,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.GList
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Types
{-# LINE 92 "./Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs" #-}
import Graphics.UI.Gtk.Signals
{-# LINE 93 "./Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs" #-}
import Graphics.UI.Gtk.General.StockItems
{-# LINE 96 "./Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs" #-}
radioActionNew :: GlibString string
=> string
-> string
-> Maybe string
-> Maybe StockId
-> Int
-> IO RadioAction
radioActionNew :: forall string.
GlibString string =>
string
-> string -> Maybe string -> Maybe StockId -> Int -> IO RadioAction
radioActionNew string
name string
label Maybe string
tooltip Maybe StockId
stockId Int
value =
(ForeignPtr RadioAction -> RadioAction, FinalizerPtr RadioAction)
-> IO (Ptr RadioAction) -> IO RadioAction
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr RadioAction -> RadioAction, FinalizerPtr RadioAction)
forall {a}. (ForeignPtr RadioAction -> RadioAction, FinalizerPtr a)
mkRadioAction (IO (Ptr RadioAction) -> IO RadioAction)
-> IO (Ptr RadioAction) -> IO RadioAction
forall a b. (a -> b) -> a -> b
$
(StockId
-> (Ptr CChar -> IO (Ptr RadioAction)) -> IO (Ptr RadioAction))
-> Maybe StockId
-> (Ptr CChar -> IO (Ptr RadioAction))
-> IO (Ptr RadioAction)
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 RadioAction)) -> IO (Ptr RadioAction)
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 RadioAction)) -> IO (Ptr RadioAction))
-> (Ptr CChar -> IO (Ptr RadioAction)) -> IO (Ptr RadioAction)
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
stockIdPtr ->
(string
-> (Ptr CChar -> IO (Ptr RadioAction)) -> IO (Ptr RadioAction))
-> Maybe string
-> (Ptr CChar -> IO (Ptr RadioAction))
-> IO (Ptr RadioAction)
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 RadioAction)) -> IO (Ptr RadioAction)
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 RadioAction)) -> IO (Ptr RadioAction))
-> (Ptr CChar -> IO (Ptr RadioAction)) -> IO (Ptr RadioAction)
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
tooltipPtr ->
string
-> (Ptr CChar -> IO (Ptr RadioAction)) -> IO (Ptr RadioAction)
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 RadioAction)) -> IO (Ptr RadioAction))
-> (Ptr CChar -> IO (Ptr RadioAction)) -> IO (Ptr RadioAction)
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
labelPtr ->
string
-> (Ptr CChar -> IO (Ptr RadioAction)) -> IO (Ptr RadioAction)
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 RadioAction)) -> IO (Ptr RadioAction))
-> (Ptr CChar -> IO (Ptr RadioAction)) -> IO (Ptr RadioAction)
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
namePtr ->
Ptr CChar
-> Ptr CChar
-> Ptr CChar
-> Ptr CChar
-> CInt
-> IO (Ptr RadioAction)
gtk_radio_action_new
{-# LINE 122 "./Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs" #-}
namePtr
Ptr CChar
labelPtr
Ptr CChar
tooltipPtr
Ptr CChar
stockIdPtr
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
value)
radioActionGetGroup :: RadioActionClass self => self
-> IO [RadioAction]
radioActionGetGroup :: forall self. RadioActionClass self => self -> IO [RadioAction]
radioActionGetGroup self
self =
(\(RadioAction ForeignPtr RadioAction
arg1) -> ForeignPtr RadioAction
-> (Ptr RadioAction -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr RadioAction
arg1 ((Ptr RadioAction -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr RadioAction -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr RadioAction
argPtr1 ->Ptr RadioAction -> IO (Ptr ())
gtk_radio_action_get_group Ptr RadioAction
argPtr1)
{-# LINE 137 "./Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs" #-}
(toRadioAction self)
IO (Ptr ())
-> (Ptr () -> IO [Ptr RadioAction]) -> IO [Ptr RadioAction]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr () -> IO [Ptr RadioAction]
forall a. Ptr () -> IO [Ptr a]
readGSList
IO [Ptr RadioAction]
-> ([Ptr RadioAction] -> IO [RadioAction]) -> IO [RadioAction]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Ptr RadioAction -> IO RadioAction)
-> [Ptr RadioAction] -> IO [RadioAction]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM (\Ptr RadioAction
elemPtr -> (ForeignPtr RadioAction -> RadioAction, FinalizerPtr RadioAction)
-> IO (Ptr RadioAction) -> IO RadioAction
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr RadioAction -> RadioAction, FinalizerPtr RadioAction)
forall {a}. (ForeignPtr RadioAction -> RadioAction, FinalizerPtr a)
mkRadioAction (Ptr RadioAction -> IO (Ptr RadioAction)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr RadioAction
elemPtr))
radioActionSetGroup :: (RadioActionClass self, RadioActionClass groupMember) => self
-> groupMember
-> IO ()
radioActionSetGroup :: forall self groupMember.
(RadioActionClass self, RadioActionClass groupMember) =>
self -> groupMember -> IO ()
radioActionSetGroup self
self groupMember
group = do
Ptr ()
groupPtr <- (\(RadioAction ForeignPtr RadioAction
arg1) -> ForeignPtr RadioAction
-> (Ptr RadioAction -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr RadioAction
arg1 ((Ptr RadioAction -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr RadioAction -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr RadioAction
argPtr1 ->Ptr RadioAction -> IO (Ptr ())
gtk_radio_action_get_group Ptr RadioAction
argPtr1) (groupMember -> RadioAction
forall o. RadioActionClass o => o -> RadioAction
toRadioAction groupMember
group)
(\(RadioAction ForeignPtr RadioAction
arg1) Ptr ()
arg2 -> ForeignPtr RadioAction -> (Ptr RadioAction -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr RadioAction
arg1 ((Ptr RadioAction -> IO ()) -> IO ())
-> (Ptr RadioAction -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr RadioAction
argPtr1 ->Ptr RadioAction -> Ptr () -> IO ()
gtk_radio_action_set_group Ptr RadioAction
argPtr1 Ptr ()
arg2)
{-# LINE 149 "./Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs" #-}
(toRadioAction self)
Ptr ()
groupPtr
radioActionGetCurrentValue :: RadioActionClass self => self
-> IO Int
radioActionGetCurrentValue :: forall self. RadioActionClass self => self -> IO Int
radioActionGetCurrentValue self
self =
(CInt -> Int) -> IO CInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CInt -> IO Int) -> IO CInt -> IO Int
forall a b. (a -> b) -> a -> b
$
(\(RadioAction ForeignPtr RadioAction
arg1) -> ForeignPtr RadioAction -> (Ptr RadioAction -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr RadioAction
arg1 ((Ptr RadioAction -> IO CInt) -> IO CInt)
-> (Ptr RadioAction -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr RadioAction
argPtr1 ->Ptr RadioAction -> IO CInt
gtk_radio_action_get_current_value Ptr RadioAction
argPtr1)
{-# LINE 160 "./Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs" #-}
(toRadioAction self)
radioActionValueAttr :: RadioActionClass self => Attr self Int
radioActionValueAttr :: forall self. RadioActionClass self => Attr self Int
radioActionValueAttr = String -> Attr self Int
forall gobj. GObjectClass gobj => String -> Attr gobj Int
newAttrFromIntProperty String
"value"
radioActionGroup :: RadioActionClass self => ReadWriteAttr self [RadioAction] RadioAction
radioActionGroup :: forall self.
RadioActionClass self =>
ReadWriteAttr self [RadioAction] RadioAction
radioActionGroup = (self -> IO [RadioAction])
-> (self -> RadioAction -> IO ())
-> ReadWriteAttr self [RadioAction] RadioAction
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
self -> IO [RadioAction]
forall self. RadioActionClass self => self -> IO [RadioAction]
radioActionGetGroup
self -> RadioAction -> IO ()
forall self groupMember.
(RadioActionClass self, RadioActionClass groupMember) =>
self -> groupMember -> IO ()
radioActionSetGroup
radioActionCurrentValue :: RadioActionClass self => Attr self Int
radioActionCurrentValue :: forall self. RadioActionClass self => Attr self Int
radioActionCurrentValue = String -> Attr self Int
forall gobj. GObjectClass gobj => String -> Attr gobj Int
newAttrFromIntProperty String
"current-value"
radioActionChanged :: RadioActionClass self => Signal self (RadioAction -> IO ())
radioActionChanged :: forall self.
RadioActionClass self =>
Signal self (RadioAction -> IO ())
radioActionChanged = (Bool -> self -> (RadioAction -> IO ()) -> IO (ConnectId self))
-> Signal self (RadioAction -> IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String
-> Bool -> self -> (RadioAction -> IO ()) -> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
String -> Bool -> obj -> (a' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT__NONE String
"changed")
onRadioActionChanged, afterRadioActionChanged :: RadioActionClass self => self
-> (RadioAction -> IO ())
-> IO (ConnectId self)
onRadioActionChanged :: forall self.
RadioActionClass self =>
self -> (RadioAction -> IO ()) -> IO (ConnectId self)
onRadioActionChanged = String
-> Bool -> self -> (RadioAction -> IO ()) -> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
String -> Bool -> obj -> (a' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT__NONE String
"changed" Bool
False
afterRadioActionChanged :: forall self.
RadioActionClass self =>
self -> (RadioAction -> IO ()) -> IO (ConnectId self)
afterRadioActionChanged = String
-> Bool -> self -> (RadioAction -> IO ()) -> IO (ConnectId self)
forall a' obj.
(GObjectClass a', GObjectClass obj) =>
String -> Bool -> obj -> (a' -> IO ()) -> IO (ConnectId obj)
connect_OBJECT__NONE String
"changed" Bool
True
foreign import ccall safe "gtk_radio_action_new"
gtk_radio_action_new :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (CInt -> (IO (Ptr RadioAction)))))))
foreign import ccall unsafe "gtk_radio_action_get_group"
gtk_radio_action_get_group :: ((Ptr RadioAction) -> (IO (Ptr ())))
foreign import ccall safe "gtk_radio_action_set_group"
gtk_radio_action_set_group :: ((Ptr RadioAction) -> ((Ptr ()) -> (IO ())))
foreign import ccall safe "gtk_radio_action_get_current_value"
gtk_radio_action_get_current_value :: ((Ptr RadioAction) -> (IO CInt))