df3ac4b25e
Use BigRectangle to draw the border and background if there's a border width or border radius and no border image. (Only uniform borders are supported for now with some deviations from the CSS model noted in the comments.) The background color and image parameters are removed from StWidget's draw_background() method since they were not used for StButton (the only current user) and the encapsulation break that they presented caused some minor problems. Add a test case for borders, and also use borders to style the buttons in the 'inline-style' test case. https://bugzilla.gnome.org/show_bug.cgi?id=595993
48 lines
1.0 KiB
JavaScript
48 lines
1.0 KiB
JavaScript
/* -*- mode: js2; js2-basic-offset: 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({ spacing: 12 });
|
|
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' });
|
|
hbox.add (button);
|
|
button.connect('clicked', function() {
|
|
size /= 1.2;
|
|
update_size ();
|
|
});
|
|
|
|
button = new St.Button ({ label: 'Bigger' });
|
|
hbox.add (button);
|
|
button.connect('clicked', function() {
|
|
size *= 1.2;
|
|
update_size ();
|
|
});
|
|
|
|
stage.show();
|
|
Clutter.main();
|
|
stage.destroy();
|
|
|