3ds Max C++ API Reference
Loading...
Searching...
No Matches
IMenuItem Class Referenceabstract

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

#include <imenus.h>

+ Inheritance diagram for IMenuItem:

Public Types

enum  ActionMode {
  AM_INACTIVE = 0 , AM_SEPARATOR , AM_ITEM , AM_FN ,
  AM_SUBMENU , AM_ITEM_SUBMENU
}
 
enum  {
  setTitle , getTitle , setUseCustomTitle , getUseCustomTitle ,
  setDisplayFlat , getDisplayFlat , getIsSeparator , getSubMenu ,
  getMacroScript
}
 
typedef int IMenuItemIcon
 
typedef void(* ActionFn) (void)
 
typedef void(* PreDisplayCB) (IMenuItem &menuItem)
 
- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease , immediateRelease , wantsRelease , serverControlled }
 
- Public Types inherited from IMenuElement
enum  OriginLocation { UPPER_LEFT , LOWER_LEFT , LOWER_RIGHT , UPPER_RIGHT }
 

Public Member Functions

virtual void SetIMenuLocalContext (IMenuLocalContext *pIMenuLocalContext)=0
 
virtual ActionMode GetActionMode () const =0
 
virtual bool ExecuteAction () const =0
 
virtual void ActAsSeparator ()=0
 
virtual bool IsSeparator () const =0
 
virtual void SetActionItem (ActionItem *pActionItem)=0
 
virtual ActionItemGetActionItem () const =0
 
virtual void SetActionFn (ActionFn actionFn)=0
 
virtual const ActionFn GetActionFn () const =0
 
virtual void SetSubMenu (IMenu *menu)=0
 
virtual IMenuGetSubMenu ()=0
 
virtual void SetPreDisplayCB (PreDisplayCB preDisplayCB)=0
 
virtual const PreDisplayCB GetPreDisplayCB () const =0
 
virtual void Display (bool leftToRight)=0
 
virtual MCHAR GetAccelerator ()=0
 
virtual void SetIcon (MaxIcon *pMaxIcon)=0
 
virtual const MaxIconGetIcon () const =0
 
virtual void SetChecked (bool checked)=0
 
virtual bool GetChecked ()=0
 
virtual void SetHighlighted (bool highlighted)=0
 
virtual bool GetHighlighted () const =0
 
virtual void SetUseCustomTitle (bool useCustomTitle)=0
 
virtual bool GetUseCustomTitle () const =0
 
virtual void SetDisplayFlat (bool displayFlat)=0
 
virtual bool GetDisplayFlat () const =0
 
virtual void PostMenuInteraction ()=0
 
- Public Member Functions inherited from FPMixinInterface
 FPMixinInterface ()
 
virtual LifetimeType LifetimeControl ()
 
virtual CoreExport bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
CoreExport ~FPMixinInterface ()
 
virtual BaseInterfaceGetInterface (Interface_ID id)
 
virtual FPInterfaceDescGetDescByID (Interface_ID id)
 
virtual Interface_ID GetID ()
 
- Public Member Functions inherited from FPInterface
virtual BaseInterfaceGetInterface (Interface_ID id)
 
virtual FPInterfaceDescGetDesc ()=0
 
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t=0, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPParams *params)
 
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t, FPValue &result, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPValue &result, FPParams *params=NULL)
 
virtual CoreExport FunctionID FindFn (const MCHAR *name)
 
virtual CoreExport BOOL IsEnabled (FunctionID actionID)
 
virtual CoreExport BOOL IsChecked (FunctionID actionID)
 
