Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TMenuView Class Reference

An abstract base from which menu bar and menu box classes (either pull down or pop up) are derived. More...

#include <menus.h>

Inheritance diagram for TMenuView::

TView TObject TStreamable TMenuBar TMenuBox TMenuPopup List of all members.

Public Methods

 TMenuView (const TRect &bounds, TMenu *aMenu, TMenuView *aParent=0)
 TMenuView (const TRect &bounds)
void setBounds (const TRect &bounds)
virtual ushort execute ()
TMenuItemfindItem (char ch)
virtual TRect getItemRect (TMenuItem *item)
virtual ushort getHelpCtx ()
virtual TPalettegetPalette () const
virtual void handleEvent (TEvent &event)
TMenuItemhotKey (ushort keyCode)
TMenuView* newSubView (const TRect &bounds, TMenu *aMenu, TMenuView *aParentMenu)

Static Public Methods

TStreamablebuild ()

Static Public Attributes

const char* const name

Protected Methods

 TMenuView (StreamableInit)
virtual void write (opstream &os)
virtual void* read (ipstream &is)

Protected Attributes

TMenuView* parentMenu
TMenumenu
TMenuItemcurrent

Detailed Description

TMenuView provides an abstract base from which menu bar and menu box classes (either pull down or pop up) are derived. You cannot instantiate a TMenuView itself.

Definition at line 249 of file menus.h.


Constructor & Destructor Documentation

TMenuView::TMenuView ( const TRect & bounds,
TMenu * aMenu,
TMenuView * aParent = 0 ) [inline]
 

Undocumented.

Definition at line 401 of file menus.h.

TMenuView::TMenuView ( const TRect & bounds ) [inline]
 

Calls TView constructor to create a TMenuView object of size `bounds'.

See also:
TView::TView

The current parentMenu and menu pointers are set to 0. The default eventMask is set to evBroadcast.

Definition at line 413 of file menus.h.

TMenuView::TMenuView ( StreamableInit ) [protected]
 

Each streamable class needs a "builder" to allocate the correct memory for its objects together with the initialized virtual table pointers. This is achieved by calling this constructor with an argument of type StreamableInit.


Member Function Documentation

TStreamable * TMenuView::build ( ) [static]
 

Called to create an object in certain stream-reading situations.

Reimplemented from TView.

Reimplemented in TMenuBar, and TMenuBox.

ushort TMenuView::execute ( ) [virtual]
 

Executes a menu view until the user selects a menu item or cancels the process. Returns the command assigned to the selected menu item, or zero if the menu was canceled.

Should never be called except by TGroup::execView().

Reimplemented from TView.

TMenuItem * TMenuView::findItem ( char ch )
 

Returns a pointer to the menu item that has toupper(ch) as its hot key (the highlighted character). Returns 0 if no such menu item is found or if the menu item is disabled. Note that findItem() is case insensitive.

ushort TMenuView::getHelpCtx ( ) [virtual]
 

By default, this member function returns the help context of the current menu selection. If this is hcNoContext, the parent menu's current context is checked. If there is no parent menu, getHelpCtx() returns hcNoContext.

See also:
helpCtx

Reimplemented from TView.

TRect TMenuView::getItemRect ( TMenuItem * item ) [virtual]
 

Classes derived from TMenuView must override this member function in order to respond to mouse events. Your overriding functions in derived classes must return the rectangle occupied by the given menu item.

Reimplemented in TMenuBar, and TMenuBox.

TPalette & TMenuView::getPalette ( ) const [virtual]
 

Returns the default palette string.

Reimplemented from TView.

void TMenuView::handleEvent ( TEvent & event ) [virtual]
 

Called whenever a menu event needs to be handled. Determines which menu item has been mouse or keyboard selected (including hot keys) and generates the appropriate command event with putEvent().

Reimplemented from TView.

TMenuItem * TMenuView::hotKey ( ushort keyCode )
 

Returns a pointer to the menu item associated with the hot key given by `keyCode'. Returns 0 if no such menu item exists, or if the item is disabled. hotKey() is used by handleEvent() to determine whether a keystroke event selects an item in the menu.

TMenuView * TMenuView::newSubView ( const TRect & bounds,
TMenu * aMenu,
TMenuView * aParentMenu )
 

Undocumented.

void * TMenuView::read ( ipstream & is ) [protected, virtual]
 

Reads from the input stream `is'.

Reimplemented from TView.

void TMenuView::setBounds ( const TRect & bounds )
 

Undocumented.

Reimplemented from TView.

void TMenuView::write ( opstream & os ) [protected, virtual]
 

Writes to the output stream `os'.

Reimplemented from TView.


Member Data Documentation

TMenuItem * TMenuView::current [protected]
 

A pointer to the currently selected menu item.

Definition at line 335 of file menus.h.

TMenu * TMenuView::menu [protected]
 

A pointer to the TMenu object for this menu, which provides a linked list of menu items. The menu pointer allows access to all the data members of the menu items in this menu view.

Definition at line 331 of file menus.h.

const char *const TMenuView::name [static]
 

Undocumented.

Reimplemented from TView.

Reimplemented in TMenuBar, TMenuBox, and TMenuPopup.

Definition at line 372 of file menus.h.

TMenuView * TMenuView::parentMenu [protected]
 

A pointer to the TMenuView object (or any class derived from TMenuView) that owns this menu.

Definition at line 325 of file menus.h.


The documentation for this class was generated from the following file:
Generated at Sat Sep 22 20:19:29 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001