ManaPlus
src
gui
widgets
horizontcontainer.cpp
Go to the documentation of this file.
1
/*
2
* The ManaPlus Client
3
* Copyright (C) 2009-2010 The Mana Developers
4
* Copyright (C) 2011-2019 The ManaPlus Developers
5
*
6
* This file is part of The ManaPlus 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
#include "
gui/widgets/horizontcontainer.h
"
23
24
#include "
debug.h
"
25
26
HorizontContainer::HorizontContainer
(
const
Widget2
*
const
widget,
27
const
int
height,
28
const
int
spacing) :
29
Container
(widget),
30
WidgetListener
(),
31
ToolTipListener
(),
32
mSpacing(spacing),
33
mCount(0),
34
mLastX(spacing)
35
{
36
setHeight
(height);
37
addWidgetListener
(
this
);
38
addMouseListener
(
this
);
39
}
40
41
void
HorizontContainer::add
(
Widget
*
const
widget)
42
{
43
add
(widget,
mSpacing
);
44
}
45
46
void
HorizontContainer::add
(
Widget
*
const
widget,
const
int
spacing)
47
{
48
if
(widget ==
nullptr
)
49
return
;
50
51
Container::add
(widget);
52
widget->
setPosition
(
mLastX
, spacing);
53
mCount
++;
54
mLastX
+= widget->
getWidth
() + 2 *
mSpacing
;
55
}
56
57
void
HorizontContainer::clear
()
58
{
59
Container::clear
();
60
61
mCount
= 0;
62
}
63
64
void
HorizontContainer::widgetResized
(
const
Event
&event
A_UNUSED
)
65
{
66
}
Widget::getWidth
int getWidth() const
Definition:
widget.h:220
Container
Definition:
container.h:37
debug.h
HorizontContainer::clear
void clear()
Definition:
horizontcontainer.cpp:57
HorizontContainer::mCount
int mCount
Definition:
horizontcontainer.h:58
ToolTipListener
Definition:
tooltiplistener.h:30
BasicContainer::clear
virtual void clear()
Definition:
basiccontainer.cpp:302
horizontcontainer.h
BasicContainer2::add
virtual void add(Widget *const widget)
Definition:
basiccontainer2.cpp:112
HorizontContainer::mSpacing
int mSpacing
Definition:
horizontcontainer.h:57
Widget::addMouseListener
void addMouseListener(MouseListener *const mouseListener)
Definition:
widget.cpp:291
Widget::setPosition
void setPosition(const int x, const int y)
Definition:
widget.cpp:160
HorizontContainer::add
void add(Widget *const widget)
Definition:
horizontcontainer.cpp:41
WidgetListener
Definition:
widgetlistener.h:79
Widget::setHeight
void setHeight(const int height)
Definition:
widget.cpp:139
Widget::addWidgetListener
void addWidgetListener(WidgetListener *const widgetListener)
Definition:
widget.cpp:301
Widget2
Definition:
widget2.h:35
A_UNUSED
#define A_UNUSED
Definition:
localconsts.h:159
Widget
Definition:
widget.h:97
Event
Definition:
event.h:77
HorizontContainer::HorizontContainer
HorizontContainer(const Widget2 *const widget, const int height, const int spacing)
Definition:
horizontcontainer.cpp:26
HorizontContainer::widgetResized
void widgetResized(const Event &event)
Definition:
horizontcontainer.cpp:64
HorizontContainer::mLastX
int mLastX
Definition:
horizontcontainer.h:59
Generated on Tue Feb 12 2019 00:16:59 for ManaPlus by
1.8.13