[ Index ]
 

Code source de phpMyVisites 2.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/libs/artichow/php5/inc/ -> Tools.class.php (source)

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


Généré le : Mon Nov 26 14:10:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics