2012-02-13 23:13:57 +00:00
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const Pango = imports.gi.Pango;
|
|
|
|
const St = imports.gi.St;
|
|
|
|
|
2017-10-31 01:19:44 +00:00
|
|
|
var CheckBox = class CheckBox {
|
|
|
|
constructor(label) {
|
2013-07-11 14:09:54 +00:00
|
|
|
let container = new St.BoxLayout();
|
2012-02-13 23:13:57 +00:00
|
|
|
this.actor = new St.Button({ style_class: 'check-box',
|
2013-07-11 14:09:54 +00:00
|
|
|
child: container,
|
2012-02-13 23:13:57 +00:00
|
|
|
button_mask: St.ButtonMask.ONE,
|
|
|
|
toggle_mode: true,
|
|
|
|
can_focus: true,
|
|
|
|
x_fill: true,
|
|
|
|
y_fill: true });
|
2013-07-11 14:09:54 +00: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 23:13:57 +00:00
|
|
|
|
|
|
|
if (label)
|
|
|
|
this.setLabel(label);
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2012-02-13 23:13:57 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
setLabel(label) {
|
2013-07-11 14:09:54 +00:00
|
|
|
this._label.set_text(label);
|
2017-10-31 01:19:44 +00:00
|
|
|
}
|
2012-02-29 08:50:22 +00:00
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
getLabelActor() {
|
2013-07-11 14:09:54 +00:00
|
|
|
return this._label;
|
2012-02-13 23:13:57 +00:00
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
};
|