Public Types | Public Member Functions

IMenu Class Reference

This reference page is linked to from the following overview topics: Menu Manager, IMenuBarContext.


Search for all occurrences

Detailed Description

See also:
Class IMenuElement, Class IMenuItem, Class IMenuGlobalContext, Class IMenuLocalContext, Structure MenuEvent, Class IPoint2, Class Interface.

Description:
This class is available in release 4.0 and later only.

This abstract class represents an interface for a menu item. Methods that are marked as internal should not be used.

#include <imenus.h>

Inheritance diagram for IMenu:
Inheritance graph
[legend]

List of all members.

Public Types

enum   {
  numItems, getItem, addItem, removeItem,
  removeItemByPosition, setTitle, getTitle, getUseCustomTitle
}

Public Member Functions

virtual void  SetIMenuGlobalContext (IMenuGlobalContext *pIMenuGlobalContext, int level, Tab< IMenuItem * > *pExecutedItemPath, const MenuColors *pMenuColors)=0
virtual IMenuLocalContext GetIMenuLocalContext ()=0
virtual int  NumItems () const =0
virtual IMenuItem GetItem (int position)=0
virtual void  AddItem (IMenuItem *item, int position=-1)=0
virtual void  RemoveItem (int position)=0
virtual void  RemoveItem (IMenuItem *item)=0
virtual IPoint2  GetMaxItemSize ()=0
virtual void  Initialize ()=0
virtual void  PostMenuInteraction ()=0
virtual bool  HandleEvent (MenuEvent &event)=0
virtual void  Show (DisplayMethod displayMethod=DM_NORMAL, Box2 *rect=NULL)=0
virtual void  Hide (DisplayMethod displayMethod=DM_NORMAL)=0
virtual IMenuItem FindAccelItem (MCHAR accelerator)=0
virtual IMenuItem FindNewSelectedItem ()=0
virtual void  Display (IMenu *pParentMenu=NULL, bool show=true)=0
virtual void  DisplayItems (IPoint2 &origin, bool descending, bool leftToRight, bool nextSeparatorOK)=0
virtual void  Undisplay ()=0
virtual bool  IsDisplayingSubMenu ()=0
virtual void  TimerElapsed (EventParam timingType)=0
virtual void  SetShowTitle (bool showTitle)=0
virtual bool  GetShowTitle () const =0
virtual void  SetCustomTitle (const MCHAR *customTitle)=0
virtual const MSTR GetCustomTitle () const =0
virtual void  SetUseCustomTitle (bool useCustomTitle)=0
virtual bool  GetUseCustomTitle () const =0
virtual void  SetUseGlobalWidths (bool useGlobalWidths)=0
virtual bool  GetUseGlobalWidths () const =0
virtual bool  NoVisibleItems ()=0

Member Enumeration Documentation

anonymous enum

Member Function Documentation

virtual void SetIMenuGlobalContext ( IMenuGlobalContext pIMenuGlobalContext,
int  level,
Tab< IMenuItem * > *  pExecutedItemPath,
const MenuColors pMenuColors 
) [pure virtual]
Remarks:
This method is used internally.

This method sets a new context for the menu, invalidating the menu's cache.
Parameters:
IMenuGlobalContext* pIMenuGlobalContext

Points to the context to set.
virtual IMenuLocalContext* GetIMenuLocalContext ( ) [pure virtual]
Remarks:
This method is used internally.

Returns a pointer to the menu's local context.
virtual int NumItems ( ) const [pure virtual]
Remarks:
Returns the number of items in the menu.
virtual IMenuItem* GetItem ( int  position ) [pure virtual]
Remarks:
Returns a pointer to the specified menu item.
Parameters:
int position

The position/index in the menu.
virtual void AddItem ( IMenuItem item,
int  position = -1 
) [pure virtual]
Remarks:
This method adds the specified item into the menu at the position passed. The default position is at the end.
Parameters:
IMenuItem* item

Points to the menu item to add.

int position = -1

Position 0 indicates the beginnng of the list. A negative or otherwise invalid position defaults to end of list.
virtual void RemoveItem ( int  position ) [pure virtual]
Remarks:
Removes the item from the menu whose position is passed.
Parameters:
int position

The zero based index in the list of the item to remove. Position 0 is the first item.
virtual void RemoveItem ( IMenuItem item ) [pure virtual]
Remarks:
Removes the specified item from the menu (if it indeed appears in the menu).
Parameters:
IMenuItem* item

