MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / eventOccured

Method eventOccured

forms/control.cpp:100–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void Control::eventOccured(Event *e)
101{
102 for (auto ctrlidx = Controls.rbegin(); ctrlidx != Controls.rend(); ctrlidx++)
103 {
104 auto c = *ctrlidx;
105 if (c->Visible && c->Enabled)
106 {
107 c->eventOccured(e);
108 if (e->Handled)
109 {
110 return;
111 }
112 }
113 }
114
115 if (e->type() == EVENT_MOUSE_MOVE || e->type() == EVENT_MOUSE_DOWN ||
116 e->type() == EVENT_MOUSE_UP || e->type() == EVENT_MOUSE_SCROLL)
117 {
118 bool newInside = isPointInsideControlBounds(e->mouse().X, e->mouse().Y);
119 // (e->mouse().X >= resolvedLocation.x && e->mouse().X < resolvedLocation.x + Size.x &&
120 // e->mouse().Y >= resolvedLocation.y && e->mouse().Y < resolvedLocation.y + Size.y);
121
122 if (e->type() == EVENT_MOUSE_MOVE || e->type() == EVENT_MOUSE_SCROLL)
123 {
124 if (newInside)
125 {
126 if (!mouseInside)
127 {
128 this->pushFormEvent(FormEventType::MouseEnter, e);
129 }
130 this->pushFormEvent(FormEventType::MouseMove, e);
131 e->Handled = true;
132 }
133 else
134 {
135 if (mouseInside)
136 {
137 this->pushFormEvent(FormEventType::MouseLeave, e);
138 mouseDepressed = false;
139 }
140 }
141 }
142
143 if (e->type() == EVENT_MOUSE_DOWN)
144 {
145 if (newInside)
146 {
147 this->pushFormEvent(FormEventType::MouseDown, e);
148 mouseDepressed = true;
149 if (isClickable)
150 {
151 e->Handled = true;
152 }
153 }
154 }
155
156 if (e->type() == EVENT_MOUSE_UP)
157 {

Callers

nothing calls this directly

Calls 13

pushFormEventMethod · 0.95
splitFunction · 0.85
typeMethod · 0.80
emptyMethod · 0.80
toolTipStartTimerMethod · 0.80
toolTipStopTimerMethod · 0.80
showToolTipMethod · 0.80
getStringMethod · 0.45
getFontHeightMethod · 0.45
sizeMethod · 0.45
drawFilledRectMethod · 0.45
drawRectMethod · 0.45

Tested by

no test coverage detected