Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * TImageMap and related class file.
4
 *
5
 * @author Qiang Xue <qiang.xue@gmail.com>
6
 * @link http://www.pradosoft.com/
7
 * @copyright Copyright &copy; 2005-2008 PradoSoft
8
 * @license http://www.pradosoft.com/license/
9
 * @version $Id: TImageMap.php 2541 2008-10-21 15:05:13Z qiang.xue $
10
 * @package System.Web.UI.WebControls
11
 */
12
 
13
/**
14
 * Includes TImage class file
15
 */
16
Prado::using('System.Web.UI.WebControls.TImage');
17
 
18
/**
19
 * TImageMap class
20
 *
21
 * TImageMap represents an image on a page. Hotspot regions can be defined
22
 * within the image. Depending on the {@link setHotSpotMode HotSpotMode},
23
 * clicking on the hotspots may trigger a postback or navigate to a specified
24
 * URL. The hotspots defined may be accessed via {@link getHotSpots HotSpots}.
25
 * Each hotspot is described as a {@link THotSpot}, which can be a circle,
26
 * rectangle, polygon, etc. To add hotspot in a template, use the following,
27
 * <code>
28
 *  <com:TImageMap>
29
 *    <com:TCircleHotSpot ... />
30
 *    <com:TRectangleHotSpot ... />
31
 *    <com:TPolygonHotSpot ... />
32
 *  </com:TImageMap>
33
 * </code>
34
 *
35
 * @author Qiang Xue <qiang.xue@gmail.com>
36
 * @version $Id: TImageMap.php 2541 2008-10-21 15:05:13Z qiang.xue $
37
 * @package System.Web.UI.WebControls
38
 * @since 3.0
39
 */
40
class TImageMap extends TImage implements IPostBackEventHandler
41
{
42
	const MAP_NAME_PREFIX='ImageMap';
43
 
44
	/**
45
	 * Processes an object that is created during parsing template.
46
	 * This method adds {@link THotSpot} objects into the hotspot collection
47
	 * of the imagemap.
48
	 * @param string|TComponent text string or component parsed and instantiated in template
49
	 */
50
	public function addParsedObject($object)
51
	{
52
		if($object instanceof THotSpot)
53
			$this->getHotSpots()->add($object);
54
	}
55
 
56
	/**
57
	 * Adds attribute name-value pairs to renderer.
58
	 * This overrides the parent implementation with additional imagemap specific attributes.
59
	 * @param THtmlWriter the writer used for the rendering purpose
60
	 */
61
	protected function addAttributesToRender($writer)
62
	{
63
		parent::addAttributesToRender($writer);
64
		if($this->getHotSpots()->getCount()>0)
65
		{
66
			$writer->addAttribute('usemap','#'.self::MAP_NAME_PREFIX.$this->getClientID());
67
			$writer->addAttribute('id',$this->getUniqueID());
68
		}
69
		if($this->getEnabled() && !$this->getEnabled(true))
70
			$writer->addAttribute('disabled','disabled');
71
	}
72
 
73
	/**
74
	 * Renders this imagemap.
75
	 * @param THtmlWriter
76
	 */
77
	public function render($writer)
78
	{
79
		parent::render($writer);
80
 
81
		$hotspots=$this->getHotSpots();
82
 
83
		if($hotspots->getCount()>0)
84
		{
85
			$clientID=$this->getClientID();
86
			$cs=$this->getPage()->getClientScript();
87
			$writer->writeLine();
88
			$writer->addAttribute('name',self::MAP_NAME_PREFIX.$clientID);
89
			$writer->renderBeginTag('map');
90
			$writer->writeLine();
91
			if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet)
92
				$mode=THotSpotMode::Navigate;
93
			$target=$this->getTarget();
94
			$i=0;
95
			$options['EventTarget'] = $this->getUniqueID();
96
			$options['StopEvent'] = true;
97
			$cs=$this->getPage()->getClientScript();
98
			foreach($hotspots as $hotspot)
99
			{
100
				if($hotspot->getHotSpotMode()===THotSpotMode::NotSet)
101
					$hotspot->setHotSpotMode($mode);
102
				if($target!=='' && $hotspot->getTarget()==='')
103
					$hotspot->setTarget($target);
104
				if($hotspot->getHotSpotMode()===THotSpotMode::PostBack)
105
				{
106
					$id=$clientID.'_'.$i;
107
					$writer->addAttribute('id',$id);
108
					$writer->addAttribute('href','#'.$id); //create unique no-op url references
109
					$options['ID']=$id;
110
					$options['EventParameter']="$i";
111
					$options['CausesValidation']=$hotspot->getCausesValidation();
112
					$options['ValidationGroup']=$hotspot->getValidationGroup();
113
					$cs->registerPostBackControl($this->getClientClassName(),$options);
114
				}
115
				$hotspot->render($writer);
116
				$writer->writeLine();
117
				$i++;
118
			}
119
			$writer->renderEndTag();
120
		}
121
	}
