|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace eXpansion\Bundle\ImmersiveWindows\Model\Gui\Factory; |
|
4
|
|
|
|
|
5
|
|
|
use eXpansion\Bundle\Menu\DataProviders\MenuItemProvider; |
|
6
|
|
|
use eXpansion\Bundle\Menu\Gui\MenuTabsFactory; |
|
7
|
|
|
use eXpansion\Framework\Core\Model\Gui\Factory\WindowFrameFactory as OriginalWindowFrameFactory; |
|
8
|
|
|
use eXpansion\Framework\Core\Model\Gui\ManialinkInterface; |
|
9
|
|
|
use eXpansion\Framework\Core\Model\Gui\ManiaScriptFactory; |
|
10
|
|
|
use eXpansion\Framework\Core\Model\Gui\WindowFrameFactoryInterface; |
|
11
|
|
|
use eXpansion\Framework\Gui\Components\uiButton; |
|
12
|
|
|
use eXpansion\Framework\Gui\Ui\Factory; |
|
13
|
|
|
use FML\Controls\Frame; |
|
14
|
|
|
use FML\Controls\Label; |
|
15
|
|
|
use FML\Controls\Quad; |
|
16
|
|
|
use FML\ManiaLink; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Class WindowFrameFactory |
|
20
|
|
|
* |
|
21
|
|
|
* @author de Cramer Oliver<[email protected]> |
|
22
|
|
|
* @copyright 2017 Smile |
|
23
|
|
|
* @package eXpansion\Bundle\ImmersiveWindows\Model\Gui\Factory |
|
24
|
|
|
*/ |
|
25
|
|
|
class WindowFrameFactory extends OriginalWindowFrameFactory implements WindowFrameFactoryInterface |
|
26
|
|
|
{ |
|
27
|
|
|
/** @var MenuTabsFactory */ |
|
28
|
|
|
protected $menuTabsFactory; |
|
29
|
|
|
|
|
30
|
|
|
/** @var MenuItemProvider */ |
|
31
|
|
|
protected $menuItemProvider; |
|
32
|
|
|
/** |
|
33
|
|
|
* @var ManiaScriptFactory |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $maniaScriptFactory; |
|
36
|
|
|
/** |
|
37
|
|
|
* @var ManialinkInterface |
|
38
|
|
|
*/ |
|
39
|
|
|
protected $manialinkInterface; |
|
40
|
|
|
/** |
|
41
|
|
|
* @var Factory |
|
42
|
|
|
*/ |
|
43
|
|
|
protected $uiFactory; |
|
44
|
|
|
|
|
45
|
|
|
/** @var uiButton */ |
|
46
|
|
|
private $closeButton; |
|
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* WindowFrameFactory constructor. |
|
50
|
|
|
* |
|
51
|
|
|
* @param ManiaScriptFactory $maniaScriptFactory |
|
52
|
|
|
* @param MenuTabsFactory $menuTabsFactory |
|
53
|
|
|
* @param MenuItemProvider $menuItemProvider |
|
54
|
|
|
* @param Factory $uiFactory |
|
55
|
|
|
*/ |
|
56
|
|
|
public function __construct( |
|
57
|
|
|
ManiaScriptFactory $maniaScriptFactory, |
|
58
|
|
|
MenuTabsFactory $menuTabsFactory, |
|
59
|
|
|
MenuItemProvider $menuItemProvider, |
|
60
|
|
|
Factory $uiFactory |
|
61
|
|
|
) { |
|
62
|
|
|
parent::__construct($maniaScriptFactory); |
|
63
|
|
|
$this->maniaScriptFactory = $maniaScriptFactory; |
|
64
|
|
|
$this->menuTabsFactory = $menuTabsFactory; |
|
65
|
|
|
$this->menuItemProvider = $menuItemProvider; |
|
66
|
|
|
$this->uiFactory = $uiFactory; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @inheritdoc |
|
71
|
|
|
*/ |
|
72
|
|
|
public function build( |
|
73
|
|
|
ManiaLink $manialink, |
|
74
|
|
|
Frame $mainFrame, |
|
75
|
|
|
$name, |
|
76
|
|
|
$sizeX, |
|
77
|
|
|
$sizeY |
|
78
|
|
|
) { |
|
79
|
|
|
// Creating sub frame to keep all the pieces together. Position needs to be top left corner. |
|
80
|
|
|
$frame = new Frame(); |
|
81
|
|
|
$frame->setPosition(-160 - $mainFrame->getX(), 90 - $mainFrame->getY()); |
|
82
|
|
|
|
|
83
|
|
|
|
|
84
|
|
|
// Creating the tabs. |
|
85
|
|
|
$mainFrame->addChild( |
|
86
|
|
|
$this->menuTabsFactory->createTabsMenu( |
|
|
|
|
|
|
87
|
|
|
$this->manialinkInterface, |
|
88
|
|
|
$frame, |
|
89
|
|
|
$this->menuItemProvider->getRootItem(), |
|
|
|
|
|
|
90
|
|
|
'admin/admin' |
|
91
|
|
|
) |
|
92
|
|
|
); |
|
93
|
|
|
$mainFrame->addChild($frame); |
|
94
|
|
|
|
|
95
|
|
|
$closeButton = $this->uiFactory->createButton('Close', uiButton::TYPE_DECORATED); |
|
96
|
|
|
$closeButton->setBorderColor(uiButton::COLOR_WARNING)->setFocusColor(uiButton::COLOR_WARNING); |
|
97
|
|
|
$closeButton->setPosition(300, -20); |
|
98
|
|
|
$this->closeButton = $closeButton; |
|
99
|
|
|
$frame->addChild($closeButton); |
|
100
|
|
|
|
|
101
|
|
|
|
|
102
|
|
|
/* |
|
103
|
|
|
* Adding background frame |
|
104
|
|
|
*/ |
|
105
|
|
|
$bgFrame = Frame::create("background"); |
|
106
|
|
|
$quad = new Quad(); |
|
107
|
|
|
$quad->addClass("bg") |
|
108
|
|
|
->setId("mainBg") |
|
109
|
|
|
->setPosition(0, 0) |
|
110
|
|
|
->setSize(322, 182); |
|
111
|
|
|
$quad->setAlign("left", "top") |
|
112
|
|
|
->setStyles("Bgs1", "BgDialogBlur"); |
|
113
|
|
|
$bgFrame->addChild($quad); |
|
114
|
|
|
|
|
115
|
|
|
$frame->addChild($bgFrame); |
|
116
|
|
|
|
|
117
|
|
|
|
|
118
|
|
|
|
|
119
|
|
|
|
|
120
|
|
|
|
|
121
|
|
|
$manialink->addChild($this->maniaScriptFactory->createScript([''])); |
|
122
|
|
|
|
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* @param ManialinkInterface $manialinkInterface |
|
127
|
|
|
*/ |
|
128
|
|
|
public function setManialinkInterface(ManialinkInterface $manialinkInterface) |
|
129
|
|
|
{ |
|
130
|
|
|
$this->manialinkInterface = $manialinkInterface; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
public function setCloseAction($action) |
|
134
|
|
|
{ |
|
135
|
|
|
$this->closeButton->setAction($action); |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
} |
|
139
|
|
|
|