vwRadioButton - A radiobutton class.

vwButton, vwObserver

#include <vwRadioButton.h>

vwRadioButton::vwRadioButton ( vwMediator * concreteMediator, pfDCS * dcs, int unPress=True);
virtual vwRadioButton::~vwRadioButton ( void);
void vwRadioButton::update ( vwSubject * callingSubject, void * data);
virtual void vwRadioButton::setPressed ( int pressedState);
virtual void vwRadioButton::setPressed ( void);
virtual void vwRadioButton::setIsPressed ( int isPressed=True);


   Inherited from vwButton
virtual void vwButton::setOver ( int overState=True);
virtual void vwButton::setPressed ( int pressedState=True);
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);

   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 extrudeSize=1.0);
inline void vwLabel::setSpacingScale( float horizSpc=1.0, float vertSpc=1.0, float depthSpc=1.0);
inline void vwLabel::setLabelHeight ( float hight=0.0);
inline void vwLabel::setFlatten ( int flatten=True);
inline void vwLabel::clearLabel ( void);

   Inherited from vwObserver
virtual void vwObserver::update ( vwSubject * callingSubject, void * data) = 0;

   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 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 vwButton
virtual void vwButton::doProcessPress ( void);
virtual void vwButton::doPostProcessPress ( void);
virtual void vwButton::doPushButton ( void);

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

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

vwRadioButton is a radiobutton publicly derived from vwButton and vwObserver. As both a subject and an observer, it can notify() other observer radiobuttons that belong to its programmer defined 'group' to update() when it has been pressed. In the case of the vwRadioButton, an update() sets its pressed state to False.


vwRadioButton ( vwMediator *concreteMediator, pfDCS *dcs, int unPress);

Construct a radiobutton.

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

*dcs specifies a pointer to a Performer pfDCS containing the radiobutton's geometry.

unPress specifies whether or not this radiobutton is allowed to un-press itself. A parameter value of False (0) means that this radiobutton cannot be un-pressed directly by user interaction. The default value for unPress is True. The rational behind this parameter is as follows: in certain situations there must always be a pressed radiobutton among its attached family of radiobuttons. Otherwise, the state which the family of radiobuttons controls becomes undefined. In such a situation, one would pass False as the third argument in the constructor. This makes it impossible for a user to un-press that radiobutton. A simple illustration of such a situation is that of a family of three radiobuttons which set a state. One radiobutton sets the state to 1. The second radiobutton sets the state to 2, and the third radiobutton sets the state to 3. One would want to disallow the direct un-pressing of any of these buttons as the state would then become undefined.

virtual ~vwRadioButton ( void);

Destruct an instance.

void update ( vwSubject * callingSubject, void * data);

Override pure virtual vwObserver::update(). update() gets called whenever a notify() event is generated by a widget to which the vwRadioButton is attached. Normally, only radiobuttons of the same programmer defined 'group' would generate update()s among one another. When update() is called in a vwRadioButton, it checks the status of the calling subject and then sets its own pressed state to False if it is True. The result, of course, is that only one of a group of radiobuttons can be pressed at any given time. To group a set of radiobuttons, one needs to attach() the other members of the group to each vwRadioButton, taking care not to attach a vwRadioButton to itself. If one or more vwRadioButtons become attached to themselves, button behavior becomes undefined.

*callingSubject specifies a pointer to the vwSubject that generated the event.

*data specifies a pointer to the subject's data. In the case of an update generated by a vwRadioButton, *data points to a value of vwRadioButton::RADIO.

virtual void setPressed ( int pressedState);

Override of overloaded vwButton::setPressed(int) that sets the button's Pressed State to pressedState and generates a notify event after calling doProcessPress() and before calling doPostProcessPress(). Note that if the vwRadioButton was constructed with the third argument (int unPress) passed as False, vwRadioButton::setPressed(False) will have no effect with a vwRadioButton who's current pressed state is True.

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

virtual void setPressed ( void);

Override of overloaded vwButton::setPressed(void) by performing a Boolean NOT on its current (pre-pressed) value. And then generates a notify event after calling doProcessPress() and before calling doPostProcessPress(). Note that if the vwRadioButton was constructed with the third argument (int unPress) passed as False, vwRadioButton::setPressed() will have no effect with a vwRadioButton who's current pressed state is True.

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.Note that if the vwRadioButton was constructed with the third argument (int unPress) passed as False, vwRadioButton::setIsPressed(False) will have no effect with a vwRadioButton who's current pressed state is True.

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

vwButton, vwObserver

vrmedlab.jpg (7272 bytes)