/usr/include/Wt/WBorderLayout is in libwt-dev 3.3.4+dfsg-6ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WBORDER_LAYOUT_H_
#define WBORDER_LAYOUT_H_
#include <Wt/WGridLayout>
namespace Wt {
/*! \class WBorderLayout Wt/WBorderLayout Wt/WBorderLayout
* \brief A layout manager which divides the container region in five regions.
*
* The five regions are composed of:
* <pre>
------------------------------------
| North |
------------------------------------
| | | |
| West | Center | East |
| | | |
------------------------------------
| South |
------------------------------------
* </pre>
*
* 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.
*
* \if cpp
* Usage example:
* \code
* Wt::WContainerWidget *w = new Wt::WContainerWidget(this);
* Wt::WBorderLayout *layout = new Wt::WBorderLayout();
* layout->addWidget(new Wt::WText("West-side is best"), Wt::WBorderLayout::West);
* layout->addWidget(new Wt::WText("East-side is best"), Wt::WBorderLayout::East);
* layout->addWidget(contents, Wt::WBorderLayout::Center);
*
* // use layout but do not justify vertically
* w->setLayout(layout, Wt::AlignTop | Wt::AlignJustify);
* \endcode
* \endif
*/
class WT_API WBorderLayout : public WLayout
{
public:
/*! \brief Enumeration of possible positions in the layout.
*/
enum Position {
North, //!< North (top)
East, //!< East (right)
South, //!< South (bottom)
West, //!< West (left)
Center //!< Center
};
/*! \brief Creates a new border layout.
*/
WBorderLayout(WWidget *parent = 0);
/*! \brief Destructor.
*/
~WBorderLayout();
/*! \brief Sets spacing between each item.
*
* The default spacing is 6 pixels.
*/
void setSpacing(int size);
/*! \brief Returns the spacing between each item.
*
* \sa setSpacing()
*/
int spacing() const { return grid_.horizontalSpacing_; }
virtual void addItem(WLayoutItem *item);
virtual void removeItem(WLayoutItem *item);
virtual WLayoutItem *itemAt(int index) const;
virtual int count() const;
virtual void clear();
/*! \brief Adds a widget to the given position.
*
* Only one widget per position is supported.
*
* \sa add(WLayoutItem *, Position)
*/
void addWidget(WWidget *widget, Position position);
/*! \brief Adds a layout item to the given position.
*
* Only one widget per position is supported.
*/
void add(WLayoutItem *item, Position position);
/*! \brief Returns the widget at a position.
*
* Returns \c 0 if no widget was set for that position.
*/
WWidget *widgetAt(Position position) const;
/*! \brief Returns the item at a position.
*
* Returns \c 0 if no item was set for that position.
*/
WLayoutItem *itemAt(Position position) const;
/*! \brief Returns the position at which the given layout item is set.
*/
Position position(WLayoutItem *item) const;
Impl::Grid& grid() { return grid_; }
private:
Impl::Grid grid_;
const Impl::Grid::Item& itemAtPosition(Position position) const;
Impl::Grid::Item& itemAtPosition(Position position);
};
}
#endif // WBORDER_LAYOUT_H_
|