Mana
Loading...
Searching...
No Matches
layouthelper.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include "gui/widgets/layout.h"
25
26#include <guichan/widgetlistener.hpp>
27
33class LayoutHelper : public gcn::WidgetListener
34{
35 public:
36 explicit LayoutHelper(gcn::Container *container);
37
38 ~LayoutHelper() override;
39
43 Layout &getLayout() { return mLayout; }
44
55 void reflowLayout(int w = 0, int h = 0);
56
60 LayoutCell &place(int x, int y, gcn::Widget *, int w = 1, int h = 1);
61
65 ContainerPlacer getPlacer(int x, int y);
66
70 void widgetResized(const gcn::Event &event) override;
71
72 private:
74 gcn::Container *mContainer;
75};
This class is a helper for adding widgets to nested tables in a window.
Definition layout.h:34
This class describes the formatting of a widget in the cell of a layout table.
Definition layout.h:159
A helper class for adding a layout to a Guichan container widget.
LayoutCell & place(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.
Layout & getLayout()
Gets the layout handler.
void reflowLayout(int w=0, int h=0)
Computes the position of the widgets according to the current layout.
gcn::Container * mContainer
Managed container.
~LayoutHelper() override
Layout mLayout
Layout handler.
void widgetResized(const gcn::Event &event) override
Called whenever the managed container changes size.
This class is an helper for setting the position of widgets.
Definition layout.h:281