TeeChartPHP
[ class tree: TeeChartPHP ] [ index: TeeChartPHP ] [ all elements ]

Source for file Tool.php

Documentation is available at Tool.php

  1. <?php
  2.  
  3. /**
  4.  * Tool class
  5.  *
  6.  * Description: Base Tool class
  7.  *
  8.  * @author
  9.  * @copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
  10.  * @version 1.0
  11.  * @package TeeChartPHP
  12.  * @subpackage tools
  13.  * @link http://www.steema.com
  14.  */
  15.  
  16.  class Tool extends TeeBase {
  17.  
  18.     public $clickTolerance = 3;
  19.  
  20.     protected $pPen=null// $Delayed $creation $at $derived $getPen()
  21.     protected $bBrush=null// $Delayed $creation $at $derived $getBrush()
  22.     private $active true;
  23.  
  24.     protected $listenerList;
  25.  
  26.     // Interceptors
  27.     function __get$property {
  28.       $method ="get{$property}";
  29.       if method_exists$this$method ) ) {
  30.         return $this->$method();
  31.       }
  32.     }
  33.  
  34.     function __set $property,$value {
  35.       $method ="set{$property}";
  36.       if method_exists$this$method ) ) {
  37.         return $this->$method($value);
  38.       }
  39.     }
  40.  
  41.     protected function readResolve({
  42.         $this->listenerList = new EventListenerList();
  43.         // TODO remove posted by me $this->addMyEventListener($this);
  44.  
  45.         return $this;
  46.     }
  47.  
  48.      function getFirstLastSeries($s{
  49.         $result new GetFirstLast();
  50.  
  51.         $result->min $s->getFirstVisible();
  52.         if ($result->min 0{
  53.             $result->min 0;
  54.         }
  55.  
  56.         $result->max $s->getLastVisible();
  57.         if ($result->max 0{
  58.             $result->max $s->getCount(1;
  59.         else
  60.         if ($result->max >= $s->getCount()) {
  61.             $result->max $s->getCount(1// 5.03
  62.         }
  63.  
  64.         $result->result ($s->getCount(0&& ($result->min <= $s->getCount()) &&
  65.                         ($this->result->max <= $s->getCount());
  66.         return $result;
  67.     }
  68.  
  69.     protected function Tool($c=null{
  70.         parent::__construct($c);
  71.        
  72.         if ($this->chart != null{
  73.             $this->chart->getTools()->internalAdd($this);
  74.         }
  75.  
  76.         $this->readResolve();
  77.     }
  78.  
  79.     public function toString({
  80.         return $this->getDescription();
  81.     }
  82.  
  83.     /* TODO
  84.     public function addMouseMotionListener($l) {
  85.         $this->listenerList->add($this->MouseMotionListener->class, $l);
  86.     }
  87.  
  88.     public function removeMouseMotionListener($l) {
  89.         $this->listenerList->remove($this->MouseMotionListener->class, $l);
  90.     }
  91.  
  92.     protected function fireMouse($e) {
  93.         $this->Object[] $this->listeners = $this->listenerList->getListenerList();
  94.         for ( $i = $this->listeners->length - 2; $i >= 0; $i -= 2) {
  95.             if ($this->listeners[$i] == $this->MouseMotionListener->class) {
  96.                 $tmpMouseEvent = new MouseEvent();
  97.                 if ($e->getID()==$tmpMouseEvent->MOUSE_DRAGGED) {
  98.                     (($this->MouseMotionListener) $this->listeners[$i + 1])->mouseDragged($e);
  99.                 } else if ($e->getID()==$tmpMouseEvent->MOUSE_MOVED) {
  100.                     (($this->MouseMotionListener) $this->listeners[$i + 1])->mouseMoved($e);
  101.                 }
  102.             }
  103.             if ($this->listeners[$i] == $this->MouseListener->class) {
  104.  
  105.             }
  106.         }
  107.     }
  108.  
  109.     protected function fireChanged($ce) {
  110.         $this->Object[] $this->listeners = $this->listenerList->getListenerList();
  111.         for ( $i = $this->listeners->length - 2; $i >= 0; $i -= 2) {
  112.             if ($this->listeners[$i] == $this->ChangeListener->class) {
  113.               (($this->ChangeListener) $this->listeners[$i + 1])->stateChanged($ce);
  114.             }
  115.         }
  116.     }
  117.  
  118.     protected function fireClicked($e) {
  119.         $this->Object[] $this->listeners = $this->listenerList->getListenerList();
  120.         for ( $i = $this->listeners->length - 2; $i >= 0; $i -= 2) {
  121.             if ($this->listeners[$i] == $this->ToolMouseListener->class) {
  122.               (($this->ToolMouseListener) $this->listeners[$i + 1])->toolClicked($e);
  123.             }
  124.         }
  125.     }
  126.  
  127.     protected function fireDragged($e) {
  128.         $this->Object[] $this->listeners = $this->listenerList->getListenerList();
  129.         for ( $i = $this->listeners->length - 2; $i >= 0; $i -= 2) {
  130.             if ($this->listeners[$i] == $this->DragListener->class) {
  131.               (($this->DragListener) $this->listeners[$i + 1])->dragFinished($e);
  132.             }
  133.         }
  134.     }
  135.  
  136.     protected function fireDragging($e) {
  137.         $this->Object[] $this->listeners = $this->listenerList->getListenerList();
  138.         for ( $i = $this->listeners->length - 2; $i >= 0; $i -= 2) {
  139.             if ($this->listeners[$i] == $this->DragListener->class) {
  140.               (($this->DragListener) $this->listeners[$i + 1])->dragMoving($e);
  141.             }
  142.         }
  143.     }
  144.  
  145.     protected function fireResized($e) {
  146.         $this->Object[] $this->listeners = $this->listenerList->getListenerList();
  147.         for ( $i = $this->listeners->length - 2; $i >= 0; $i -= 2) {
  148.             if ($this->listeners[$i] == $this->SizeListener->class) {
  149.               (($this->SizeListener) $this->listeners[$i + 1])->sizeChanged($e);
  150.             }
  151.         }
  152.     }
  153.     */
  154.  
  155.     /**
  156.       * Enables/Disables the indexed Tool.<br>
  157.       * Default value: true
  158.       *
  159.       * @param value boolean
  160.       */
  161.     public function setActive($value{
  162.         $this->active $this->setBooleanProperty($this->active$value);
  163.     }
  164.  
  165.     /**
  166.       * Enables/Disables the indexed Tool.<br>
  167.       * Default value: true
  168.       *
  169.       * @return boolean 
  170.       */
  171.     public function getActive({
  172.         return $this->active;
  173.     }
  174.  
  175.     public function setChart($value{
  176.         if (!($this->chart === $value)) {
  177.             if ($this->chart != null{
  178.                 $this->chart->getTools()->remove($this);
  179.             }
  180.  
  181.             parent::setChart($value);
  182.  
  183.             if ($this->chart != null{
  184.                 $this->chart->getTools()->add($this);
  185.             }
  186.             if ($this->pPen != null{
  187.                 $this->pPen->setChart($this->chart);
  188.             }
  189.             if ($this->bBrush != null{
  190.                 $this->bBrush->setChart($this->chart);
  191.             }
  192.             if ($this->chart != null{
  193.                 $this->chart->invalidate();
  194.             }
  195.         }
  196.     }
  197.  
  198.     public function chartEvent($ce{}
  199.  
  200.     public function mouseEvent($e$c{
  201.         $this->fireMouse($e);
  202.         return $c;
  203.     }
  204.  
  205.     /**
  206.       * Gets descriptive text.
  207.       *
  208.       * @return String 
  209.       */
  210.     public function getDescription({
  211.         return "";
  212.     }
  213.  
  214.     /**
  215.       * Gets detailed descriptive text.
  216.       *
  217.       * @return String 
  218.       */
  219.     public function getSummary({
  220.         return "";
  221.     }
  222.  
  223.     /**
  224.       * Returns the URL of the associated icon for a given Tool class.<br>
  225.       * This icon is used at Tools gallery listbox and Tools Editor dialog.
  226.       *
  227.       * @return URL 
  228.       */
  229.     public function getBitmapEditor({
  230.         $name $this->getClass()->getName();
  231.         $name "icons/"+$name->substring($name->lastIndexOf('->')+1)+"->gif";
  232.         return $this->Tool->class->getResource($name);
  233.     }
  234. }
  235.  
  236.  class GetFirstLast {
  237.         public $result;
  238.         public $min;
  239.         public $max;
  240. }
  241. ?>

Documentation generated on Wed, 16 Jun 2010 12:09:01 +0200 by phpDocumentor 1.4.1