|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace eXpansion\Bundle\Acme\Plugins\Gui; |
|
4
|
|
|
|
|
5
|
|
|
use eXpansion\Framework\Core\Model\Gui\ManialinkInterface; |
|
6
|
|
|
use eXpansion\Framework\Core\Plugins\Gui\WindowFactory as BaseWindowFactory; |
|
7
|
|
|
use eXpansion\Framework\Gui\Components\uiButton; |
|
8
|
|
|
use eXpansion\Framework\Gui\Components\uiCheckbox; |
|
9
|
|
|
use eXpansion\Framework\Gui\Components\uiDropdown; |
|
10
|
|
|
use eXpansion\Framework\Gui\Components\uiLabel; |
|
11
|
|
|
use eXpansion\Framework\Gui\Components\uiLine; |
|
12
|
|
|
use eXpansion\Framework\Gui\Components\uiTooltip; |
|
13
|
|
|
use eXpansion\Framework\Gui\Layouts\layoutLine; |
|
14
|
|
|
use eXpansion\Framework\Gui\Layouts\layoutRow; |
|
15
|
|
|
use FML\Controls\Quad; |
|
16
|
|
|
use FML\Script\Features\Tooltip; |
|
17
|
|
|
|
|
18
|
|
|
class WindowFactory extends BaseWindowFactory |
|
19
|
|
|
{ |
|
20
|
|
|
|
|
21
|
|
|
protected function createContent(ManialinkInterface $manialink) |
|
22
|
|
|
{ |
|
23
|
|
|
parent::createContent($manialink); |
|
24
|
|
|
|
|
25
|
|
|
$tooltip = new uiTooltip(); |
|
26
|
|
|
$manialink->addChild($tooltip); |
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
$label = new uiLabel("Test", uiLabel::TYPE_NORMAL); |
|
30
|
|
|
$tooltip->addTooltip($label, "tooltip test"); |
|
31
|
|
|
|
|
32
|
|
|
$manialink->addChild($label); |
|
33
|
|
|
|
|
34
|
|
|
$checkbox = new uiCheckbox("test checkbox 1", "checkbox1"); |
|
35
|
|
|
$tooltip->addTooltip($checkbox, "testing 123"); |
|
36
|
|
|
|
|
37
|
|
|
$checkbox2 = new uiCheckbox("test checkbox 2", "checkbox2"); |
|
38
|
|
|
$tooltip->addTooltip($checkbox2, "testing"); |
|
39
|
|
|
$line1 = new layoutRow(0, 0, [$checkbox, $checkbox2], 0); |
|
|
|
|
|
|
40
|
|
|
|
|
41
|
|
|
$ok = new uiButton("Apply", uiButton::TYPE_DECORATED); |
|
42
|
|
|
$tooltip->addTooltip($ok, "ridicolously long description text is here!"); |
|
43
|
|
|
$ok->setAction($this->actionFactory->createManialinkAction($manialink, [$this, 'ok'], ["ok" => "ok"])); |
|
44
|
|
|
|
|
45
|
|
|
$cancel = new uiButton("Cancel"); |
|
46
|
|
|
$cancel->setAction($this->actionFactory->createManialinkAction($manialink, [$this, 'ok'], ["ok" => "cancel"])); |
|
47
|
|
|
|
|
48
|
|
|
$line2 = new layoutLine(0, 0, [$ok, $cancel], 1); |
|
|
|
|
|
|
49
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
$line3 = new layoutRow(55, 0, [], 1); |
|
52
|
|
|
|
|
53
|
|
|
for ($x = 0; $x < 10; $x++) { |
|
54
|
|
|
$btn = new uiCheckbox('box'.$x, 'cb_'.$x); |
|
55
|
|
|
$line3->addChild($btn); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
$manialink->addChild($line3); |
|
59
|
|
|
|
|
60
|
|
|
$row = new layoutRow(0, -10, [$line1, $line2], 0); |
|
|
|
|
|
|
61
|
|
|
$manialink->addChild($row); |
|
62
|
|
|
|
|
63
|
|
|
|
|
64
|
|
|
$dropdown = new uiDropdown("dropdown", ["option1" => 1, "option2" => 2]); |
|
65
|
|
|
$dropdown->setPosition(0, -30); |
|
66
|
|
|
$manialink->addChild($dropdown); |
|
67
|
|
|
|
|
68
|
|
|
$dropdown = new uiDropdown("style", ["tech" => "tech", "fullspeed" => "fullspeed", "speedtech" => "speedtech"]); |
|
69
|
|
|
$dropdown->setPosition(40, -30); |
|
70
|
|
|
$manialink->addChild($dropdown); |
|
71
|
|
|
|
|
72
|
|
|
|
|
73
|
|
|
$quad = new Quad(); |
|
74
|
|
|
$quad->setPosition(20, -40) |
|
75
|
|
|
->setAlign("center", "center") |
|
76
|
|
|
->setSize(2,2) |
|
77
|
|
|
->setBackgroundColor("0f0"); |
|
78
|
|
|
$manialink->addChild($quad); |
|
79
|
|
|
|
|
80
|
|
|
$quad = new Quad(); |
|
81
|
|
|
$quad->setPosition(40, -20) |
|
82
|
|
|
->setAlign("center", "center") |
|
83
|
|
|
->setSize(2,2) |
|
84
|
|
|
->setBackgroundColor("0ff"); |
|
85
|
|
|
$manialink->addChild($quad); |
|
86
|
|
|
|
|
87
|
|
|
$line = new uiLine(20.1, -40); |
|
88
|
|
|
$line->to(20.1, 0); |
|
89
|
|
|
$manialink->addChild($line); |
|
90
|
|
|
|
|
91
|
|
|
$line = new uiLine(20, -40); |
|
92
|
|
|
$line->to(40, -20); |
|
93
|
|
|
|
|
94
|
|
|
$manialink->addChild($line); |
|
95
|
|
|
|
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
|
|
99
|
|
|
public function ok($login, $params, $args) |
|
100
|
|
|
{ |
|
101
|
|
|
var_dump($login); |
|
|
|
|
|
|
102
|
|
|
print_r($params); |
|
103
|
|
|
print_r($args); |
|
104
|
|
|
|
|
105
|
|
|
|
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
|
|
109
|
|
|
} |
|
110
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: