wMenu

A menu is a popup (or pull down) list of items.

Superclass:wMenuBase
Seealso:wMenuBar wMenuItem

Procs

proc detach(self: wMenu; menuBar: wMenuBar) {...}{.raises: [wNilAccess], tags: [RootEffect].}
Detach a menu from a menubar.
proc detach(self: wMenu; parentMenu: wMenu) {...}{.raises: [wNilAccess, Exception],
    tags: [RootEffect].}
Detach a menu from a parent menu.
proc detach(self: wMenu) {...}{.raises: [KeyError, wNilAccess, Exception],
                        tags: [RootEffect].}
Detach a menu from all menubar and menu(as submenu).
proc insert(self: wMenu; pos: int = -1; id: wCommandID = wIdAny; text = ""; help = "";
           bitmap: wBitmap = nil; submenu: wMenu = nil; kind = wMenuItemNormal): wMenuItem {...}{.
    discardable, raises: [wError], tags: [RootEffect].}
Inserts the given item before the position. Kind is one of wMenuItemNormal, wMenuItemCheck, wMenuItemRadio or wMenuItemSeparator.
proc insert(self: wMenu; pos: int = -1; item: wMenuItem): wMenuItem {...}{.discardable,
    raises: [wNilAccess, wError], tags: [RootEffect].}
Inserts the given item before the position. The given wMenuItem object will be copied internally.
proc insertSubMenu(self: wMenu; pos: int = -1; submenu: wMenu; text: string; help = "";
                  bitmap: wBitmap = nil; id: wCommandID = wIdAny): wMenuItem {...}{.inline,
    discardable, raises: [wNilAccess, wError], tags: [RootEffect].}
Inserts the given submenu before the position.
proc insertSeparator(self: wMenu; pos: int = -1): wMenuItem {...}{.inline, discardable,
    raises: [wError], tags: [RootEffect].}
Inserts a separator at the given position.
proc insertCheckItem(self: wMenu; pos: int = -1; id: wCommandID = wIdAny; text: string;
                    help = ""; bitmap: wBitmap = nil): wMenuItem {...}{.inline, discardable,
    raises: [wError], tags: [RootEffect].}
Inserts a checkable item at the given position.
proc insertRadioItem(self: wMenu; pos: int = -1; id: wCommandID = wIdAny; text: string;
                    help = ""; bitmap: wBitmap = nil): wMenuItem {...}{.inline, discardable,
    raises: [wError], tags: [RootEffect].}
Inserts a radio item at the given position.
proc append(self: wMenu; id: wCommandID = wIdAny; text: string; help = "";
           bitmap: wBitmap = nil; submenu: wMenu = nil; kind = wMenuItemNormal): wMenuItem {...}{.
    inline, discardable, raises: [wError], tags: [RootEffect].}
Adds a menu item.
proc append(self: wMenu; item: wMenuItem): wMenuItem {...}{.inline, discardable,
    raises: [wNilAccess, wError], tags: [RootEffect].}
Adds a menu item.
proc appendSubMenu(self: wMenu; submenu: wMenu; text: string; help = "";
                  bitmap: wBitmap = nil; id: wCommandID = wIdAny): wMenuItem {...}{.inline,
    discardable, raises: [wError], tags: [RootEffect].}
Adds a submenu.
proc appendSeparator(self: wMenu): wMenuItem {...}{.inline, discardable, raises: [wError],
    tags: [RootEffect].}
Adds a separator.
proc appendCheckItem(self: wMenu; id: wCommandID = wIdAny; text: string; help = "";
                    bitmap: wBitmap = nil): wMenuItem {...}{.inline, discardable,
    raises: [wError], tags: [RootEffect].}
Adds a checkable item.
proc appendRadioItem(self: wMenu; id: wCommandID = wIdAny; text: string; help = "";
                    bitmap: wBitmap = nil): wMenuItem {...}{.inline, discardable,
    raises: [wError], tags: [RootEffect].}
