1: <?php
2: /**
3: * ManiaLib - Lightweight PHP framework for Manialinks
4: *
5: * @see http://code.google.com/p/manialib/
6: * @copyright Copyright (c) 2009-2011 NADEO (http://www.nadeo.com)
7: * @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
8: * @version $Revision: 590 $:
9: * @author $Author: maximeraoust $:
10: * @date $Date: 2011-12-27 19:40:38 +0100 (mar., 27 déc. 2011) $:
11: */
12:
13: namespace ManiaLib\Gui\Layouts;
14:
15: /**
16: * Elements are added below their predecessor
17: */
18: class Column extends AbstractLayout
19: {
20: const DIRECTION_DOWN = -1;
21: const DIRECTION_UP = 1;
22:
23: protected $direction;
24:
25: function __construct($sizeX = 20, $sizeY = 20,
26: $direction = self::DIRECTION_DOWN)
27: {
28: parent::__construct($sizeX, $sizeY);
29: $this->direction = $direction;
30: }
31:
32: function setDirection($direction)
33: {
34: $this->direction = $direction;
35: }
36:
37: function preFilter(\ManiaLib\Gui\Component $item)
38: {
39: if($this->direction == self::DIRECTION_UP)
40: {
41: $this->yIndex += $item->getRealSizeY() + $this->marginHeight;
42: }
43: }
44:
45: function postFilter(\ManiaLib\Gui\Component $item)
46: {
47: if($this->direction == self::DIRECTION_DOWN)
48: {
49: $this->yIndex -= $item->getRealSizeY() + $this->marginHeight;
50: }
51: }
52:
53: }
54:
55: ?>