vwButton - A generic button class.

vwWidget, vwLabel

#include <vwButton.h>

vwButton::vwButton ( vwMediator * concreteMediator, pfNode * node);
virtual vwButton::~vwButton ( void);
virtual void vwButton::setOver ( int overState=True);
virtual void vwButton::setPressed ( int pressedState);
virtual void vwButton::setPressed ( void);
virtual void vwButton::setIsPressed ( int isPressed=True);
inline int vwButton::getNumChildren ( void);
inline int vwButton::isGeneric ( void);
inline void vwButton::setPushDistance ( float pushDistance=1.0);
inline int vwButton::getExpanded ( void);
inline void vwButton::setExpanded ( int expandedState=True);
virtual char * vwButton::getChild ( int childListIndex=0);
virtual int vwButton::addChild ( char * child);

virtual void vwButton::doProcessPress ( void);
virtual void vwButton::doPostProcessPress ( void);
virtual void vwButton::doPushButton ( void);
void vwButton::press ( void);


   Inherited from vwWidget
virtual void vwWidget::setActive ( int activeState=True);
virtual void vwWidget::setOver ( int overState=True);
virtual void vwWidget::setVisible ( int visibiltyState=True);
inline int vwWidget::getActive ( void);
inline int vwWidget::getOver ( void);

inline int vwWidget::getPressed (

inline int vwWidget::getVisible ( void);
inline int vwWidget::getDragged ( void);
inline int vwWidget::getIdent ( void);
inline int vwWidget::getInterface ( void);
void vwWidget::getColor ( wColor colorIndex, float rgba[]);
inline void vwWidget::setColor ( wColor colorIndex=ACTIVE);
void vwWidget::registerColor ( wColor colorIndex, float *rgba);
inline int vwWidget::isOfType ( wType wdg_type);
inline pfSCS * vwWidget::getSCS ( void);
inline pfDCS * vwWidget::getDCS ( void);
inline void vwWidget::getParentMtx ( pfMatrix * m);

   Inherited from vwLabel
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, int total_rows=1);
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 hight=0.0);
inline void vwLabel::setSpacingScale ( float horiz=1.0, float vert=1.0, float depth=1.0);
inline void vwLabel::setFlatten ( int flatten=True);
inline void vwLabel::clearLabel ( void);

   Inherited from vwSubject
virtual void vwSubject::attach ( vwObserver *concreteObserver);
virtual void vwSubject::detach ( vwObserver *concreteObserver);
inline void vwSubject::setSubectData ( void * data);
inline void * vwSubject::getSubjectData ( void);
inline unsigned long vwSubject::getID ( void);


   Inherited from vwWidget
virtual void vwWidget::doSetColor ( wColor colorIndex);
virtual void vwWidget::setWType ( wType widgetType);

   Inherited from vwSubject
virtual void vwSubject::notify ( void);

vwButton is the generic button class publicly derived from vwWidget. It holds a pressed state, which is either False or True. Whenever it is pressed, its Pressed State is changed and it generates a notify event to any observers attached to it. As with other widgets, a button will not generate events, nor will it signify attribute changes due to pointer intersection if its Active State is set to False.  See vwWidget::setActive().


vwButton ( vwMediator *concreteMediator, pfNode *node);

Construct a button.

*concreteMediator specifies a pointer to the concrete mediator of the interface being created.

*node specifies a pointer to a Performer pfDCS containing the button geometry.

virtual ~vwButton ( void);

Destruct an instance.

virtual void setOver ( int overState);

Set the button's Over State. Overrides vwWidget::setOver() mainly to change the characteristic of a button who's Over State is True while its Pressed State is also True.

overstate specifies a value of False (0) or True.Default value is True.

virtual void setPressed ( int pressedState);

Overloaded function that sets the button's Pressed State to pressedState and generates a notify event after calling doProcessPress() and before calling doPostProcessPress().

pressedState specifies a value of False (0) or True.

virtual void setPressed ( void);

Overloaded function that changes the button's Pressed State by performing a Boolean NOT on its current (pre-press) value. And then generates a notify event after calling doProcessPress() and before calling doPostProcessPress().

virtual void setIsPressed ( int isPressed);

Modify the button's Pressed State without generating any events or altering a button geometric attributes or position. Generally would not be used, but may be useful in certain esoteric circumstances.

isPressed specifies a value of True or False. Default value is True.

inline int getNumChildren ( void);

Get the number of children a button has. Current implementation limit is 1.

inline int isGeneric ( void);

Returns True if this is a generic vwButton, Should return False if it is a subclass of vwButton.

inline void setPushDistance ( float pushDistance);

Sets the distance in the button's local coordinate system that the button will be displaced in Z (Performer -y) when it is pressed.

pushDistance specifies a floating point displacement value. Default value is 1.0.

inline int getExpanded ( void);

Returns an int value reflecting the widget's current expanded state, True or False (0). Expanded state describes whether or not the widget's child interface exists. In this 1.1 implementation, only vwButton and it's descendents are capable of having children; one child maximum in current implementation.

inline int setExpanded ( int expandedState);

Sets a buttons expanded state to either True or False (0).

expandedState specifies an integer value of either True or False. Default value is True.

inline char * getChild ( int childListIndex);

If successful, returns a pointer to the string specifying the path to the child interface file. Otherwise returns a NULL pointer.

childListIndex specifies an index into the button's childlist.

virtual int addChild ( char * child);

Appends a child interface pathstring to the end of the button's childlist.

child specifies a pointer to a string containing the relative path to a child interface configuration file.

   doProcessPress() [Protected]
virtual void doProcessPress ( void);

A hook operation that gets called from within setPressed(). This function is called before notify(), and may be overridden by classes publicly inheriting from vwButton when a specific pre-notify behavior is required. In the case of vwButton, doProcessPress() does nothing.
internal bookkeeping and performs the forward and back translation associated with setPushDistance().

   doPostProcessPress() [Protected]
virtual void doPostProcessPress ( void);

A hook operation that gets called from within setPressed(). This function is called after notify(), and may be overridden by classes publicly inheriting from vwButton when a specific post-notify behavior is required. In the case of vwButton, doPostProcessPress() does nothing. vwPushButton, publically derived from vwButton, is an example where doPostProcessPress() is overriden as vwPushButton::doPostProcessPress().

   doPushButton() [Protected]
virtual void doPushButton ( void);

This method is called from within setPressed(). It performs the forward and back translation associated with setPushDistance(). It is virtual so that subclasses may override this behavior.

   press() [Protected]
void press ( void);

This method is called from within setPressed(). All attached vwObservers are notified via notify() from this method.

vwWidget, vwLabel, vwSubject

vrmedlab.jpg (7272 bytes)