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. interface awPositionable {
  19.  
  20.     /**
  21.      * Left align
  22.      *
  23.      * @var int 
  24.      */
  25.     const LEFT 1;
  26.  
  27.     /**
  28.      * Right align
  29.      *
  30.      * @var int 
  31.      */
  32.     const RIGHT 2;
  33.  
  34.     /**
  35.      * Center align
  36.      *
  37.      * @var int 
  38.      */
  39.     const CENTER 3;
  40.  
  41.     /**
  42.      * Top align
  43.      *
  44.      * @var int 
  45.      */
  46.     const TOP 4;
  47.  
  48.     /**
  49.      * Bottom align
  50.      *
  51.      * @var int 
  52.      */
  53.     const BOTTOM 5;
  54.  
  55.     /**
  56.      * Middle align
  57.      *
  58.      * @var int 
  59.      */
  60.     const MIDDLE 6;
  61.     
  62.     /**
  63.      * Change alignment
  64.      *
  65.      * @param int $h Horizontal alignment
  66.      * @param int $v Vertical alignment
  67.      */
  68.     public function setAlign($h NULL$v NULL);
  69.     
  70. }
  71.  
  72. registerInterface('Positionable');
  73.  
  74. /**
  75.  * Manage left, right, top and bottom sides
  76.  *
  77.  * @package linea21.externals
  78.  * @subpackage artichow
  79.  */
  80. class awSide {
  81.  
  82.     /**
  83.      * Left side
  84.      *
  85.      * @var int 
  86.      */
  87.     public $left = 0;
  88.  
  89.     /**
  90.      * Right side
  91.      *
  92.      * @var int 
  93.      */
  94.     public $right = 0;
  95.  
  96.     /**
  97.      * Top side
  98.      *
  99.      * @var int 
  100.      */
  101.     public $top = 0;
  102.  
  103.     /**
  104.      * Bottom side
  105.      *
  106.      * @var int 
  107.      */
  108.     public $bottom = 0;
  109.     
  110.     /**
  111.      * Build the side
  112.      *
  113.      * @param mixed $left 
  114.      * @param mixed $right 
  115.      * @param mixed $top 
  116.      * @param mixed $bottom 
  117.      */
  118.     public function __construct($left NULL$right NULL$top NULL$bottom NULL{
  119.         $this->set($left$right$top$bottom);
  120.     }
  121.     
  122.     
  123.     /**
  124.      * Change side values
  125.      *
  126.      * @param mixed $left 
  127.      * @param mixed $right 
  128.      * @param mixed $top 
  129.      * @param mixed $bottom 
  130.      */
  131.     public function set($left NULL$right NULL$top NULL$bottom NULL{
  132.     
  133.         if($left !== NULL{
  134.             $this->left = (float)$left;
  135.         }
  136.         if($right !== NULL{
  137.             $this->right = (float)$right;
  138.         }
  139.         if($top !== NULL{
  140.             $this->top = (float)$top;
  141.         }
  142.         if($bottom !== NULL{
  143.             $this->bottom = (float)$bottom;
  144.         }
  145.         
  146.     }
  147.     
  148.     
  149.     /**
  150.      * Add values to each side
  151.      *
  152.      * @param mixed $left 
  153.      * @param mixed $right 
  154.      * @param mixed $top 
  155.      * @param mixed $bottom 
  156.      */
  157.     public function add($left NULL$right NULL$top NULL$bottom NULL{
  158.     
  159.         if($left !== NULL{
  160.             $this->left += (float)$left;
  161.         }
  162.         if($right !== NULL{
  163.             $this->right += (float)$right;
  164.         }
  165.         if($top !== NULL{
  166.             $this->top += (float)$top;
  167.         }
  168.         if($bottom !== NULL{
  169.             $this->bottom += (float)$bottom;
  170.         }
  171.         
  172.     }
  173.  
  174. }
  175.  
  176. registerClass('Side');
  177. ?>

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