2019-01-31 09:07:06 -05:00
|
|
|
/* exported CheckBox */
|
2019-02-08 22:21:36 -05:00
|
|
|
const { Clutter, Pango, St } = imports.gi;
|
2012-02-13 18:13:57 -05:00
|
|
|
|
2017-10-30 21:19:44 -04:00
|
|
|
var CheckBox = class CheckBox {
|
|
|
|
constructor(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);
|
2017-10-30 21:19:44 -04:00
|
|
|
}
|
2012-02-13 18:13:57 -05:00
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
setLabel(label) {
|
2013-07-11 10:09:54 -04:00
|
|
|
this._label.set_text(label);
|
2017-10-30 21:19:44 -04:00
|
|
|
}
|
2012-02-29 03:50:22 -05:00
|
|
|
|
2017-10-30 20:03:21 -04:00
|
|
|
getLabelActor() {
|
2013-07-11 10:09:54 -04:00
|
|
|
return this._label;
|
2012-02-13 18:13:57 -05:00
|
|
|
}
|
2017-10-30 21:19:44 -04:00
|
|
|
};
|