2011-09-28 09:16:26 -04:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2009-09-19 22:56:09 -04:00
|
|
|
|
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const St = imports.gi.St;
|
|
|
|
|
|
|
|
const UI = imports.testcommon.ui;
|
|
|
|
|
2012-06-24 15:11:41 -04:00
|
|
|
function test() {
|
|
|
|
let stage = new Clutter.Stage();
|
|
|
|
UI.init(stage);
|
|
|
|
|
|
|
|
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 ();
|
|
|
|
});
|
|
|
|
|
|
|
|
UI.main(stage);
|
2009-09-19 22:56:09 -04:00
|
|
|
}
|
2012-06-24 15:11:41 -04:00
|
|
|
test();
|