#include <Wt/Ext/Container>
Public Member Functions | |
Container (WContainerWidget *parent=0) | |
Create a new container. | |
virtual | ~Container () |
Destroy the container. | |
void | setLayout (WLayout *layout) |
Set a layout manager for the container. | |
WLayout * | layout () |
Get the layout manager that was set for the container. |
The Container is the Ext equivalent of WContainerWidget, and manages other widgets. Unlike WContainerWidget, Container uses layout managers to manage its content.
Typically, panels will be added directly into a layout, and are components to organize your user interface. You may also add a container inside a plain WContainerWidget, but then you should set a size for the container (using WWidget::resize()), in pixels.
In most cases, using a Panel is more convenient than a Container, since a Panel also manages standard GUI components (such as menu/tool bars), and interactive controls (for resizing, for example). There is however one case where you need to use a Container, which is when you wish to use a layout manager to manage the contents of the entire view port. In that case, you should use a Container to represent the view port, by adding the Container as only child directly to the application's WApplication::root() container.
For example, the following creates a top borderlayout that spans the entire viewport:
Wt::Ext::Container *rootContainer = new Wt::Ext::Container(app->root()); Wt::WBorderLayout *topLayout = new Wt::WBorderLayout() rootContainer->setLayout(topLayout);
Wt::Ext::Container::Container | ( | WContainerWidget * | parent = 0 |
) |
Create a new container.
When a parent is specified, or the container is after construction added to a WContainerWidget, the container should be given an explicit size in pixels, using WWidget::resize().
void Wt::Ext::Container::setLayout | ( | WLayout * | layout | ) | [virtual] |
Set a layout manager for the container.
Only a single layout manager may be set. Note that you can nest layout managers inside each other, to create a complex layout hierarchy.
Reimplemented from Wt::WWidget.
WLayout * Wt::Ext::Container::layout | ( | ) |
Get the layout manager that was set for the container.
If no layout manager was previously set using setLayout(WLayout *), a default layout manager is created (WDefaultLayout), which does not attempt to size widgets to fit the entire container region.