ManaPlus
|
#include <layoutarray.h>
Public Member Functions | |
LayoutArray () | |
~LayoutArray () | |
LayoutCell & | at (const int x, const int y, const int w, const int h) |
LayoutCell & | place (Widget *const widget, const int x, const int y, const int w, const int h) |
void | setColWidth (const int n, const int w) |
void | setRowHeight (const int n, const int h) |
void | matchColWidth (const int n1, const int n2) |
void | extend (const int x, const int y, const int w, const int h) |
void | reflow (const int nX, const int nY, const int nW, const int nH) |
Private Member Functions | |
LayoutArray (LayoutArray const &) | |
LayoutArray & | operator= (LayoutArray const &) |
void | align (int &pos, int &size, const int dim, LayoutCell const &cell, const int *const sizes, const int sizeCount) const |
void | resizeGrid (int w, const int h) |
std::vector< int > | getSizes (const int dim, int upp) const |
int | getSize (const int dim) const |
Private Attributes | |
std::vector< int > | mSizes [2] |
std::vector< std::vector< LayoutCell * > > | mCells |
int | mSpacing |
Friends | |
class | LayoutCell |
This class contains a rectangular array of cells.
Definition at line 37 of file layoutarray.h.
LayoutArray::LayoutArray | ( | ) |
Definition at line 35 of file layoutarray.cpp.
LayoutArray::~LayoutArray | ( | ) |
|
explicitprivate |
|
private |
Gets the position and size of a widget along a given axis
Definition at line 161 of file layoutarray.cpp.
References LayoutCell::CENTER, LayoutCell::FILL, LayoutCell::LEFT, Logger::log1(), logger, mSpacing, LayoutCell::RIGHT, and EmoteDB::size().
Referenced by reflow().
LayoutCell & LayoutArray::at | ( | const int | x, |
const int | y, | ||
const int | w, | ||
const int | h | ||
) |
Returns a reference on the cell at given position.
Definition at line 60 of file layoutarray.cpp.
References CAST_SIZE, LayoutCell, mCells, resizeGrid(), x, and y.
Referenced by LayoutCell::at(), extend(), and place().
void LayoutArray::extend | ( | const int | x, |
const int | y, | ||
const int | w, | ||
const int | h | ||
) |
Spawns a cell over several columns/rows.
Definition at line 122 of file layoutarray.cpp.
References at(), LayoutCell::mExtent, x, and y.
Referenced by LayoutCell::extend().
|
private |
Gets the total size along a given axis.
Definition at line 268 of file layoutarray.cpp.
References CAST_S32, CAST_SIZE, LayoutType::DEF, getSizes(), mSpacing, and EmoteDB::size().
Referenced by LayoutCell::computeSizes().
|
private |
Gets the column/row sizes along a given axis.
upp | target size for the array. Ignored if AUTO_DEF. |
Definition at line 196 of file layoutarray.cpp.
References CAST_S32, CAST_SIZE, LayoutType::DEF, mCells, LayoutCell::mExtent, LayoutCell::mSize, mSizes, mSpacing, LayoutCell::mType, LayoutCell::mVPadding, LayoutCell::NONE, LayoutType::SET, and EmoteDB::size().
Referenced by getSize(), matchColWidth(), and reflow().
void LayoutArray::matchColWidth | ( | const int | n1, |
const int | n2 | ||
) |
Sets the widths of two columns to the maximum of their widths.
Definition at line 112 of file layoutarray.cpp.
References CAST_SIZE, LayoutType::DEF, getSizes(), mSizes, and resizeGrid().
Referenced by LayoutCell::matchColWidth().
|
private |
LayoutCell & LayoutArray::place | ( | Widget *const | widget, |
const int | x, | ||
const int | y, | ||
const int | w, | ||
const int | h | ||
) |
Places a widget in a given cell.
w | number of columns the widget spawns. |
h | number of rows the widget spawns. |
Definition at line 129 of file layoutarray.cpp.
References at(), CAST_SIZE, LayoutType::DEF, LayoutCell::FILL, Widget::getHeight(), Widget::getWidth(), LayoutCell::mAlign, LayoutCell::mExtent, LayoutCell::mHPadding, LayoutCell::mSize, mSizes, LayoutCell::mType, LayoutCell::mVPadding, LayoutCell::mWidget, LayoutCell::NONE, LayoutCell::WIDGET, x, and y.
Referenced by LayoutCell::place().
void LayoutArray::reflow | ( | const int | nX, |
const int | nY, | ||
const int | nW, | ||
const int | nH | ||
) |
Computes and sets the positions of all the widgets.
nW | width of the array, used to resize the AUTO_ columns. |
nH | height of the array, used to resize the AUTO_ rows. |
Definition at line 282 of file layoutarray.cpp.
References align(), CAST_S32, CAST_SIZE, getSizes(), mCells, mSizes, mSpacing, LayoutCell::mType, LayoutCell::NONE, LayoutCell::reflow(), EmoteDB::size(), x, and y.
Referenced by LayoutCell::reflow().
|
private |
Ensures the private vectors are large enough.
Definition at line 70 of file layoutarray.cpp.
References CAST_S32, CAST_SIZE, LayoutType::DEF, mCells, mSizes, and EmoteDB::size().
Referenced by at(), matchColWidth(), setColWidth(), and setRowHeight().
void LayoutArray::setColWidth | ( | const int | n, |
const int | w | ||
) |
Sets the minimum width of a column.
Definition at line 100 of file layoutarray.cpp.
References CAST_SIZE, mSizes, and resizeGrid().
Referenced by LayoutCell::setColWidth().
void LayoutArray::setRowHeight | ( | const int | n, |
const int | h | ||
) |
Sets the minimum height of a row.
Definition at line 106 of file layoutarray.cpp.
References CAST_SIZE, mSizes, and resizeGrid().
Referenced by LayoutCell::setRowHeight().
|
friend |
Definition at line 39 of file layoutarray.h.
Referenced by at().
|
private |
Definition at line 128 of file layoutarray.h.
Referenced by at(), LayoutCell::computeSizes(), getSizes(), reflow(), resizeGrid(), and ~LayoutArray().
|
private |
Definition at line 127 of file layoutarray.h.
Referenced by getSizes(), matchColWidth(), place(), reflow(), resizeGrid(), setColWidth(), and setRowHeight().
|
private |
Definition at line 130 of file layoutarray.h.
Referenced by align(), getSize(), getSizes(), and reflow().