virtual CoreExport BOOL IsVisible (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsEnabled (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsChecked (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsVisible (FunctionID actionID)
 
virtual ActionTableGetActionTable ()
 
virtual void EnableActions (BOOL onOff)
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor.
 
UtilExport BaseInterfaceGetInterface (Interface_ID id) override
 
virtual UtilExport Interface_ID GetID ()
 
virtual LifetimeType LifetimeControl ()
 
virtual bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=nullptr)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor.
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 
- Public Member Functions inherited from IMenuElement
virtual ~IMenuElement ()
 
virtual void SetOrigin (const IPoint2 &origin, OriginLocation location)=0
 
virtual const IPoint2GetOrigin () const =0
 
virtual void SetVisible (bool visible)=0
 
virtual bool GetVisible ()=0
 
virtual void SetTitle (const MCHAR *customTitle)=0
 
virtual const MSTRGetTitle ()=0
 
virtual void SetEnabled (bool enabled)=0
 
virtual bool GetEnabled ()=0
 
virtual const IPoint2GetSize ()=0
 
virtual const Box2GetRect ()=0
 
virtual bool IsInRect (const IPoint2 &point)=0
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown.
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned.
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen.
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 
- Static Public Attributes inherited from FPInterface
static CoreExport FPInterfaceDesc nullInterface
 
- Protected Member Functions inherited from FPMixinInterface
 FPMixinInterface (const FPMixinInterface &rhs)
 
FPMixinInterfaceoperator= (const FPMixinInterface &rhs)
 
- Protected Member Functions inherited from FPInterface
virtual FPStatus _dispatch_fn (FunctionID fid, TimeValue t, FPValue &result, FPParams *p)
 
- Protected Attributes inherited from FPMixinInterface
Tab< InterfaceNotifyCallback * > * interfaceNotifyCBs
 

Detailed Description

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

Note, that this class has been extended by class IMenuItemExtension.

See also
Class IMenuItemExtension, Class IMenuElement, Class IMenuGlobalContext, Class IMenuLocalContext, Class ActionItem, Class IMenu, Class MaxIcon , Class IQuadMenuSettings

Member Typedef Documentation

◆ IMenuItemIcon

typedef int IMenuItemIcon

◆ ActionFn

typedef void(* ActionFn) (void)

◆ PreDisplayCB

typedef void(* PreDisplayCB) (IMenuItem &menuItem)

Member Enumeration Documentation

◆ ActionMode

enum ActionMode
Enumerator
AM_INACTIVE 
AM_SEPARATOR 
AM_ITEM 
AM_FN 
AM_SUBMENU 
AM_ITEM_SUBMENU 
1364 { AM_INACTIVE = 0,
1366 AM_ITEM,
1367 AM_FN,
1368 AM_SUBMENU,
@ AM_SEPARATOR
Definition: imenus.h:1365
@ AM_SUBMENU
Definition: imenus.h:1368
@ AM_ITEM_SUBMENU
Definition: imenus.h:1369
@ AM_FN
Definition: imenus.h:1367
@ AM_ITEM
Definition: imenus.h:1366
@ AM_INACTIVE
Definition: imenus.h:1364

◆ anonymous enum

anonymous enum
Enumerator
setTitle 
getTitle 
setUseCustomTitle 
getUseCustomTitle 
setDisplayFlat 
getDisplayFlat 
getIsSeparator 
getSubMenu 
getMacroScript 
1520 {
1521 setTitle,
1522 getTitle,
1528 getSubMenu,
1530 };
@ setTitle
Definition: imenus.h:1521
@ setDisplayFlat
Definition: imenus.h:1525
@ getMacroScript
Definition: imenus.h:1529
@ getIsSeparator
Definition: imenus.h:1527
@ getDisplayFlat
Definition: imenus.h:1526
@ getTitle
Definition: imenus.h:1522
@ setUseCustomTitle
Definition: imenus.h:1523
@ getSubMenu
Definition: imenus.h:1528
@ getUseCustomTitle
Definition: imenus.h:1524

Member Function Documentation

◆ SetIMenuLocalContext()

virtual void SetIMenuLocalContext ( IMenuLocalContext pIMenuLocalContext)
pure virtual
Remarks
This method is used internally.

This method allows you to set a new (local) context for the menu, invalidating the menu's cache.
Parameters:
IMenuLocalContext* pIMenuLocalContext

A pointer to the new local context object you wish to set.

◆ GetActionMode()

virtual ActionMode GetActionMode ( ) const
pure virtual
Remarks
This method returns the current action mode. When item selection instigates an action item, calls functions, or displays a submenu the action mode changes to indicate the exact state the system is in.
Returns
Either of the following; AM_INACTIVE, AM_SEPARATOR, AM_ITEM, AM_FN, AM_SUBMENU, AM_ITEM_SUBMENU

◆ ExecuteAction()

virtual bool ExecuteAction ( ) const
pure virtual
Remarks
This method will execute the current action.
Returns
TRUE if the action was executed successfully, otherwise FALSE.

◆ ActAsSeparator()

virtual void ActAsSeparator ( )
pure virtual
Remarks
This method allows you to make the item act as an item seperator.

◆ IsSeparator()

virtual bool IsSeparator ( ) const
pure virtual
Remarks
This method determines if the item is acting as a seperator (TRUE) or not (FALSE).

◆ SetActionItem()

virtual void SetActionItem ( ActionItem pActionItem)
pure virtual
Remarks
This method allows you to set the current action item. Note that GetActionItem() returns NULL if the ActionMode is not AM_ITEM.
Parameters:
ActionItem* pActionItem

The action item you wish to set.

◆ GetActionItem()

virtual ActionItem * GetActionItem ( ) const
pure virtual
Remarks
This method returns a pointer to the current action item, or NULL if the ActionMode is not AM_ITEM.

◆ SetActionFn()

virtual void SetActionFn ( ActionFn  actionFn)
pure virtual
Remarks
This method allows you to set the current action function. Note that GetActionFn() returns NULL if the ActionMode is not AM_FN. A

lso note: typedef void (* ActionFn)(void);
Parameters:
ActionFn actionFn

The action function you wish to set.

◆ GetActionFn()

virtual const ActionFn GetActionFn ( ) const
pure virtual
Remarks
This method returns the current action function, or NULL if the ActionMode is not AM_FN.

Note: typedef void (* ActionFn)(void);

◆ SetSubMenu()

virtual void SetSubMenu ( IMenu menu)
pure virtual
Remarks
This method allows you to set the submenu. Note that GetSubMenu() returns NULL if the ActionMode is not AM_SUBMENU.
Parameters:
IMenu* menu

The submenu you wish to set.

◆ GetSubMenu()

virtual IMenu * GetSubMenu ( )
pure virtual
Remarks
This method returns a pointer to the submenu, or NULL if the ActionMode is not AM_SUBMENU.

◆ SetPreDisplayCB()

virtual void SetPreDisplayCB ( PreDisplayCB  preDisplayCB)
pure virtual
Remarks
This method allows you to set the pre-display callback.

Note: typedef void (* PreDisplayCB)(IMenuItem& menuItem);
Parameters:
PreDisplayCB preDisplayCB

The callback to set.

◆ GetPreDisplayCB()

virtual const PreDisplayCB GetPreDisplayCB ( ) const
pure virtual
Remarks
This method returns the pre-display callback.

◆ Display()

virtual void Display ( bool  leftToRight)
pure virtual
Remarks
This method is used internally.

◆ GetAccelerator()

virtual MCHAR GetAccelerator ( )
pure virtual
Remarks
This method is used internally.

This method returns the item's accelerator, or 0 if none is assigned.

◆ SetIcon()

virtual void SetIcon ( MaxIcon pMaxIcon)
pure virtual
Remarks
This method allows you to set the item's icon.
Parameters:
MaxIcon* pMaxIcon

A pointer to a MaxIcon to set.

◆ GetIcon()

virtual const MaxIcon * GetIcon ( ) const
pure virtual
Remarks
This method returns a pointer to the item's icon.

◆ SetChecked()

virtual void SetChecked ( bool  checked)
pure virtual
Remarks
This method allows you to set the checked state of the item.
Parameters:
bool checked

TRUE to check the item, FALSE to uncheck the item.

◆ GetChecked()

virtual bool GetChecked ( )
pure virtual
Remarks
This method returns TRUE if the item is checked or FALSE if it is unchecked.

◆ SetHighlighted()

virtual void SetHighlighted ( bool  highlighted)
pure virtual
Remarks
This method allows you to set the highlighted state of the item.
Parameters:
bool highlighted

TRUE to highlight the item, FALSE if you do not want to highlight the item.

◆ GetHighlighted()

virtual bool GetHighlighted ( ) const
pure virtual
Remarks
This method returns TRUE if the item is highlighted, otherwise FALSE.

◆ SetUseCustomTitle()

virtual void SetUseCustomTitle ( bool  useCustomTitle)
pure virtual
Remarks
This method allows you to tell the item it should use a custom title, which is set through SetTitle().
Parameters:
bool useCustomTitle

TRUE to use a custom title, FALSE to use the default.

◆ GetUseCustomTitle()

virtual bool GetUseCustomTitle ( ) const
pure virtual
Remarks
This method returns TRUE if the item is using a custom title or FALSE if it's using a default.

◆ SetDisplayFlat()

virtual void SetDisplayFlat ( bool  displayFlat)
pure virtual
Remarks
This method allows you to set whether the submenu-item should be displayed 'flat'.
Parameters:
bool displayFlat

TRUE to set to flat, otherwise FALSE.

◆ GetDisplayFlat()

virtual bool GetDisplayFlat ( ) const
pure virtual
Remarks
This method returns TRUE if the submenu-item should be displayed 'flat', otherwise FALSE.

◆ PostMenuInteraction()

virtual void PostMenuInteraction ( )
pure virtual
Remarks
This method is used internally.

This method is called after the user/menu interaction is done after which it will clear the caches for ActionItem handler values.