Class IMenu

3DS Max Plug-In SDK

Class IMenu

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

class IMenu : public IMenuElement

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.

Methods:

public:

Prototype:

virtual void SetIMenuGlobalContext(IMenuGlobalContext* pIMenuGlobalContext) = 0;

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.

Prototype:

virtual IMenuLocalContext* GetIMenuLocalContext() = 0;

Remarks:

This method is used internally.

Returns a pointer to the menu's local context.

Prototype:

virtual int NumItems() const = 0;

Remarks:

Returns the number of items in the menu.

Prototype:

virtual IMenuItem* GetItem(int position) = 0;

Remarks:

Returns a pointer to the specified menu item.

Parameters:

int position

The position/index in the menu.

Prototype:

virtual void AddItem(IMenuItem* item, int position = -1) = 0;

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.

Prototype:

virtual void RemoveItem(int position) = 0;

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.

Prototype:

virtual void RemoveItem(IMenuItem* item) = 0;

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.

Prototype:

virtual IPoint2 GetMaxItemSize() = 0;

Remarks:

This method is used internally.

Returns the maximum size of all items in the menu in pixels.

Prototype:

virtual void Initialize() = 0;

Remarks:

This method is used internally.

This method is called before menu is first displayed during a user / menu interaction.

Prototype:

virtual void PostMenuInteraction() = 0;

Remarks:

This method is used internally.

This method is called after a user / menu interaction.

Prototype:

virtual bool HandleEvent(MenuEvent event) = 0;

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.

Return Value:

TRUE if the event was handled successfully, otherwise FALSE.

 

Prototype:

virtual void Show(DisplayMethod displayMethod = DM_NORMAL, Box2 *rect = NULL) = 0;

Remarks:

This method is used internally.

This method will display the menu using the provided display method.

Prototype:

virtual void Hide(DisplayMethod displayMethod = DM_NORMAL) = 0;

Remarks:

This method is used internally.

This method will hide the menu using the provided display method.

Prototype:

virtual IMenuItem* FindAccelItem(TCHAR accelerator) = 0;

Remarks:

This method is used internally.

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

Parameters:

TCHAR accelerator

The single character of the accelerator.

Return Value:

A pointer to the menu item or NULL if not found.

Prototype:

virtual IMenuItem* FindNewSelectedItem() = 0;

Remarks:

This method is used internally.

Returns a pointer to the currently selected menu item.

Prototype:

virtual void Display(IMenu* pParentMenu = NULL) = 0;

Remarks:

This method is used internally.

This method displays the menu.

Parameters:

IMenu* pParentMenu = NULL

Points to the parent menu.

Prototype:

virtual void DisplayItems(IPoint2& origin, bool descending) = 0;

Remarks:

This method is used internally.

Prototype:

virtual void Undisplay() = 0;

Remarks:

This method is used internally.

This methods removes the menu from the display.

Prototype:

virtual bool IsDisplayingSubMenu() = 0;

Remarks:

This method is used internally.

Returns TRUE if the menu is displaying a sub-menu; otherwise FALSE.

Prototype:

virtual void TimerElapsed(EventParam timingType) = 0;

Remarks:

This method is used internally.

This method notifies the menu that the timer has elapsed.

Prototype:

virtual void SetShowTitle(bool showTitle) = 0;

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.

Prototype:

virtual bool GetShowTitle() const = 0;

Remarks:

This method is used internally.

Returns true if a title is shown; otherwise false.

Prototype:

virtual void SetCustomTitle(const TCHAR *customTitle) = 0;

Remarks:

Sets the custom title to the string passed.

Parameters:

const TCHAR *customTitle

Points to the string to use.

Prototype:

virtual const TSTR& GetCustomTitle() const = 0;

Remarks:

Returns the custom title string.

Prototype:

virtual void SetUseCustomTitle(bool useCustomTitle) = 0;

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.

Prototype:

virtual bool GetUseCustomTitle() const = 0;

Remarks:

This method returns TRUE if the menu uses a custom title, otherwise FALSE.

Prototype:

virtual void SetUseGlobalWidths(bool useGlobalWidths) = 0;

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.

Prototype:

virtual bool GetUseGlobalWidths() const = 0;

Remarks:

This method is used internally.

This method returns TRUE if the menu uses global widths in order to show the title, otherwise FALSE.

Prototype:

virtual bool NoVisibleItems() = 0;

Remarks:

This method is used internally.

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

The following functions are not part of the class but are available for use.

Function:

IMenu * GetIMenu();

Remarks:

This method will return a pointer to the IMenu.

Prototype:

void ReleaseIMenu(IMenu *);

Remarks:

This method will release the specified IMenu.

Parameters:

IMenuItem *

A pointer to the IMenu you wish to release.