Graphics.UI.Gtk.MenuComboToolbar.Menu

gtk-0.12.4: Binding to the Gtk+ graphical user interface library.

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

Graphics.UI.Gtk.MenuComboToolbar.Menu

Contents

- Detail
- Class Hierarchy
- Types
- Constructors
- Methods
- Attributes
- Child Attributes

Description

A menu widget

Synopsis

- data Menu
- class MenuShellClass o => MenuClass o
- castToMenu :: GObjectClass obj => obj -> Menu
- gTypeMenu :: GType
- toMenu :: MenuClass o => o -> Menu
- menuNew :: IO Menu
- menuReorderChild :: (MenuClass self, MenuItemClass child) => self -> child -> Int -> IO ()
- menuPopup :: MenuClass self => self -> Maybe (MouseButton, TimeStamp) -> IO ()
- menuSetAccelGroup :: MenuClass self => self -> AccelGroup -> IO ()
- menuGetAccelGroup :: MenuClass self => self -> IO AccelGroup
- menuSetAccelPath :: MenuClass self => self -> String -> IO ()
- menuSetTitle :: MenuClass self => self -> String -> IO ()
- menuGetTitle :: MenuClass self => self -> IO (Maybe String)
- menuPopdown :: MenuClass self => self -> IO ()
- menuReposition :: MenuClass self => self -> IO ()
- menuGetActive :: MenuClass self => self -> IO MenuItem
- menuSetActive :: MenuClass self => self -> Int -> IO ()
- menuSetTearoffState :: MenuClass self => self -> Bool -> IO ()
- menuGetTearoffState :: MenuClass self => self -> IO Bool
- menuAttachToWidget :: (MenuClass self, WidgetClass attachWidget) => self -> attachWidget -> IO ()
- menuDetach :: MenuClass self => self -> IO ()
- menuGetAttachWidget :: MenuClass self => self -> IO (Maybe Widget)
- menuSetScreen :: MenuClass self => self -> Maybe Screen -> IO ()
- menuSetMonitor :: MenuClass self => self -> Int -> IO ()
- menuAttach :: (MenuClass self, MenuItemClass child) => self -> child -> Int -> Int -> Int -> Int -> IO ()
- menuGetForAttachWidget :: WidgetClass widget => widget -> IO [Menu]
- menuTearoffState :: MenuClass self => Attr self Bool
- menuAccelGroup :: MenuClass self => Attr self AccelGroup
- menuActive :: MenuClass self => ReadWriteAttr self MenuItem Int
- menuTitle :: MenuClass self => Attr self String
- menuChildLeftAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int
- menuChildRightAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int
- menuChildTopAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int
- menuChildBottomAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int

# Detail

A `Menu` is a `MenuShell` that implements a drop down menu consisting of a list of `MenuItem` objects which can be navigated and activated by the user to perform application functions.

A `Menu` is most commonly dropped down by activating a `MenuItem` in a `MenuBar` or popped up by activating a `MenuItem` in another `Menu`.

A `Menu` can also be popped up by activating a `OptionMenu`. Other composite widgets such as the `Notebook` can pop up a `Menu` as well.

Applications can display a `Menu` as a popup menu by calling the `menuPopup` function.

# Class Hierarchy

     | GObject
     | +----Object
     | +----Widget
     | +----Container
     | +----MenuShell
     | +----Menu

# Types

data Menu

Instances

Eq Menu |
Ord Menu |
GObjectClass Menu |
MenuClass Menu |
MenuShellClass Menu |
ContainerClass Menu |
WidgetClass Menu |
ObjectClass Menu |

class MenuShellClass o => MenuClass o

Instances

MenuClass RecentChooserMenu |
MenuClass Menu |

castToMenu :: GObjectClass obj => obj -> Menu

gTypeMenu :: GType

toMenu :: MenuClass o => o -> Menu

# Constructors

menuNew :: IO Menu

Creates a new `Menu`.

# Methods

menuReorderChild

Arguments

:: (MenuClass self, MenuItemClass child) |
=> self |
-> child | `child` - the `MenuItem` to move.
-> Int | `position` - the new position to place `child`. Positions are numbered from 0 to n-1.
-> IO () |

Moves a `MenuItem` to a new position within the `Menu`.

menuPopup

Arguments

:: MenuClass self |
=> self | The menu to be shown.
-> Maybe (MouseButton, TimeStamp) | The mouse button returned by `eventButton` and the time of the event returned by `eventTime`. These values are used to match the corresponding release of the button. If this context menu is shown by programmatic means, supply `Nothing`.
-> IO () |

Popup a context menu where a button press occurred.

- This function must be called in response to a button click. It opens the given menu at a place determined by the last emitted event (hence the requirement that this function is called as response to a button press signal).

menuSetAccelGroup

Arguments

:: MenuClass self |
=> self |
-> AccelGroup | `accelGroup` - the `AccelGroup` to be associated with the menu.
-> IO () |

Set the `AccelGroup` which holds global accelerators for the menu. This accelerator group needs to also be added to all windows that this menu is being used in with `windowAddAccelGroup`, in order for those windows to support all the accelerators contained in this group.

menuGetAccelGroup

Arguments

:: MenuClass self |
=> self |
-> IO AccelGroup | returns the `AccelGroup` associated with the menu.

Gets the `AccelGroup` which holds global accelerators for the menu. See `menuSetAccelGroup`.

menuSetAccelPath

Arguments

:: MenuClass self |
=> self |
-> String | `accelPath` - a valid accelerator path
-> IO () |

