Wt  3.7.1
Public Types | Public Member Functions | List of all members
Wt::WBorderLayout Class Reference

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

#include <Wt/WBorderLayout>

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

Public Types

enum  Position {
  North, East, South, West,
  Center
}
 Enumeration of possible positions in the layout. More...
 
- Public Types inherited from Wt::WObject
typedef void(WObject::* Method) ()
 Typedef for a WObject method without arguments.
 

Public Member Functions

 WBorderLayout (WWidget *parent=0)
 Creates a new border layout.
 
 ~WBorderLayout ()
 Destructor.
 
void setSpacing (int size)
 Sets spacing between each item. More...
 
int spacing () const
 Returns the spacing between each item. More...
 
virtual void addItem (WLayoutItem *item)
 Adds a layout item. More...
 
virtual void removeItem (WLayoutItem *item)
 Removes a layout item (widget or nested layout). More...
 
virtual WLayoutItemitemAt (int index) const
 Returns the layout item at a specific index. More...
 
virtual int count () const
 Returns the number of items in this layout. More...
 
virtual void clear ()
 Removes and deletes all child widgets and nested layouts. More...
 
void addWidget (WWidget *widget, Position position)
 Adds a widget to the given position. More...
 
void add (WLayoutItem *item, Position position)
 Adds a layout item to the given position. More...
 
WWidgetwidgetAt (Position position) const
 Returns the widget at a position. More...
 
WLayoutItemitemAt (Position position) const
 Returns the item at a position. More...
 
Position position (WLayoutItem *item) const
 Returns the position at which the given layout item is set.
 
- Public Member Functions inherited from Wt::WLayout
virtual ~WLayout ()
 Destructor. More...
 
void addWidget (WWidget *widget)
 Adds the given widget to the layout. More...
 
bool removeWidget (WWidget *widget)
 Removes the given widget from the layout. More...
 
virtual int indexOf (WLayoutItem *item) const
 Returns the index of a given item. More...
 
virtual WWidgetItemfindWidgetItem (WWidget *widget)
 Finds the widget item associated with the given widget.
 
void setLayoutHint (const std::string &name, const std::string &value)
 Provides a hint to the layout implementation. More...
 
virtual WWidgetwidget ()
 Returns the widget that is held by this WLayoutItem. More...
 
virtual WLayoutlayout ()
 Returns the layout that implements this WLayoutItem. More...
 
virtual WLayoutparentLayout () const
 Returns the layout in which this item is contained.
 
WLayoutItemImplimpl () const
 Returns the implementation for this layout item. More...
 
void setContentsMargins (int left, int top, int right, int bottom)
 Set contents margins (in pixels). More...
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 Returns the contents margins. More...
 
- Public Member Functions inherited from Wt::WLayoutItem
virtual ~WLayoutItem ()
 Destructor.
 
- Public Member Functions inherited from Wt::WObject
 WObject (WObject *parent=0)
 Create a WObject with a given parent object. More...
 
virtual ~WObject ()
 Destructor. More...
 
virtual const std::string id () const
 Returns the (unique) identifier for this object. More...
 
virtual void setObjectName (const std::string &name)
 Sets an object name. More...
 
virtual std::string objectName () const
 Returns the object name. More...
 
void resetLearnedSlots ()
 Resets learned stateless slot implementations. More...
 
template<class T >
void resetLearnedSlot (void(T::*method)())
 Resets a learned stateless slot implementation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)())
 Declares a slot to be stateless and learn client-side behaviour on first invocation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
 Declares a slot to be stateless and learn client-side behaviour in advance. More...
 
void isNotStateless ()
 Marks the current function as not stateless. More...
 
template<class T >
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
 Provides a JavaScript implementation for a method. More...
 
void addChild (WObject *child)
 Adds a child object. More...
 
virtual void removeChild (WObject *child)
 Removes a child object. More...
 
const std::vector< WObject * > & children () const
 Returns the children.
 
WObjectparent () const
 Returns the parent object.
 

Additional Inherited Members

- Protected Member Functions inherited from Wt::WLayout
 WLayout ()
 Create a layout.
 
void update (WLayoutItem *item=0)
 Update the layout. More...
 
void updateAddItem (WLayoutItem *item)
 Update the layout, adding the given layout item. More...
 
void updateRemoveItem (WLayoutItem *item)
 Update the layout, remove the given layout item. More...
 
void setLayoutInParent (WWidget *parent)
 Set the layout in the parent. More...
 
void clearLayoutItem (WLayoutItem *item)
 Clears and deletes an item. More...
 
- Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * getStateless (Method method)
 On-demand stateless slot implementation. More...
 
- Static Protected Member Functions inherited from Wt::WObject
static WObjectsender ()
 Returns the sender of the current slot call. More...
 

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:

layout->addWidget(new Wt::WText("West-side is best"), Wt::WBorderLayout::West);
layout->addWidget(new Wt::WText("East-side is best"), Wt::WBorderLayout::East);
// use layout but do not justify vertically

Member Enumeration Documentation

◆ 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

◆ add()

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

Adds a layout item to the given position.

Only one widget per position is supported.

◆ addItem()

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.

◆ addWidget()

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)

◆ clear()

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.

◆ count()

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.

◆ itemAt() [1/2]

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.

◆ itemAt() [2/2]

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

Returns the item at a position.

Returns 0 if no item was set for that position.

◆ removeItem()

void Wt::WBorderLayout::removeItem ( WLayoutItem item)
virtual

Removes a layout item (widget or nested layout).

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

Implements Wt::WLayout.

◆ setSpacing()

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

Sets spacing between each item.

The default spacing is 6 pixels.

◆ spacing()

int Wt::WBorderLayout::spacing ( ) const

Returns the spacing between each item.

See also
setSpacing()

◆ widgetAt()

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

Returns the widget at a position.

Returns 0 if no widget was set for that position.


Generated on Tue Dec 15 2020 for the C++ Web Toolkit (Wt) by doxygen 1.8.13