ParentContentsIndex
Graphics.UI.Port.Menu
Portability portable
Stability provisional
Maintainer ka2_mail@yahoo.com
Contents
Menu bar
Sub menus
Popup menus
Menu items
Common functions
Description
The module contains all functions for creation and management of menus. A menu is a list of items that specify options or groups of options (a submenu). Clicking a menu item opens a submenu or causes the application to carry out a command. A menu is arranged in a hierarchy. At the top level of the hierarchy is the menu bar; which contains a list of menus, which in turn can contain submenus.
Synopsis
mainMenu :: MenuHandle
insertMenu :: MenuHandle -> Maybe Int -> IO MenuHandle
getMenuItemCount :: MenuHandle -> IO Int
createPopupMenu :: IO MenuHandle
trackPopupMenu :: MenuHandle -> WindowHandle -> Point -> IO ()
insertMenuItem :: MenuHandle -> Maybe Int -> IO MenuHandle
insertMenuSeparatorItem :: MenuHandle -> Maybe Int -> IO MenuHandle
insertMenuCheckItem :: MenuHandle -> Maybe Int -> IO MenuHandle
insertMenuRadioItem :: MenuHandle -> Maybe Int -> IO MenuHandle
setMenuRadioGroup :: [MenuHandle] -> IO ()
setMenuItemAccel :: MenuHandle -> Key -> IO ()
getMenuItemAccel :: MenuHandle -> IO Key
setMenuItemEnabled :: MenuHandle -> Bool -> IO ()
getMenuItemEnabled :: MenuHandle -> IO Bool
setMenuItemChecked :: MenuHandle -> Bool -> IO ()
getMenuItemChecked :: MenuHandle -> IO Bool
setMenuItemBitmap :: MenuHandle -> Maybe Bitmap -> IO ()
getMenuItemBitmap :: MenuHandle -> IO (Maybe Bitmap)
destroyMenu :: MenuHandle -> IO ()
getMenuItemPos :: MenuHandle -> IO Int
setMenuLabel :: MenuHandle -> String -> IO ()
getMenuLabel :: MenuHandle -> IO String
Menu bar
mainMenu :: MenuHandle
The main application menu (the menu bar)
Sub menus
insertMenu
:: MenuHandle The handle of the parent menu. Use the mainMenu handle if you want to place the menu in the application menu bar.
-> Maybe Int The position where to place the submenu. or Nothing if you want to append it.
-> IO MenuHandle The handle of the created submenu.
The insertMenu function creates and inserts an item with submenu in the parent menu. The created submenu is initially empty. You can insert or append menu items by using the insertMenuItem, insertMenuCheckItem, insertMenuRadioItem or insertMenuSeparatorItem functions. Using the insertMenu you can create nested submenus.
getMenuItemCount :: MenuHandle -> IO Int
The getMenuItemCount function determines the number of items in the specified popup or sub menu.
Popup menus
createPopupMenu
:: IO MenuHandle The handle of the created popup menu.
The createPopupMenu function creates a drop-down menu. The menu is initially empty. You can insert or append menu items by using the insertMenuItem, insertMenuCheckItem, insertMenuRadioItem or insertMenuSeparatorItem functions. Using the insertMenu you can create nested submenus.
trackPopupMenu
:: MenuHandle The handle of the popup menu
-> WindowHandle The handle of the window in which to popup the menu
-> Point The location inside the window at which to display the menu
-> IO ()
The trackPopupMenu function displays a shortcut menu at the specified location in the window and tracks the selection of items on the menu.
Menu items
insertMenuItem :: MenuHandle -> Maybe Int -> IO MenuHandle
Add a menu item. An event handler for a menu item can be installed with setMenuCommandHandler.
insertMenuSeparatorItem :: MenuHandle -> Maybe Int -> IO MenuHandle
Add a menu item separator line.
insertMenuCheckItem :: MenuHandle -> Maybe Int -> IO MenuHandle
Add a checkable menu item. An event handler for a menu item can be installed with setMenuCommandHandler.
insertMenuRadioItem :: MenuHandle -> Maybe Int -> IO MenuHandle
Add a menu radio item. . An event handler for a menu item can be installed with setMenuCommandHandler.
setMenuRadioGroup :: [MenuHandle] -> IO ()
setMenuItemAccel :: MenuHandle -> Key -> IO ()
getMenuItemAccel :: MenuHandle -> IO Key
setMenuItemEnabled :: MenuHandle -> Bool -> IO ()
Enable or disable a menu item.
getMenuItemEnabled :: MenuHandle -> IO Bool
returns True if the menu item is enabled.
setMenuItemChecked :: MenuHandle -> Bool -> IO ()
Check or uncheck a checkable menu item.
getMenuItemChecked :: MenuHandle -> IO Bool
returns True if the menu item is checked.
setMenuItemBitmap :: MenuHandle -> Maybe Bitmap -> IO ()
getMenuItemBitmap :: MenuHandle -> IO (Maybe Bitmap)
Common functions
destroyMenu :: MenuHandle -> IO ()
The destroyMenu function deletes an item from the specified menu. If the menu item opens a menu or submenu, this function destroys the handle to the menu or submenu and frees the memory used by the menu or submenu.
getMenuItemPos :: MenuHandle -> IO Int
Returns the position of the item in the parent menu
setMenuLabel :: MenuHandle -> String -> IO ()
Change the label of a menu item (or checkable menu item).
getMenuLabel :: MenuHandle -> IO String
Returns the label of a menu item (or checkable menu item).
Produced by Haddock version 0.4