blob: 3f097b91b4b0d85b35869a2c4ce07be0f77c69ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
<?php
/**
* TDropContainer class file
*
* @author Christophe BOULAIN (Christophe.Boulain@gmail.com)
* @copyright Copyright © 2008, PradoSoft
* @license http://www.pradosoft.com/license
* @license http://www.pradosoft.com/license
* @package Prado\Web\UI\ActiveControls
*/
namespace Prado\Web\UI\ActiveControls;
use Prado\Prado;
use Prado\TPropertyValue;
use Prado\Web\Services\TPageService;
use Prado\Web\UI\TControl;
/**
* TDropContainerEventParameter class
*
* TDropContainerEventParameter encapsulate the parameter
* data for <b>OnDrop</b> event of TDropContainer components
*
* @author Christophe BOULAIN (Christophe.Boulain@ceram.fr)
* @copyright Copyright © 2008, PradoSoft
* @license http://www.pradosoft.com/license
* @package Prado\Web\UI\ActiveControls
*/
class TDropContainerEventParameter extends \Prado\TEventParameter
{
private $_dragElementId;
private $_screenX;
private $_screenY;
private $_offsetX;
private $_offsetY;
private $_clientX;
private $_clientY;
private $_shiftKey;
private $_ctrlKey;
private $_altKey;
public function __construct($dropParams)
{
$this->_dragElementId = $dropParams->DragElementID;
$this->_screenX = $dropParams->ScreenX;
$this->_screenY = $dropParams->ScreenY;
$this->_offsetX = isset($dropParams->OffsetX) ? $dropParams->OffsetX : false;
$this->_offsetY = isset($dropParams->OffsetY) ? $dropParams->OffsetY : false;
$this->_clientX = $dropParams->ClientX;
$this->_clientY = $dropParams->ClientY;
$this->_shiftKey = TPropertyValue::ensureBoolean($dropParams->ShiftKey);
$this->_ctrlKey = TPropertyValue::ensureBoolean($dropParams->CtrlKey);
$this->_altKey = TPropertyValue::ensureBoolean($dropParams->AltKey);
}
public function getDragElementId() { return $this->_dragElementId; }
public function getScreenX() { return $this->_screenX; }
public function getScreenY() { return $this->_screenY; }
public function getOffsetX() { return $this->_offsetX; }
public function geOffsetY() { return $this->_offsetY; }
public function getClientX() { return $this->_clientX; }
public function getClientY() { return $this->_clientY; }
public function getShiftKey() { return $this->_shiftKey; }
public function getCtrlKey() { return $this->_ctrlKey; }
public function getAltKey() { return $this->_altKey; }
/**
* GetDroppedControl
*
* Compatibility method to get the dropped control
* @return TControl dropped control, or null if not found
*/
public function getDroppedControl ()
{
$control=null;
$service=prado::getApplication()->getService();
if ($service instanceof TPageService)
{
// Find the control
// Warning, this will not work if you have a '_' in your control Id !
$dropControlId=str_replace(TControl::CLIENT_ID_SEPARATOR,TControl::ID_SEPARATOR,$this->_dragElementId);
$control=$service->getRequestedPage()->findControl($dropControlId);
}
return $control;
}
}
|