-
Notifications
You must be signed in to change notification settings - Fork 1
/
UserInterface.pde
55 lines (45 loc) · 1.39 KB
/
UserInterface.pde
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
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// The user interface control of the program
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
class UserInterface {
// The tree of buttons
ButtonTree buttonTree;
// The view, data, stats button group
String [] topTexts = {
"data", "view", "stats"
};
String [] dataTexts = {
"select folder"
};
String [] viewTexts = {
"mesh on/off", "overlay on/off", "reset camera"
};
String [] statsTexts = {
"change difference measure", "change number of bins", "change distribution"
};
//--- Constructor ---//
UserInterface() {
buttonTree = new ButtonTree(int(width*.5), 10);
buttonTree.addTopLevel(topTexts);
buttonTree.addSecondLevel(topTexts[0], dataTexts);
buttonTree.addSecondLevel(topTexts[1], viewTexts);
buttonTree.addSecondLevel(topTexts[2], statsTexts);
}
//--- Draw the user interface ---//
void draw() {
buttonTree.draw();
}
//--- Mouse pressed events ---//
void mousePressed() {
// forward mouse pressed to the tree
buttonTree.mousePressed();
// check if the data button was pushed
if (buttonTree.getButton("select folder").buttonOver()){
selectFolder("Select a folder to process:", "folderSelectedAction");
}
}
//--- Deselect all UI buttons ---//
void deselectAll(){
buttonTree.deselectAll();
}
}