gnome-shell/js/ui/checkBox.js
Jonas Dreßler f3eeb94c90 checkBox: Fix expand and align properties
In f2bd39b20c, the expand property for
checkboxes was accidentally set to the grandchild (the StBin), instead
of the child (the StBoxLayout) of the StButton. Fix that and let the
BoxLayout expand instead of the Bin.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/885
2019-12-05 15:35:22 +00:00

39 lines
994 B
JavaScript

/* exported CheckBox */
const { Clutter, GObject, Pango, St } = imports.gi;
var CheckBox = GObject.registerClass(
class CheckBox extends St.Button {
_init(label) {
let container = new St.BoxLayout({
x_expand: true,
y_expand: true,
});
super._init({
style_class: 'check-box',
child: container,
button_mask: St.ButtonMask.ONE,
toggle_mode: true,
can_focus: true,
});
this._box = new St.Bin({ 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);
if (label)
this.setLabel(label);
}
setLabel(label) {
this._label.set_text(label);
}
getLabelActor() {
return this._label;
}
});