-
Notifications
You must be signed in to change notification settings - Fork 0
/
ofxJFEvent.h
68 lines (48 loc) · 1.99 KB
/
ofxJFEvent.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// ofxJFcontroller.h
// jfGui
//
// Created by João Fonseca on 03/04/15.
//
//
#pragma once
#include "ofMain.h"
class ofxJFEvent {
public:
ofxJFEvent();
virtual ~ofxJFEvent();
void setEventArea(ofPoint _location, ofVec2f _size);
bool hitTest(int tx, int ty) const;
virtual bool hitTest(int tx, int ty, int w, int h) const;
void enableMouseEvents();
void disableMouseEvents();
void enableKeyEvents();
void disableKeyEvents();
// you shouldn't need access to any of these unless you know what you are doing
// (i.e. disable auto updates and call these manually)
/*§
void _setup(ofEventArgs &e);
void _update(ofEventArgs &e);
void _draw(ofEventArgs &e);
void _exit(ofEventArgs &e);
*/
bool clickedTwice();
void _mouseMoved(ofMouseEventArgs &e);
void _mousePressed(ofMouseEventArgs &e);
void _mouseDragged(ofMouseEventArgs &e);
void _mouseReleased(ofMouseEventArgs &e);
void _keyPressed(ofKeyEventArgs &e);
void _keyReleased(ofKeyEventArgs &e);
// these are called when the relevant event occurs without caring where it actually happened
// i.e. its the raw event
virtual void mouseMoved(int x, int y) {} // called when mouse moves anywhere
virtual void mousePressed(int x, int y, int button) {} // called when mouse pressed anywhere
virtual void mouseDragged(int x, int y, int button) {} // called when mouse dragged anywhere
virtual void mouseReleased(int x, int y, int button) {} // called when mouse released anywhere
virtual void doubleClick(int x, int y, int button) {} // called when mouse released anywhere
virtual void keyPressed(int key) {} // called when keypressed anywhere
virtual void keyReleased(int key) {} // called when keyreleased anywhere
ofPoint location;
ofVec2f size;
float lastClick;
};