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
|
define.class(function(require, $ui$, view, label, button, scrollbar, textbox, icon){
this.attributes ={
values: Config({type:Object, value:[]}),
currentvalue: Config({type:String, value:""}),
fgcolor: Config({type:vec4, value:vec4("white"), meta:"color"}),
fontsize: Config({type: float, value: 12, meta:"fontsize"})
}
this.flexdirection = "row"
this.bgcolor = "#262626";
this.title = ""
this.borderradius = 5;
this.render = function(){
var res = [];
if (this.title && this.title.length > 0){
res.push(
view({bgcolor:this.bordercolor, margin:0,borderradius:vec4(4,1,1,4), padding:4},
label({name:"thetitle", margin:vec4(5,0,5,0),align:"right", bgcolor:NaN,text:this.title,flex:1, fontsize: this.fontsize, fgcolor:this.fgcolor})
)
)
}
var radio = this;
for(var i =0 ;i<this.values.length;i++)
{
var v = (this.values[i])?this.values[i].toString():"undefined";
if (v == this.currentvalue || ((v==undefined || v=="undefined") && !this.currentvalue)){
res.push(
view({
alignitems:"center",
bgcolor:"#3b3b3b",
padding:2,
borderradius: (i == this.values.length -1)?vec4(1,4,4,1):vec4(1),
margin:(i == this.values.length -1)?vec4(2,2,2,0):vec4(2,2,0,2)
},
label({
bold: true,
text:(v&&v.trim().length > 0)?v:"undefined",
bgcolor:NaN,
margin: vec4(5,0,5,0),
fgcolor:this.fgcolor,
fontsize:this.fontsize
}
)
)
)
}
else{
res.push(button({
bgcolor:"#3b3b3b",
borderwidth:0,
padding:2,
buttoncolor1: "#3b3b3b",
buttoncolor2: "#3b3b3b",
internalmargin: vec4(5,0,5,0),
borderradius: (i == this.values.length -1)?vec4(1,4,4,1):vec4(1),
margin:(i == this.values.length -1)?vec4(2,2,2,2):vec4(2,2,0,2),
fgcolor:"#909090",
bold: false,
text:(v===undefined)?"unD": ((v.trim().length > 0)?v:"AAA"), pointerstart:function(){
radio.currentvalue = (this.text=="undefined" ||this.text=="unD") ? undefined:this.text;
},fontsize:this.fontsize
}))
}
}
return res;
}
})
|