summaryrefslogtreecommitdiffstats
path: root/js/ui/checkBox.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:54:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:54:43 +0000
commite4283f6d48b98e764b988b43bbc86b9d52e6ec94 (patch)
treec8f7f7a6c2f5faa2942d27cefc6fd46cca492656 /js/ui/checkBox.js
parentInitial commit. (diff)
downloadgnome-shell-e4283f6d48b98e764b988b43bbc86b9d52e6ec94.tar.xz
gnome-shell-e4283f6d48b98e764b988b43bbc86b9d52e6ec94.zip
Adding upstream version 43.9.upstream/43.9upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/ui/checkBox.js')
-rw-r--r--js/ui/checkBox.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/js/ui/checkBox.js b/js/ui/checkBox.js
new file mode 100644
index 0000000..d64bd0d
--- /dev/null
+++ b/js/ui/checkBox.js
@@ -0,0 +1,40 @@
+/* exported CheckBox */
+const { Atk, 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.set_accessible_role(Atk.Role.CHECK_BOX);
+
+ this._box = new St.Bin({ y_align: Clutter.ActorAlign.START });
+ container.add_actor(this._box);
+
+ this._label = new St.Label({ y_align: Clutter.ActorAlign.CENTER });
+ this._label.clutter_text.set_line_wrap(true);
+ this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE);
+ this.set_label_actor(this._label);
+ container.add_actor(this._label);
+
+ if (label)
+ this.setLabel(label);
+ }
+
+ setLabel(label) {
+ this._label.set_text(label);
+ }
+
+ getLabelActor() {
+ return this._label;
+ }
+});