2012-02-13 18:13:57 -05:00
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const Pango = imports.gi.Pango;
|
|
|
|
const St = imports.gi.St;
|
|
|
|
|
|
|
|
const Lang = imports.lang;
|
|
|
|
|
2017-07-18 13:41:25 -04:00
|
|
|
var CheckBox = new Lang.Class({
|
2012-02-13 18:13:57 -05:00
|
|
|
Name: 'CheckBox',
|
|
|
|
|
|
|
|
_init: function(label) {
|
2013-07-11 10:09:54 -04:00
|
|
|
let container = new St.BoxLayout();
|
2012-02-13 18:13:57 -05:00
|
|
|
this.actor = new St.Button({ style_class: 'check-box',
|
2013-07-11 10:09:54 -04:00
|
|
|
child: container,
|
2012-02-13 18:13:57 -05:00
|
|
|
button_mask: St.ButtonMask.ONE,
|
|
|
|
toggle_mode: true,
|
|
|
|
can_focus: true,
|
|
|
|
x_fill: true,
|
|
|
|
y_fill: true });
|
2013-07-11 10:09:54 -04:00
|
|
|
|
|
|
|
this._box = new St.Bin();
|
|
|
|
this._box.set_y_align(Clutter.ActorAlign.START);
|
|
|
|
container.add_actor(this._box);
|
|
|
|
|
|
|
|
this._label = new St.Label();
|
|
|
|
this._label.clutter_text.set_line_wrap(true);
|
|
|
|
this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE);
|
|
|
|
container.add_actor(this._label);
|
2012-02-13 18:13:57 -05:00
|
|
|
|
|
|
|
if (label)
|
|
|
|
this.setLabel(label);
|
|
|
|
},
|
|
|
|
|
|
|
|
setLabel: function(label) {
|
2013-07-11 10:09:54 -04:00
|
|
|
this._label.set_text(label);
|
2012-02-29 03:50:22 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
getLabelActor: function() {
|
2013-07-11 10:09:54 -04:00
|
|
|
return this._label;
|
2012-02-13 18:13:57 -05:00
|
|
|
}
|
|
|
|
});
|