| Gtk2Hs | Contents | Index

Graphics.UI.Gtk.MenuComboToolbar.MenuItem

Portability | portable (depends on GHC)
Stability | provisional
Maintainer | gtk2hs-users@lists.sourceforge.net

Contents

Detail
Class Hierarchy
Types
Constructors
Methods
Attributes
Signals

Description
The widget used for item in menus
Synopsis

data MenuItem
class ItemClass o => MenuItemClass o
castToMenuItem :: GObjectClass obj => obj -> MenuItem
toMenuItem :: MenuItemClass o => o -> MenuItem
menuItemNew :: IO MenuItem
menuItemNewWithLabel :: String -> IO MenuItem
menuItemNewWithMnemonic :: String -> IO MenuItem
menuItemSetSubmenu :: (MenuItemClass self, MenuClass submenu) => self -> submenu -> IO ()
menuItemGetSubmenu :: MenuItemClass self => self -> IO (Maybe Widget)
menuItemRemoveSubmenu :: MenuItemClass self => self -> IO ()
menuItemSelect :: MenuItemClass self => self -> IO ()
menuItemDeselect :: MenuItemClass self => self -> IO ()
menuItemActivate :: MenuItemClass self => self -> IO ()
menuItemSetRightJustified :: MenuItemClass self => self -> Bool -> IO ()
menuItemGetRightJustified :: MenuItemClass self => self -> IO Bool
menuItemSetAccelPath :: MenuItemClass self => self -> Maybe String -> IO ()
menuItemSubmenu :: (MenuItemClass self, MenuClass submenu) => ReadWriteAttr self (Maybe Widget) submenu
menuItemRightJustified :: MenuItemClass self => Attr self Bool
onActivateItem :: MenuItemClass self => self -> IO () -> IO (ConnectId self)
afterActivateItem :: MenuItemClass self => self -> IO () -> IO (ConnectId self)
onActivateLeaf :: MenuItemClass self => self -> IO () -> IO (ConnectId self)
afterActivateLeaf :: MenuItemClass self => self -> IO () -> IO (ConnectId self)
onSelect :: ItemClass i => i -> IO () -> IO (ConnectId i)
afterSelect :: ItemClass i => i -> IO () -> IO (ConnectId i)
onDeselect :: ItemClass i => i -> IO () -> IO (ConnectId i)
afterDeselect :: ItemClass i => i -> IO () -> IO (ConnectId i)
onToggle :: ItemClass i => i -> IO () -> IO (ConnectId i)
afterToggle :: ItemClass i => i -> IO () -> IO (ConnectId i)

Detail
The `MenuItem` widget and the derived widgets are the only valid childs for menus. Their function is to correctly handle highlighting, alignment, events and submenus. As it derives from `Bin` it can hold any valid child widget, altough only a few are really useful.
Class Hierarchy

     |  GObject
     |   +----Object
     |         +----Widget
     |               +----Container
     |                     +----Bin
     |                           +----Item
     |                                 +----MenuItem
     |                                       +----CheckMenuItem
     |                                       +----ImageMenuItem
     |                                       +----SeparatorMenuItem
     |                                       +----TearoffMenuItem

Types
data MenuItem

Instances

GObjectClass MenuItem
MenuItemClass MenuItem
ItemClass MenuItem
BinClass MenuItem
ContainerClass MenuItem
WidgetClass MenuItem
ObjectClass MenuItem

class ItemClass o => MenuItemClass o

Instances

MenuItemClass SeparatorMenuItem
MenuItemClass ImageMenuItem
MenuItemClass TearoffMenuItem
MenuItemClass RadioMenuItem
MenuItemClass CheckMenuItem
MenuItemClass MenuItem

castToMenuItem :: GObjectClass obj => obj -> MenuItem
toMenuItem :: MenuItemClass o => o -> MenuItem
Constructors
menuItemNew :: IO MenuItem
Creates a new `MenuItem`.
menuItemNewWithLabel

:: String | `label` - the text for the label
-> IO MenuItem |
Creates a new `MenuItem` whose child is a `Label`.

menuItemNewWithMnemonic

