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