-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpushPotGUI.cpp
58 lines (39 loc) · 1.45 KB
/
pushPotGUI.cpp
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
#include "pushPotGUI.h"
#include <drawObj.h>
// This on is to be called for setting the controller.
void setControlPtr(pushPotGUI* newController) {
controlPtr = newController; // The up and coming..
if (controlPtr) { // If we're actually passed in something.
controlPtr->gainControl(); // Tell 'em they got the wheel!
}
}
// Send the pot val to whomever is the current controller.
// Returns false if theris no controller. True if there is one.
// Don't have a clue as to what it will do with it.
bool potVal(int aVal) {
if (controlPtr) { // Check for NULL..
controlPtr->doPotVal(aVal); // Try this on for size..
return true;
}
return false;
}
// Send the button click to whomever has current focus.
// Returns false if theris no one with focus. True if there
// was one. Don't have a clue as to what it will do with it.
bool buttonClick(void) {
if (currentFocus) {
currentFocus->doAction();
return true;
}
return false;
}
pushPotGUI* controlPtr = NULL;
pushPotGUI::pushPotGUI(void) { }
pushPotGUI::~pushPotGUI(void) { if (controlPtr==this) setControlPtr(NULL); }
// Stuff to do when we're started or restarted.
void pushPotGUI::reset(void) { }
// Notifyer, you have the wheel now, take appropriate action.
void pushPotGUI::gainControl(void) { }
// Calliing program sends us in raw pot values.
// I guess we're the controller.
void pushPotGUI::doPotVal(int aVal) { }