Class IActionManager

3DS Max Plug-In SDK

Class IActionManager

See Also: Class ActionTable, Class ClassDesc, Class ActionItem, Class ActionCallback, Class ActionContext, Class DynamicMenu, Class DynamicMenuCallback, Class Interface.

class IActionManager

Description:

This class is available in release 4.0 and later only.

The ActionManager manages a set of ActionTables, callbacks and ActionContexts. The manager handles the keyboard accelerator tables for each ActionTable as well. You get a pointer to this class using Interface::GetActionManager().

Methods:

public:

Prototype:

virtual void RegisterActionTable(ActionTable* pTable) = 0;

Remarks:

Register an action table with the manager. Note that most plug-ins will not need this method. Instead, plug-ins export action table with the methods in ClassDesc. See ClassDesc Action Table Methods.

Parameters:

ActionTable* pTable

Points to the Action Table to register.

Prototype:

virtual int NumActionTables() = 0;

Remarks:

Returns the number of ActionTables.

Prototype:

virtual ActionTable* GetTable(int i) = 0;

Remarks:

Returns a pointer to the 'i-th' ActionTable.

Parameters:

int i

The zero based index of the table.

Prototype:

virtual int ActivateActionTable(ActionCallback* pCallback, ActionTableId id) = 0;

Remarks:

This method is called to activate the action table. Some plug-ins (for instance Modifiers or Geometric Objects) may only want to activate the table when they are being edited in the command panel (between BeginEditParams() and EndEditParams()). Others, for instance Global Utility Plug-ins, may wish to do so when they are initially loaded so the actions are always available.

Note that if this method is called multiple times, only the callback from the last call will be used.

Parameters:

ActionCallback* pCallback

Points to the callback object which is responsible for executing the action.

ActionTableId id

This is the ID of the table to activate.

Return Value:

TRUE if the action table was activated. FALSE if the table is already active or doesn’t exist.

Prototype:

virtual int DeactivateActionTable(ActionCallback* pCallback, ActionTableId id) = 0;

Remarks:

This method is called to deactivate the action table. After the table is deactivated (for example in EndEditParams()) the callback object can be deleted. Tables are initially active, please do not call this method without a preceding call to ActivateActionTable().

Parameters:

ActionCallback* pCallback

Points to the callback object responsible for executing the action. Pass the same callback that was originally passed to ActivateActionTable() and do not set this to NULL.

ActionTableId id

The ID of the table to deactivate.

Return Value:

TRUE if the action table was deactivated. FALSE if the table was already deactivated or doesn’t exist.

Prototype:

virtual ActionTable* FindTable(ActionTableId id) = 0;

Remarks:

This method returns a pointer to the action table as specified by it's ID.

Parameters:

ActionTableId id

The ID of the table to find.

Prototype:

virtual BOOL GetShortcutString(ActionTableId tableId, int commandId, TCHAR* buf) = 0;

Remarks:

Retrieves the string that describes the keyboard shortcut for the operation.

Parameters:

ActionTableId tableId

The ID of the action table.

int commandId

The ID of the command for the action.

TCHAR* buf

Points to storage for the string.

Return Value:

TRUE if found; FALSE if not found.

Prototype:

virtual BOOL GetActionDescription(ActionTableId tableId, int commandId, TCHAR* buf) = 0;

Remarks:

Retrieves a string that descibes the specified operation from the action table whose ID is passed.

Parameters:

ActionTableId tableId

The ID of the action table.

int commandId

The ID of the command.

TCHAR* buf

Points to storage for the description string.

Return Value:

TRUE if the string was returned; FALSE if not.

Prototype:

virtual BOOL RegisterActionContext(ActionContextId contextId, TCHAR* pName) = 0;

Remarks:

Register the specified action context with the system. This is called when you create the action table that uses this context.

Parameters:

ActionContextId contextId

The context ID.

TCHAR* pName

The name for the action context.

Return Value:

If the specified action context is already registered FALSE is returned; otherwise TRUE is returned.

Prototype:

virtual int NumActionContexts() = 0;

Remarks:

Returns the number of ActionContexts.

Prototype:

virtual ActionContext* GetActionContext(int i) = 0;

Remarks:

Returns a pointer to the 'i-th' ActionContext.

Parameters:

int i

The zero based index of the ActionContext.

Prototype:

virtual ActionContext* FindContext(ActionContextId contextId) = 0;

Remarks:

Returns a pointer to the ActionContext based on it's ID. If not found NULL is returned.

Parameters:

ActionContextId contextId

The ID whose context is found.

Prototype:

virtual BOOL IsContextActive(ActionContextId contextId) = 0;

Remarks:

Returns TRUE if the specified context is active; otherwise FALSE.

Parameters:

ActionContextId contextId

Specifies the context to check.