Browse Source

Add `backgroundPressedEvent`

master
Krisjanis Rijnieks 9 years ago
parent
commit
8bec40d8db
  1. 6
      src/Application/Gui.cpp
  2. 16
      src/Application/Gui.h

6
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

16
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 <GuiEvent> event;
void notifyEvent(ofMouseEventArgs & args);
// TODO: combine the following events into one
ofEvent <GuiJointEvent> jointPressedEvent;
ofEvent <GuiJointEvent> jointReleasedEvent;
ofEvent <GuiJointEvent> jointDraggedEvent;
@ -45,6 +57,10 @@ class Gui {
void notifySurfaceReleased(ofMouseEventArgs & args, BaseSurface * surface);
void notifySurfaceDragged(ofMouseEventArgs & args, BaseSurface * surface);
ofEvent <GuiBackgroundEvent> backgroundPressedEvent;
void notifyBackgroundPressed(ofMouseEventArgs & args);
private:
static Gui * _instance;
};

Loading…
Cancel
Save