-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSidebar.pde
55 lines (44 loc) · 1.05 KB
/
Sidebar.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
55
/**
* Dispaly the sidebar for the bank app
* whitch contains Accounts registered in the bank and at the bottom a button to add a new user
*/
public class Sidebar extends Obj {
public static final int w = 350;
public static final color c = #d4d4d4;
AccountDrawer accDrawer;
NewAccBtn newAccBtn;
protected void _update() {
checkBtns();
drawBg();
drawAccounts();
newAccBtn.update();
}
private void drawBg() {
fill(c);
shapeMode(CORNERS);
rect(0, 0, w, v.h);
}
private void drawAccounts() {
for (int i=0; i < v.accounts.size(); i++) {
accDrawer.draw(i);
}
}
public void _setup() {
accDrawer = new AccountDrawer(app);
newAccBtn = new NewAccBtn(app);
newAccBtn.setup();
}
public void mousePressed() {
for (int i=0; i < v.accounts.size(); i++) {
accDrawer.mousePressed(i);
}
newAccBtn.mousePressed();
}
public void checkBtns() {
if (newAccBtn.clicked) {
v.newAcc = true;
println("clicked");
}
}
public Sidebar(BankApp app) { super(app); }
}