2011-09-28 13:16:26 +00:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2009-09-20 02:56:09 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2009-09-30 03:03:41 +00:00
|
|
|
let hbox = new St.BoxLayout({ style: 'spacing: 12px;' });
|
2009-09-20 02:56:09 +00:00
|
|
|
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();
|
|
|
|
|
2009-09-20 20:21:47 +00:00
|
|
|
let button;
|
|
|
|
|
2009-09-30 13:50:37 +00:00
|
|
|
button = new St.Button ({ label: 'Smaller', style_class: 'push-button' });
|
2009-09-20 02:56:09 +00:00
|
|
|
hbox.add (button);
|
|
|
|
button.connect('clicked', function() {
|
|
|
|
size /= 1.2;
|
|
|
|
update_size ();
|
|
|
|
});
|
|
|
|
|
2009-09-30 13:50:37 +00:00
|
|
|
button = new St.Button ({ label: 'Bigger', style_class: 'push-button' });
|
2009-09-20 02:56:09 +00:00
|
|
|
hbox.add (button);
|
|
|
|
button.connect('clicked', function() {
|
|
|
|
size *= 1.2;
|
|
|
|
update_size ();
|
|
|
|
});
|
|
|
|
|
|
|
|
stage.show();
|
|
|
|
Clutter.main();
|
|
|
|
stage.destroy();
|
|
|
|
|