{-# LINE 2 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}
-- -*-haskell-*-
-- GIMP Toolkit (GTK) Widget RadioButton
--
-- Author : Axel Simon
--
-- Created: 15 May 2001
--
-- Copyright (C) 1999-2005 Axel Simon
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- Note:
--
-- No function that directly accesses the group is bound. This is due to the
-- difficulties assuring that these groups are valid as the group is a plain
-- GSList from Glib.
--
-- |
-- Maintainer : gtk2hs-users@lists.sourceforge.net
-- Stability : provisional
-- Portability : portable (depends on GHC)
--
-- A choice from multiple check buttons
--
module Graphics.UI.Gtk.Buttons.RadioButton (
-- * Detail
--
-- | A single radio button performs the same basic function as a
-- 'CheckButton', as its position in the object hierarchy reflects. It is only
-- when multiple radio buttons are grouped together that they become a
-- different user interface component in their own right.
--
-- Every radio button is a member of some group of radio buttons. When one
-- is selected, all other radio buttons in the same group are deselected. A
-- 'RadioButton' is one way of giving the user a choice from many options.
--
-- Radio button widgets are created with 'radioButtonNew'.
-- Optionally, 'radioButtonNewWithLabel' can be used if you want a
-- text label on the radio button.
--
-- For the radio button functions that take an existing group, the groups are
-- represented by any of their members. So when adding widgets to an existing
-- group of radio buttons, use 'radioButtonNewFromWidget' with a 'RadioButton'
-- that is already a member of the group. The convenience function
-- 'radioButtonNewWithLabelFromWidget' is also provided.
--
-- To remove a 'RadioButton' from one group and make it part of a new one,
-- use 'radioButtonSetGroup'.
--
-- * How to create a group of two radio buttons.
--
-- >
-- > createRadioButtons :: IO ()
-- > createRadioButtons = do
-- > window <- windowNew
-- > box <- vBoxNew True 2
-- >
-- > -- Create a radio button with a Entry widget
-- > radio1 <- radioButtonNew
-- > entry <- entryNew
-- > containerAdd radio1 entry
-- >
-- > -- Create a radio button with a label
-- > radio2 <- radioButtonNewWithLabelFromWidget
-- > radio1 "I'm the second radio button."
-- >
-- > -- Pack them into a box, then show all the widgets
-- > boxPackStart box radio1 PackGrow 2
-- > boxPackStart box radio2 PackGrow 2
-- > containerAdd window box
-- > widgetShowAll window
-- >
--
-- When an unselected button in the group is clicked the clicked button
-- receives the \"toggled\" signal, as does the previously selected button.
-- Inside the \"toggled\" handler,
-- 'Graphics.UI.Gtk.Buttons.ToggleButton.toggleButtonGetActive' can be used to
-- determine if the button has been selected or deselected.

-- * Class Hierarchy
-- |
-- @
-- | 'GObject'
-- | +----'Object'
-- | +----'Widget'
-- | +----'Container'
-- | +----'Bin'
-- | +----'Button'
-- | +----'ToggleButton'
-- | +----'CheckButton'
-- | +----RadioButton
-- @

-- * Types
  RadioButton,
  RadioButtonClass,
  castToRadioButton, gTypeRadioButton,
  toRadioButton,

-- * Constructors
  radioButtonNew,
  radioButtonNewWithLabel,
  radioButtonNewWithMnemonic,
  radioButtonNewFromWidget,
  radioButtonNewWithLabelFromWidget,
  radioButtonNewWithMnemonicFromWidget,

  -- * Compatibility aliases
  radioButtonNewJoinGroup,
  radioButtonNewJoinGroupWithLabel,
  radioButtonNewJoinGroupWithMnemonic,

-- * Methods
  radioButtonSetGroup,
  radioButtonGetGroup,

-- * Attributes
  radioButtonGroup,

-- * Signals

  groupChanged,


-- * Deprecated






  ) where

import Control.Monad (liftM)

import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.GList
import System.Glib.Attributes
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
{-# LINE 151 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}
import Graphics.UI.Gtk.Signals
{-# LINE 152 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}


{-# LINE 154 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}

--------------------
-- Constructors

-- | Creates a new 'RadioButton' with a new group. To be of any practical
-- value, a widget should then be packed into the radio button.
--
radioButtonNew :: IO RadioButton
radioButtonNew :: IO RadioButton
radioButtonNew =
  (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
forall {a}. (ForeignPtr RadioButton -> RadioButton, FinalizerPtr a)
mkRadioButton (IO (Ptr RadioButton) -> IO RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall a b. (a -> b) -> a -> b
$
  (Ptr Widget -> Ptr RadioButton)
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr RadioButton
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr RadioButton) (IO (Ptr Widget) -> IO (Ptr RadioButton))
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall a b. (a -> b) -> a -> b
$
  Ptr () -> IO (Ptr Widget)
gtk_radio_button_new
{-# LINE 166 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}
    nullPtr

-- | Creates a new 'RadioButton' with a text label.
--
radioButtonNewWithLabel :: GlibString string => string -> IO RadioButton
radioButtonNewWithLabel :: forall string. GlibString string => string -> IO RadioButton
radioButtonNewWithLabel string
label =
  (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
forall {a}. (ForeignPtr RadioButton -> RadioButton, FinalizerPtr a)
mkRadioButton (IO (Ptr RadioButton) -> IO RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall a b. (a -> b) -> a -> b
$
  (Ptr Widget -> Ptr RadioButton)
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr RadioButton
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr RadioButton) (IO (Ptr Widget) -> IO (Ptr RadioButton))
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall a b. (a -> b) -> a -> b
$
  string -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
label ((CString -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \CString
labelPtr ->
  Ptr () -> CString -> IO (Ptr Widget)
gtk_radio_button_new_with_label
{-# LINE 176 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}
    nullPtr
    CString
labelPtr

-- | Creates a new 'RadioButton' containing a label. The label will be created
-- using 'Graphics.UI.Gtk.Display.Label.labelNewWithMnemonic',
-- so underscores in @label@ indicate the mnemonic
-- for the button.
--
radioButtonNewWithMnemonic :: GlibString string
 => string -- ^ @label@ - the text of the button, with an underscore
                   -- in front of the mnemonic character
 -> IO RadioButton
radioButtonNewWithMnemonic :: forall string. GlibString string => string -> IO RadioButton
radioButtonNewWithMnemonic string
label =
  (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
forall {a}. (ForeignPtr RadioButton -> RadioButton, FinalizerPtr a)
mkRadioButton (IO (Ptr RadioButton) -> IO RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall a b. (a -> b) -> a -> b
$
  (Ptr Widget -> Ptr RadioButton)
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr RadioButton
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr RadioButton) (IO (Ptr Widget) -> IO (Ptr RadioButton))
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall a b. (a -> b) -> a -> b
$
  string -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
label ((CString -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \CString
labelPtr ->
  Ptr () -> CString -> IO (Ptr Widget)
gtk_radio_button_new_with_mnemonic
{-# LINE 193 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}
    nullPtr
    CString
labelPtr

-- | Creates a new 'RadioButton', adding it to the same group as the group to
-- which @groupMember@ belongs. As with 'radioButtonNew', a widget should be
-- packed into the radio button.
--
radioButtonNewFromWidget ::
    RadioButton -- ^ @groupMember@ - a member of an existing radio button
                   -- group, to which the new radio button will be added.
 -> IO RadioButton
radioButtonNewFromWidget :: RadioButton -> IO RadioButton
radioButtonNewFromWidget RadioButton
group =
  (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
forall {a}. (ForeignPtr RadioButton -> RadioButton, FinalizerPtr a)
mkRadioButton (IO (Ptr RadioButton) -> IO RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall a b. (a -> b) -> a -> b
$
  (Ptr Widget -> Ptr RadioButton)
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr RadioButton
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr RadioButton) (IO (Ptr Widget) -> IO (Ptr RadioButton))
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall a b. (a -> b) -> a -> b
$
  (\(RadioButton ForeignPtr RadioButton
arg1) -> ForeignPtr RadioButton
-> (Ptr RadioButton -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr RadioButton
arg1 ((Ptr RadioButton -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (Ptr RadioButton -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \Ptr RadioButton
argPtr1 ->Ptr RadioButton -> IO (Ptr Widget)
gtk_radio_button_new_from_widget Ptr RadioButton
argPtr1)
{-# LINE 208 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}
    group

-- | Creates a new 'RadioButton' with a text label, adding it to the same group
-- as the group to which @groupMember@ belongs.
--
radioButtonNewWithLabelFromWidget :: GlibString string
 => RadioButton -- ^ @groupMember@ - a member of an existing radio button
                   -- group, to which the new radio button will be added.
 -> string -- ^ @label@ - a text string to display next to the radio
                   -- button.
 -> IO RadioButton
radioButtonNewWithLabelFromWidget :: forall string.
GlibString string =>
RadioButton -> string -> IO RadioButton
radioButtonNewWithLabelFromWidget RadioButton
group string
label =
  (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
forall {a}. (ForeignPtr RadioButton -> RadioButton, FinalizerPtr a)
mkRadioButton (IO (Ptr RadioButton) -> IO RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall a b. (a -> b) -> a -> b
$
  (Ptr Widget -> Ptr RadioButton)
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr RadioButton
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr RadioButton) (IO (Ptr Widget) -> IO (Ptr RadioButton))
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall a b. (a -> b) -> a -> b
$
  string -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
label ((CString -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \CString
labelPtr ->
  (\(RadioButton ForeignPtr RadioButton
arg1) CString
arg2 -> ForeignPtr RadioButton
-> (Ptr RadioButton -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr RadioButton
arg1 ((Ptr RadioButton -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (Ptr RadioButton -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \Ptr RadioButton
argPtr1 ->Ptr RadioButton -> CString -> IO (Ptr Widget)
gtk_radio_button_new_with_label_from_widget Ptr RadioButton
argPtr1 CString
arg2)
{-# LINE 224 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}
    group
    CString
labelPtr

-- | Creates a new 'RadioButton' containing a label, adding it to the same group
-- as the group to which @groupMember@ belongs. The label will be created using
-- 'Graphics.UI.Gtk.Display.Label.labelNewWithMnemonic',
-- so underscores in @label@ indicate the mnemonic for the button.
--
radioButtonNewWithMnemonicFromWidget :: GlibString string
 => RadioButton -- ^ @groupMember@ - a member of an existing radio button
                   -- group, to which the new radio button will be added.
 -> string -- ^ @label@ - the text of the button, with an underscore
                   -- in front of the mnemonic character
 -> IO RadioButton
radioButtonNewWithMnemonicFromWidget :: forall string.
GlibString string =>
RadioButton -> string -> IO RadioButton
radioButtonNewWithMnemonicFromWidget RadioButton
group string
label =
  (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
forall {a}. (ForeignPtr RadioButton -> RadioButton, FinalizerPtr a)
mkRadioButton (IO (Ptr RadioButton) -> IO RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall a b. (a -> b) -> a -> b
$
  (Ptr Widget -> Ptr RadioButton)
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr RadioButton
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr RadioButton) (IO (Ptr Widget) -> IO (Ptr RadioButton))
-> IO (Ptr Widget) -> IO (Ptr RadioButton)
forall a b. (a -> b) -> a -> b
$
  string -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
label ((CString -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \CString
labelPtr ->
  (\(RadioButton ForeignPtr RadioButton
arg1) CString
arg2 -> ForeignPtr RadioButton
-> (Ptr RadioButton -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr RadioButton
arg1 ((Ptr RadioButton -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (Ptr RadioButton -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \Ptr RadioButton
argPtr1 ->Ptr RadioButton -> CString -> IO (Ptr Widget)
gtk_radio_button_new_with_mnemonic_from_widget Ptr RadioButton
argPtr1 CString
arg2)
{-# LINE 243 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}
    group
    CString
labelPtr

-- | Alias for 'radioButtonNewFromWidget'.
radioButtonNewJoinGroup ::
    RadioButton -- ^ @groupMember@ - a member of an existing radio button
                   -- group, to which the new radio button will be added.
 -> IO RadioButton
radioButtonNewJoinGroup :: RadioButton -> IO RadioButton
radioButtonNewJoinGroup = RadioButton -> IO RadioButton
radioButtonNewFromWidget
{-# DEPRECATED radioButtonNewJoinGroup "use radioButtonNewFromWidget instead" #-}

-- | Alias for 'radioButtonNewWithLabelFromWidget'.
radioButtonNewJoinGroupWithLabel :: GlibString string
 => RadioButton -- ^ @groupMember@ - a member of an existing radio button
                   -- group, to which the new radio button will be added.
 -> string -- ^ @label@ - a text string to display next to the radio
                   -- button.
 -> IO RadioButton
radioButtonNewJoinGroupWithLabel :: forall string.
GlibString string =>
RadioButton -> string -> IO RadioButton
radioButtonNewJoinGroupWithLabel = RadioButton -> string -> IO RadioButton
forall string.
GlibString string =>
RadioButton -> string -> IO RadioButton
radioButtonNewWithLabelFromWidget
{-# DEPRECATED radioButtonNewJoinGroupWithLabel "use radioButtonNewWithLabelFromWidget instead" #-}

-- | Alias for 'radioButtonNewWithMnemonicFromWidget'.
radioButtonNewJoinGroupWithMnemonic :: GlibString string
 => RadioButton -- ^ @groupMember@ - a member of an existing radio button
                   -- group, to which the new radio button will be added.
 -> string -- ^ @label@ - the text of the button, with an underscore
                   -- in front of the mnemonic character
 -> IO RadioButton
radioButtonNewJoinGroupWithMnemonic :: forall string.
GlibString string =>
RadioButton -> string -> IO RadioButton
radioButtonNewJoinGroupWithMnemonic = RadioButton -> string -> IO RadioButton
forall string.
GlibString string =>
RadioButton -> string -> IO RadioButton
radioButtonNewWithMnemonicFromWidget
{-# DEPRECATED radioButtonNewJoinGroupWithMnemonic "use radioButtonNewWithMnemonicFromWidget instead" #-}

--------------------
-- Methods

-- | Sets a 'RadioButton's group. It should be noted that this does not
-- change the layout of your interface in any way, so if you are changing the
-- group, it is likely you will need to re-arrange the user interface to
-- reflect these changes.
--
radioButtonSetGroup :: RadioButton
 -> RadioButton -- ^ @groupMember@ - a member of an existing radio button group,
                -- to which this radio button will be added.
 -> IO ()
radioButtonSetGroup :: RadioButton -> RadioButton -> IO ()
radioButtonSetGroup RadioButton
self RadioButton
group =
  (\(RadioButton ForeignPtr RadioButton
arg1) -> ForeignPtr RadioButton
-> (Ptr RadioButton -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr RadioButton
arg1 ((Ptr RadioButton -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr RadioButton -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr RadioButton
argPtr1 ->Ptr RadioButton -> IO (Ptr ())
gtk_radio_button_get_group Ptr RadioButton
argPtr1) RadioButton
group IO (Ptr ()) -> (Ptr () -> IO ()) -> IO ()
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr ()
groupGSList ->
  (\(RadioButton ForeignPtr RadioButton
arg1) Ptr ()
arg2 -> ForeignPtr RadioButton -> (Ptr RadioButton -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr RadioButton
arg1 ((Ptr RadioButton -> IO ()) -> IO ())
-> (Ptr RadioButton -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr RadioButton
argPtr1 ->Ptr RadioButton -> Ptr () -> IO ()
gtk_radio_button_set_group Ptr RadioButton
argPtr1 Ptr ()
arg2)
{-# LINE 289 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}
    self
    Ptr ()
groupGSList

-- | Retrieves the group assigned to a radio button.
--
radioButtonGetGroup :: RadioButton
 -> IO [RadioButton] -- ^ returns a list containing all the radio buttons
                     -- in the same group as this radio button.
radioButtonGetGroup :: RadioButton -> IO [RadioButton]
radioButtonGetGroup RadioButton
self =
  (\(RadioButton ForeignPtr RadioButton
arg1) -> ForeignPtr RadioButton
-> (Ptr RadioButton -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr RadioButton
arg1 ((Ptr RadioButton -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr RadioButton -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr RadioButton
argPtr1 ->Ptr RadioButton -> IO (Ptr ())
gtk_radio_button_get_group Ptr RadioButton
argPtr1)
{-# LINE 299 "./Graphics/UI/Gtk/Buttons/RadioButton.chs" #-}
    self
  IO (Ptr ())
-> (Ptr () -> IO [Ptr RadioButton]) -> IO [Ptr RadioButton]
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 RadioButton]
forall a. Ptr () -> IO [Ptr a]
readGSList
  IO [Ptr RadioButton]
-> ([Ptr RadioButton] -> IO [RadioButton]) -> IO [RadioButton]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Ptr RadioButton -> IO RadioButton)
-> [Ptr RadioButton] -> IO [RadioButton]
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 RadioButton
elemPtr -> (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
-> IO (Ptr RadioButton) -> IO RadioButton
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr RadioButton -> RadioButton, FinalizerPtr RadioButton)
forall {a}. (ForeignPtr RadioButton -> RadioButton, FinalizerPtr a)
mkRadioButton (Ptr RadioButton -> IO (Ptr RadioButton)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr RadioButton
elemPtr))

--------------------
-- Attributes

-- | Sets a new group for a radio button.
--
radioButtonGroup :: ReadWriteAttr RadioButton [RadioButton] RadioButton
radioButtonGroup :: ReadWriteAttr RadioButton [RadioButton] RadioButton
radioButtonGroup = (RadioButton -> IO [RadioButton])
-> (RadioButton -> RadioButton -> IO ())
-> ReadWriteAttr RadioButton [RadioButton] RadioButton
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
  RadioButton -> IO [RadioButton]
radioButtonGetGroup
  RadioButton -> RadioButton -> IO ()
radioButtonSetGroup

--------------------
-- Signals


-- %hash c:be94 d:a584
-- | Emitted when the group of radio buttons that a radio button belongs to
-- changes. This is emitted when a radio button switches from being alone to
-- being part of a group of 2 or more buttons, or vice-versa, and when a
-- button is moved from one group of 2 or more buttons to a different one, but
-- not when the composition of the group that a button belongs to changes.
--
-- * Available since Gtk+ version 2.4
--
groupChanged :: RadioButtonClass self => Signal self (IO ())
groupChanged :: forall self. RadioButtonClass self => Signal self (IO ())
groupChanged = (Bool -> self -> IO () -> IO (ConnectId self))
-> Signal self (IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName -> Bool -> self -> IO () -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
SignalName -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE SignalName
"group-changed")


--------------------
-- Deprecated Signals

foreign import ccall unsafe "gtk_radio_button_new"
  gtk_radio_button_new :: ((Ptr ()) -> (IO (Ptr Widget)))

foreign import ccall unsafe "gtk_radio_button_new_with_label"
  gtk_radio_button_new_with_label :: ((Ptr ()) -> ((Ptr CChar) -> (IO (Ptr Widget))))

foreign import ccall unsafe "gtk_radio_button_new_with_mnemonic"
  gtk_radio_button_new_with_mnemonic :: ((Ptr ()) -> ((Ptr CChar) -> (IO (Ptr Widget))))

foreign import ccall safe "gtk_radio_button_new_from_widget"
  gtk_radio_button_new_from_widget :: ((Ptr RadioButton) -> (IO (Ptr Widget)))

foreign import ccall safe "gtk_radio_button_new_with_label_from_widget"
  gtk_radio_button_new_with_label_from_widget :: ((Ptr RadioButton) -> ((Ptr CChar) -> (IO (Ptr Widget))))

foreign import ccall safe "gtk_radio_button_new_with_mnemonic_from_widget"
  gtk_radio_button_new_with_mnemonic_from_widget :: ((Ptr RadioButton) -> ((Ptr CChar) -> (IO (Ptr Widget))))

foreign import ccall unsafe "gtk_radio_button_get_group"
  gtk_radio_button_get_group :: ((Ptr RadioButton) -> (IO (Ptr ())))

foreign import ccall safe "gtk_radio_button_set_group"
  gtk_radio_button_set_group :: ((Ptr RadioButton) -> ((Ptr ()) -> (IO ())))