-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshowObject.cpp
More file actions
110 lines (84 loc) · 2 KB
/
showObject.cpp
File metadata and controls
110 lines (84 loc) · 2 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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include "buttonEvent.h"
#include "MouseDropEvent.h"
#include "mouseEvent.h"
#include "mouseWheelEvent.h"
#include "paintEvent.h"
#include "showObject.h"
ShowObject::ShowObject(ShowObject* parent) : Object(parent)
{
if (parent)
parent->addShowList(this);
}
ShowObject::~ShowObject()
{
}
/**
* @brief 将对象加到展示列表中,会一直向上追到最父一级的showlist
* @param toAddObject 要添加的对象
*/
void ShowObject::addShowList(ShowObject* toAddObject) {
m_showChildList.push_back(toAddObject);
}
/**
* @brief 返回展示列表
* @return 展示列表引用
*/
std::vector<ShowObject*>& ShowObject::getShowList() {
return m_showChildList;
}
bool ShowObject::eventLoop(Event* event)
{
switch (event->getType()) {
case Event::EventType::LBUTTONDOWN:
case Event::EventType::RBUTTONDOWN:
mousePressEvent(static_cast<MouseEvent*>(event));
break;
case Event::EventType::LBUTTONUP:
case Event::EventType::RBUTTONUP:
mouseReleaseEvent(static_cast<MouseEvent*>(event));
break;
case Event::EventType::MOUSEMOVE:
mouseMoveEvent(static_cast<MouseEvent*>(event));
break;
case Event::EventType::BUTTON_CLICK:
case Event::EventType::BUTTON_DBLCLK:
buttonPressEvent(static_cast<ButtonEvent*>(event));
break;
case Event::EventType::PAINTEVENT:
paintEvent(static_cast<PaintEvent*>(event));
break;
case Event::EventType::MOUSEDROP:
mouseDropEvent(static_cast<MouseDropEvent*>(event));
break;
case Event::EventType::MOUSE_WHEEL:
mouseWheelEvent(static_cast<MouseWheelEvent*>(event));
break;
}
return Object::eventLoop(event);
}
void ShowObject::showChildren()
{
for (auto x : m_showChildList)
x->show();
}
void ShowObject::mousePressEvent(MouseEvent* event)
{
}
void ShowObject::mouseMoveEvent(MouseEvent* event)
{
}
void ShowObject::mouseReleaseEvent(MouseEvent* event)
{
}
void ShowObject::paintEvent(PaintEvent* event)
{
}
void ShowObject::buttonPressEvent(ButtonEvent* event)
{
}
void ShowObject::mouseDropEvent(MouseDropEvent* event)
{
}
void ShowObject::mouseWheelEvent(MouseWheelEvent* event)
{
}