Public Member Functions | Private Attributes
ContainerPlacer Class Reference

#include <containerplacer.h>

Public Member Functions

 ContainerPlacer (BasicContainer2 *const c, LayoutCell *const lc)
LayoutCellgetCell ()
ContainerPlacer at (const int x, const int y)
LayoutCelloperator() (const int x, const int y, Widget *const wg, const int w, const int h)

Private Attributes


Detailed Description

This class is a helper for adding widgets to nested tables in a window.

Definition at line 35 of file containerplacer.h.

Constructor & Destructor Documentation

◆ ContainerPlacer()

ContainerPlacer::ContainerPlacer ( BasicContainer2 *const  c,
LayoutCell *const  lc 

Definition at line 38 of file containerplacer.h.

References A_DEFAULT_COPY.

Referenced by at().

39  :
40  mContainer(c),
41  mCell(lc)
42  {}
LayoutCell * mCell
BasicContainer2 * mContainer

Member Function Documentation

◆ at()

ContainerPlacer ContainerPlacer::at ( const int  x,
const int  y 

Returns a placer for the same container but to an inner cell.

Definition at line 30 of file containerplacer.cpp.

References LayoutCell::at(), ContainerPlacer(), mCell, and mContainer.

Referenced by getCell().

31 {
33  mCell != nullptr ? &mCell->at(x, y) : nullptr);
34 }
LayoutCell * mCell
ContainerPlacer(BasicContainer2 *const c, LayoutCell *const lc)
LayoutCell & at(const int x, const int y)
Definition: layoutcell.cpp:105
BasicContainer2 * mContainer

◆ getCell()

LayoutCell& ContainerPlacer::getCell ( )

Gets the pointed cell.

Definition at line 49 of file containerplacer.h.

References A_WARN_UNUSED, at(), mCell, operator()(), x, and y.

Referenced by InfoClanTab::InfoClanTab(), MapDebugTab::MapDebugTab(), NetDebugTab::NetDebugTab(), and TargetDebugTab::TargetDebugTab().

50  { return *mCell; }
LayoutCell * mCell

◆ operator()()

LayoutCell & ContainerPlacer::operator() ( const int  x,
const int  y,
Widget *const  wg,
const int  w,
const int  h 

Adds the given widget to the container and places it in the layout.

See also

Definition at line 37 of file containerplacer.cpp.

References BasicContainer2::add(), LayoutCell::emptyCell, mCell, mContainer, LayoutCell::place(), x, and y.

Referenced by getCell().

38 {
39  if (mContainer != nullptr)
40  mContainer->add(wg);
41  if (mCell != nullptr)
42  return mCell->place(wg, x, y, w, h);
43  return LayoutCell::emptyCell;
44 }
LayoutCell * mCell
static LayoutCell emptyCell
Definition: layoutcell.h:155
virtual void add(Widget *const widget)
BasicContainer2 * mContainer
LayoutCell & place(Widget *const wg, const int x, const int y, const int w, const int h)
Definition: layoutcell.cpp:110

Field Documentation

◆ mCell

LayoutCell* ContainerPlacer::mCell

Definition at line 70 of file containerplacer.h.

Referenced by at(), getCell(), and operator()().

◆ mContainer

BasicContainer2* ContainerPlacer::mContainer

Definition at line 69 of file containerplacer.h.

Referenced by at(), and operator()().

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