122
 
123
	/**
124
	 * Gets the name of the javascript class responsible for performing postback for this control.
125
	 * This method overrides the parent implementation.
126
	 * @return string the javascript class name
127
	 */
128
	protected function getClientClassName()
129
	{
130
		return 'Prado.WebUI.TImageMap';
131
	}
132
 
133
	/**
134
	 * Raises the postback event.
135
	 * This method is required by {@link IPostBackEventHandler} interface.
136
	 * This method is mainly used by framework and control developers.
137
	 * @param TEventParameter the event parameter
138
	 */
139
	public function raisePostBackEvent($param)
140
	{
141
		$postBackValue=null;
142
		if($param!=='')
143
		{
144
			$index=TPropertyValue::ensureInteger($param);
145
			$hotspots=$this->getHotSpots();
146
			if($index>=0 && $index<$hotspots->getCount())
147
			{
148
				$hotspot=$hotspots->itemAt($index);
149
				if(($mode=$hotspot->getHotSpotMode())===THotSpotMode::NotSet)
150
					$mode=$this->getHotSpotMode();
151
				if($mode===THotSpotMode::PostBack)
152
				{
153
					$postBackValue=$hotspot->getPostBackValue();
154
					if($hotspot->getCausesValidation())
155
						$this->getPage()->validate($hotspot->getValidationGroup());
156
				}
157
			}
158
		}
159
		if($postBackValue!==null)
160
			$this->onClick(new TImageMapEventParameter($postBackValue));
161
	}
162
 
163
	/**
164
	 * @return THotSpotMode the behavior of hotspot regions in this imagemap when they are clicked. Defaults to THotSpotMode::NotSet.
165
	 */
166
	public function getHotSpotMode()
167
	{
168
		return $this->getViewState('HotSpotMode',THotSpotMode::NotSet);
169
	}
170
 
171
	/**
172
	 * Sets the behavior of hotspot regions in this imagemap when they are clicked.
173
	 * If an individual hotspot has a mode other than 'NotSet', the mode set in this
174
	 * imagemap will be ignored. By default, 'NotSet' is equivalent to 'Navigate'.
175
	 * @param THotSpotMode the behavior of hotspot regions in this imagemap when they are clicked.
176
	 */
177
	public function setHotSpotMode($value)
178
	{
179
		$this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'THotSpotMode'),THotSpotMode::NotSet);
180
	}
181
 
182
	/**
183
	 * @return THotSpotCollection collection of hotspots defined in this imagemap.
184
	 */
185
	public function getHotSpots()
186
	{
187
		if(($hotspots=$this->getViewState('HotSpots',null))===null)
188
		{
189
			$hotspots=new THotSpotCollection;
190
			$this->setViewState('HotSpots',$hotspots);
191
		}
192
		return $hotspots;
193
	}
194
 
195
	/**
196
	 * @return string  the target window or frame to display the new page when a hotspot region is clicked within the imagemap. Defaults to ''.
197
	 */
198
	public function getTarget()
199
	{
200
		return $this->getViewState('Target','');
201
	}
202
 
203
	/**
204
	 * @param string  the target window or frame to display the new page when a hotspot region is clicked within the imagemap.
205
	 */
206
	public function setTarget($value)