Adds a radio item.
proc find(self: wMenu; item: wMenuItem): int {...}{.raises: [wNilAccess], tags: [].}
Find the index of the item or wNotFound(-1) if not found.
proc find(self: wMenu; submenu: wMenu): int {...}{.raises: [wNilAccess], tags: [].}
Find the first index of submenu or wNotFound(-1) if not found.
proc find(self: wMenu; text: string): int {...}{.raises: [], tags: [].}
Find the first index with the given text or wNotFound(-1) if not found.
proc findItem(self: wMenu; text: string): wMenuItem {...}{.raises: [], tags: [].}
Find the first wMenuItem object with the given text or nil if not found.
proc findText(self: wMenu; text: string): int {...}{.raises: [], tags: [].}
Find the first index with the given text (not include any accelerator characters), wNotFound(-1) if not found.
proc findItemText(self: wMenu; text: string): wMenuItem {...}{.raises: [], tags: [].}
Find the first wMenuItem object with the given text (not include any accelerator characters), nil if not found.
proc remove(self: wMenu; pos: int) {...}{.raises: [], tags: [].}
Removes the menu item from the menu. If the item is a submenu, it will not be deleted. Use destroy() if you want to delete a submenu.
proc remove(self: wMenu; submenu: wMenu) {...}{.raises: [wNilAccess], tags: [].}
Find and remove all the submenu object from the menu.
proc removeAll(self: wMenu) {...}{.raises: [], tags: [].}
Removes all the menu items from the menu.
proc delete(self: wMenu; pos: int) {...}{.raises: [], tags: [].}
Deletes the menu item from the menu. Same as remove().
proc getKind(self: wMenu; pos: int): wMenuItemKind {...}{.raises: [], tags: [].}
Returns the item kind at the position, one of wMenuItemNormal, wMenuItemCheck, wMenuItemRadio, wMenuItemSeparator, or wMenuItemSubMenu.
proc getSubMenu(self: wMenu; pos: int): wMenu {...}{.raises: [], tags: [].}
Returns the submenu for the menu item at the position, or nil if there isn't one.
proc getText(self: wMenu; pos: int): string {...}{.raises: [], tags: [].}
Returns the text for the menu item at the position.
proc getLabel(self: wMenu; pos: int): string {...}{.inline, raises: [], tags: [].}
Returns the text for the menu item at the position.
proc setText(self: wMenu; pos: int; text: string) {...}{.raises: [], tags: [].}
Sets the text for the menu item at the position.
proc setLabel(self: wMenu; pos: int; text: string) {...}{.inline, raises: [], tags: [].}
Sets the text for the menu item at the position.
proc getLabelText(self: wMenu; pos: int): string {...}{.inline, raises: [], tags: [].}
Returns the text for the menu item at the position, not include any accelerator characters.
proc getHelp(self: wMenu; pos: int): string {...}{.raises: [], tags: [].}
Returns the help string for the menu item at the position.
proc setHelp(self: wMenu; pos: int; help: string) {...}{.raises: [], tags: [].}
Sets the help string of item at the position.
proc getBitmap(self: wMenu; pos: int): wBitmap {...}{.raises: [], tags: [].}
Returns the bitmap of item at the position.
proc setBitmap(self: wMenu; pos: int; bitmap: wBitmap = nil) {...}{.raises: [],
    tags: [RootEffect].}
Sets the bitmap for the menu item at the position. nil for clear the bitmap.
proc setId(self: wMenu; pos: int; id: wCommandID) {...}{.raises: [], tags: [].}
Sets the id for the menu item at the position.
proc replace(self: wMenu; pos: int; id: wCommandID = wIdAny; text = ""; help = "";
            bitmap: wBitmap = nil; submenu: wMenu = nil; kind = wMenuItemNormal): wMenuItem {...}{.
    discardable, raises: [wError], tags: [RootEffect].}
Replaces the menu item at the given position with another one. Return the new menu item object.
proc replace(self: wMenu; pos: int; item: wMenuItem): wMenuItem {...}{.discardable,
    raises: [wNilAccess, wError], tags: [RootEffect].}
