wMenu

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

Superclass:wMenuBase
Seealso:wMenuBar wMenuItem

Procs

proc detach(self: wMenu; menuBar: wMenuBar) {...}{.validate, raises: [], tags: [].}
Detach a menu from a menubar.
proc detach(self: wMenu; parentMenu: wMenu) {...}{.validate, raises: [], tags: [].}
Detach a menu from a parent menu.
proc detach(self: wMenu) {...}{.validate, raises: [], tags: [].}
Detach a menu from all menubar and menu(as submenu).
proc insert(self: wMenu; pos: int = -1; id: wCommandID = 0; text = ""; help = "";
           bitmap: wBitmap = nil; submenu: wMenu = nil; kind = wMenuItemNormal): wMenuItem {...}{.
    validate, discardable, raises: [], tags: [].}
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 {...}{.validate,
    discardable, raises: [], tags: [].}
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 = 0): wMenuItem {...}{.validate,
    inline, discardable, raises: [], tags: [].}
Inserts the given submenu before the position.
proc insertSeparator(self: wMenu; pos: int = -1): wMenuItem {...}{.validate, inline,
    discardable, raises: [], tags: [].}
Inserts a separator at the given position.
proc insertCheckItem(self: wMenu; pos: int = -1; id: wCommandID = 0; text: string; help = "";
                    bitmap: wBitmap = nil): wMenuItem {...}{.validate, inline, discardable,
    raises: [], tags: [].}
Inserts a checkable item at the given position.
proc insertRadioItem(self: wMenu; pos: int = -1; id: wCommandID = 0; text: string; help = "";
                    bitmap: wBitmap = nil): wMenuItem {...}{.validate, inline, discardable,
    raises: [], tags: [].}
Inserts a radio item at the given position.
proc append(self: wMenu; id: wCommandID = 0; text: string; help = ""; bitmap: wBitmap = nil;
           submenu: wMenu = nil; kind = wMenuItemNormal): wMenuItem {...}{.validate, inline,
    discardable, raises: [], tags: [].}
Adds a menu item.
proc append(self: wMenu; item: wMenuItem): wMenuItem {...}{.validate, inline, discardable,
    raises: [], tags: [].}
Adds a menu item.
proc appendSubMenu(self: wMenu; submenu: wMenu; text: string; help = "";
                  bitmap: wBitmap = nil; id: wCommandID = 0): wMenuItem {...}{.validate,
    inline, discardable, raises: [], tags: [].}
Adds a submenu.
proc appendSeparator(self: wMenu): wMenuItem {...}{.validate, inline, discardable,
    raises: [], tags: [].}
Adds a separator.
proc appendCheckItem(self: wMenu; id: wCommandID = 0; text: string; help = "";
                    bitmap: wBitmap = nil): wMenuItem {...}{.validate, inline, discardable,
    raises: [], tags: [].}
Adds a checkable item.
proc appendRadioItem(self: wMenu; id: wCommandID = 0; text: string; help = "";
                    bitmap: wBitmap = nil): wMenuItem {...}{.validate, inline, discardable,
    raises: [], tags: [].}