207
	{
208
		$this->setViewState('Target',TPropertyValue::ensureString($value),'');
209
	}
210
 
211
	/**
212
	 * Raises <b>OnClick</b> event.
213
	 * This method is invoked when a hotspot region is clicked within the imagemap.
214
	 * If you override this method, be sure to call the parent implementation
215
	 * so that the event handler can be invoked.
216
	 * @param TImageMapEventParameter event parameter to be passed to the event handlers
217
	 */
218
	public function onClick($param)
219
	{
220
		$this->raiseEvent('OnClick',$this,$param);
221
	}
222
}
223
 
224
/**
225
 * TImageMapEventParameter class.
226
 *
227
 * TImageMapEventParameter represents a postback event parameter
228
 * when a hotspot is clicked and posts back in a {@link TImageMap}.
229
 * To retrieve the post back value associated with the hotspot being clicked,
230
 * access {@link getPostBackValue PostBackValue}.
231
 *
232
 * @author Qiang Xue <qiang.xue@gmail.com>
233
 * @version $Id: TImageMap.php 2541 2008-10-21 15:05:13Z qiang.xue $
234
 * @package System.Web.UI.WebControls
235
 * @since 3.0
236
 */
237
class TImageMapEventParameter extends TEventParameter
238
{
239
	private $_postBackValue;
240
 
241
	/**
242
	 * Constructor.
243
	 * @param string post back value associated with the hotspot clicked
244
	 */
245
	public function __construct($postBackValue)
246
	{
247
		$this->_postBackValue=$postBackValue;
248
	}
249
 
250
	/**
251
	 * @return string post back value associated with the hotspot clicked
252
	 */
253
	public function getPostBackValue()
254
	{
255
		return $this->_postBackValue;
256
	}
257
}
258
 
259
/**
260
 * THotSpotCollection class.
261
 *
262
 * THotSpotCollection represents a collection of hotspots in an imagemap.
263
 *
264
 * @author Qiang Xue <qiang.xue@gmail.com>
265
 * @version $Id: TImageMap.php 2541 2008-10-21 15:05:13Z qiang.xue $
266
 * @package System.Web.UI.WebControls
267
 * @since 3.0
268
 */
269
class THotSpotCollection extends TList
270
{
271
	/**
272
	 * Inserts an item at the specified position.
273
	 * This overrides the parent implementation by inserting only {@link THotSpot}.
274
	 * @param integer the speicified position.
275
	 * @param mixed new item
276
	 * @throws TInvalidDataTypeException if the item to be inserted is not a THotSpot.
277
	 */
278
	public function insertAt($index,$item)
279
	{
280
		if($item instanceof THotSpot)
281
			parent::insertAt($index,$item);
282
		else
283
			throw new TInvalidDataTypeException('hotspotcollection_hotspot_required');
284
	}
285
}
286
 
287
 
288
/**
289
 * THotSpot class.
290
 *
291
 * THotSpot implements the basic functionality common to all hot spot shapes.
292
 * Derived classes include {@link TCircleHotSpot}, {@link TPolygonHotSpot}
293
 * and {@link TRectangleHotSpot}.
294
 *
295
 * @author Qiang Xue <qiang.xue@gmail.com>
296
 * @version $Id: TImageMap.php 2541 2008-10-21 15:05:13Z qiang.xue $
297
 * @package System.Web.UI.WebControls
298
 * @since 3.0
299
 */
