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

A helper class for adding a layout to a Guichan container widget. More...

#include <layouthelper.h>

Inheritance diagram for LayoutHelper:

Public Member Functions

 LayoutHelper (gcn::Container *container)
 
 ~LayoutHelper () override
 
LayoutgetLayout ()
 Gets the layout handler.
 
void reflowLayout (int w=0, int h=0)
 Computes the position of the widgets according to the current layout.
 
LayoutCellplace (int x, int y, gcn::Widget *, int w=1, int h=1)
 Adds a widget to the container and sets it at given cell.
 
ContainerPlacer getPlacer (int x, int y)
 Returns a proxy for adding widgets in an inner table of the layout.
 
void widgetResized (const gcn::Event &event) override
 Called whenever the managed container changes size.
 

Private Attributes

Layout mLayout
 Layout handler.
 
gcn::Container * mContainer
 Managed container.
 

Detailed Description

A helper class for adding a layout to a Guichan container widget.

The layout will register itself as a widget listener and relayout the widgets in the container dynamically on resize.

Definition at line 33 of file layouthelper.h.

Constructor & Destructor Documentation

◆ LayoutHelper()

LayoutHelper::LayoutHelper ( gcn::Container *  container)
explicit

Definition at line 24 of file layouthelper.cpp.

◆ ~LayoutHelper()

LayoutHelper::~LayoutHelper ( )
override

Definition at line 30 of file layouthelper.cpp.

Member Function Documentation

◆ getLayout()

Layout & LayoutHelper::getLayout ( )
inline

Gets the layout handler.

Definition at line 43 of file layouthelper.h.

◆ getPlacer()

ContainerPlacer LayoutHelper::getPlacer ( int  x,
int  y 
)

Returns a proxy for adding widgets in an inner table of the layout.

Definition at line 41 of file layouthelper.cpp.

◆ place()

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

Adds a widget to the container and sets it at given cell.

Definition at line 35 of file layouthelper.cpp.

◆ reflowLayout()

void LayoutHelper::reflowLayout ( int  w = 0,
int  h = 0 
)

Computes the position of the widgets according to the current layout.

Resizes the managed container so that the layout fits.

Note
This function is meant to be called with fixed-size containers.
Parameters
wif non-zero, force the container to this width.
hif non-zero, force the container to this height.

Definition at line 46 of file layouthelper.cpp.

◆ widgetResized()

void LayoutHelper::widgetResized ( const gcn::Event &  event)
override

Called whenever the managed container changes size.

Definition at line 52 of file layouthelper.cpp.

Member Data Documentation

◆ mContainer

gcn::Container* LayoutHelper::mContainer
private

Managed container.

Definition at line 74 of file layouthelper.h.

◆ mLayout

Layout LayoutHelper::mLayout
private

Layout handler.

Definition at line 73 of file layouthelper.h.


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