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); ofNotifyEvent(surfaceDraggedEvent, e, this);
} }
void Gui::notifyBackgroundPressed(ofMouseEventArgs & args){
GuiBackgroundEvent e;
e.args = args;
ofNotifyEvent(backgroundPressedEvent, e, this);
}
} // piMapper } // piMapper
} // ofx } // ofx

16
src/Application/Gui.h

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

Loading…
Cancel
Save