300
abstract class THotSpot extends TComponent
301
{
302
	private $_viewState=array();
303
 
304
	/**
305
	 * Returns a viewstate value.
306
	 *
307
	 * This function is very useful in defining getter functions for component properties
308
	 * that must be kept in viewstate.
309
	 * @param string the name of the viewstate value to be returned
310
	 * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned
311
	 * @return mixed the viewstate value corresponding to $key
312
	 */
313
	protected function getViewState($key,$defaultValue=null)
314
	{
315
		return isset($this->_viewState[$key])?$this->_viewState[$key]:$defaultValue;
316
	}
317
 
318
	/**
319
	 * Sets a viewstate value.
320
	 *
321
	 * This function is very useful in defining setter functions for control properties
322
	 * that must be kept in viewstate.
323
	 * Make sure that the viewstate value must be serializable and unserializable.
324
	 * @param string the name of the viewstate value
325
	 * @param mixed the viewstate value to be set
326
	 * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate.
327
	 */
328
	protected function setViewState($key,$value,$defaultValue=null)
329
	{
330
		if($value===$defaultValue)
331
			unset($this->_viewState[$key]);
332
		else
333
			$this->_viewState[$key]=$value;
334
	}
335
 
336
	/**
337
	 * @return string shape of the hotspot, can be 'circle', 'rect', 'poly', etc.
338
	 */
339
	abstract public function getShape();
340
	/**
341
	 * @return string coordinates defining the hotspot shape.
342
	 */
343
	abstract public function getCoordinates();
344
 
345
	/**
346
	 * @return string the access key that allows you to quickly navigate to the HotSpot region. Defaults to ''.
347
	 */
348
	public function getAccessKey()
349
	{
350
		return $this->getViewState('AccessKey','');
351
	}
352
 
353
	/**
354
	 * @param string the access key that allows you to quickly navigate to the HotSpot region.
355
	 */
356
	public function setAccessKey($value)
357
	{
358
		$this->setViewState('AccessKey',TPropertyValue::ensureString($value),'');
359
	}
360
 
361
	/**
362
	 * @return string the alternate text to display for a HotSpot object. Defaults to ''.
363
	 */
364
	public function getAlternateText()
365
	{
366
		return $this->getViewState('AlternateText','');
367
	}
368
 
369
	/**
370
	 * @param string the alternate text to display for a HotSpot object.
371
	 */
372
	public function setAlternateText($value)
373
	{
374
		$this->setViewState('AlternateText',TPropertyValue::ensureString($value),'');
375
	}
376
 
377
	/**
378
	 * @return THotSpotMode the behavior of a HotSpot object when it is clicked. Defaults to THotSpotMode::NotSet.
379
	 */
380
	public function getHotSpotMode()
381
	{
382
		return $this->getViewState('HotSpotMode',THotSpotMode::NotSet);
383
	}
384
 
385
	/**
386
	 * @param THotSpotMode the behavior of a HotSpot object when it is clicked.
387
	 */
388
	public function setHotSpotMode($value)
389
	{
390
		$this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'THotSpotMode'),THotSpotMode::NotSet);
391
	}
392
 
393
	/**
394
	 * @return string the URL to navigate to when a HotSpot object is clicked. Defaults to ''.
395
	 */
396
	public function getNavigateUrl()
397
	{
398
		return $this->getViewState('NavigateUrl','');
399
	}
400
 
401
	/**
402
	 * @param string the URL to navigate to when a HotSpot object is clicked.
403
	 */
404
	public function setNavigateUrl($value)
405
	{
406
		$this->setViewState('NavigateUrl',TPropertyValue::ensureString($value),'');
407
	}
408
 
409
	/**
410
	 * @return string a value that is post back when the HotSpot is clicked. Defaults to ''.
411
	 */
412
	public function getPostBackValue()
413
	{
414
		return $this->getViewState('PostBackValue','');
415
	}
416
 
417
	/**
418
	 * @param string a value that is post back when the HotSpot is clicked.
419
	 */
420
	public function setPostBackValue($value)
421
	{
422
		$this->setViewState('PostBackValue',TPropertyValue::ensureString($value),'');
423
	}
424
 
425
	/**
426
	 * @return integer the tab index of the HotSpot region. Defaults to 0.
427
	 */
428
	public function getTabIndex()
429
	{
430
		return $this->getViewState('TabIndex',0);
431
	}
432
 
433
	/**
434
	 * @param integer the tab index of the HotSpot region.
435
	 */
436
	public function setTabIndex($value)
437
	{
438
		$this->setViewState('TabIndex',TPropertyValue::ensureInteger($value),0);
439
	}
440
 
441
	/**
442
	 * @return boolean whether postback event trigger by this hotspot will cause input validation, default is true
443
	 */
444
	public function getCausesValidation()
445
	{
446
		return $this->getViewState('CausesValidation',true);
447
	}
448
 
