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

Method eventOccured

forms/graphicbutton.cpp:38–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38void GraphicButton::eventOccured(Event *e)
39{
40 Control::eventOccured(e);
41
42 if (e->type() == EVENT_FORM_INTERACTION && e->forms().RaisedBy == shared_from_this() &&
43 e->forms().EventFlag == FormEventType::MouseDown)
44 {
45 if (buttonclick)
46 {
47 fw().soundBackend->playSample(buttonclick);
48 }
49 }
50
51 if (e->type() == EVENT_FORM_INTERACTION && e->forms().RaisedBy == shared_from_this() &&
52 e->forms().EventFlag == FormEventType::MouseClick)
53 {
54 this->pushFormEvent(FormEventType::ButtonClick, e);
55
56 if (ScrollBarPrev != nullptr)
57 {
58 ScrollBarPrev->scrollPrev();
59 }
60
61 if (ScrollBarNext != nullptr)
62 {
63 ScrollBarNext->scrollNext();
64 }
65
66 if (ScrollBarPrevHorizontal != nullptr)
67 {
68 ScrollBarPrevHorizontal->scrollPrev(1);
69 }
70
71 if (ScrollBarNextHorizontal != nullptr)
72 {
73 ScrollBarNextHorizontal->scrollNext(1);
74 }
75 }
76}
77
78void GraphicButton::onRender()
79{

Callers

nothing calls this directly

Calls 5

typeMethod · 0.80
pushFormEventMethod · 0.80
scrollPrevMethod · 0.80
scrollNextMethod · 0.80
playSampleMethod · 0.45

Tested by

no test coverage detected