Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
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.
Synopsis
- newtype RadioMenuItem = RadioMenuItem (ManagedPtr RadioMenuItem)
- class (GObject o, IsDescendantOf RadioMenuItem o) => IsRadioMenuItem o
- toRadioMenuItem :: (MonadIO m, IsRadioMenuItem o) => o -> m RadioMenuItem
- radioMenuItemGetGroup :: (HasCallStack, MonadIO m, IsRadioMenuItem a) => a -> m [RadioMenuItem]
- 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
- radioMenuItemSetGroup :: (HasCallStack, MonadIO m, IsRadioMenuItem a, IsRadioMenuItem b) => a -> [b] -> m ()
- clearRadioMenuItemGroup :: (MonadIO m, IsRadioMenuItem o) => o -> m ()
- constructRadioMenuItemGroup :: (IsRadioMenuItem o, MonadIO m, IsRadioMenuItem a) => a -> m (GValueConstruct o)
- setRadioMenuItemGroup :: (MonadIO m, IsRadioMenuItem o, IsRadioMenuItem a) => o -> a -> m ()
- type C_RadioMenuItemGroupChangedCallback = Ptr () -> Ptr () -> IO ()
- type RadioMenuItemGroupChangedCallback = IO ()
- afterRadioMenuItemGroupChanged :: (IsRadioMenuItem a, MonadIO m) => a -> RadioMenuItemGroupChangedCallback -> m SignalHandlerId
- genClosure_RadioMenuItemGroupChanged :: MonadIO m => RadioMenuItemGroupChangedCallback -> m (GClosure C_RadioMenuItemGroupChangedCallback)
- mk_RadioMenuItemGroupChangedCallback :: C_RadioMenuItemGroupChangedCallback -> IO (FunPtr C_RadioMenuItemGroupChangedCallback)
- noRadioMenuItemGroupChangedCallback :: Maybe RadioMenuItemGroupChangedCallback
- onRadioMenuItemGroupChanged :: (IsRadioMenuItem a, MonadIO m) => a -> RadioMenuItemGroupChangedCallback -> m SignalHandlerId
- wrap_RadioMenuItemGroupChangedCallback :: RadioMenuItemGroupChangedCallback -> C_RadioMenuItemGroupChangedCallback
Exported types
newtype RadioMenuItem Source #
Memory-managed wrapper type.
RadioMenuItem (ManagedPtr RadioMenuItem) |
Instances
class (GObject o, IsDescendantOf RadioMenuItem o) => IsRadioMenuItem o Source #
Type class for types which can be safely cast to RadioMenuItem
, for instance with toRadioMenuItem
.
Instances
(GObject o, IsDescendantOf RadioMenuItem o) => IsRadioMenuItem o Source # | |
Defined in GI.Gtk.Objects.RadioMenuItem |
toRadioMenuItem :: (MonadIO m, IsRadioMenuItem o) => o -> m RadioMenuItem Source #
Cast to RadioMenuItem
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
activate, add, addAccelerator, addChild, addDeviceEvents, addEvents, addMnemonicLabel, addTickCallback, bindProperty, bindPropertyFull, canActivateAccel, checkResize, childFocus, childGetProperty, childNotify, childNotifyByPspec, childSetProperty, childType, classPath, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, deselect, destroy, destroyed, deviceIsShadowed, doSetRelatedAction, dragBegin, dragBeginWithCoordinates, dragCheckThreshold, dragDestAddImageTargets, dragDestAddTextTargets, dragDestAddUriTargets, dragDestFindTarget, dragDestGetTargetList, dragDestGetTrackMotion, dragDestSet, dragDestSetProxy, dragDestSetTargetList, dragDestSetTrackMotion, dragDestUnset, dragGetData, dragHighlight, dragSourceAddImageTargets, dragSourceAddTextTargets, dragSourceAddUriTargets, dragSourceGetTargetList, dragSourceSet, dragSourceSetIconGicon, dragSourceSetIconName, dragSourceSetIconPixbuf, dragSourceSetIconStock, dragSourceSetTargetList, dragSourceUnset, dragUnhighlight, draw, ensureStyle, errorBell, event, forall, forceFloating, foreach, freezeChildNotify, freezeNotify, getv, grabAdd, grabDefault, grabFocus, grabRemove, hasDefault, hasFocus, hasGrab, hasRcStyle, hasScreen, hasVisibleFocus, hide, hideOnDelete, inDestruction, initTemplate, inputShapeCombineRegion, insertActionGroup, intersect, isAncestor, isComposited, isDrawable, isFloating, isFocus, isSensitive, isToplevel, isVisible, joinGroup, keynavFailed, listAccelClosures, listActionPrefixes, listMnemonicLabels, map, mnemonicActivate, modifyBase, modifyBg, modifyCursor, modifyFg, modifyFont, modifyStyle, modifyText, notify, notifyByPspec, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, parserFinished, path, propagateDraw, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, remove, removeAccelerator, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reparent, resetRcStyles, resetStyle, resizeChildren, runDispose, select, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, stealData, stealQdata, styleAttach, styleGetProperty, syncActionProperties, thawChildNotify, thawNotify, toggleSizeAllocate, toggleSizeRequest, toggled, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unregisterWindow, unsetFocusChain, unsetStateFlags, watchClosure.
Getters
getAccelPath, getAccessible, getActionGroup, getActionName, getActionTargetValue, getActive, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAncestor, getAppPaintable, getBorderWidth, getCanDefault, getCanFocus, getChild, getChildRequisition, getChildVisible, getChildren, getClip, getClipboard, getCompositeName, getData, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getDrawAsRadio, getEvents, getFocusChain, getFocusChild, getFocusHadjustment, getFocusOnClick, getFocusVadjustment, getFontMap, getFontOptions, getFrameClock, getGroup, getHalign, getHasTooltip, getHasWindow, getHexpand, getHexpandSet, getInconsistent, getInternalChild, getLabel, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getPangoContext, getParent, getParentWindow, getPath, getPathForChild, getPointer, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getQdata, getRealized, getReceivesDefault, getRelatedAction, getRequestMode, getRequisition, getReserveIndicator, getResizeMode, getRightJustified, getRootWindow, getScaleFactor, getScreen, getSensitive, getSettings, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSubmenu, getSupportMultidevice, getTemplateChild, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getUseActionAppearance, getUseUnderline, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWindow.
Setters
setAccelPath, setActionName, setActionTargetValue, setActive, setAllocation, setAppPaintable, setBorderWidth, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setCompositeName, setData, setDataFull, setDetailedActionName, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setDrawAsRadio, setEvents, setFocusChain, setFocusChild, setFocusHadjustment, setFocusOnClick, setFocusVadjustment, setFontMap, setFontOptions, setGroup, setHalign, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setInconsistent, setLabel, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setName, setNoShowAll, setOpacity, setParent, setParentWindow, setProperty, setRealized, setReallocateRedraws, setReceivesDefault, setRedrawOnAllocate, setRelatedAction, setReserveIndicator, setResizeMode, setRightJustified, setSensitive, setSizeRequest, setState, setStateFlags, setStyle, setSubmenu, setSupportMultidevice, setTooltipMarkup, setTooltipText, setTooltipWindow, setUseActionAppearance, setUseUnderline, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow.
getGroup
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
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
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
The radio menu item whose group this widget belongs to.
Since: 2.8
clearRadioMenuItemGroup :: (MonadIO m, IsRadioMenuItem o) => o -> m () Source #
Set the value of the “group
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#group
constructRadioMenuItemGroup :: (IsRadioMenuItem o, MonadIO m, IsRadioMenuItem a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “group
” property. This is rarely needed directly, but it is used by new
.
setRadioMenuItemGroup :: (MonadIO m, IsRadioMenuItem o, IsRadioMenuItem a) => o -> a -> m () Source #
Set the value of the “group
” property.
When overloading is enabled, this is equivalent to
set
radioMenuItem [ #group:=
value ]
Signals
groupChanged
type C_RadioMenuItemGroupChangedCallback = Ptr () -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type RadioMenuItemGroupChangedCallback = IO () Source #
No description available in the introspection data.
afterRadioMenuItemGroupChanged :: (IsRadioMenuItem a, MonadIO m) => a -> RadioMenuItemGroupChangedCallback -> m SignalHandlerId Source #
Connect a signal handler for the groupChanged signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
radioMenuItem #groupChanged callback
genClosure_RadioMenuItemGroupChanged :: MonadIO m => RadioMenuItemGroupChangedCallback -> m (GClosure C_RadioMenuItemGroupChangedCallback) Source #
Wrap the callback into a GClosure
.
mk_RadioMenuItemGroupChangedCallback :: C_RadioMenuItemGroupChangedCallback -> IO (FunPtr C_RadioMenuItemGroupChangedCallback) Source #
Generate a function pointer callable from C code, from a C_RadioMenuItemGroupChangedCallback
.
noRadioMenuItemGroupChangedCallback :: Maybe RadioMenuItemGroupChangedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
RadioMenuItemGroupChangedCallback
onRadioMenuItemGroupChanged :: (IsRadioMenuItem a, MonadIO m) => a -> RadioMenuItemGroupChangedCallback -> m SignalHandlerId Source #
Connect a signal handler for the groupChanged signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
radioMenuItem #groupChanged callback