linea21-externals
[ class tree: linea21-externals ] [ index: linea21-externals ] [ all elements ]

Source for file Tools.class.php

Documentation is available at Tools.class.php

  1. <?php
  2. /*
  3.  * This work is hereby released into the Public Domain.
  4.  * To view a copy of the public domain dedication,
  5.  * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
  6.  * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
  7.  *
  8.  */
  9.  
  10. require_once dirname(__FILE__)."/../Graph.class.php";
  11.  
  12. /**
  13.  * Objects capable of being positioned
  14.  *
  15.  * @package linea21.externals
  16.  * @subpackage artichow
  17.  */
  18.  
  19.  
  20. registerInterface('Positionable');
  21.  
  22. /**
  23.  * Manage left, right, top and bottom sides
  24.  *
  25.  * @package linea21.externals
  26.  * @subpackage artichow
  27.  */
  28. class awSide {
  29.  
  30.     /**
  31.      * Left side
  32.      *
  33.      * @var int 
  34.      */
  35.     var $left = 0;
  36.  
  37.     /**
  38.      * Right side
  39.      *
  40.      * @var int 
  41.      */
  42.     var $right = 0;
  43.  
  44.     /**
  45.      * Top side
  46.      *
  47.      * @var int 
  48.      */
  49.     var $top = 0;
  50.  
  51.     /**
  52.      * Bottom side
  53.      *
  54.      * @var int 
  55.      */
  56.     var $bottom = 0;
  57.     
  58.     /**
  59.      * Build the side
  60.      *
  61.      * @param mixed $left 
  62.      * @param mixed $right 
  63.      * @param mixed $top 
  64.      * @param mixed $bottom 
  65.      */
  66.      function awSide($left NULL$right NULL$top NULL$bottom NULL{
  67.         $this->set($left$right$top$bottom);
  68.     }
  69.     
  70.     
  71.     /**
  72.      * Change side values
  73.      *
  74.      * @param mixed $left 
  75.      * @param mixed $right 
  76.      * @param mixed $top 
  77.      * @param mixed $bottom 
  78.      */
  79.      function set($left NULL$right NULL$top NULL$bottom NULL{
  80.     
  81.         if($left !== NULL{
  82.             $this->left = (float)$left;
  83.         }
  84.         if($right !== NULL{
  85.             $this->right = (float)$right;
  86.         }
  87.         if($top !== NULL{
  88.             $this->top = (float)$top;
  89.         }
  90.         if($bottom !== NULL{
  91.             $this->bottom = (float)$bottom;
  92.         }
  93.         
  94.     }
  95.     
  96.     
  97.     /**
  98.      * Add values to each side
  99.      *
  100.      * @param mixed $left 
  101.      * @param mixed $right 
  102.      * @param mixed $top 
  103.      * @param mixed $bottom 
  104.      */
  105.      function add($left NULL$right NULL$top NULL$bottom NULL{
  106.     
  107.         if($left !== NULL{
  108.             $this->left += (float)$left;
  109.         }
  110.         if($right !== NULL{
  111.             $this->right += (float)$right;
  112.         }
  113.         if($top !== NULL{
  114.             $this->top += (float)$top;
  115.         }
  116.         if($bottom !== NULL{
  117.             $this->bottom += (float)$bottom;
  118.         }
  119.         
  120.     }
  121.  
  122. }
  123.  
  124. registerClass('Side');
  125. ?>

Documentation generated on Fri, 16 Oct 2009 09:40:05 +0200 by phpDocumentor 1.4.1