[ Index ] |
|
Code source de phpMyVisites 2.3 |
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 * To handle text 12 * 13 * @package Artichow 14 */ 15 class awText { 16 17 /** 18 * Your text 19 * 20 * @var string 21 */ 22 private $text; 23 24 /** 25 * Text font 26 * 27 * @var Font 28 */ 29 private $font; 30 31 /** 32 * Text angle 33 * Can be 0 or 90 34 * 35 * @var int 36 */ 37 private $angle; 38 39 /** 40 * Text color 41 * 42 * @var Color 43 */ 44 private $color; 45 46 /** 47 * Text background 48 * 49 * @var Color, Gradient 50 */ 51 private $background; 52 53 /** 54 * Padding 55 * 56 * @var array Array for left, right, top and bottom paddings 57 */ 58 private $padding; 59 60 /** 61 * Text border 62 * 63 * @var Border 64 */ 65 public $border; 66 67 /** 68 * Build a new awtext 69 * 70 * @param string $text Your text 71 */ 72 public function __construct($text, $font = NULL, $color = NULL, $angle = 0) { 73 74 if(is_null($font)) { 75 $font = new awFont2; 76 } 77 78 $this->setText($text); 79 $this->setFont($font); 80 81 // Set default color to black 82 if($color === NULL) { 83 $color = new awColor(0, 0, 0); 84 } 85 86 $this->setColor($color); 87 $this->setAngle($angle); 88 89 $this->border = new awBorder; 90 $this->border->hide(); 91 92 } 93 94 /** 95 * Get text 96 * 97 * @return string 98 */ 99 public function getText() { 100 return $this->text; 101 } 102 103 /** 104 * Change text 105 * 106 * @param string $text New text 107 */ 108 public function setText($text) { 109 $this->text = (string)$text; 110 } 111 112 /** 113 * Change text font 114 * 115 * @param Font 116 */ 117 public function setFont(awFont $font) { 118 $this->font = $font; 119 } 120 121 /** 122 * Get text font 123 * 124 * @return int 125 */ 126 public function getFont() { 127 return $this->font; 128 } 129 130 /** 131 * Change text angle 132 * 133 * @param int 134 */ 135 public function setAngle($angle) { 136 $this->angle = (int)$angle; 137 } 138 139 /** 140 * Get text angle 141 * 142 * @return int 143 */ 144 public function getAngle() { 145 return $this->angle; 146 } 147 148 /** 149 * Change text color 150 * 151 * @param Color 152 */ 153 public function setColor(awColor $color) { 154 $this->color = $color; 155 } 156 157 /** 158 * Get text color 159 * 160 * @return Color 161 */ 162 public function getColor() { 163 return $this->color; 164 } 165 166 /** 167 * Change text background color 168 * 169 * @param awColor $color 170 */ 171 public function setBackgroundColor(awColor $color) { 172 $this->background = $color; 173 } 174 175 /** 176 * Change text background gradient 177 * 178 * @param awGradient $gradient 179 */ 180 public function setBackgroundGradient(awGradient $gradient) { 181 $this->background = $gradient; 182 } 183 184 /** 185 * Get text background 186 * 187 * @return Color, Gradient 188 */ 189 public function getBackground() { 190 return $this->background; 191 } 192 193 /** 194 * Change padding 195 * 196 * @param int $left Left padding 197 * @param int $right Right padding 198 * @param int $top Top padding 199 * @param int $bottom Bottom padding 200 */ 201 public function setPadding($left, $right, $top, $bottom) { 202 $this->padding = array((int)$left, (int)$right, (int)$top, (int)$bottom); 203 } 204 205 /** 206 * Get current padding 207 * 208 * @return array 209 */ 210 public function getPadding() { 211 return $this->padding; 212 } 213 214 } 215 216 registerClass('Text'); 217 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 14:10:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |