class menu_item


NAME

menu_item - Base class for items in a menu container

SYNOPSIS

#include "menu.h"

class menu_item : public window

DESCRIPTION

A menu_container is a window that contains subwindows in the form of menu_item objects. It is the job of the menu_container to line-up its menu items. The menu items handle all action in the menu system. A menu_item reacts when it is entered by the pointer by highlighting itself, usually changing the background color. When the pointer leaves a menu_item, the highlight vanishes and the menu_item returns to its original state.

A menu_item may relate to an other menu_container in the form of a popup_menu. The popup_menu is not a child window of the menu_item but is an independent window; an unmanaged direct child of the root window. The popup menu pops up, i.e. becomes visible when the pointer enters the menu item. Once a popup menu is visible, it stays visible until the pointer enters another menu item in the same menu container or when a mouse button is clicked. So when a menu item is highlighted, it tells its sibling menu items to remove their popup menus. Removing a submenu means the menu items in the submenu must also remove their submenus recursively.

The third action of a menu_item when the pointer enters its window, is grabbing the pointer. This prevents windows which are not part of the menu system from reacting to the mouse buttons. The menu system remains active until the button is clicked. After the mouse button is released, all popup menus are removed and the pointer grab is cancelled.

The pointer grab may be released inside a menu item or outside a menu item. Only when the button click happens inside a menu item that does not have a popup menu will the menu item send a comamnd back to the application.
Member functions
menu_item menu_item contructors and destructors
HideSubmenu Hide the submenus related to this item
ShowSubmenu Show the submenu related to this item
Popup Relate the item to a submenu
Enable Enable or disable a menu item

SEE ALSO

DIAGNOSTICS