ManaPlus
|
#include <layouthelper.h>
Public Member Functions | |
LayoutHelper (BasicContainer2 *const container) | |
~LayoutHelper () | |
const Layout & | getLayout () const A_CONST |
void | reflowLayout (int w, int h) |
LayoutCell & | place (const int x, const int y, Widget *const wg, const int w, const int h) |
ContainerPlacer | getPlacer (const int x, const int y) |
void | widgetResized (const Event &event) |
Public Member Functions inherited from WidgetListener | |
virtual | ~WidgetListener () |
virtual void | widgetMoved (const Event &event) |
virtual void | widgetHidden (const Event &event) |
virtual void | widgetShown (const Event &event) |
Private Attributes | |
Layout | mLayout |
BasicContainer2 * | mContainer |
Additional Inherited Members | |
Protected Member Functions inherited from WidgetListener | |
WidgetListener () | |
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 39 of file layouthelper.h.
|
explicit |
Constructor.
Definition at line 31 of file layouthelper.cpp.
References Widget::addWidgetListener(), and mContainer.
LayoutHelper::~LayoutHelper | ( | ) |
Destructor.
Definition at line 40 of file layouthelper.cpp.
References mContainer, and Widget::removeWidgetListener().
const Layout & LayoutHelper::getLayout | ( | ) | const |
Gets the layout handler.
Definition at line 46 of file layouthelper.cpp.
References mLayout.
Referenced by StatsClanTab::updateClan(), and RelationClanTab::updateClan().
ContainerPlacer LayoutHelper::getPlacer | ( | const int | x, |
const int | y | ||
) |
Returns a proxy for adding widgets in an inner table of the layout.
Definition at line 60 of file layouthelper.cpp.
References LayoutCell::at(), mContainer, mLayout, x, and y.
Referenced by ChangeDisplay::ChangeDisplay(), CharacterDisplay::CharacterDisplay(), DerDisplay::DerDisplay(), InfoClanTab::InfoClanTab(), MapDebugTab::MapDebugTab(), NetDebugTab::NetDebugTab(), Setup_Audio::Setup_Audio(), Setup_Chat::Setup_Chat(), Setup_Colors::Setup_Colors(), Setup_Input::Setup_Input(), Setup_Joystick::Setup_Joystick(), Setup_Misc::Setup_Misc(), Setup_Mods::Setup_Mods(), Setup_Perfomance::Setup_Perfomance(), Setup_Players::Setup_Players(), Setup_Quick::Setup_Quick(), Setup_Relations::Setup_Relations(), Setup_Theme::Setup_Theme(), Setup_Touch::Setup_Touch(), Setup_Video::Setup_Video(), Setup_Visual::Setup_Visual(), StatDebugTab::StatDebugTab(), and TargetDebugTab::TargetDebugTab().
LayoutCell & LayoutHelper::place | ( | const int | x, |
const int | y, | ||
Widget *const | wg, | ||
const int | w, | ||
const int | h | ||
) |
Adds a widget to the container and sets it at given cell.
Definition at line 51 of file layouthelper.cpp.
References BasicContainer2::add(), mContainer, mLayout, LayoutCell::place(), x, and y.
void LayoutHelper::reflowLayout | ( | int | w, |
int | h | ||
) |
Computes the position of the widgets according to the current layout. Resizes the managed container so that the layout fits.
w | if non-zero, force the container to this width. |
h | if non-zero, force the container to this height. |
Definition at line 65 of file layouthelper.cpp.
References mContainer, mLayout, Layout::reflow(), and Widget::setSize().
|
virtual |
Called whenever the managed container changes size.
Reimplemented from WidgetListener.
Definition at line 72 of file layouthelper.cpp.
References BasicContainer::getChildrenArea(), Rect::height, mContainer, mLayout, Layout::reflow(), and Rect::width.
|
private |
Managed container
Definition at line 93 of file layouthelper.h.
Referenced by getPlacer(), LayoutHelper(), place(), reflowLayout(), widgetResized(), and ~LayoutHelper().
|
private |
Layout handler
Definition at line 92 of file layouthelper.h.
Referenced by getLayout(), getPlacer(), place(), reflowLayout(), and widgetResized().