wMenuBase

wMenuBase is the super class of wMenuBar and wMenu. It means the functions here work with both menubar and menu.

Subclasses:wMenuBar wMenu

Procs

proc find(self: wMenuBase; id: wCommandID): tuple[menu: wMenu, pos: int] {...}{.raises: [],
    tags: [].}
Return the tuple (menu, pos) indicate a item with the given id, (nil, wNotFound(-1)) if not found.
proc findItem(self: wMenuBase; id: wCommandID): wMenuItem {...}{.raises: [], tags: [].}
Search the first wMenuItem object with the given id, nil if not found.
proc remove(self: wMenuBase; id: wCommandID) {...}{.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 delete(self: wMenuBase; id: wCommandID) {...}{.raises: [], tags: [].}
Deletes the menu item from the menu. Same as remove().
proc destroy(self: wMenuBase; id: wCommandID) {...}{.
    raises: [KeyError, NilAccessError, 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 getKind(self: wMenuBase; id: wCommandID): wMenuItemKind {...}{.raises: [], tags: [].}
Returns the item kind, one of wMenuItemNormal, wMenuItemCheck, wMenuItemRadio, wMenuItemSeparator, or wMenuItemSubMenu.
proc getSubMenu(self: wMenuBase; id: wCommandID): wMenu {...}{.raises: [], tags: [].}
Returns the submenu for the menu item, or nil if there isn't one.
proc getText(self: wMenuBase; id: wCommandID): string {...}{.raises: [], tags: [].}
Returns the text for the menu item.
proc getLabel(self: wMenuBase; id: wCommandID): string {...}{.raises: [], tags: [].}
Returns the text for the menu item.
proc setText(self: wMenuBase; id: wCommandID; text: string) {...}{.raises: [], tags: [].}
Sets the text for the menu item at the position.
proc setLabel(self: wMenuBase; id: wCommandID; text: string) {...}{.raises: [], tags: [].}
Sets the text for the menu item.
proc getLabelText(self: wMenuBase; id: wCommandID): string {...}{.raises: [], tags: [].}
Returns the text for the menu item, not include any accelerator characters.
proc getHelp(self: wMenuBase; id: wCommandID): string {...}{.raises: [], tags: [].}
Returns the help string for the menu item.
proc setHelp(self: wMenuBase; id: wCommandID; help: string) {...}{.raises: [], tags: [].}
Sets the help string of item.
proc getBitmap(self: wMenuBase; id: wCommandID): wBitmap {...}{.raises: [], tags: [].}
Returns the bitmap of item.
proc setBitmap(self: wMenuBase; id: wCommandID; bitmap: wBitmap = nil) {...}{.raises: [],
    tags: [].}
Sets the bitmap for the menu item, nil for clear the bitmap.
proc setId(self: wMenuBase; id: wCommandID; newid: wCommandID) {...}{.raises: [], tags: [].}
Sets the id for the menu item.
proc replace(self: wMenuBase; id: wCommandID; text = ""; help = ""; bitmap: wBitmap = nil;
            submenu: wMenu = nil; kind = wMenuItemNormal): wMenuItem {...}{.discardable,
    raises: [wError], tags: [].}
Replaces the menu item with another one. Return the new menu item object.
proc replace(self: wMenuBase; id: wCommandID; item: wMenuItem): wMenuItem {...}{.discardable,
    raises: [NilAccessError, wError], tags: [].}
Replaces the menu item with another one. Return the new menu item object.
proc isCheck(self: wMenuBase; id: wCommandID): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is a kind of check item.
proc isRadio(self: wMenuBase; id: wCommandID): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is a kind of radio item.
proc isSeparator(self: wMenuBase; id: wCommandID): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is a kind of separator.
proc isSubMenu(self: wMenuBase; id: wCommandID): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is a kind of submenu.
proc enable(self: wMenuBase; id: wCommandID; flag = true) {...}{.
    raises: [KeyError, NilAccessError], tags: [].}
Enables or disables (greys out) a menu item.
proc disable(self: wMenuBase; id: wCommandID) {...}{.raises: [KeyError, NilAccessError],
    tags: [].}
Disables (greys out) a menu item.
proc isEnabled(self: wMenuBase; id: wCommandID): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is enabled.
proc check(self: wMenuBase; id: wCommandID; flag = true) {...}{.raises: [], tags: [].}
Checks or unchecks the menu item.
proc isChecked(self: wMenuBase; id: wCommandID): bool {...}{.raises: [], tags: [].}
Determines whether a menu item is checked.
proc toggle(self: wMenuBase; id: wCommandID) {...}{.raises: [], tags: [].}
Toggle the menu item.
proc MenuBase(hMenu: HMENU): wMenuBase {...}{.inline, raises: [KeyError], tags: [].}
Return the wMenuBase object of specific hMenu handle or nil if not exists. Notice: This is not a constructor and for low level use only.