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
|
define.class( function(require, $ui$, view, label, menubutton){
this.bgcolor = "#585858"
this.flexdirection = "row"
this.attributes = {
errortext:"",
infotext: "",
statustext: "",
menus:[]
}
this.onstatustext = function(){
if (this.statustext && this.statustext.length > 0)
{
this.setTimeout(function(){this.statustext = ""}.bind(this), 4000);
}
}
this.render = function(){
if (!this.menus) return []
var mres = []
for(var m in this.menus){
var res = []
var menu = this.menus[m]
mres.push(
menubutton({
bgcolor:"#585858",
hovercolor1:"#737373",
hovercolor2:"#737373",
bold:false,
borderwidth:0,
borderradius:8,
margin:vec4(4,0,0,0),
padding:5,
text:menu.name,
commands: menu.commands,
click: function(){
this.screen.contextMenu(this.commands, this.layout.absx,this.layout.absy + this.layout.height);
}
}))
}
var labelres = []
if (this.errortext && this.errortext.length > 0 && this.errortext !== "undefined"){
labelres.push(label({margin:vec4(13,0,0,0), text:"ERROR", bold:true, fgcolor: "#e05f21", alignself:"center", bgcolor:NaN}));
labelres.push(label({margin:vec4(3,0,3,0), text:this.errortext, fgcolor: "#e05f21", alignself:"center", bgcolor:NaN}));
}
if (this.infotext && this.infotext.length > 0 && this.infotext !== "undefined"){
labelres.push(label({margin:vec4(13,0,0,0), text:"INFO", bold:true, fgcolor: "white", alignself:"center", bgcolor:NaN}));
labelres.push(label({margin:vec4(3,0,3,0),text:this.infotext, fgcolor: "white", alignself:"center", bgcolor:NaN}));
}
if (this.statustext && this.statustext.length > 0 && this.statustext !== "undefined"){
labelres.push(label({margin:vec4(13,0,4,0),text:this.statustext, fgcolor: "#d0d0d0", alignself:"center", bgcolor:NaN}));
}
return view({bgcolor:NaN, flex:1, justifycontent:"space-between" }, view({bgcolor:NaN,alignself:"center"},mres), view({bgcolor:NaN,alignself:"center"},labelres));
}
})
|