forked from chaosct/ofxPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathofxPythonCallBack.h
More file actions
34 lines (28 loc) · 965 Bytes
/
Copy pathofxPythonCallBack.h
File metadata and controls
34 lines (28 loc) · 965 Bytes
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
#pragma once
#include "ofMain.h"
#include "ofxPythonCallBackBase.h"
class ofxPythonObject;
//we can convert a CallBack* to a ofxPythonObject with this method
ofxPythonObject CallBack2Python(CallBack * c);
//Subclass this to get positional and keyword arguments in your callback
class ofxPythonCallBack: public CallBack
{
public:
void _call();
virtual void call(ofxPythonObject args, ofxPythonObject kwargs)=0;
virtual ~ofxPythonCallBack(){}
};
//use this to send a free function as a callback
class ofxPythonCallBackSimple : public ofxPythonCallBack{
public:
void (*cb)();
void call(ofxPythonObject args, ofxPythonObject kwargs);
};
//use this to register a callback with one argument to a ofEvent<ofxPythonObject>
class ofxPythonCallBackEvent1Arg : public ofxPythonCallBack{
public:
typedef ofEvent<ofxPythonObject> EventType;
EventType & event;
ofxPythonCallBackEvent1Arg( EventType & e);
void call(ofxPythonObject args, ofxPythonObject kwargs);
};