sptk2 logo
SPTK Home Page

sptk::CButtonGroup Class Reference
[GUI Classes]

Base class for CCheckButtons and CRadioButtons. More...

#include <CButtonGroup.h>

Inheritance diagram for sptk::CButtonGroup:

sptk::CControl sptk::CLayoutClient sptk::CRadioButtons sptk::CCheckButtons

List of all members.

Public Member Functions

void buttons (const CStrings &buttonList)
 Sets the list of the buttons.
const CStringsbuttons () const
 Returns the list of the buttons.
virtual void clearButtons ()
 Clears the list of buttons.
virtual CVariant data () const
 Returns the currently selected button(s) as pipe ('|') separated string.
virtual void data (const CVariant v)
 Sets the currently selected button(s).
virtual void load (CQuery *)
 Loads the the currently selected button(s).
virtual void save (CQuery *)
 Saves the the currently selected button(s).
virtual void load (const CXmlNode *node, CLayoutXMLmode xmlMode)
 Loads control data from XML.
virtual void save (CXmlNode *node, CLayoutXMLmode xmlMode) const
 Saves control data to XML.
virtual bool valid () const
 Tells if the the current data content is valid.
virtual bool preferredSize (int &w, int &h)
 Computes the preferred size of the button group based on its contents.

Protected Member Functions

virtual void controlDataChanged ()
 Internal callback processing.
int buttonIndex (const char *buttonLabel)
void deselectAllButtons ()
 Deselects all buttons.
void selectButton (int choice)
 Selects button by index.
virtual Fl_Button * createButton (const char *label, int sz=10, CLayoutAlign layoutAlignment=SP_ALIGN_TOP)=0
 Creates button. Should be implemented in the derived class.
void ctor_init ()
 Constructor initializer.
 CButtonGroup (const char *label=0, int layoutSize=20, CLayoutAlign layoutAlignment=SP_ALIGN_TOP)

Protected Attributes

std::string m_lastValue
 Last value of the group (last list of choices).
CStrings m_buttonLabels
 Button labels for the buttons inside.
Fl_Button * m_otherButton
 The 'Other' Button if requested (add '*' in the button list).
CInput_m_otherInput
 The 'Other' Input if requested (add '*' in the button list).


Detailed Description

Base class for CCheckButtons and CRadioButtons.

Implements the most important data communication methods for these button groups.


Constructor & Destructor Documentation

sptk::CButtonGroup::CButtonGroup ( const char *  label = 0,
int  layoutSize = 20,
CLayoutAlign  layoutAlignment = SP_ALIGN_TOP 
) [protected]

SPTK-style constructor

Parameters:
label const char *, the widget label
layoutSize int, the size of widget in layout
layoutAlignment CLayoutAlign, widget align in the layout


Member Function Documentation

int sptk::CButtonGroup::buttonIndex ( const char *  buttonLabel  )  [protected]

Finds a button by label

Parameters:
buttonLabel const char *, button label
Returns:
button index, or -1 if not found

void sptk::CButtonGroup::buttons ( const CStrings buttonList  ) 

Sets the list of the buttons.

Parameters:
buttonList CStrings, list of the buttons

virtual void sptk::CButtonGroup::data ( const CVariant  v  )  [virtual]

Sets the currently selected button(s).

Buttons are presented as pipe ('|') separated string. If the button group allows only one button to be selected at a time (like radio buttons), only the first item of the string will be used.

Reimplemented from sptk::CControl.

Reimplemented in sptk::CCheckButtons.

virtual void sptk::CButtonGroup::load ( const CXmlNode node,
CLayoutXMLmode  xmlMode 
) [virtual]

Loads control data from XML.

Layout information may also include widget size and position, as well as visible() and active() states

Parameters:
node CXmlNode*, the XML node
xmlMode CLayoutXMLmode, the mode defining how the layout and/or data should be stored

Reimplemented from sptk::CControl.

virtual void sptk::CButtonGroup::load ( CQuery  )  [virtual]

Loads the the currently selected button(s).

Buttons should be presented as pipe ('|') separated string.

Reimplemented from sptk::CControl.

virtual bool sptk::CButtonGroup::preferredSize ( int &  w,
int &  h 
) [virtual]

Computes the preferred size of the button group based on its contents.

Parameters:
w int&, the optimal width
h int&, the optimal height
Returns:
true if the size is stable (doesn't depend on input sizes)

Reimplemented from sptk::CLayoutClient.

virtual void sptk::CButtonGroup::save ( CXmlNode node,
CLayoutXMLmode  xmlMode 
) const [virtual]

Saves control data to XML.

Layout information may also include widget size and position, as well as visible() and active() states

Parameters:
node CXmlNode*, the XML node
xmlMode CLayoutXMLmode, the mode defining how the layout and/or data should be stored

Reimplemented from sptk::CControl.

virtual void sptk::CButtonGroup::save ( CQuery  )  [virtual]

Saves the the currently selected button(s).

Buttons are presented as pipe ('|') separated string

Reimplemented from sptk::CControl.

virtual bool sptk::CButtonGroup::valid (  )  const [inline, virtual]

Tells if the the current data content is valid.

Always true for this widget.

Implements sptk::CControl.


The documentation for this class was generated from the following file:

Mon Mar 5 11:56:09 2012: SPTK 3.5.7