Wt::WContainerWidget Class Reference

A widget that holds and manages child widgets. More...

#include <WContainerWidget>

Inheritance diagram for Wt::WContainerWidget:

Inheritance graph
[legend]

List of all members.

Public Types

enum  Overflow { OverflowVisible = 0x0, OverflowAuto = 0x1, OverflowHidden = 0x2, OverflowScroll = 0x3 }
 How to handle overflow of inner content. More...

Public Member Functions

 WContainerWidget (WContainerWidget *parent=0)
 Create a container with optional parent.
 ~WContainerWidget ()
 Destruct a WContainerWidget.
virtual void addWidget (WWidget *widget)
 Add a child widget to this container.
virtual void insertBefore (WWidget *widget, WWidget *before)
 insert a child widget in this container, before another widget.
virtual void insertWidget (int index, WWidget *widget)
 insert a child widget in this container at given index.
virtual void removeWidget (WWidget *widget)
 Remove a child widget from this container.
virtual void clear ()
 Remove and delete all child widgets.
virtual int indexOf (WWidget *widget) const
 Return the index of a widget.
virtual WWidgetwidget (int index) const
 Return the widget at index.
virtual int count () const
 Get the number of widgets in this container.
void setContentAlignment (HorizontalAlignment contentAlignment)
 Specify how child widgets must be aligned within the container.
void setPadding (WLength padding, int sides=All)
 Set padding inside the widget.
WLength padding (Side side) const
 Get the padding set for the widget.
HorizontalAlignment contentAlignment () const
 Get the horizontal alignment of children.
virtual const
std::vector< WWidget * > & 
children () const
 Get the children.
void setOverflow (Overflow overflow, int orientation=Horizontal|Vertical)
 Set how overflow of contained children must be handled.
void setList (bool list, bool ordered=false)
 Render the container as an HTML list.
bool isList () const
 Return if this container is rendered as a List.
bool isUnorderedList () const
 Return if this container is rendered as an Unordered List.
bool isOrderedList () const
 Return if this container is rendered as an Ordered List.


Detailed Description

A widget that holds and manages child widgets.

A WContainerWidget acts as a container for child widgets.

By default, a WContainerWidget is stacked and manages its children within a rectangle. When setting the WContainerWidget inline the container only acts as a conceptual container, offering a common style to its children. Inline children are still layed out inline within the flow of the parent container of this container, as if they were inserted directly into that parent container.

FIXME: We still need to provide a method to specify an inline-block, this is a container that itself has an inline layout, but that manages it children in a block.


Member Enumeration Documentation

enum Wt::WContainerWidget::Overflow

How to handle overflow of inner content.

Enumerator:
OverflowVisible  Show content that overflows.
OverflowAuto  Show scrollbars when needed.
OverflowHidden  Hide content that overflows.
OverflowScroll  Always show scroll bars.


Member Function Documentation

void Wt::WContainerWidget::addWidget ( WWidget widget  )  [virtual]

Add a child widget to this container.

This is equivalent to passing this container as the parent when constructing the child. The widget is appended to the list of children, and thus also layed-out at the end.

Reimplemented in Wt::WStackedWidget, and Wt::Ext::Splitter.

void Wt::WContainerWidget::insertBefore ( WWidget widget,
WWidget before 
) [virtual]

insert a child widget in this container, before another widget.

The widget is inserted at the place of the before widget, and subsequent widgets are shifted.

See also:
insertWidget(int index, WWidget *widget);

Reimplemented in Wt::Ext::Splitter.

void Wt::WContainerWidget::insertWidget ( int  index,
WWidget widget 
) [virtual]

insert a child widget in this container at given index.

The widget is inserted at the given index, and subsequent widgets are shifted.

See also:
insertBefore(WWidget *widget, WWidget *before);

Reimplemented in Wt::WStackedWidget, and Wt::Ext::Splitter.

void Wt::WContainerWidget::removeWidget ( WWidget widget  )  [virtual]

Remove a child widget from this container.

This removes the widget from this container, but does not delete the widget !

Reimplemented in Wt::WStackedWidget.

void Wt::WContainerWidget::clear (  )  [virtual]

Remove and delete all child widgets.

This deletes all children that have been added to this container.

void Wt::WContainerWidget::setContentAlignment ( HorizontalAlignment  contentAlignment  ) 

Specify how child widgets must be aligned within the container.

Specify the horizontal alignment of child widgets. Note that there is no way to specify vertical alignment: children are always pushed to the top of the container. Only in a WTableCell, there is a method to align the children vertically.

void Wt::WContainerWidget::setPadding ( WLength  padding,
int  sides = All 
)

Set padding inside the widget.

Setting padding has the effect of adding distance between the widget children and the border.

WLength Wt::WContainerWidget::padding ( Side  side  )  const

Get the padding set for the widget.

See also:
setPadding(WLength padding, Side sides);

HorizontalAlignment Wt::WContainerWidget::contentAlignment (  )  const [inline]

Get the horizontal alignment of children.

See also:
setContentAlignment(HorizontalAlignment)

Reimplemented in Wt::WTableCell.

void Wt::WContainerWidget::setOverflow ( Overflow  overflow,
int  orientation = Horizontal | Vertical 
)

Set how overflow of contained children must be handled.

This is an alternative (CSS-ish) way to provide scroll bars on a container widget, compared to wrapping inside a WScrollArea.

Note that currently, you cannot separately specify vertical and horizontal scroll behaviour, since this is not supported on Opera. Therefore, settings will apply automatically to both orientations.

See also:
WScrollArea

void Wt::WContainerWidget::setList ( bool  list,
bool  ordered = false 
)

Render the container as an HTML list.

Setting renderList to true will cause the container to be using an HTML <UL> or <OL> type, depending on the value of orderedList. This must be set before the initial render of the container. When set, any contained WContainerWidget will be rendered as an HTML <LI>. Adding non-WContainerWidget children results in unspecified behaviour.

Note that CSS default layout rules for <UL> and <OL> add margin and padding to the container, which may look odd if you do not use bullets.

By default, a container is rendered using a <DIV> element.

See also:
isList(), isOrderedList(), isUnorderedList()

bool Wt::WContainerWidget::isList (  )  const

Return if this container is rendered as a List.

See also:
setList(), isOrderedList(), isUnorderedList()

bool Wt::WContainerWidget::isUnorderedList (  )  const

Return if this container is rendered as an Unordered List.

See also:
setList(), isList(), isOrderedList()

bool Wt::WContainerWidget::isOrderedList (  )  const

Return if this container is rendered as an Ordered List.

See also:
setList(), isList(), isUnrderedList()


The documentation for this class was generated from the following files:
Generated on Mon Apr 14 15:15:01 2008 for Wt by doxygen 1.5.3