[ 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/php4/inc/ -> Border.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   * Draw border
  12   *
  13   * @package Artichow
  14   */
  15  class awBorder {
  16  
  17      /**
  18       * Border color
  19       *
  20       * @var Color
  21       */
  22      var $color;
  23  
  24      /**
  25       * Hide border ?
  26       *
  27       * @var bool
  28       */
  29      var $hide = FALSE;
  30  
  31      /**
  32       * Border line style
  33       *
  34       * @var int
  35       */
  36      var $style;
  37      
  38      /**
  39       * Build the border
  40       *
  41       * @param $color Border color
  42       * @param int $style Border style
  43       */
  44  	 function awBorder($color = NULL, $style = LINE_SOLID) {
  45      
  46          $this->setStyle($style);
  47          
  48          if(is_a($color, 'awColor')) {
  49              $this->setColor($color);
  50          } else {
  51              $this->setColor(new awBlack);
  52          }
  53          
  54      }
  55      
  56      /**
  57       * Change border color
  58       * This method automatically shows the border if it is hidden
  59       *
  60       * @param $color
  61       */
  62  	 function setColor($color) {
  63          $this->color = $color;
  64          $this->show();
  65      }
  66      
  67      /**
  68       * Change border style
  69       *
  70       * @param int $style
  71       */
  72  	 function setStyle($style) {
  73          $this->style = (int)$style;
  74      }
  75      
  76      /**
  77       * Hide border ?
  78       *
  79       * @param bool $hide
  80       */
  81  	 function hide($hide = TRUE) {
  82          $this->hide = (bool)$hide;
  83      }
  84      
  85      /**
  86       * Show border ?
  87       *
  88       * @param bool $show
  89       */
  90  	 function show($show = TRUE) {
  91          $this->hide = (bool)!$show;
  92      }
  93      
  94      /**
  95       * Is the border visible ?
  96       *
  97       * @return bool
  98       */
  99  	 function visible() {
 100          return !$this->hide;
 101      }
 102      
 103      /**
 104       * Draw border as a rectangle
 105       *
 106       * @param $drawer
 107       * @param $p1 Top-left corner
 108       * @param $p2 Bottom-right corner
 109       */
 110  	 function rectangle($drawer, $p1, $p2) {
 111      
 112          // Border is hidden
 113          if($this->hide) {
 114              return;
 115          }
 116      
 117          $line = new awLine;
 118          $line->setStyle($this->style);
 119          $line->setLocation($p1, $p2);
 120          
 121          $drawer->rectangle($this->color, $line);
 122          
 123      }
 124      
 125      /**
 126       * Draw border as an ellipse
 127       *
 128       * @param $drawer
 129       * @param $center Ellipse center
 130       * @param int $width Ellipse width
 131       * @param int $height Ellipse height
 132       */
 133  	 function ellipse($drawer, $center, $width, $height) {
 134      
 135          // Border is hidden
 136          if($this->hide) {
 137              return;
 138          }
 139          
 140          switch($this->style) {
 141          
 142              case LINE_SOLID :
 143                  $drawer->ellipse($this->color, $center, $width, $height);
 144                  break;
 145              
 146              default :
 147                  trigger_error("Dashed and dotted borders and not yet implemented on ellipses", E_USER_ERROR);
 148                  break;
 149          
 150          }
 151          
 152          
 153      }
 154  
 155  }
 156  
 157  registerClass('Border');
 158  ?>


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