Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
A radio menu item is a check menu item that belongs to a group. At each instant exactly one of the radio menu items from a group is selected.
The group list does not need to be freed, as each RadioMenuItem
will
remove itself and its list item when it is destroyed.
The correct way to create a group of radio menu items is approximatively this:
How to create a group of radio menu items.
C code
GSList *group = NULL; GtkWidget *item; gint i; for (i = 0; i < 5; i++) { item = gtk_radio_menu_item_new_with_label (group, "This is an example"); group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); if (i == 1) gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); }
CSS nodes
plain code
menuitem ├── radio.left ╰── <child>
GtkRadioMenuItem has a main CSS node with name menuitem, and a subnode with name radio, which gets the .left or .right style class.
- newtype RadioMenuItem = RadioMenuItem (ManagedPtr RadioMenuItem)
- class GObject o => IsRadioMenuItem o
- toRadioMenuItem :: IsRadioMenuItem o => o -> IO RadioMenuItem
- noRadioMenuItem :: Maybe RadioMenuItem
- data RadioMenuItemGetGroupMethodInfo
- radioMenuItemGetGroup :: (HasCallStack, MonadIO m, IsRadioMenuItem a) => a -> m [RadioMenuItem]
- data RadioMenuItemJoinGroupMethodInfo
- radioMenuItemJoinGroup :: (HasCallStack, MonadIO m, IsRadioMenuItem a, IsRadioMenuItem b) => a -> Maybe b -> m ()
- radioMenuItemNew :: (HasCallStack, MonadIO m, IsRadioMenuItem a) => [a] -> m RadioMenuItem
- radioMenuItemNewFromWidget :: (HasCallStack, MonadIO m, IsRadioMenuItem a) => Maybe a -> m RadioMenuItem
- radioMenuItemNewWithLabel :: (HasCallStack, MonadIO m, IsRadioMenuItem a) => [a] -> Text -> m RadioMenuItem
- radioMenuItemNewWithLabelFromWidget :: (HasCallStack, MonadIO m, IsRadioMenuItem a) => Maybe a -> Maybe Text -> m RadioMenuItem
- radioMenuItemNewWithMnemonic :: (HasCallStack, MonadIO m, IsRadioMenuItem a) => [a] -> Text -> m RadioMenuItem
- radioMenuItemNewWithMnemonicFromWidget :: (HasCallStack, MonadIO m, IsRadioMenuItem a) => Maybe a -> Maybe Text -> m RadioMenuItem
- data RadioMenuItemSetGroupMethodInfo
- radioMenuItemSetGroup :: (HasCallStack, MonadIO m, IsRadioMenuItem a, IsRadioMenuItem b) => a -> [b] -> m ()
- data RadioMenuItemGroupPropertyInfo
- clearRadioMenuItemGroup :: (MonadIO m, IsRadioMenuItem o) => o -> m ()
- constructRadioMenuItemGroup :: (IsRadioMenuItem o, IsRadioMenuItem a) => a -> IO (GValueConstruct o)
- radioMenuItemGroup :: AttrLabelProxy "group"
- setRadioMenuItemGroup :: (MonadIO m, IsRadioMenuItem o, IsRadioMenuItem a) => o -> a -> m ()
- type C_RadioMenuItemGroupChangedCallback = Ptr () -> Ptr () -> IO ()
- type RadioMenuItemGroupChangedCallback = IO ()
- data RadioMenuItemGroupChangedSignalInfo
- afterRadioMenuItemGroupChanged :: (GObject a, MonadIO m) => a -> RadioMenuItemGroupChangedCallback -> m SignalHandlerId
- genClosure_RadioMenuItemGroupChanged :: RadioMenuItemGroupChangedCallback -> IO Closure
- mk_RadioMenuItemGroupChangedCallback :: C_RadioMenuItemGroupChangedCallback -> IO (FunPtr C_RadioMenuItemGroupChangedCallback)
- noRadioMenuItemGroupChangedCallback :: Maybe RadioMenuItemGroupChangedCallback
- onRadioMenuItemGroupChanged :: (GObject a, MonadIO m) => a -> RadioMenuItemGroupChangedCallback -> m SignalHandlerId
- wrap_RadioMenuItemGroupChangedCallback :: RadioMenuItemGroupChangedCallback -> Ptr () -> Ptr () -> IO ()
Exported types
newtype RadioMenuItem Source #
GObject RadioMenuItem Source # | |
IsImplementorIface RadioMenuItem Source # | |
IsObject RadioMenuItem Source # | |
IsWidget RadioMenuItem Source # | |
IsMenuItem RadioMenuItem Source # | |
IsContainer RadioMenuItem Source # | |
IsCheckMenuItem RadioMenuItem Source # | |
IsBin RadioMenuItem Source # | |
IsBuildable RadioMenuItem Source # | |
IsActivatable RadioMenuItem Source # | |
IsActionable RadioMenuItem Source # | |
IsRadioMenuItem RadioMenuItem Source # | |
((~) * info (ResolveRadioMenuItemMethod t RadioMenuItem), MethodInfo * info RadioMenuItem p) => IsLabel t (RadioMenuItem -> p) Source # | |
((~) * info (ResolveRadioMenuItemMethod t RadioMenuItem), MethodInfo * info RadioMenuItem p) => IsLabelProxy t (RadioMenuItem -> p) Source # | |
HasAttributeList * RadioMenuItem Source # | |
type AttributeList RadioMenuItem Source # | |
type SignalList RadioMenuItem Source # | |
class GObject o => IsRadioMenuItem o Source #
toRadioMenuItem :: IsRadioMenuItem o => o -> IO RadioMenuItem Source #
Methods
getGroup
data RadioMenuItemGetGroupMethodInfo Source #
((~) * signature (m [RadioMenuItem]), MonadIO m, IsRadioMenuItem a) => MethodInfo * RadioMenuItemGetGroupMethodInfo a signature Source # | |
radioMenuItemGetGroup Source #
:: (HasCallStack, MonadIO m, IsRadioMenuItem a) | |
=> a |
|
-> m [RadioMenuItem] | Returns: the group
of |
Returns the group to which the radio menu item belongs, as a List
of
RadioMenuItem
. The list belongs to GTK+ and should not be freed.
joinGroup
data RadioMenuItemJoinGroupMethodInfo Source #
((~) * signature (Maybe b -> m ()), MonadIO m, IsRadioMenuItem a, IsRadioMenuItem b) => MethodInfo * RadioMenuItemJoinGroupMethodInfo a signature Source # | |
radioMenuItemJoinGroup Source #
:: (HasCallStack, MonadIO m, IsRadioMenuItem a, IsRadioMenuItem b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Joins a RadioMenuItem
object to the group of another RadioMenuItem
object.
This function should be used by language bindings to avoid the memory
manangement of the opaque SList
of radioMenuItemGetGroup
and radioMenuItemSetGroup
.
A common way to set up a group of RadioMenuItem
instances is:
GtkRadioMenuItem *last_item = NULL; while ( ...more items to add... ) { GtkRadioMenuItem *radio_item; radio_item = gtk_radio_menu_item_new (...); gtk_radio_menu_item_join_group (radio_item, last_item); last_item = radio_item; }
Since: 3.18
new
:: (HasCallStack, MonadIO m, IsRadioMenuItem a) | |
=> [a] |
|
-> m RadioMenuItem | Returns: a new |
Creates a new RadioMenuItem
.
newFromWidget
radioMenuItemNewFromWidget Source #
:: (HasCallStack, MonadIO m, IsRadioMenuItem a) | |
=> Maybe a |
|
-> m RadioMenuItem | Returns: The new |
Creates a new RadioMenuItem
adding it to the same group as group
.
Since: 2.4
newWithLabel
radioMenuItemNewWithLabel Source #
:: (HasCallStack, MonadIO m, IsRadioMenuItem a) | |
=> [a] |
|
-> Text |
|
-> m RadioMenuItem | Returns: A new |
Creates a new RadioMenuItem
whose child is a simple Label
.
newWithLabelFromWidget
radioMenuItemNewWithLabelFromWidget Source #
:: (HasCallStack, MonadIO m, IsRadioMenuItem a) | |
=> Maybe a |
|
-> Maybe Text |
|
-> m RadioMenuItem | Returns: The new |
Creates a new GtkRadioMenuItem whose child is a simple GtkLabel.
The new RadioMenuItem
is added to the same group as group
.
Since: 2.4
newWithMnemonic
radioMenuItemNewWithMnemonic Source #
:: (HasCallStack, MonadIO m, IsRadioMenuItem a) | |
=> [a] |
|
-> Text |
|
-> m RadioMenuItem | Returns: a new |
Creates a new RadioMenuItem
containing a label. The label
will be created using labelNewWithMnemonic
, so underscores
in label
indicate the mnemonic for the menu item.
newWithMnemonicFromWidget
radioMenuItemNewWithMnemonicFromWidget Source #
:: (HasCallStack, MonadIO m, IsRadioMenuItem a) | |
=> Maybe a |
|
-> Maybe Text |
|
-> m RadioMenuItem | Returns: The new |
Creates a new GtkRadioMenuItem containing a label. The label will be
created using labelNewWithMnemonic
, so underscores in label
indicate the mnemonic for the menu item.
The new RadioMenuItem
is added to the same group as group
.
Since: 2.4
setGroup
data RadioMenuItemSetGroupMethodInfo Source #
((~) * signature ([b] -> m ()), MonadIO m, IsRadioMenuItem a, IsRadioMenuItem b) => MethodInfo * RadioMenuItemSetGroupMethodInfo a signature Source # | |
radioMenuItemSetGroup Source #
:: (HasCallStack, MonadIO m, IsRadioMenuItem a, IsRadioMenuItem b) | |
=> a |
|
-> [b] |
|
-> m () |
Sets the group of a radio menu item, or changes it.
Properties
group
data RadioMenuItemGroupPropertyInfo Source #
clearRadioMenuItemGroup :: (MonadIO m, IsRadioMenuItem o) => o -> m () Source #
constructRadioMenuItemGroup :: (IsRadioMenuItem o, IsRadioMenuItem a) => a -> IO (GValueConstruct o) Source #
radioMenuItemGroup :: AttrLabelProxy "group" Source #
setRadioMenuItemGroup :: (MonadIO m, IsRadioMenuItem o, IsRadioMenuItem a) => o -> a -> m () Source #
Signals
groupChanged
type RadioMenuItemGroupChangedCallback = IO () Source #
afterRadioMenuItemGroupChanged :: (GObject a, MonadIO m) => a -> RadioMenuItemGroupChangedCallback -> m SignalHandlerId Source #
mk_RadioMenuItemGroupChangedCallback :: C_RadioMenuItemGroupChangedCallback -> IO (FunPtr C_RadioMenuItemGroupChangedCallback) Source #
onRadioMenuItemGroupChanged :: (GObject a, MonadIO m) => a -> RadioMenuItemGroupChangedCallback -> m SignalHandlerId Source #
wrap_RadioMenuItemGroupChangedCallback :: RadioMenuItemGroupChangedCallback -> Ptr () -> Ptr () -> IO () Source #