-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxLib_MainPanel.pde
More file actions
151 lines (122 loc) · 2.36 KB
/
Copy pathxLib_MainPanel.pde
File metadata and controls
151 lines (122 loc) · 2.36 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
class MainPanel
{
ArrayList<GUIPanel> panels = new ArrayList<GUIPanel>();
String activeTab = "";
MainPanel()
{
}
void addTab(GUIPanel panel)
{
panels.add(panel);
}
void Init()
{
// must be called after addTabs
for (GUIPanel panel : panels)
{
panel.Init();
panel.setupControls();
}
}
void setGUIValues()
{
for (GUIPanel panel : panels)
{
panel.setGUIValues();
}
}
void update_ui()
{
// update all changes in data to controller thats are not user inputs
// like labels
// or show hide controls depending on a status
if (!data.any_change() && !data.need_update_ui )
return;
for (GUIPanel panel : panels)
{
panel.update_ui();
}
}
void draw()
{
// checks if it's not an export
if (_record)
return;
for (GUIPanel panel : panels)
{
panel.draw();
}
}
void set_key_move(PVector key_move)
{
this.key_move = key_move;
}
PVector key_move = new PVector(0, 0) ;
// key move is sent to active tab
boolean checkKeyMove( )
{
// could be overriden
return false;
}
GUIPanel dragging_panel;
void mousePressed()
{
if (cp5.isMouseOver())
return;
//println("mouse pressed " + mouseX);
for (GUIPanel panel : panels)
{
if (!panel.tab.isActive())
continue;
if (panel.mousePressed())
{
dragging_panel = panel;
return;
}
}
// if not check the non active panel
for (GUIPanel panel : panels)
{
if (panel.tab.isActive())
continue;
if (panel.mousePressed())
{
dragging_panel = panel;
cp5.getTab(dragging_panel.pageName).bringToFront();
return;
}
}
}
void mouseDragged()
{
if (dragging_panel != null)
{
dragging_panel.mouseDragged();
}
}
void mouseReleased() {
if (dragging_panel != null)
{
dragging_panel.mouseReleased();
dragging_panel = null;
}
}
void mouseWheel(processing.event.MouseEvent event)
{
// optional override in subclasses
if (event == null)
return;
}
}
void mousePressed() {
dataGui.mousePressed();
}
void mouseDragged() {
dataGui.mouseDragged();
}
void mouseReleased() {
dataGui.mouseReleased();
}
void mouseWheel(processing.event.MouseEvent event) {
dataGui.mouseWheel(event);
}