From 8bec40d8db10a88094131fe19a64ddf9d78d290b Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Mon, 15 Feb 2016 17:31:40 +0100 Subject: [PATCH] Add `backgroundPressedEvent` --- src/Application/Gui.cpp | 6 ++++++ src/Application/Gui.h | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/Application/Gui.cpp b/src/Application/Gui.cpp index 5afea42..a4d10c7 100644 --- a/src/Application/Gui.cpp +++ b/src/Application/Gui.cpp @@ -61,5 +61,11 @@ void Gui::notifySurfaceDragged(ofMouseEventArgs & args, BaseSurface * surface){ ofNotifyEvent(surfaceDraggedEvent, e, this); } +void Gui::notifyBackgroundPressed(ofMouseEventArgs & args){ + GuiBackgroundEvent e; + e.args = args; + ofNotifyEvent(backgroundPressedEvent, e, this); +} + } // piMapper } // ofx \ No newline at end of file diff --git a/src/Application/Gui.h b/src/Application/Gui.h index 1c611a5..f8859b6 100644 --- a/src/Application/Gui.h +++ b/src/Application/Gui.h @@ -12,6 +12,13 @@ struct GuiEvent{ int type; }; +// TODO: compress the following structs into something like: +// struct GuiEvent{ +// ofMouseEventArgs args; +// GuiObject obj; +// }; +// It could be then possible to check the object in question +// to decide what to do next. struct GuiJointEvent{ ofMouseEventArgs args; int jointIndex; @@ -22,6 +29,10 @@ struct GuiSurfaceEvent{ BaseSurface * surface; }; +struct GuiBackgroundEvent{ + ofMouseEventArgs args; +}; + class Gui { public: static Gui * instance(); @@ -29,6 +40,7 @@ class Gui { ofEvent event; void notifyEvent(ofMouseEventArgs & args); + // TODO: combine the following events into one ofEvent jointPressedEvent; ofEvent jointReleasedEvent; ofEvent jointDraggedEvent; @@ -45,6 +57,10 @@ class Gui { void notifySurfaceReleased(ofMouseEventArgs & args, BaseSurface * surface); void notifySurfaceDragged(ofMouseEventArgs & args, BaseSurface * surface); + ofEvent backgroundPressedEvent; + + void notifyBackgroundPressed(ofMouseEventArgs & args); + private: static Gui * _instance; };