Class MacroButtonData

3DS Max Plug-In SDK

Class MacroButtonData

See Also: Class ToolMacroItem, Class MacroEntry, Class MacroDir, Class ICustButton, Class ICustomControl, Class ShortcutTable, Class ShortcutCallback, Class ActionItem, Keyboard Shortcut System.

class MacroButtonData

Description:

This class is available in release 3.0 and later only.

A Macro Button is a button which can execute either a keyboard macro or macro script. This class contains the data and access methods for such a UI button. This data includes a macro type, command ID, macro script ID, label, tooltip, image name, and image ID.

This object is used in the ToolMacroItem constructor. There are also methods of class ICustButton to get and set the macro button data.

Data Members:

public:

int macroType;

The macro type. One of the following values:

MB_TYPE_KBD

A keyboard macro.

MB_TYPE_SCRIPT

A Script macro.

ActionTableId tblID;

The Shortcut Action Table ID.

void *cb;

The ShortcutCallback. See Class ShortcutCallback. This is currently not used.

int cmdID;

The command ID. There are method of class Interface that provide access to the command IDs for various keyboard shortcut tables. See Keyboard Shortcut Related Methods.

int macroScriptID;

The macroScriptID holds the id of the macroScript associated with this button. This id is the MacroID that is used by the methods in the MacroDir and MacroEntry classes (at one time it was an indirect reference to this id and so was typed as an int). The id can have values from 0 to the number of macro scripts currently defined in the running 3ds max or the special value UNDEFINED_MACRO.

TCHAR *label;

The label text for a text button. This is used if imageID is -1.

TCHAR *tip;

The tooltip text.

TCHAR *imageName;

This is the name for the button image. This is the 'base' name only. For example if the actual image name was Spline_16i.bmp then the name supplied here would be Spline. See the remarks in Class CUIFrameMgr for details on the image naming scheme the CUI system uses.

int imageID;

The image ID. If this is set to -1 it indicates to use the label. If it is set to 0 or greater it indicates this is an image based button and this is the zero based index of the button that was added. This then is an ID into an image group as specified by imageName. Said another way, 3ds max builds one large image list internally and uses the imageName to get an offset into the list and then uses this imageID as an additional offset from the start as indicated by the name (each imageName may contain multiple icons in the single BMP).

ActionItem* actionItem;

This data member is available in release 4.0 and later only.

A pointer to the ActionItem.

DWORD flags;

This data member is available in release 4.0 and later only.

These flags contain the last state when redrawing

Methods:

public:

Prototype:

MacroButtonData();

Remarks:

Constructor. The data members are initialized as follows:

label = tip = imageName = NULL; imageID = -1;

Prototype:

MacroButtonData(long tID, void *cb, int cID, TCHAR *lbl, TCHAR *tp=NULL, int imID=-1, TCHAR *imName=NULL);

Remarks:

Constructor. This one is used for keyboard macro buttons (MB_TYPE_KBD). The data members are initialized to the values passed as shown:

macroType=MB_TYPE_KBD; tblID=tID; this->cb=cb; cmdID=cID; imageID=imID; label=NULL; SetLabel(lbl); tip=NULL; SetTip(tp); imageName=NULL; SetImageName(imName);

Prototype:

MacroButtonData(int msID, TCHAR *lbl, TCHAR *tp=NULL, int imID=-1, TCHAR *imName=NULL);

Remarks:

Constructor. This one is used for macro script buttons (MB_TYPE_SCRIPT). The data members are initialized to the values passed as shown:

macroType=MB_TYPE_SCRIPT; macroScriptID=msID; imageID=imID; label=NULL; SetLabel(lbl); tip=NULL; SetTip(tp); imageName=NULL; SetImageName(imName);

Prototype:

~MacroButtonData();

Remarks:

Destructor. Any label, tooltip or image name strings are deleted.

Prototype:

void SetLabel(TCHAR *lbl);

Remarks:

Sets the label text.

Parameters:

TCHAR *lbl

The label to set.

Prototype:

TCHAR *GetLabel();

Remarks:

Returns the label text.

Prototype:

void SetTip(TCHAR *tp);

Remarks:

Sets the tooltip text.

Parameters:

TCHAR *tp

The text to set.

Prototype:

TCHAR *GetTip();

Remarks:

Returns the tooltip text.

Prototype:

void SetCmdID(int id);

Remarks:

Sets the command ID.

Parameters:

int id

The command ID to set.

Prototype:

int GetCmdID();

Remarks:

Returns the command ID.

Prototype:

void SetScriptID(int id);

Remarks:

Sets the script ID.

Parameters:

int id

The script ID to set.

Prototype:

int GetScriptID();

Remarks:

Returns the script ID.

Prototype:

void SetImageName(TCHAR *imName);

Remarks:

Sets the image name. See the imageName data member above for details on the name format.

Parameters:

TCHAR *imName

The name to set.

Prototype:

TCHAR *GetImageName();

Remarks:

Returns the image name.

Prototype:

void SetImageID(int id);

Remarks:

Sets the image ID.

Parameters:

int id

The image ID to set.

Prototype:

int GetImageID();

Remarks:

Retuns the image ID.

Prototype:

void SetTblID(ActionTableId id);

Remarks:

This method is available in release 4.0 and later only.

This method sets the ActionTableID ID.

Parameters:

ActionTableId id

The ActionTableID ID to set.

Prototype:

ActionTableId GetTblID();

Remarks:

This method is available in release 4.0 and later only.

This method returns the ActionTableID ID.

Prototype:

void SetActionItem(ActionItem* pAction);

Remarks:

This method is available in release 4.0 and later only.

This method allows you to set the ActionItem.

Parameters:

ActionItem* pAction

A point to the ActionItem to set.

Prototype:

ActionItem* GetActionItem();

Remarks:

This method is available in release 4.0 and later only.

This method returns a pointer to the ActionItem.

Prototype:

BOOL IsActionButton();

Remarks:

This method is available in release 4.0 and later only.

This method returns TRUE if the button is an Action button. FALSE if it is not.

Prototype:

MacroButtonData & operator=(const MacroButtonData& mbd);

Remarks:

Assignment operator.