vwLabel - An abstract base class which most text supporting widgets inherit from.

#include <vwLabel.h>

virtual vwLabel::~vwLabel ( void);
void vwLabel::setLabelColor ( float * rgba);
void vwLabel::setLabelText ( vwWidget::wdgStruct *widget_struct, pfFont *font);
void vwLabel::addToLabel ( char *word, int column, int row);
void vwLabel::initLabelParms ( pfFont * font, int total_words=1.0, int total_rows=1.0);
inline void vwLabel::setLabelSize ( float size=1.0);
inline void vwLabel::setLabelVSpc ( float verticalSpacing=1.0);
inline void vwLabel::setExtrudeSize ( float size=1.0);
inline void vwLabel::setLabelHeight ( float height=0.0);
inline void vwLabel::setSpacingScale ( int horiz=1.0, int vert=1.0, int depth=1.0);
inline void vwLabel::setFlatten ( int flatten=True);
inline void vwLabel::clearLabel ( void);

vwLabel::vwLabel ( pfNode * node);

vwLabel is an abstract label class. Certain widgets, such as vwButton, inherit from this class in order to gain label functionality. There are two ways in which to create a widget label via vwLabel's methods. One, setLabelText(), requires a pointer to the appropriate vwWidget::wdgStruct (presumably generated in the static vwWidget::parseWdgConfig() method) along with a pointer to the pfFont being used by the interface. The other way in which to construct a label is through an initial call to vwButton::initLabelParms(), followed by successive calls to vwButton::addToLabel(). The default values for size, spacing and height work well for widgets which are roughly unit size in X and Y. Current implementation supports up to three rows of up to six words of horizontal text. Vertical text support will be added in a later release.


   vwLabel [Protected]
vwLabel ( pfNode *node);

Construct a label.

*node specifies a pointer to a Performer pfDCS or pfSCS.

virtual ~vwLabel ( void);

Destruct an instance. The destructor removes the Performer text node and label structure.

void setLabelColor ( float * rgba);

Set label color.

*rgba specifies a pointer to a 4 component color value.

void setLabelText ( vwWidget::wdgStruct *widget_struct, pfFont *font);

Create label.

*widget_struct specifies a pointer to a structure who's type is defined in vwWidget.h. Among other things this structure contains fields for words, and their column and row on the label to be created. The static helper function vwWidget::parseWdgConfig() stores widget information in this structure type. It can then be passed on to setLabelText(). An alternate method for label creation is addToLabel().

*font specifies the pfFont to be used for the label.

void addToLabel ( char *word, int column, int row);

Build a label one word at a time.

*word specifies a pointer to a string.

column specifies the string's position in its row.

row specifies the row in which the word belongs.

Currently, there is a 3-row maximum and 6-word maximum for labels. initLabelParms() must be called before this function is called.

void initLabelParms ( pfFont *font, int total_words, int total_rows);

Initialize a  label..

*font specifies the pfFont to be used for the button label.

total_words specifies the total number of words that will appear in the label; 6 maximum. Default is 1.

total_rowls specifies the total number of rows that will make up the label; 3 maximum. Default is 1.

initLabelParms() need not be called before setLabelText(), but must be called before addToLabel(). It should be called only once. Subsequent calls are ignored.

inline void setLabelSize ( float size);

Sets the scale factor of the label.

size specifies the floating point scale factor to be used. Default value is 1.0f.

inline void setLabelVSpc ( float verticalSpacing);

Sets the vertical spacing factor of the label.

verticalSpacing specifies the floating point vertical spacing factor to be used. Default value is 1.0f.

inline void setExtudeSize ( float size);

Sets the extrusion (depth) scalefactor of the label.

size specifies the floating point extrusion scale factor to be used. Default value is 1.0f.

inline void setLabelHeight ( float height);

Sets the vertical displacement factor of the label.

height specifies the floating point vertical displacement factor to be used. Default value is 0.0f.

inline void setSpacingScale ( float horiz, float vert, float depth);

Sets the values for an internal call to pfString::setSpacingScale() for all pfStrings in the label.

horiz specifies the floating point horizontal scalefactor. Default value is 1.0f;

vert specifies the floating point vertical scalefactor. Default value is 1.0f;

depth specifies the floating point depth scalefactor. Default value is 1.0f;

inline void setFlatten ( int flatten);

Sets the flatten flag for the pfStrings making up the pfText label. Default value is True.

flatten specifies the int value to invoke or disallow flattening of pfStrings. Either True or False. For setFlatten() to have any effect, it must be called before setLabelText() or addToLabel(). The default behavior is to flatten pfStrings.

inline void clearLabel ( void);

Removes label structure and all of its pfStrings and pfText members. Resets label to non-initialized state in the event that a new label is to be created.


vrmedlab.jpg (7272 bytes)