Sets an accelerator path for this menu from which accelerator paths for its immediate children, its menu items, can be constructed. The main purpose of this function is to spare the programmer the inconvenience of having to call `menuItemSetAccelPath` on each menu item that should support runtime user changable accelerators. Instead, by just calling `menuSetAccelPath` on their parent, each menu item of this menu, that contains a label describing its purpose, automatically gets an accel path assigned.

For example, a menu containing menu items "New" and "Exit", will, after calling

     menu `menuSetAccelPath` "<Gnumeric-Sheet>/File"

assign its items the accel paths: `"<Gnumeric-Sheet>/File/New"` and `"<Gnumeric-Sheet>/File/Exit"`.

Assigning accel paths to menu items then enables the user to change their accelerators at runtime. More details about accelerator paths and their default setups can be found at `accelMapAddEntry`.

menuSetTitle :: MenuClass self => self -> String -> IO ()

Sets the title string for the menu. The title is displayed when the menu is shown as a tearoff menu.

menuGetTitle

Arguments

:: MenuClass self |
=> self |
-> IO (Maybe String) | returns the title of the menu, or `Nothing` if the menu has no title set on it.

Returns the title of the menu. See `menuSetTitle`.

menuPopdown :: MenuClass self => self -> IO ()

Removes the menu from the screen.

menuReposition :: MenuClass self => self -> IO ()

Repositions the menu according to its position function.

menuGetActive

Arguments

:: MenuClass self |
=> self |
-> IO MenuItem | returns the `MenuItem` that was last selected in the menu. If a selection has not yet been made, the first menu item is selected.

Returns the selected menu item from the menu. This is used by the `OptionMenu`.

menuSetActive

Arguments

:: MenuClass self |
=> self |
-> Int | `index` - the index of the menu item to select. Index values are from 0 to n-1.
-> IO () |

Selects the specified menu item within the menu. This is used by the `OptionMenu` and should not be used by anyone else.

menuSetTearoffState

Arguments

:: MenuClass self |
=> self |
-> Bool | `tornOff` - If `True`, menu is displayed as a tearoff menu.
-> IO () |

Changes the tearoff state of the menu. A menu is normally displayed as drop down menu which persists as long as the menu is active. It can also be displayed as a tearoff menu which persists until it is closed or reattached.

menuGetTearoffState

Arguments

:: MenuClass self |
=> self |
-> IO Bool | returns `True` if the menu is currently torn off.

Returns whether the menu is torn off. See `menuSetTearoffState`.

menuAttachToWidget :: (MenuClass self, WidgetClass attachWidget) => self -> attachWidget -> IO ()

Attach this menu to another widget.

menuDetach :: MenuClass self => self -> IO ()

Detach this menu from the widget it is attached to.

menuGetAttachWidget :: MenuClass self => self -> IO (Maybe Widget)

Get the widget this menu is attached to. Returns Nothing if this is a tearoff (context) menu.

menuSetScreen

Arguments

:: MenuClass self |
=> self |
-> Maybe Screen | `screen` - a `Screen`, or `Nothing` if the screen should be determined by the widget the menu is attached to.
-> IO () |

Sets the `Screen` on which the menu will be displayed.

- Available since Gtk+ version 2.2

menuSetMonitor

Arguments

:: MenuClass self |
=> self |
-> Int | `monitorNum` - the number of the monitor on which the menu should be popped up
-> IO () |

Informs Gtk+ on which monitor a menu should be popped up. See `screenGetMonitorGeometry`.

- Available since Gtk+ version 2.4

menuAttach

Arguments

:: (MenuClass self, MenuItemClass child) |
=> self |
-> child | `child` - a `MenuItem`.
-> Int | `leftAttach` - The column number to attach the left side of the item to.
-> Int | `rightAttach` - The column number to attach the right side of the item to.
-> Int | `topAttach` - The row number to attach the top of the item to.
-> Int | `bottomAttach` - The row number to attach the bottom of the item to.
-> IO () |

Adds a new `MenuItem` to a (table) menu. The number of 'cells' that an item will occupy is specified by `leftAttach`, `rightAttach`, `topAttach` and `bottomAttach`. These each represent the leftmost, rightmost, uppermost and lower column and row numbers of the table. (Columns and rows are indexed from zero).

Note that this function is not related to `menuDetach`.

- Available since Gtk+ version 2.4

menuGetForAttachWidget

Arguments

:: WidgetClass widget |
=> widget | `widget` - a `Widget`
-> IO [Menu] |

Returns a list of the menus which are attached to this widget.

- Available since Gtk+ version 2.6

# Attributes

menuTearoffState :: MenuClass self => Attr self Bool

A boolean that indicates whether the menu is torn-off.

Default value: `False`

menuAccelGroup :: MenuClass self => Attr self AccelGroup

'accelGroup' property. See `menuGetAccelGroup` and `menuSetAccelGroup`

menuActive :: MenuClass self => ReadWriteAttr self MenuItem Int

'active' property. See `menuGetActive` and `menuSetActive`

menuTitle :: MenuClass self => Attr self String

A title that may be displayed by the window manager when this menu is torn-off.

Default value: ""

# Child Attributes

menuChildLeftAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int

The column number to attach the left side of the child to.

Allowed values: >= -1

Default value: -1

menuChildRightAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int

The column number to attach the right side of the child to.

Allowed values: >= -1

Default value: -1

menuChildTopAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int

The row number to attach the top of the child to.

Allowed values: >= -1

Default value: -1

menuChildBottomAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int

The row number to attach the bottom of the child to.

Allowed values: >= -1

Default value: -1