YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
VerticalLayout.cpp
Go to the documentation of this file.
1
#include "
YAPOG/Graphics/Gui/VerticalLayout.hpp
"
2
#include "
YAPOG/Graphics/Gui/Padding.hpp
"
3
#include "
YAPOG/Collection/List.hpp
"
4
#include "
YAPOG/System/MathHelper.hpp
"
5
6
namespace
yap
7
{
8
9
VerticalLayout::VerticalLayout
()
10
:
LayoutBox
()
11
{
12
}
13
14
VerticalLayout::VerticalLayout
(
Padding
ext,
Padding
in,
bool
isExt)
15
:
LayoutBox
(ext, in, isExt)
16
{
17
}
18
19
float
VerticalLayout::GetWidthItem
()
20
{
21
for
(
auto
itMap =
items_
.
begin
(); itMap !=
items_
.
end
(); itMap++)
22
return
(*itMap).first->GetSize ().y;
23
return
0;
24
}
25
26
VerticalLayout::~VerticalLayout
()
27
{
28
}
29
30
void
VerticalLayout::GeneratePosition
()
31
{
32
float
totalPad = 0;
33
34
35
if
(
globalAlign_
== Align::BOTTOM)
36
totalPad =
GetSize
().y -
externPad_
.
bottom
;
37
else
if
(
globalAlign_
== Align::CENTER)
38
totalPad = (
GetSize
().y -
externPad_
.
bottom
-
externPad_
.
top
) / 2
39
+
externPad_
.
top
;
40
else
41
totalPad =
externPad_
.
top
;
42
43
44
float
leftAlign =
externPad_
.
left
;
45
float
rightAlign =
GetSize
().x -
externPad_
.
right
;
46
float
midAlign = (
GetSize
().x -
externPad_
.
right
-
externPad_
.
left
) / 2
47
+
externPad_
.
left
;
48
49
for (
IWidget
* child :
childen_
)
50
{
51
child->SetPosition (
GetPosition
());
52
53
float
posX = 0;
54
if
(
items_
[child] == Align::LEFT)
55
posX = leftAlign;
56
else
if
(
items_
[child] == Align::RIGHT)
57
posX = rightAlign - child->GetSize ().x;
58
else
59
posX = midAlign - (child->GetSize ().x / 2);
60
61
Vector2
currentPos (posX, totalPad);
62
child->Move (currentPos);
63
64
totalPad += child->GetSize ().y +
innerPad_
.
bottom
;
65
}
66
realSize_
.y =
MathHelper::Max
(totalPad -
innerPad_
.
bottom
67
+
externPad_
.
bottom
68
,
GetUserSize
().y
/* spatialInfo_.GetSize ().y*/
);
69
realSize_
.x =
MaxSize
(
'x'
);
70
BaseWidget::Refresh
();
71
}
72
73
void
VerticalLayout::HandleDraw
(
IDrawingContext
& context)
74
{
75
}
76
77
void
VerticalLayout::HandleShow
(
bool
isVisible)
78
{
79
}
80
81
void
VerticalLayout::HandleMove
(
const
Vector2
& offset)
82
{
83
}
84
85
void
VerticalLayout::HandleScale
(
const
Vector2
& factor)
86
{
87
}
88
89
void
VerticalLayout::HandleUpdate
(
const
Time
& dt)
90
{
91
}
92
93
void
VerticalLayout::HandleChangeColor
(
const
sf::Color& color)
94
{
95
}
96
}
//namespace yap
YAPOG
src
YAPOG
Graphics
Gui
VerticalLayout.cpp
Generated on Mon Sep 17 2012 22:24:26 for YAPOG by
1.8.1.1