-
Notifications
You must be signed in to change notification settings - Fork 1
/
ScrolledCheckbox.pde
56 lines (49 loc) · 1.24 KB
/
ScrolledCheckbox.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
56
color checkboxColor2 = 255;
class ScrolledCheckbox extends View {
boolean value;
color ckbColor = -1;
PImage icon;
String title;
color iconColor = -1;
PImage unchecked;
PImage checked;
int sized = 0;
public Integrator interpolar;
public int cutoff;
ScrolledCheckbox(float x_, float y_,int w_, int h_,PImage checked, PImage unchecked, String text_,boolean value, Integrator i, int cutoff){
super(x_, y_,w_,h_);
title = text_;
this.value = value;
this.checked = checked;
this.unchecked = unchecked;
this.interpolar = i;
this.cutoff = cutoff;
}
void drawContent()
{
// strokeWeight(1);
if(checked != null && unchecked != null){
//System.out.println("Drawing Checkbox");
// textFont(fbold);
fill(255);
text(title, w+70, interpolar.value+cutoff+20);
// textFont(f2);
if(value){
//checked.resize(0,sized);
image(checked,0,interpolar.value+cutoff,w,h);
}else{
//unchecked.resize(0,sized);
image(unchecked,0,interpolar.value+cutoff,w,h);
}
}
}
boolean contentClicked(float lx, float ly)
{
value = !value;
// println(value);
return true;
}
void setValue(Boolean _value){
value = _value;
}
}