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
* Copyright (C) 2019-2021 Andrei Karas
6
*
7
* This file is part of The ManaPlus Client.
8
*
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
*/
22
23
#include "
gui/widgets/horizontcontainer.h
"
24
25
#include "
debug.h
"
26
27
HorizontContainer::HorizontContainer
(
const
Widget2
*
const
widget,
28
const
int
height,
29
const
int
spacing) :
30
Container
(widget),
31
WidgetListener
(),
32
ToolTipListener
(),
33
mSpacing(spacing),
34
mCount(0),
35
mLastX(spacing)
36
{
37
setHeight
(height);
38
addWidgetListener
(
this
);
39
addMouseListener
(
this
);
40
}
41
42
void
HorizontContainer::add
(
Widget
*
const
widget)
43
{
44
add
(widget,
mSpacing
);
45
}
46
47
void
HorizontContainer::add
(
Widget
*
const
widget,
const
int
spacing)
48
{
49
if
(widget ==
nullptr
)
50
return
;
51
52
Container::add
(widget);
53
widget->
setPosition
(
mLastX
, spacing);
54
mCount
++;
55
mLastX
+= widget->
getWidth
() + 2 *
mSpacing
;
56
}
57
58
void
HorizontContainer::clear
()
59
{
60
Container::clear
();
61
62
mCount
= 0;
63
}
64
65
void
HorizontContainer::widgetResized
(
const
Event
&event
A_UNUSED
)
66
{
67
}
BasicContainer2::add
virtual void add(Widget *const widget)
Definition:
basiccontainer2.cpp:113
BasicContainer::clear
virtual void clear()
Definition:
basiccontainer.cpp:303
Container
Definition:
container.h:39
Event
Definition:
event.h:79
HorizontContainer::add
void add(Widget *const widget)
Definition:
horizontcontainer.cpp:42
HorizontContainer::mCount
int mCount
Definition:
horizontcontainer.h:59
HorizontContainer::mSpacing
int mSpacing
Definition:
horizontcontainer.h:58
HorizontContainer::mLastX
int mLastX
Definition:
horizontcontainer.h:60
HorizontContainer::HorizontContainer
HorizontContainer(const Widget2 *const widget, const int height, const int spacing)
Definition:
horizontcontainer.cpp:27
HorizontContainer::clear
void clear()
Definition:
horizontcontainer.cpp:58
HorizontContainer::widgetResized
void widgetResized(const Event &event)
Definition:
horizontcontainer.cpp:65
ToolTipListener
Definition:
tooltiplistener.h:32
Widget2
Definition:
widget2.h:37
WidgetListener
Definition:
widgetlistener.h:81
Widget
Definition:
widget.h:99
Widget::addMouseListener
void addMouseListener(MouseListener *const mouseListener)
Definition:
widget.cpp:292
Widget::addWidgetListener
void addWidgetListener(WidgetListener *const widgetListener)
Definition:
widget.cpp:302
Widget::setHeight
void setHeight(const int height)
Definition:
widget.cpp:140
Widget::setPosition
void setPosition(const int x, const int y)
Definition:
widget.cpp:161
Widget::getWidth
int getWidth() const
Definition:
widget.h:221
debug.h
horizontcontainer.h
A_UNUSED
#define A_UNUSED
Definition:
localconsts.h:160
Generated on Wed Mar 17 2021 19:19:06 for ManaPlus by
1.9.1