449
	/**
450
	 * @param boolean whether postback event trigger by this hotspot will cause input validation
451
	 */
452
	public function setCausesValidation($value)
453
	{
454
		$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
455
	}
456
 
457
	/**
458
	 * @return string the group of validators which the hotspot causes validation upon postback
459
	 */
460
	public function getValidationGroup()
461
	{
462
		return $this->getViewState('ValidationGroup','');
463
	}
464
 
465
	/**
466
	 * @param string the group of validators which the hotspot causes validation upon postback
467
	 */
468
	public function setValidationGroup($value)
469
	{
470
		$this->setViewState('ValidationGroup',$value,'');
471
	}
472
 
473
	/**
474
	 * @return string  the target window or frame to display the new page when the HotSpot region
475
	 * is clicked. Defaults to ''.
476
	 */
477
	public function getTarget()
478
	{
479
		return $this->getViewState('Target','');
480
	}
481
 
482
	/**
483
	 * @param string  the target window or frame to display the new page when the HotSpot region
484
	 * is clicked.
485
	 */
486
	public function setTarget($value)
487
	{
488
		$this->setViewState('Target',TPropertyValue::ensureString($value),'');
489
	}
490
 
491
	/**
492
	 * @return boolean whether the hotspot has custom attributes
493
	 */
494
	public function getHasAttributes()
495
	{
496
		if($attributes=$this->getViewState('Attributes',null))
497
			return $attributes->getCount()>0;
498
		else
499
			return false;
500
	}
501
 
502
	/**
503
	 * Returns the list of custom attributes.
504
	 * Custom attributes are name-value pairs that may be rendered
505
	 * as HTML tags' attributes.
506
	 * @return TAttributeCollection the list of custom attributes
507
	 */
508
	public function getAttributes()
509
	{
510
		if($attributes=$this->getViewState('Attributes',null))
511
			return $attributes;
512
		else
513
		{
514
			$attributes=new TAttributeCollection;
515
			$this->setViewState('Attributes',$attributes,null);
516
			return $attributes;
517
		}
518
	}
519
 
520
	/**
521
	 * @return boolean whether the named attribute exists
522
	 */
523
	public function hasAttribute($name)
524
	{
525
		if($attributes=$this->getViewState('Attributes',null))
526
			return $attributes->contains($name);
527
		else
528
			return false;
529
	}
530
 
531
	/**
532
	 * @return string attribute value, null if attribute does not exist
533
	 */
534
	public function getAttribute($name)
535
	{
536
		if($attributes=$this->getViewState('Attributes',null))
537
			return $attributes->itemAt($name);
538
		else
539
			return null;
540
	}
541
 
542
	/**
543
	 * Sets a custom hotspot attribute.
544
	 * @param string attribute name
545
	 * @param string value of the attribute
546
	 */
547
	public function setAttribute($name,$value)
548
	{
549
		$this->getAttributes()->add($name,$value);
550
	}
551
 
552
	/**
553
	 * Removes the named attribute.
554
	 * @param string the name of the attribute to be removed.
555
	 * @return string attribute value removed, null if attribute does not exist.
556
	 */
557
	public function removeAttribute($name)
558
	{
559
		if($attributes=$this->getViewState('Attributes',null))
560
			return $attributes->remove($name);
561
		else
562
			return null;
563
	}
564
 
565
	/**
566
	 * Renders this hotspot.
567
	 * @param THtmlWriter
568
	 */
569
	public function render($writer)
570
	{
571
		$writer->addAttribute('shape',$this->getShape());
572
		$writer->addAttribute('coords',$this->getCoordinates());
573
		if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet)
574
			$mode=THotSpotMode::Navigate;
575
		if($mode===THotSpotMode::Navigate)
576
		{
577
			$writer->addAttribute('href',$this->getNavigateUrl());
578
			if(($target=$this->getTarget())!=='')
579
				$writer->addAttribute('target',$target);
580
		}
581
		else if($mode===THotSpotMode::Inactive)
582
			$writer->addAttribute('nohref','true');
583
		$text=$this->getAlternateText();
584
		$writer->addAttribute('title',$text);
