ManiaLib 1.0b1 API Reference

Source for file VerticalFlowLayout.class.php

Documentation is available at VerticalFlowLayout.class.php

  1. <?php
  2. /**
  3.  * @author Maxime Raoust
  4.  * @copyright 2009-2010 NADEO
  5.  * @package ManiaLib
  6.  */
  7.  
  8. /**
  9.  * Flow layout
  10.  * Column-like, items fill vertically the current column then the next one on the right etc.
  11.  * @package ManiaLib
  12.  * @subpackage GUIToolkit_Layouts
  13.  */
  14. {
  15.     /**#@+
  16.      * @ignore
  17.      */
  18.     protected $maxWidth 0;
  19.     protected $currentColumnElementCount 0;
  20.     /**#@-*/
  21.  
  22.     /**
  23.      * @ignore
  24.      */
  25.     function preFilter(GuiElement $item)
  26.     {
  27.         $availableHeight $this->sizeY $this->yIndex $this->borderHeight;
  28.  
  29.         // If end of the line is reached
  30.         if($availableHeight $item->getSizeY($this->currentColumnElementCount 0)
  31.         {
  32.             $this->xIndex += $this->maxWidth $this->marginWidth;
  33.             $this->yIndex $this->borderHeight;
  34.             $this->currentColumnElementCount 0;
  35.             $this->maxWidth 0;
  36.         }
  37.  
  38.     }
  39.  
  40.     /**
  41.      * @ignore
  42.      */
  43.     function postFilter(GuiElement $item)
  44.     {
  45.         $this->yIndex -= $item->getSizeY($this->marginHeight;
  46.         if(!$this->maxWidth || $item->getSizeX($this->maxWidth)
  47.         {
  48.             $this->maxWidth $item->getSizeX();
  49.         }
  50.         $this->currentColumnElementCount++;
  51.     }
  52. }
  53.  
  54. ?>