YAPOG  0.0.1
Yet Another Pokemon Online Game
HorizontalLayout.cpp
Go to the documentation of this file.
5 
6 namespace yap
7 {
8 
10  : LayoutBox ()
11  {
12  }
13 
15  : LayoutBox (ext, in, isExt)
16  {
17  }
18 
20  {
21  }
22 
24  {
25  for (auto itMap = items_.begin (); itMap != items_.end (); itMap++)
26  return (*itMap).first->GetSize ().x;
27  return 0;
28  }
29 
31  {
32  float totalPad = 0;
33 
34 
35  if (globalAlign_ == Align::RIGHT)
36  totalPad = GetSize ().x - externPad_.right;
37  else if (globalAlign_ == Align::CENTER)
38  totalPad = (GetSize ().x - externPad_.left- externPad_.right) / 2
39  + externPad_.left;
40  else
41  totalPad = externPad_.left;
42 
43 
44  float topAlign = externPad_.top;
45  float botAlign = GetSize ().y - externPad_.bottom;
46  float midAlign = (GetSize ().y - externPad_.bottom - externPad_.top) / 2
47  + externPad_.top;
48 
49  for (IWidget* child : childen_)
50  {
51  child->SetPosition (GetPosition ());
52 
53  float posY = 0;
54  if (items_[child] == Align::TOP)
55  posY = topAlign;
56  else if (items_[child] == Align::BOTTOM)
57  posY = botAlign - child->GetSize ().y;
58  else
59  posY = midAlign - (child->GetSize ().y / 2);
60 
61  Vector2 currentPos (totalPad, posY);
62  child->Move (currentPos);
63 
64  totalPad += child->GetSize ().x + innerPad_.right;
65  }
68  , GetUserSize ().x /*spatialInfo_.GetSize ().x*/);
69  realSize_.y = MaxSize ('y');
71  }
72 
74  {
75  }
76 
77  void HorizontalLayout::HandleShow (bool isVisible)
78  {
79  }
80 
82  {
83  }
84 
86  {
87  }
88 
90  {
91  }
92 
93  void HorizontalLayout::HandleChangeColor (const sf::Color& color)
94  {
95  }
96 } //namespace yap