ManiaLib 1.0b1 API Reference

Source for file ColumnLayout.class.php

Documentation is available at ColumnLayout.class.php

  1. <?php
  2. /**
  3.  * @author Maxime Raoust
  4.  * @copyright 2009-2010 NADEO
  5.  * @package ManiaLib
  6.  */
  7.  
  8. /**
  9.  * Column layout
  10.  * Elements are added below their predecessor
  11.  * @package ManiaLib
  12.  * @subpackage GUIToolkit_Layouts
  13.  */
  14. class ColumnLayout extends AbstractLayout
  15. {
  16.     const DIRECTION_DOWN = -1;
  17.     const DIRECTION_UP = 1;
  18.     
  19.     /**
  20.      * @ignore
  21.      */
  22.     protected $direction = -1;
  23.     
  24.     function setDirection($direction)
  25.     {
  26.         $this->direction $direction;
  27.     }
  28.     
  29.     /**
  30.      * @ignore
  31.      */
  32.     function preFilter(GuiElement $item)
  33.     {
  34.         if($this->direction == self::DIRECTION_UP)
  35.         {
  36.             $this->yIndex += $item->getSizeY($this->marginHeight;
  37.         }
  38.     }
  39.     
  40.     /**
  41.      * @ignore
  42.      */
  43.     function postFilter(GuiElement $item)
  44.     {
  45.         if($this->direction == self::DIRECTION_DOWN)
  46.         {
  47.             $this->yIndex -= $item->getSizeY($this->marginHeight;
  48.         }
  49.     }
  50. }
  51.  
  52. ?>