2011-09-28 13:16:26 +00:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2009-09-20 01:10:15 +00:00
|
|
|
|
2017-02-15 00:43:09 +00:00
|
|
|
const UI = imports.testcommon.ui;
|
|
|
|
|
2023-06-08 04:52:46 +00:00
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const St = imports.gi.St;
|
|
|
|
|
2009-09-20 01:10:15 +00:00
|
|
|
|
2012-06-24 19:11:41 +00:00
|
|
|
function test() {
|
|
|
|
let stage = new Clutter.Stage();
|
|
|
|
UI.init(stage);
|
|
|
|
|
|
|
|
let vbox = new St.BoxLayout({ vertical: true,
|
|
|
|
width: stage.width,
|
|
|
|
height: stage.height,
|
|
|
|
style: "padding: 10px;" });
|
|
|
|
stage.add_actor(vbox);
|
|
|
|
|
|
|
|
let toggle = new St.Button({ label: 'Horizontal Scrolling',
|
|
|
|
toggle_mode: true });
|
|
|
|
vbox.add(toggle);
|
|
|
|
|
|
|
|
let v = new St.ScrollView();
|
|
|
|
vbox.add(v, { expand: true });
|
|
|
|
|
2017-10-31 00:38:18 +00:00
|
|
|
toggle.connect('notify::checked', () => {
|
2023-04-12 13:20:42 +00:00
|
|
|
v.set_policy(toggle.checked ? St.PolicyType.AUTOMATIC
|
|
|
|
: St.PolicyType.NEVER,
|
|
|
|
St.PolicyType.AUTOMATIC);
|
2012-06-24 19:11:41 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
let b = new St.BoxLayout({ vertical: true,
|
|
|
|
style: "border: 2px solid #880000; border-radius: 10px; padding: 0px 5px;" });
|
|
|
|
v.add_actor(b);
|
|
|
|
|
|
|
|
let cc_a = "a".charCodeAt(0);
|
|
|
|
let s = "";
|
|
|
|
for (let i = 0; i < 26 * 3; i++) {
|
|
|
|
s += String.fromCharCode(cc_a + i % 26);
|
|
|
|
|
|
|
|
let t = new St.Label({ text: s,
|
|
|
|
reactive: true });
|
|
|
|
let line = i + 1;
|
|
|
|
t.connect('button-press-event',
|
|
|
|
function() {
|
|
|
|
log("Click on line " + line);
|
|
|
|
});
|
|
|
|
b.add(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
UI.main(stage);
|
2009-09-20 01:10:15 +00:00
|
|
|
}
|
2012-06-24 19:11:41 +00:00
|
|
|
test();
|