585
		$writer->addAttribute('alt',$text);
586
		if(($accessKey=$this->getAccessKey())!=='')
587
			$writer->addAttribute('accesskey',$accessKey);
588
		if(($tabIndex=$this->getTabIndex())!==0)
589
			$writer->addAttribute('tabindex',"$tabIndex");
590
		if($this->getHasAttributes())
591
		{
592
			foreach($this->getAttributes() as $name=>$value)
593
				$writer->addAttribute($name,$value);
594
		}
595
		$writer->renderBeginTag('area');
596
		$writer->renderEndTag();
597
	}
598
}
599
 
600
/**
601
 * Class TCircleHotSpot.
602
 *
603
 * TCircleHotSpot defines a circular hot spot region in a {@link TImageMap}
604
 * control.
605
 *
606
 * @author Qiang Xue <qiang.xue@gmail.com>
607
 * @version $Id: TImageMap.php 2541 2008-10-21 15:05:13Z qiang.xue $
608
 * @package System.Web.UI.WebControls
609
 * @since 3.0
610
 */
611
class TCircleHotSpot extends THotSpot
612
{
613
	/**
614
	 * @return string shape of this hotspot.
615
	 */
616
	public function getShape()
617
	{
618
		return 'circle';
619
	}
620
 
621
	/**
622
	 * @return string coordinates defining this hotspot shape
623
	 */
624
	public function getCoordinates()
625
	{
626
		return $this->getX().','.$this->getY().','.$this->getRadius();
627
	}
628
 
629
	/**
630
	 * @return integer radius of the circular HotSpot region. Defaults to 0.
631
	 */
632
	public function getRadius()
633
	{
634
		return $this->getViewState('Radius',0);
635
	}
636
 
637
	/**
638
	 * @param integer radius of the circular HotSpot region.
639
	 */
640
	public function setRadius($value)
641
	{
642
		$this->setViewState('Radius',TPropertyValue::ensureInteger($value),0);
643
	}
644
 
645
	/**
646
	 * @return integer the X coordinate of the center of the circular HotSpot region. Defaults to 0.
647
	 */
648
	public function getX()
649
	{
650
		return $this->getViewState('X',0);
651
	}
652
 
653
	/**
654
	 * @param integer the X coordinate of the center of the circular HotSpot region.
655
	 */
656
	public function setX($value)
657
	{
658
		$this->setViewState('X',TPropertyValue::ensureInteger($value),0);
659
	}
660
 
661
	/**
662
	 * @return integer the Y coordinate of the center of the circular HotSpot region. Defaults to 0.
663
	 */
664
	public function getY()
665
	{
666
		return $this->getViewState('Y',0);
667
	}
668
 
669
	/**
670
	 * @param integer the Y coordinate of the center of the circular HotSpot region.
671
	 */
672
	public function setY($value)
673
	{
674
		$this->setViewState('Y',TPropertyValue::ensureInteger($value),0);
675
	}
676
}
677
 
678
/**
679
 * Class TRectangleHotSpot.
680
 *
681
 * TRectangleHotSpot defines a rectangle hot spot region in a {@link
682
 * TImageMap} control.
683
 *
684
 * @author Qiang Xue <qiang.xue@gmail.com>
685
 * @version $Id: TImageMap.php 2541 2008-10-21 15:05:13Z qiang.xue $
686
 * @package System.Web.UI.WebControls
687
 * @since 3.0
688
 */
