File: checkBox.js

package info (click to toggle)
gnome-shell 3.14.4-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 14,412 kB
  • ctags: 7,297
  • sloc: ansic: 45,021; sh: 11,312; xml: 875; makefile: 696; cpp: 57; python: 39; perl: 13
file content (40 lines) | stat: -rw-r--r-- 1,205 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const Clutter = imports.gi.Clutter;
const Pango = imports.gi.Pango;
const St = imports.gi.St;

const Lang = imports.lang;

const CheckBox = new Lang.Class({
    Name: 'CheckBox',

    _init: function(label) {
        let container = new St.BoxLayout();
        this.actor = new St.Button({ style_class: 'check-box',
                                     child: container,
                                     button_mask: St.ButtonMask.ONE,
                                     toggle_mode: true,
                                     can_focus: true,
                                     x_fill: true,
                                     y_fill: true });

        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);

        if (label)
            this.setLabel(label);
    },

    setLabel: function(label) {
        this._label.set_text(label);
    },

    getLabelActor: function() {
        return this._label;
    }
});