#include <WCompositeWidget>
Public Member Functions | |
WCompositeWidget (WContainerWidget *parent=0) | |
Create a WCompositeWidget. | |
virtual void | setPositionScheme (PositionScheme scheme) |
Set the widget position scheme. | |
virtual PositionScheme | positionScheme () const |
Get the widget position scheme. | |
virtual void | setOffsets (WLength offset, int sides=All) |
Apply offsets to a widget. | |
virtual WLength | offset (Side s) const |
Retrieve the offset of the widget. | |
virtual void | resize (WLength width, WLength height) |
Resize the widget. | |
virtual WLength | width () const |
Get the widget width. | |
virtual WLength | height () const |
Get the widget height. | |
virtual void | setMinimumSize (WLength width, WLength height) |
Set a minimum size. | |
virtual WLength | minimumWidth () const |
Get the minimum width. | |
virtual WLength | minimumHeight () const |
Get the minimum height. | |
virtual void | setMaximumSize (WLength width, WLength height) |
Set a maximum size. | |
virtual WLength | maximumWidth () const |
Get the maximum width. | |
virtual WLength | maximumHeight () const |
Get the maximum height. | |
virtual void | setFloatSide (Side s) |
Specify a side to which the WWidget must float. | |
virtual Side | floatSide () const |
Return the float side. | |
virtual void | setClearSides (int sides) |
Set the sides that should remain empty. | |
virtual int | clearSides () const |
Get the sides that should remain empty. | |
virtual void | setMargin (WLength margin, int sides=All) |
Set margins around the widget. | |
virtual WLength | margin (Side side) const |
Get the margin set for that side. | |
virtual void | setHidden (bool) |
Set whether the widget must be hidden. | |
virtual bool | isHidden () const |
Return whether this widget is set hidden. | |
virtual void | setPopup (bool) |
Set whether this widget is overlayed on the parent widget. | |
virtual bool | isPopup () const |
Returns whether this WWidget is overlayed. | |
virtual void | setInline (bool) |
Set whether this widget is inline or stacked. | |
virtual bool | isInline () const |
Returns whether this widget is inline or stacked. | |
virtual WCssDecorationStyle & | decorationStyle () |
Access the decoration style of this widget. | |
virtual void | setStyleClass (const WString &styleClass) |
Specify that a particular style class must be applied to this WWidget. | |
virtual WString | styleClass () const |
Returns the style class for this WWidget. | |
virtual void | setVerticalAlignment (VerticalAlignment alignment, WLength length=WLength()) |
Set the vertical alignment of this (inline) WWidget. | |
virtual VerticalAlignment | verticalAlignment () const |
Get the vertical alignment of this WWidget. | |
virtual WLength | verticalAlignmentLength () const |
Get the a fixed vertical alignment with respect to the baseline of this WWidget. | |
virtual void | setToolTip (const WString &text) |
Set the tooltip for the widget. | |
virtual WString | toolTip () const |
Get the tooltip text. | |
virtual void | refresh () |
Refresh the widget. | |
virtual void | setAttributeValue (const std::string &name, const WString &value) |
Set an attribute value. | |
virtual void | load () |
Load content just before the widget's content is rendered. | |
virtual bool | loaded () const |
Return if this widget has been loaded. | |
virtual void | setId (const std::string &id) |
Set the CSS Id. | |
Protected Member Functions | |
void | setImplementation (WWidget *widget) |
Set the implementation widget. |
Composite widgets, built on top of the WebWidgets, should derive from this class, and use setImplementation() to set the widget that implements the composite widget (which is typically a WContainerWidget or a WTable, or another widget that allows composition, including perhaps another WCompositeWidget).
Using this class you can completely hide the implementation of your composite widget, and provide access to only the standard WWidget methods.
void Wt::WCompositeWidget::setPositionScheme | ( | PositionScheme | scheme | ) | [virtual] |
Set the widget position scheme.
Establishes how the widget must be layed-out relative to its siblings. The default position scheme is Static.
Implements Wt::WWidget.
WWidget::PositionScheme Wt::WCompositeWidget::positionScheme | ( | ) | const [virtual] |
void Wt::WCompositeWidget::setOffsets | ( | WLength | offset, | |
int | sides = All | |||
) | [virtual] |
Apply offsets to a widget.
sides may be a logical concatenation of Left, Right, Top, and Bottom.
This applies only to widgets that have a position scheme that is Relative, Absolute, or Fixed, and has a slightly different meaning for these three cases.
For a relatively positioned widget, an offset applies relative to the position the widget would have when layed-out using a Static position scheme. The widget may be shifted to the left or right by specifying an offset to the Left or Right). The widget may be shifted vertically, by specifying an offset for the Top or Bottom.
For an absolutely positioned widget, an offset specifies a distance of the corresponding side of the widget with respect to the corresponding side of the reference parent widget. Thus, setting all offsets to 0 result in a widget that spans the entire reference widget. The reference parent widget is the first ancestor widget that is a table cell, or a widget with a relative, absolute or fixed position scheme.
For an absolutely positioned widget, an offset specifies a distance of the corresponding side of the widget with respect to the browser window, regardless of scrolling. Thus, setting all offsets to 0 result in a widget that spans the entire browser window.
Note: this method replaces the now deprecated setOffset(Side side, WLength offset) method.
Implements Wt::WWidget.
Resize the widget.
Specify a new size for this widget, by specifying width and height. By default a widget has automatic width and height, see WLength::isAuto().
Implements Wt::WWidget.
Reimplemented in Wt::WSlider.
WLength Wt::WCompositeWidget::width | ( | ) | const [virtual] |
Get the widget width.
Return the width set for this widget. This is not a calculated width, based on layout, but the width as specified with resize(WLength width, WLength height).
Implements Wt::WWidget.
WLength Wt::WCompositeWidget::height | ( | ) | const [virtual] |
Get the widget height.
Return the height set for this widget. This is not a calculated height, based on layout, but the height as specified previously with resize(WLength width, WLength height).
Implements Wt::WWidget.
Set a minimum size.
Specify a minimum size for this widget.
Implements Wt::WWidget.
WLength Wt::WCompositeWidget::minimumWidth | ( | ) | const [virtual] |
Get the minimum width.
Return the minimum width set for this widget with setMinimumSize().
Implements Wt::WWidget.
WLength Wt::WCompositeWidget::minimumHeight | ( | ) | const [virtual] |
Get the minimum height.
Return the minmum height set for this widget with setMinimumSize().
Implements Wt::WWidget.
Set a maximum size.
Specify a minimum size for this widget.
Implements Wt::WWidget.
WLength Wt::WCompositeWidget::maximumWidth | ( | ) | const [virtual] |
Get the maximum width.
Return the maximum width set for this widget with setMaximumSize().
Implements Wt::WWidget.
WLength Wt::WCompositeWidget::maximumHeight | ( | ) | const [virtual] |
Get the maximum height.
Return the minmum height set for this widget with setMaximumSize().
Implements Wt::WWidget.
void Wt::WCompositeWidget::setFloatSide | ( | Side | s | ) | [virtual] |
Specify a side to which the WWidget must float.
This only applies to WWidgets with a Static positionScheme().
It specifies if the WWidget must be positioned on one of the sides of the parent widget, at the current line. A typical use is to position images within text. Valid values for Side or None , Left or Right .
Implements Wt::WWidget.
WWidget::Side Wt::WCompositeWidget::floatSide | ( | ) | const [virtual] |
void Wt::WCompositeWidget::setMargin | ( | WLength | margin, | |
int | sides = All | |||
) | [virtual] |
Set margins around the widget.
Setting margin has the effect of adding a distance between the widget and surrounding widgets. The default margin (with an automatic length) is zero.
Use any combination of Left , Right , Bottom , or Top .
Implements Wt::WWidget.
void Wt::WCompositeWidget::setHidden | ( | bool | ) | [virtual] |
Set whether the widget must be hidden.
Hide or show the widget (including all its descendant widgets). setHidden(false) will show this widget and all child widgets that are not hidden.
Implements Wt::WWidget.
Reimplemented in Wt::WDialog.
bool Wt::WCompositeWidget::isHidden | ( | ) | const [virtual] |
Return whether this widget is set hidden.
A widget that is not hidden may still be not visible when one of its ancestor widgets are hidden.
Implements Wt::WWidget.
void Wt::WCompositeWidget::setPopup | ( | bool | ) | [virtual] |
Set whether this widget is overlayed on the parent widget.
This option only applies to widgets with a Absolute or Fixed positionScheme().
A widget that isPopup() will be rendered on top of the parent widget.
Implements Wt::WWidget.
bool Wt::WCompositeWidget::isPopup | ( | ) | const [virtual] |
void Wt::WCompositeWidget::setInline | ( | bool | ) | [virtual] |
Set whether this widget is inline or stacked.
This option changes whether this widget must be rendered in-line with sibling widgets wrapping at the right edge of the parent container (like text), or whether this widget must be stacked vertically with sibling widgets. Depending on the WWidget type, the default value is inline (such as for example for WText, or WPushButton), or stacked (such as for example for WTable).
Implements Wt::WWidget.
bool Wt::WCompositeWidget::isInline | ( | ) | const [virtual] |
WCssDecorationStyle & Wt::WCompositeWidget::decorationStyle | ( | ) | [virtual] |
Access the decoration style of this widget.
This groups all decorative aspects of the widget, which do not affect the widget layout (except for the border properties which change the total size of the widget when adding a non-zero-width border).
Implements Wt::WWidget.
void Wt::WCompositeWidget::setStyleClass | ( | const WString & | styleClass | ) | [virtual] |
Specify that a particular style class must be applied to this WWidget.
To remove the style class, set an empty string as style class.
Implements Wt::WWidget.
WString Wt::WCompositeWidget::styleClass | ( | ) | const [virtual] |
Returns the style class for this WWidget.
Implements Wt::WWidget.
void Wt::WCompositeWidget::setVerticalAlignment | ( | VerticalAlignment | alignment, | |
WLength | length = WLength() | |||
) | [virtual] |
Set the vertical alignment of this (inline) WWidget.
This only applies to inline widgets, and determines how to position itself on the current line, with respect to sibling inline widgets.
Implements Wt::WWidget.
WWidget::VerticalAlignment Wt::WCompositeWidget::verticalAlignment | ( | ) | const [virtual] |
Get the vertical alignment of this WWidget.
Implements Wt::WWidget.
WLength Wt::WCompositeWidget::verticalAlignmentLength | ( | ) | const [virtual] |
Get the a fixed vertical alignment with respect to the baseline of this WWidget.
Implements Wt::WWidget.
void Wt::WCompositeWidget::setToolTip | ( | const WString & | text | ) | [virtual] |
Set the tooltip for the widget.
The tooltip is displayed when the cursor rests above the widget.
Implements Wt::WWidget.
void Wt::WCompositeWidget::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.
Implements Wt::WWidget.
void Wt::WCompositeWidget::setAttributeValue | ( | const std::string & | name, | |
const WString & | value | |||
) | [virtual] |
Set an attribute value.
Associate an extra attribute with this widget, with the given value. This is only useful when processing dom nodes associated with widgets in custom JavaScript code.
Implements Wt::WWidget.
void Wt::WCompositeWidget::load | ( | ) | [virtual] |
Load content just before the widget's content is rendered.
As soon as a widget is inserted into the widget hierarchy, it is rendered. Visible widgets are rendered immediately, and invisible widgets in the back-ground. This method is called when the widget is directly or indirectly inserted into the widget tree.
The default implementation simply propagates the load signal to its children. You may want to override this method to load resource-intensive content only when the widget is loaded into the browser.
Implements Wt::WWidget.
bool Wt::WCompositeWidget::loaded | ( | ) | const [virtual] |
void Wt::WCompositeWidget::setId | ( | const std::string & | id | ) | [virtual] |
Set the CSS Id.
Sets a custom Id. Note that the Id must be unique across the whole widget tree, can only be set right after construction and cannot be changed.
Implements Wt::WWidget.
void Wt::WCompositeWidget::setImplementation | ( | WWidget * | widget | ) | [protected] |
Set the implementation widget.
This sets the widget that implements this compositeWidget. Ownership of the widget is completely transferred (including deletion).