Adds a radio item.
proc find(self: wMenu; item: wMenuItem): int {...}{.validate, raises: [], tags: [].}
Find the index of the item or wNotFound(-1) if not found.
proc find(self: wMenu; submenu: wMenu): int {...}{.validate, raises: [], tags: [].}
Find the first index of submenu or wNotFound(-1) if not found.
proc find(self: wMenu; text: string): int {...}{.validate, raises: [], tags: [].}
Find the first index with the given text or wNotFound(-1) if not found.
proc findItem(self: wMenu; text: string): wMenuItem {...}{.validate, raises: [], tags: [].}
Find the first wMenuItem object with the given text or nil if not found.
proc findText(self: wMenu; text: string): int {...}{.validate, 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 {...}{.validate, 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) {...}{.validate, 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) {...}{.validate, raises: [], tags: [].}
Find and remove all the submenu object from the menu.
proc delete(self: wMenu; pos: int) {...}{.validate, raises: [], tags: [].}
Deletes the menu item from the menu. Same as remove().
proc getKind(self: wMenu; pos: int): wMenuItemKind {...}{.validate, property, raises: [],
    tags: [].}
Returns the item kind at the position, one of wMenuItemNormal, wMenuItemCheck, wMenuItemRadio, wMenuItemSeparator, or wMenuItemSubMenu.
proc getSubMenu(self: wMenu; pos: int): wMenu {...}{.validate, property, 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 {...}{.validate, property, raises: [], tags: [].}
Returns the text for the menu item at the position.
proc getLabel(self: wMenu; pos: int): string {...}{.validate, property, inline, raises: [],
    tags: [].}
Returns the text for the menu item at the position.
proc setText(self: wMenu; pos: int; text: string) {...}{.validate, property, raises: [],
    tags: [].}
Sets the text for the menu item at the position.
proc setLabel(self: wMenu; pos: int; text: string) {...}{.validate, property, inline,
    raises: [], tags: [].}
Sets the text for the menu item at the position.
proc getLabelText(self: wMenu; pos: int): string {...}{.validate, property, 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 {...}{.validate, property, raises: [], tags: [].}
Returns the help string for the menu item at the position.
proc setHelp(self: wMenu; pos: int; help: string) {...}{.validate, property, raises: [],
    tags: [].}
Sets the help string of item at the position.
proc getBitmap(self: wMenu; pos: int): wBitmap {...}{.validate, property, raises: [], tags: [].}
Returns the bitmap of item at the position.
proc setBitmap(self: wMenu; pos: int; bitmap: wBitmap = nil) {...}{.validate, property,
    raises: [], tags: [].}
Sets the bitmap for the menu item at the position. nil for clear the bitmap.
proc setId(self: wMenu; pos: int; id: wCommandID) {...}{.validate, property, raises: [],
    tags: [].}
Sets the id for the menu item at the position.
proc replace(self: wMenu; pos: int; id: wCommandID = 0; text = ""; help = "";
            bitmap: wBitmap = nil; submenu: wMenu = nil; kind = wMenuItemNormal): wMenuItem {...}{.
    validate, discardable, raises: [], tags: [].}
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 {...}{.validate, discardable,
    raises: [], tags: [].}
Replaces the menu item at the given position with another one. Return the new menu item object.
proc isCheck(self: wMenu; pos: int): bool {...}{.validate, raises: [], tags: [].}
Determines whether a menu item is a kind of check item.
proc isRadio(self: wMenu; pos: int): bool {...}{.validate, raises: [], tags: [].}
Determines whether a menu item is a kind of radio item.
proc isSeparator(self: wMenu; pos: int): bool {...}{.validate, raises: [], tags: [].}
Determines whether a menu item is a kind of separator.
proc isSubMenu(self: wMenu; pos: int): bool {...}{.validate, raises: [], tags: [].}
Determines whether a menu item is a kind of submenu.
proc enable(self: wMenu; pos: int; flag = true) {...}{.validate, raises: [], tags: [].}
Enables or disables (greys out) a menu item.
proc disable(self: wMenu; pos: int) {...}{.validate, inline, raises: [], tags: [].}
Disables (greys out) a menu item.
proc isEnabled(self: wMenu; pos: int): bool {...}{.validate, raises: [], tags: [].}
Determines whether a menu item is enabled.
proc enable(self: wMenu; flag = true) {...}{.validate, raises: [], tags: [].}
Enables or disables (greys out) this menu.
proc disable(self: wMenu) {...}{.validate, inline, raises: [], tags: [].}
Disables (greys out) this menu.
proc check(self: wMenu; pos: int; flag = true) {...}{.validate, raises: [], tags: [].}
Checks or unchecks the menu item.
proc isChecked(self: wMenu; pos: int): bool {...}{.validate, raises: [], tags: [].}
Determines whether a menu item is checked.
proc toggle(self: wMenu; pos: int) {...}{.validate, raises: [], tags: [].}
Toggle the menu item.
proc getHandle(self: wMenu): HMENU {...}{.validate, property, inline, raises: [], tags: [].}
Get system handle of this menu.
proc getTitle(self: wMenu): string {...}{.validate, property, raises: [], tags: [].}
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 getCount(self: wMenu): int {...}{.validate, property, inline, raises: [], tags: [].}
Returns the number of items in the menu.
proc `[]`(self: wMenu; pos: int): wMenuItem {...}{.validate, inline, raises: [], tags: [].}
Returns the menu item at pos. Raise error if index out of bounds.
proc len(self: wMenu): int {...}{.validate, 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) {...}{.validate, raises: [], tags: [].}
Delete the menu.
proc destroy(self: wMenu; pos: int) {...}{.validate, raises: [], tags: [].}
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 final(self: wMenu) {...}{.raises: [], tags: [].}
Default finalizer for wMenu.
proc init(self: wMenu) {...}{.validate, raises: [], tags: [].}
Initializer.
proc Menu(): wMenu {...}{.inline, raises: [], tags: [].}
Construct an empty menu.
proc init(self: wMenu; menuBar: wMenuBar; text: string; bitmap: wBitmap = nil) {...}{.validate,
    raises: [], tags: [].}
Initializer.
proc Menu(menuBar: wMenuBar; text: string; bitmap: wBitmap = nil): wMenu {...}{.inline,
    raises: [], tags: [].}
Construct an empty menu and append to menubar.

Iterators

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