forked from corecoding/Vitals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
menuItemLegacy.js
54 lines (43 loc) · 1.24 KB
/
menuItemLegacy.js
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
const Lang = imports.lang;
const St = imports.gi.St;
const PopupMenu = imports.ui.popupMenu;
var MenuItem = new Lang.Class({
Name: 'MenuItem',
Extends: PopupMenu.PopupBaseMenuItem,
_init: function(icon, key, label, value) {
this.parent();
this._checked = false;
this._key = key;
this._gIcon = icon;
this._labelActor = new St.Label({ text: label });
this.actor.add(new St.Icon({ style_class: 'popup-menu-icon', gicon : this._gIcon }));
this.actor.add(this._labelActor, { x_fill: true, expand: true });
this._valueLabel = new St.Label({ text: value });
this.actor.add(this._valueLabel);
},
set checked(checked) {
if (checked)
this.setOrnament(PopupMenu.Ornament.CHECK);
else
this.setOrnament(PopupMenu.Ornament.NONE);
this._checked = checked;
},
get checked() {
return this._checked;
},
get key() {
return this._key;
},
set display_name(text) {
return this._labelActor.text = text;
},
get gicon() {
return this._gIcon;
},
set value(value) {
this._valueLabel.text = value;
},
get value() {
return this._valueLabel.text;
}
});