Points to the menu item to remove.
virtual IPoint2 GetMaxItemSize ( ) [pure virtual]
Remarks:
This method is used internally.

Returns the maximum size of all items in the menu in pixels.
virtual void Initialize ( ) [pure virtual]
Remarks:
This method is used internally.

This method is called before menu is first displayed during a user / menu interaction.
virtual void PostMenuInteraction ( ) [pure virtual]
Remarks:
This method is used internally.

This method is called after a user / menu interaction.
virtual bool HandleEvent ( MenuEvent event ) [pure virtual]
Remarks:
This method is used internally.

This method is called to handle an event occuring within the menu.
Parameters:
MenuEvent event

A menu event structure containing the event data.
Returns:
TRUE if the event was handled successfully, otherwise FALSE.

virtual void Show ( DisplayMethod  displayMethod = DM_NORMAL,
Box2 rect = NULL 
) [pure virtual]
Remarks:
This method is used internally.

This method will display the menu using the provided display method.
virtual void Hide ( DisplayMethod  displayMethod = DM_NORMAL ) [pure virtual]
Remarks:
This method is used internally.

This method will hide the menu using the provided display method.
virtual IMenuItem* FindAccelItem ( MCHAR  accelerator ) [pure virtual]
Remarks:
This method is used internally.

Finds and returns a pointer to the menu item whose accelerator is passed.
Parameters:
MCHAR accelerator

The single character of the accelerator.
Returns:
A pointer to the menu item or NULL if not found.
virtual IMenuItem* FindNewSelectedItem ( ) [pure virtual]
Remarks:
This method is used internally.

Returns a pointer to the currently selected menu item.
virtual void Display ( IMenu pParentMenu = NULL,
bool  show = true 
) [pure virtual]
Remarks:
This method is used internally.

This method displays the menu.
Parameters:
IMenu* pParentMenu = NULL

Points to the parent menu.
virtual void DisplayItems ( IPoint2 origin,
bool  descending,
bool  leftToRight,
bool  nextSeparatorOK 
) [pure virtual]
Remarks:
This method is used internally.
virtual void Undisplay ( ) [pure virtual]
Remarks:
This method is used internally.

This methods removes the menu from the display.
virtual bool IsDisplayingSubMenu ( ) [pure virtual]
Remarks:
This method is used internally.

Returns TRUE if the menu is displaying a sub-menu; otherwise FALSE.
virtual void TimerElapsed ( EventParam  timingType ) [pure virtual]
Remarks:
This method is used internally.

This method notifies the menu that the timer has elapsed.
virtual void SetShowTitle ( bool  showTitle ) [pure virtual]
Remarks:
This method is used internally.

Sets whether to show the title or not.
Parameters:
bool showTitle

Pass true to show the title; false to not show it.
virtual bool GetShowTitle ( ) const [pure virtual]
Remarks:
This method is used internally.

Returns true if a title is shown; otherwise false.
virtual void SetCustomTitle ( const MCHAR *  customTitle ) [pure virtual]
Remarks:
Sets the custom title to the string passed.
Parameters:
const MCHAR *customTitle

Points to the string to use.
virtual const MSTR& GetCustomTitle ( ) const [pure virtual]
Remarks:
Returns the custom title string.
virtual void SetUseCustomTitle ( bool  useCustomTitle ) [pure virtual]
Remarks:
Sets if the item should use a custom title.
Parameters:
bool useCustomTitle

Pass true to use a custom title; false to not use one.
virtual bool GetUseCustomTitle ( ) const [pure virtual]
Remarks:
This method returns TRUE if the menu uses a custom title, otherwise FALSE.
virtual void SetUseGlobalWidths ( bool  useGlobalWidths ) [pure virtual]
Remarks:
This method is used internally.

This method allows you to instruct the menu to use global widths in order to show the title.
Parameters:
bool useGlobalWidths

TRUE to use global widths, otherwise FALSE.
virtual bool GetUseGlobalWidths ( ) const [pure virtual]
Remarks:
This method is used internally.

This method returns TRUE if the menu uses global widths in order to show the title, otherwise FALSE.
virtual bool NoVisibleItems ( ) [pure virtual]
Remarks:
This method is used internally.

Returns true if the menu has no visible items in it; otherwise false.

IMenu IMenu IMenu IMenu IMenu IMenu IMenu IMenu IMenu IMenu
IMenu IMenu IMenu IMenu IMenu IMenu IMenu IMenu IMenu IMenu