ManaPlus
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

BasicContainer2mContainer
 
LayoutCellmCell
 

Detailed Description

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

Definition at line 36 of file containerplacer.h.

Constructor & Destructor Documentation

◆ ContainerPlacer()

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

Definition at line 39 of file containerplacer.h.

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

Referenced by at().

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 31 of file containerplacer.cpp.

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

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

◆ getCell()

LayoutCell& ContainerPlacer::getCell ( )
inline

Gets the pointed cell.

Definition at line 50 of file containerplacer.h.

51  { return *mCell; }

References mCell.

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

◆ 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
LayoutArray::place

Definition at line 37 of file containerplacer.cpp.

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

References LayoutCell::emptyCell, LayoutCell::place(), x, and y.

Field Documentation

◆ mCell

LayoutCell* ContainerPlacer::mCell
private

Definition at line 71 of file containerplacer.h.

Referenced by at(), and getCell().

◆ mContainer

BasicContainer2* ContainerPlacer::mContainer
private

Definition at line 70 of file containerplacer.h.

Referenced by at().


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