Class ITextObject

3DS Max Plug-In SDK

Class ITextObject

See Also: Class Animatable.

class ITextObject

Description:

This is the text shape object interface. This class gives access to the standard 3ds max text object. It allows the text objects font, string, and style bits to be retrieved and set. All methods of this class are implemented by the system.

To get a pointer to an ITextObject interface given a pointer to a object, use the following macro (defined in ANIMTBL.H ). Using this macro, given any Animatable, it is easy to ask for the text object interface.

#define GetTextObjectInterface(anim)

((ITextObject*)anim->GetInterface(I_TEXTOBJECT))

A plug-in developer may use this macro as follows:

ITextObject *ito = GetTextObjectInterface(anim);

This return value will either be NULL or a pointer to a valid text object interface. You may then use this pointer to call methods of this class to retrieve and modify the object data. For example:

ito->SetUnderline(TRUE);

Note: Some aspects of the text are controlled by its parameter block. Developers can access the parameter block by calling ito->GetParamBlock(). The following are the indices into the parameter block used to access the size, kerning and leading parameters:

TEXT_SIZE

TEXT_KERNING

TEXT_LEADING

Methods:

Prototype:

virtual BOOL ChangeText(TSTR string)=0;

Remarks:

This method may be called to change the text string. Note that you can't change the string if the current font is not installed.

Parameters:

TSTR string

The new text string.

Return Value:

TRUE if the string is changed; otherwise FALSE.

Prototype:

virtual BOOL ChangeFont(TSTR name, DWORD flags)=0;

Remarks:

This method may be called to change the text font.

Parameters:

TSTR name

The name of the font.

DWORD flags

One or more of the following values:

TEXTOBJ_ITALIC

TEXTOBJ_UNDERLINE

Return Value:

TRUE if the font was successfully changed; otherwise FALSE.

Prototype:

virtual TSTR GetFont()=0;

Remarks:

Returns the name of the text font.

Prototype:

virtual TSTR GetString()=0;

Remarks:

Returns the text string.

Prototype:

virtual BOOL GetItalic()=0;

Remarks:

Returns TRUE if the text is italicized; otherwise FALSE.

Prototype:

virtual BOOL GetUnderline()=0;

Remarks:

Returns TRUE if the text is underlined; otherwise FALSE.

Prototype:

virtual void SetItalic(BOOL sw)=0;

Remarks:

Sets if the text is italicized or not.

Parameters:

BOOL sw

TRUE if the text should be italicized; FALSE if not.

Prototype:

virtual void SetUnderline(BOOL sw)=0;

Remarks:

Sets if the text is underlined or not.

Parameters:

BOOL sw

TRUE if the text should be underlined; FALSE if not.