:: String | `label` - The text of the label, with an underscore in front of the mnemonic character
-> IO MenuItem |
Creates a new `MenuItem` containing a label. The label will be created using labelNewWithMnemonic, so underscores in `label` indicate the mnemonic for the menu item.

Methods
menuItemSetSubmenu :: (MenuItemClass self, MenuClass submenu) => self -> submenu -> IO ()
Sets the item's submenu, or changes it.
menuItemGetSubmenu

:: MenuItemClass self |
=> self |
-> IO (Maybe Widget) | returns submenu for this menu item, or `Nothing` if none.
Gets the submenu underneath this menu item, if any. See `menuItemSetSubmenu`.

menuItemRemoveSubmenu :: MenuItemClass self => self -> IO ()
Removes the item's submenu.
menuItemSelect :: MenuItemClass self => self -> IO ()
Select the menu item. Emits the "select" signal on the item.
menuItemDeselect :: MenuItemClass self => self -> IO ()
Deselect the menu item. Emits the "deselect" signal on the item.
menuItemActivate :: MenuItemClass self => self -> IO ()
Simulate a click on the menu item. Emits the "activate" signal on the item.
menuItemSetRightJustified

:: MenuItemClass self |
=> self |
-> Bool | `rightJustified` - if `True` the menu item will appear at the far right if added to a menu bar.
-> IO () |
Sets whether the menu item appears justified at the right side of a menu bar. This was traditionally done for "Help" menu items, but is now considered a bad idea. (If the widget layout is reversed for a right-to-left language like Hebrew or Arabic, right-justified-menu-items appear at the left.)

menuItemGetRightJustified :: MenuItemClass self => self -> IO Bool
Gets whether the menu item appears justified at the right side of the menu bar.
menuItemSetAccelPath

:: MenuItemClass self |
=> self |
-> Maybe String | `accelPath` - accelerator path, corresponding to this menu item's functionality, or `Nothing` to unset the current path.
-> IO () |

Set the accelerator path on the menu item, through which runtime changes of the menu item's accelerator caused by the user can be identified and saved to persistant storage (see accelMapSave on this). To setup a default accelerator for this menu item, call accelMapAddEntry with the same accel path. See also accelMapAddEntry on the specifics of accelerator paths, and menuSetAccelPath for a more convenient variant of this function.

This function is basically a convenience wrapper that handles calling widgetSetAccelPath with the appropriate accelerator group for the menu item.

Note that you do need to set an accelerator on the parent menu with menuSetAccelGroup for this to work.

Attributes
menuItemSubmenu :: (MenuItemClass self, MenuClass submenu) => ReadWriteAttr self (Maybe Widget) submenu
'submenu' property. See `menuItemGetSubmenu` and `menuItemSetSubmenu`
menuItemRightJustified :: MenuItemClass self => Attr self Bool
'rightJustified' property. See `menuItemGetRightJustified` and `menuItemSetRightJustified`
Signals
onActivateItem :: MenuItemClass self => self -> IO () -> IO (ConnectId self)
afterActivateItem :: MenuItemClass self => self -> IO () -> IO (ConnectId self)

Emitted when the user chooses a menu item that has a submenu.

- This signal is not emitted if the menu item does not have a submenu.

onActivateLeaf :: MenuItemClass self => self -> IO () -> IO (ConnectId self)
afterActivateLeaf :: MenuItemClass self => self -> IO () -> IO (ConnectId self)

The user has chosen the menu item.

- This is the only function applications normally connect to. It is not emitted if the item has a submenu.

onSelect :: ItemClass i => i -> IO () -> IO (ConnectId i)
afterSelect :: ItemClass i => i -> IO () -> IO (ConnectId i)
This signal is emitted when the item is selected.
onDeselect :: ItemClass i => i -> IO () -> IO (ConnectId i)
afterDeselect :: ItemClass i => i -> IO () -> IO (ConnectId i)
This signal is emitted when the item is deselected.
onToggle :: ItemClass i => i -> IO () -> IO (ConnectId i)
afterToggle :: ItemClass i => i -> IO () -> IO (ConnectId i)
This signal is emitted when the item is toggled.
Produced by Haddock version 2.4.2