-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtogglebuttonmecs.cpp
More file actions
52 lines (43 loc) · 1.49 KB
/
togglebuttonmecs.cpp
File metadata and controls
52 lines (43 loc) · 1.49 KB
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
#include "togglebuttonmecs.h"
ToggleButtonMECS::ToggleButtonMECS(int x, int y):
ButtonMECS(x, y, false)
{
this->color = QColor(0, 0, 255);
m_onUpAction = new ItemAction();
m_onDownAction = new ItemAction();
}
QString ToggleButtonMECS::GetName()
{
return "ToggleButton";
}
QGridLayout *ToggleButtonMECS::GetPropertiesWidgets()
{
QGridLayout *layout = ButtonMECS::GetPropertiesWidgets();
layout->addWidget(new QLabel("On up action"), 3, 0, 1, 2);
layout->addLayout(m_onUpAction->GetLayout(), 4, 0, 1, 2);
layout->addWidget(new QLabel("On down action"), 5, 0, 1, 2);
layout->addLayout(m_onDownAction->GetLayout(), 6, 0, 1, 2);
return layout;
}
void ToggleButtonMECS::AcceptWidgetsProperties()
{
ButtonMECS::AcceptWidgetsProperties();
m_onUpActionString = m_onUpAction->ToString();
m_onDownActionString = m_onDownAction->ToString();
}
QString ToggleButtonMECS::Save()
{
return ButtonMECS::Save() +
QString("OnDown = %0\n" \
"OnUp = %1\n\n").arg(m_onDownActionString).arg(m_onUpActionString);
}
void ToggleButtonMECS::SetOnUpAction(QString commandType, QString target, QString command)
{
m_onUpAction->Init(commandType, target, command);
m_onUpActionString = commandType + " " + target + " " + command;
}
void ToggleButtonMECS::SetOnDownAction(QString commandType, QString target, QString command)
{
m_onDownAction->Init(commandType, target, command);
m_onDownActionString = commandType + " " + target + " " + command;
}