Public Member Functions | Protected Member Functions

Wt::WGroupBox Class Reference

A widget which group widgets into a frame with a title. More...

#include <Wt/WGroupBox>

Inheritance diagram for Wt::WGroupBox:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 WGroupBox (WContainerWidget *parent=0)
 Creates a groupbox with empty title.
 WGroupBox (const WString &title, WContainerWidget *parent=0)
 Creates a groupbox with given title message.
const WStringtitle () const
 Returns the title.
void setTitle (const WString &title)
 Returns the title.
virtual void refresh ()
 Refresh the widget.

Protected Member Functions

virtual void propagateSetEnabled (bool enabled)
 Propagates that a widget was enabled or disabled through children.

Detailed Description

A widget which group widgets into a frame with a title.

This is typically used in a form to group certain form elements together.

Usage example:

 enum Vote { Republican = 1, Democrate = 2, NoVote = 10 };

 // use a group box as widget container for 3 radio buttons, with a title
 Wt::WGroupBox *container = new Wt::WGroupBox("USA elections vote");

 // use a button group to logically group the 3 options
 Wt::WButtonGroup *group = new Wt::WButtonGroup(this);

 Wt::WRadioButton *button;
 button = new Wt::WRadioButton("I voted Republican", container);
 new Wt::WBreak(container);
 group->addButton(button, Republican);

 button = new Wt::WRadioButton("I voted Democrat", container);
 new Wt::WBreak(container);
 group->addButton(button, Democrate);

 button = new Wt::WRadioButton("I didn't vote", container);
 new Wt::WBreak(container);
 group->addButton(button, NoVote);

 group->setCheckedButton(group->button(NoVote));

Like WContainerWidget, WGroupBox is by default displayed as a block.

WGroupBox-1.png

WGroupBox example

CSS

The widget corresponds to the HTML <fieldset> tag, and the title in a nested <legend> tag. This widget does not provide styling, and can be styled using inline or external CSS as appropriate.


Member Function Documentation

void Wt::WGroupBox::propagateSetEnabled ( bool  enabled ) [protected, virtual]

Propagates that a widget was enabled or disabled through children.

When enabling or disabling a widget, you usually also want to disable contained children. This method is called by setDisabled() to propagate its state to all children.

You may want to reimplement this method if they wish to render differently when a widget is disabled. The default implementation will propagate the signal to all children.

Reimplemented from Wt::WInteractWidget.

void Wt::WGroupBox::refresh (  ) [virtual]

Refresh the widget.

The refresh method is invoked when the locale is changed using WApplication::setLocale() or when the user hit the refresh button.

The widget must actualize its contents in response.

Reimplemented from Wt::WWebWidget.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator

Generated on Fri Jul 8 2011 for the C++ Web Toolkit (Wt) by doxygen 1.7.2