Wt: Wt::WBorderLayout Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions
Wt::WBorderLayout Class Reference

A layout manager which divides the container region in five regions. More...

`#include <Wt/WBorderLayout>`

Inheritance diagram for Wt::WBorderLayout:
[legend]

List of all members.

## Public Types
enum | Position { North, East, South, West, Center }
| Enumeration of possible positions in the layout. More...
## Public Member Functions
| WBorderLayout (WWidget *parent=0)
| Creates a new border layout.
| ~WBorderLayout ()
| Destructor.
void | setSpacing (int size)
| Sets spacing between each item.
int | spacing () const
| Returns the spacing between each item.
virtual void | addItem (WLayoutItem *item)
| Adds a layout item.
virtual void | removeItem (WLayoutItem *item)
| Removes a layout item (widget or nested layout).
virtual WLayoutItem * | itemAt (int index) const
| Returns the layout item at a specific index.
virtual int | count () const
| Returns the number of items in this layout.
virtual void | clear ()
| Removes and deletes all child widgets and nested layouts.
void | addWidget (WWidget *widget, Position position)
| Adds a widget to the given position.
void | add (WLayoutItem *item, Position position)
| Adds a layout item to the given position.
WWidget * | widgetAt (Position position) const
| Returns the widget at a position.
WLayoutItem * | itemAt (Position position) const
| Returns the item at a position.
Position | position (WLayoutItem *item) const
| Returns the position at which the given layout item is set.

## Detailed Description

A layout manager which divides the container region in five regions.

The five regions are composed of:

         ------------------------------------
         |              North               |
         ------------------------------------
         |      |                    |      |
         | West |       Center       | East |
         |      |                    |      |
         ------------------------------------
         |              South               |
         ------------------------------------

Each region may hold no more than one widget, and for all but the Center region, the widget is optional.

The North, West, East, and South widgets will take their preferred sizes, while the Center widget takes all available remaining space.

Usage example:

     Wt::WContainerWidget *w = new Wt::WContainerWidget(this);
     Wt::WBorderLayout *layout = new Wt::WBorderLayout();
     layout->addWidget(new Wt::WText("West-side is best"), Wt::West);
     layout->addWidget(new Wt::WText("East-side is best"), Wt::East);
     layout->addWidget(contents, Wt::Center);

     // use layout but do not justify vertically
     w->setLayout(layout, Wt::AlignTop | Wt::AlignJustify);

## Member Enumeration Documentation

enum Wt::WBorderLayout::Position

Enumeration of possible positions in the layout.

Enumerator:

  North | North (top)
  East | East (right)
  South | South (bottom)
  West | West (left)
  Center | Center.

## Member Function Documentation

void Wt::WBorderLayout::add | ( | WLayoutItem * | item,
|  | Position | position
| ) |  |

Adds a layout item to the given position.

Only one widget per position is supported.

void Wt::WBorderLayout::addItem | ( | WLayoutItem * | item | ) | `[virtual]`

Adds a layout item.

The item may be a widget or nested layout.

How the item is layed out with respect to siblings is implementation specific to the layout manager. In some cases, a layout manager will overload this method with extra arguments that specify layout options.

See also:
  removeItem(WLayoutItem *), addWidget(WWidget *)

Implements Wt::WLayout.

void Wt::WBorderLayout::addWidget | ( | WWidget * | widget,
|  | Position | position
| ) |  |

Adds a widget to the given position.

Only one widget per position is supported.

See also:
  add(WLayoutItem *, Position)

void Wt::WBorderLayout::clear | ( |  | ) | `[virtual]`

Removes and deletes all child widgets and nested layouts.

This is similar to WContainerWidget::clear(), with the exception that the layout itself is not deleted.

Implements Wt::WLayout.

int Wt::WBorderLayout::count | ( |  | ) | const`[virtual]`

Returns the number of items in this layout.

This may be a theoretical number, which is greater than the actual number of items. It can be used to iterate over the items in the layout, in conjunction with itemAt().

Implements Wt::WLayout.

WLayoutItem * Wt::WBorderLayout::itemAt | ( | int | index | ) | const`[virtual]`

Returns the layout item at a specific index.

If there is no item at the `index`, `0` is returned.

See also:
  indexOf(WLayoutItem *) const, count()

Implements Wt::WLayout.

WLayoutItem * Wt::WBorderLayout::itemAt | ( | Position | position | ) | const

Returns the item at a position.

Returns `0` if no item was set for that position.

void Wt::WBorderLayout::removeItem | ( | WLayoutItem * | item | ) | `[virtual]`

Removes a layout item (widget or nested layout).

See also:
  addItem(WLayoutItem *), removeWidget(WWidget *)

Implements Wt::WLayout.

void Wt::WBorderLayout::setSpacing | ( | int | size | ) |

Sets spacing between each item.

The default spacing is 6 pixels.

int Wt::WBorderLayout::spacing | ( |  | ) | const

Returns the spacing between each item.

See also:
  setSpacing()

WWidget * Wt::WBorderLayout::widgetAt | ( | Position | position | ) | const

Returns the widget at a position.

Returns `0` if no widget was set for that position.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator