Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
LayoutArray Class Reference

This class contains a rectangular array of cells. More...

#include <layout.h>

Public Member Functions

 LayoutArray ()
 
 ~LayoutArray ()
 
LayoutCellat (int x, int y, int w=1, int h=1)
 Returns a reference on the cell at given position.
 
LayoutCellplace (gcn::Widget *, int x, int y, int w=1, int h=1)
 Places a widget in a given cell.
 
void setColWidth (int n, int w)
 Sets the minimum width of a column.
 
void setRowHeight (int n, int h)
 Sets the minimum height of a row.
 
void matchColWidth (int n1, int n2)
 Sets the widths of two columns to the maximum of their widths.
 
void extend (int x, int y, int w, int h)
 Spawns a cell over several columns/rows.
 
void reflow (int nX, int nY, int nW, int nH)
 Computes and sets the positions of all the widgets.
 

Private Member Functions

 LayoutArray (LayoutArray const &)
 
LayoutArrayoperator= (LayoutArray const &)
 
void align (int &pos, int &size, int dim, LayoutCell const &cell, const short *sizes) const
 Gets the position and size of a widget along a given axis.
 
void resizeGrid (int w, int h)
 Ensures the private vectors are large enough.
 
std::vector< short > getSizes (int dim, int upp) const
 Gets the column/row sizes along a given axis.
 
int getSize (int dim) const
 Gets the total size along a given axis.
 

Private Attributes

std::vector< short > mSizes [2]
 
std::vector< std::vector< LayoutCell * > > mCells
 
char mSpacing
 

Friends

class LayoutCell
 

Detailed Description

This class contains a rectangular array of cells.

Definition at line 66 of file layout.h.

Constructor & Destructor Documentation

◆ LayoutArray() [1/2]

LayoutArray::LayoutArray ( )

Definition at line 89 of file layout.cpp.

◆ ~LayoutArray()

LayoutArray::~LayoutArray ( )

Definition at line 93 of file layout.cpp.

◆ LayoutArray() [2/2]

LayoutArray::LayoutArray ( LayoutArray const &  )
private

Member Function Documentation

◆ align()

void LayoutArray::align ( int &  pos,
int &  size,
int  dim,
LayoutCell const &  cell,
const short *  sizes 
) const
private

Gets the position and size of a widget along a given axis.

Definition at line 190 of file layout.cpp.

◆ at()

LayoutCell & LayoutArray::at ( int  x,
int  y,
int  w = 1,
int  h = 1 
)

Returns a reference on the cell at given position.

Definition at line 104 of file layout.cpp.

◆ extend()

void LayoutArray::extend ( int  x,
int  y,
int  w,
int  h 
)

Spawns a cell over several columns/rows.

Definition at line 161 of file layout.cpp.

◆ getSize()

int LayoutArray::getSize ( int  dim) const
private

Gets the total size along a given axis.

Definition at line 274 of file layout.cpp.

◆ getSizes()

std::vector< short > LayoutArray::getSizes ( int  dim,
int  upp 
) const
private

Gets the column/row sizes along a given axis.

Parameters
upptarget size for the array. Ignored if AUTO_DEF.

Definition at line 214 of file layout.cpp.

◆ matchColWidth()

void LayoutArray::matchColWidth ( int  n1,
int  n2 
)

Sets the widths of two columns to the maximum of their widths.

Definition at line 152 of file layout.cpp.

◆ operator=()

LayoutArray & LayoutArray::operator= ( LayoutArray const &  )
private

◆ place()

LayoutCell & LayoutArray::place ( gcn::Widget *  widget,
int  x,
int  y,
int  w = 1,
int  h = 1 
)

Places a widget in a given cell.

Parameters
wnumber of columns the widget spawns.
hnumber of rows the widget spawns.
Note
When w is 1, the width of column x is reset to zero if it was AUTO_DEF. Similarly for h.

Definition at line 168 of file layout.cpp.

◆ reflow()

void LayoutArray::reflow ( int  nX,
int  nY,
int  nW,
int  nH 
)

Computes and sets the positions of all the widgets.

Parameters
nWwidth of the array, used to resize the AUTO_ columns.
nHheight of the array, used to resize the AUTO_ rows.

Definition at line 287 of file layout.cpp.

◆ resizeGrid()

void LayoutArray::resizeGrid ( int  w,
int  h 
)
private

Ensures the private vectors are large enough.

Definition at line 115 of file layout.cpp.

◆ setColWidth()

void LayoutArray::setColWidth ( int  n,
int  w 
)

Sets the minimum width of a column.

Definition at line 140 of file layout.cpp.

◆ setRowHeight()

void LayoutArray::setRowHeight ( int  n,
int  h 
)

Sets the minimum height of a row.

Definition at line 146 of file layout.cpp.

Friends And Related Symbol Documentation

◆ LayoutCell

friend class LayoutCell
friend

Definition at line 68 of file layout.h.

Member Data Documentation

◆ mCells

std::vector< std::vector < LayoutCell * > > LayoutArray::mCells
private

Definition at line 146 of file layout.h.

◆ mSizes

std::vector< short > LayoutArray::mSizes[2]
private

Definition at line 145 of file layout.h.

◆ mSpacing

char LayoutArray::mSpacing
private

Definition at line 148 of file layout.h.


The documentation for this class was generated from the following files: