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

Method eventIsWithin

forms/control.cpp:1058–1075  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1056}
1057
1058bool Control::eventIsWithin(const Event *e) const
1059{
1060 if (e->type() == EVENT_MOUSE_MOVE || e->type() == EVENT_MOUSE_DOWN ||
1061 e->type() == EVENT_MOUSE_UP)
1062 {
1063 return (e->mouse().X >= resolvedLocation.x && e->mouse().X < resolvedLocation.x + Size.x &&
1064 e->mouse().Y >= resolvedLocation.y && e->mouse().Y < resolvedLocation.y + Size.y);
1065 }
1066 else if (e->type() == EVENT_FINGER_DOWN || e->type() == EVENT_FINGER_UP ||
1067 e->type() == EVENT_FINGER_MOVE)
1068 {
1069 return (e->finger().X >= resolvedLocation.x &&
1070 e->finger().X < resolvedLocation.x + Size.x &&
1071 e->finger().Y >= resolvedLocation.y && e->finger().Y < resolvedLocation.y + Size.y);
1072 }
1073 // Only mouse & finger events have a location to be within
1074 return false;
1075}
1076
1077void Control::pushFormEvent(FormEventType type, Event *parentEvent)
1078{

Callers 6

eventOccurredMethod · 0.80
eventOccurredMethod · 0.80
eventOccurredMethod · 0.80
eventOccurredMethod · 0.80
eventOccurredMethod · 0.80
eventOccurredMethod · 0.80

Calls 1

typeMethod · 0.80

Tested by

no test coverage detected