689
class TRectangleHotSpot extends THotSpot
690
{
691
	/**
692
	 * @return string shape of this hotspot.
693
	 */
694
	public function getShape()
695
	{
696
		return 'rect';
697
	}
698
 
699
	/**
700
	 * @return string coordinates defining this hotspot shape
701
	 */
702
	public function getCoordinates()
703
	{
704
		return $this->getLeft().','.$this->getTop().','.$this->getRight().','.$this->getBottom();
705
	}
706
 
707
	/**
708
	 * @return integer the Y coordinate of the bottom side of the rectangle HotSpot region. Defaults to 0.
709
	 */
710
	public function getBottom()
711
	{
712
		return $this->getViewState('Bottom',0);
713
	}
714
 
715
	/**
716
	 * @param integer the Y coordinate of the bottom side of the rectangle HotSpot region.
717
	 */
718
	public function setBottom($value)
719
	{
720
		$this->setViewState('Bottom',TPropertyValue::ensureInteger($value),0);
721
	}
722
 
723
	/**
724
	 * @return integer the X coordinate of the right side of the rectangle HotSpot region. Defaults to 0.
725
	 */
726
	public function getLeft()
727
	{
728
		return $this->getViewState('Left',0);
729
	}
730
 
731
	/**
732
	 * @param integer the X coordinate of the right side of the rectangle HotSpot region.
733
	 */
734
	public function setLeft($value)
735
	{
736
		$this->setViewState('Left',TPropertyValue::ensureInteger($value),0);
737
	}
738
 
739
	/**
740
	 * @return integer the X coordinate of the right side of the rectangle HotSpot region. Defaults to 0.
741
	 */
742
	public function getRight()
743
	{
744
		return $this->getViewState('Right',0);
745
	}
746
 
747
	/**
748
	 * @param integer the X coordinate of the right side of the rectangle HotSpot region.
749
	 */
750
	public function setRight($value)
751
	{
752
		$this->setViewState('Right',TPropertyValue::ensureInteger($value),0);
753
	}
754
 
755
	/**
756
	 * @return integer the Y coordinate of the top side of the rectangle HotSpot region. Defaults to 0.
757
	 */
758
	public function getTop()
759
	{
760
		return $this->getViewState('Top',0);
761
	}
762
 
763
	/**
764
	 * @param integer the Y coordinate of the top side of the rectangle HotSpot region.
765
	 */
766
	public function setTop($value)
767
	{
768
		$this->setViewState('Top',TPropertyValue::ensureInteger($value),0);
769
	}
770
}
771
 
772
/**
773
 * Class TPolygonHotSpot.
774
 *
775
 * TPolygonHotSpot defines a polygon hot spot region in a {@link
776
 * TImageMap} control.
777
 *
778
 * @author Qiang Xue <qiang.xue@gmail.com>
779
 * @version $Id: TImageMap.php 2541 2008-10-21 15:05:13Z qiang.xue $
780
 * @package System.Web.UI.WebControls
781
 * @since 3.0
782
 */
783
class TPolygonHotSpot extends THotSpot
784
{
785
	/**
786
	 * @return string shape of this hotspot.
787
	 */
788
	public function getShape()
789
	{
790
		return 'poly';
791
	}
792
 
793
	/**
794
	 * @return string coordinates of the vertices defining the polygon.
795
	 * Coordinates are concatenated together with comma ','. Each pair
796
	 * represents (x,y) of a vertex.
797
	 */
798
	public function getCoordinates()
799
	{
800
		return $this->getViewState('Coordinates','');
801
	}
802
 
803
	/**
804
	 * @param string coordinates of the vertices defining the polygon.
805
	 * Coordinates are concatenated together with comma ','. Each pair
806
	 * represents (x,y) of a vertex.
807
	 */
808
	public function setCoordinates($value)
809
	{
810
		$this->setViewState('Coordinates',$value,'');
811
	}
812
}
813
 
814
 
815
/**
816
 * THotSpotMode class.
817
 * THotSpotMode defines the enumerable type for the possible hot spot modes.
818
 *
819
 * The following enumerable values are defined:
820
 * - NotSet: the mode is not specified
821
 * - Navigate: clicking on the hotspot will redirect the browser to a different page
822
 * - PostBack: clicking on the hotspot will cause a postback
823
 * - Inactive: the hotspot is inactive (not clickable)
824
 *
825
 * @author Qiang Xue <qiang.xue@gmail.com>
826
 * @version $Id: TImageMap.php 2541 2008-10-21 15:05:13Z qiang.xue $
827
 * @package System.Web.UI.WebControls
828
 * @since 3.0.4
829
 */
830
class THotSpotMode extends TEnumerable
831
{
832
	const NotSet='NotSet';
833
	const Navigate='Navigate';
834
	const PostBack='PostBack';
835
	const Inactive='Inactive';
836
}
837