File: inline-style.js

package info (click to toggle)
cinnamon 6.4.13-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 13,304 kB
  • sloc: javascript: 54,298; ansic: 51,499; python: 21,971; xml: 2,803; sh: 96; makefile: 27; perl: 13
file content (47 lines) | stat: -rw-r--r-- 1,137 bytes parent folder | download | duplicates (10)
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
41
42
43
44
45
46
47
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-

const Clutter = imports.gi.Clutter;
const St = imports.gi.St;

const UI = imports.testcommon.ui;

UI.init();
let stage = Clutter.Stage.get_default();

let vbox = new St.BoxLayout({ vertical: true,
                              width: stage.width,
                              height: stage.height });
stage.add_actor(vbox);

let hbox = new St.BoxLayout({ style: 'spacing: 12px;' });
vbox.add(hbox);

let text = new St.Label({ text: "Styled Text" });
vbox.add (text);

let size = 24;
function update_size() {
    text.style = 'font-size: ' + size + 'pt';
}
update_size();

let button;

button = new St.Button ({ label: 'Smaller', style_class: 'push-button' });
hbox.add (button);
button.connect('clicked', function() {
                   size /= 1.2;
                   update_size ();
               });

button = new St.Button ({ label: 'Bigger', style_class: 'push-button' });
hbox.add (button);
button.connect('clicked', function() {
                   size *= 1.2;
                   update_size ();
               });

stage.show();
Clutter.main();
stage.destroy();