Replaces the menu item at the given position with another one. Return the new menu item object.
proc isCheck(self: wMenu; pos: int): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is a kind of check item.
proc isRadio(self: wMenu; pos: int): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is a kind of radio item.
proc isSeparator(self: wMenu; pos: int): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is a kind of separator.
proc isSubMenu(self: wMenu; pos: int): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is a kind of submenu.
proc enable(self: wMenu; pos: int; flag = true) {...}{.raises: [KeyError, wNilAccess],
    tags: [RootEffect].}
Enables or disables (greys out) a menu item.
proc disable(self: wMenu; pos: int) {...}{.inline, raises: [KeyError, wNilAccess],
                                 tags: [RootEffect].}
Disables (greys out) a menu item.
proc isEnabled(self: wMenu; pos: int): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is enabled.
proc enable(self: wMenu; flag = true) {...}{.raises: [KeyError, wNilAccess],
                                  tags: [RootEffect].}
Enables or disables (greys out) this menu.
proc disable(self: wMenu) {...}{.inline, raises: [KeyError, wNilAccess], tags: [RootEffect].}
Disables (greys out) this menu.
proc check(self: wMenu; pos: int; flag = true) {...}{.raises: [], tags: [].}
Checks or unchecks the menu item.
proc isChecked(self: wMenu; pos: int): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is checked.
proc toggle(self: wMenu; pos: int) {...}{.raises: [], tags: [].}
Toggle the menu item.
proc getTitle(self: wMenu): string {...}{.raises: [KeyError, wNilAccess, IndexDefect],
                                 tags: [RootEffect].}
Returns the title of the menu, a title means it's label in menuBar or menu. (find fist match if a menu attach to more than one menuBar or menu).
proc `[]`(self: wMenu; pos: int): wMenuItem {...}{.inline, raises: [], tags: [].}
Returns the menu item at pos. Raise error if index out of bounds.
proc len(self: wMenu): int {...}{.inline, raises: [], tags: [].}
Returns the number of wMenuItem objects in the menu. This shoud be equal to getCount() in most case.
proc delete(self: wMenu) {...}{.raises: [KeyError, wNilAccess, Exception],
                        tags: [RootEffect].}
Delete the menu.
proc destroy(self: wMenu; pos: int) {...}{.raises: [KeyError, wNilAccess, Exception],
                                 tags: [RootEffect].}
Destroy the menu item from the menu. If the item is a submenu, it will be deleted. Use remove() if you want to keep the submenu.
proc init(self: wMenu) {...}{.raises: [], tags: [RootEffect].}
Initializes an empty menu.
proc Menu(): wMenu {...}{.inline, discardable, raises: [], tags: [RootEffect].}
Constructor.
proc init(self: wMenu; menuBar: wMenuBar; text: string; bitmap: wBitmap = nil) {...}{.
    raises: [wNilAccess], tags: [RootEffect].}
Initializes an empty menu and append to menubar.
proc Menu(menuBar: wMenuBar; text: string; bitmap: wBitmap = nil): wMenu {...}{.inline,
    discardable, raises: [wNilAccess], tags: [RootEffect].}
Constructor.
proc init(self: wMenu; hMenu: HMENU) {...}{.raises: [wError, Exception], tags: [RootEffect].}
Initializes a menu by a given system menu handle. The style (dwStyle) and application-defined value (dwMenuData) of this menu will be overwritten.
proc Menu(hMenu: HMENU): wMenu {...}{.inline, raises: [wError, Exception], tags: [RootEffect].}
Constructor.

Iterators

iterator find(self: wMenu; submenu: wMenu): int {...}{.raises: [wNilAccess], tags: [].}
Iterates over each index of submenu in menu.
iterator find(self: wMenu; text: string): int {...}{.raises: [], tags: [].}
Iterates over each index with the given text.
iterator findItem(self: wMenu; text: string): wMenuItem {...}{.raises: [], tags: [].}
Iterates over each wMenuItem object with the given text.
iterator findText(self: wMenu; text: string): int {...}{.raises: [], tags: [].}
Iterates over each index with the given text (not include any accelerator characters),
iterator findItemText(self: wMenu; text: string): wMenuItem {...}{.raises: [], tags: [].}
Iterates over each wMenuItem object with the given text (not include any accelerator characters).
iterator items(self: wMenu): wMenuItem {...}{.raises: [], tags: [].}
Iterator menus in a menubar