2011-09-28 13:16:26 +00:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2009-10-05 20:33:19 +00:00
|
|
|
|
2017-02-15 00:43:09 +00:00
|
|
|
const UI = imports.testcommon.ui;
|
|
|
|
|
2009-10-05 20:33:19 +00:00
|
|
|
const Clutter = imports.gi.Clutter;
|
2017-06-07 00:39:34 +00:00
|
|
|
const Mainloop = imports.mainloop;
|
2009-10-05 20:33:19 +00:00
|
|
|
const St = imports.gi.St;
|
|
|
|
|
2012-06-24 19:11:41 +00:00
|
|
|
function test() {
|
|
|
|
let stage = new Clutter.Stage({ width: 400, height: 400 });
|
|
|
|
UI.init(stage);
|
2009-10-05 20:33:19 +00:00
|
|
|
|
2012-06-24 19:11:41 +00:00
|
|
|
let vbox = new St.BoxLayout({ vertical: true,
|
|
|
|
width: stage.width,
|
|
|
|
height: stage.height,
|
2017-06-06 21:32:39 +00:00
|
|
|
style: 'padding: 10px; spacing: 10px; font: 32px sans-serif;' });
|
2012-06-24 19:11:41 +00:00
|
|
|
stage.add_actor(vbox);
|
2009-10-05 20:33:19 +00:00
|
|
|
|
2017-06-06 21:32:39 +00:00
|
|
|
let entry = new St.Entry({ style: 'border: 1px solid black; text-shadow: 0 2px red;',
|
|
|
|
text: 'Example text' });
|
2012-06-24 19:11:41 +00:00
|
|
|
vbox.add(entry,
|
|
|
|
{ expand: true,
|
|
|
|
y_fill: false, y_align: St.Align.MIDDLE });
|
|
|
|
entry.grab_key_focus();
|
2009-10-05 20:33:19 +00:00
|
|
|
|
2017-06-07 00:39:34 +00:00
|
|
|
let entryTextHint = new St.Entry({ style: 'border: 1px solid black; text-shadow: 0 2px red;',
|
|
|
|
hint_text: 'Hint text' });
|
|
|
|
vbox.add(entryTextHint,
|
|
|
|
{ expand: true,
|
|
|
|
y_fill: false, y_align: St.Align.MIDDLE });
|
|
|
|
|
|
|
|
let hintActor = new St.Label({ text: 'Hint actor' });
|
|
|
|
let entryHintActor = new St.Entry({ style: 'border: 1px solid black; text-shadow: 0 2px red;',
|
|
|
|
hint_actor: hintActor });
|
|
|
|
vbox.add(entryHintActor,
|
|
|
|
{ expand: true,
|
|
|
|
y_fill: false, y_align: St.Align.MIDDLE });
|
|
|
|
|
|
|
|
let hintActor2 = new St.Label({ text: 'Hint both (actor)' });
|
|
|
|
let entryHintBoth = new St.Entry({ style: 'border: 1px solid black; text-shadow: 0 2px red;',
|
|
|
|
hint_actor: hintActor2 });
|
|
|
|
let idx = 0;
|
|
|
|
Mainloop.timeout_add_seconds(1, function() {
|
|
|
|
idx++;
|
|
|
|
|
|
|
|
if (idx % 2 == 0)
|
|
|
|
entryHintBoth.hint_actor = hintActor2;
|
|
|
|
else
|
|
|
|
entryHintBoth.hint_text = 'Hint both (text)';
|
|
|
|
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
vbox.add(entryHintBoth,
|
|
|
|
{ expand: true,
|
|
|
|
y_fill: false, y_align: St.Align.MIDDLE });
|
|
|
|
|
2012-06-24 19:11:41 +00:00
|
|
|
UI.main(stage);
|
|
|
|
}
|
|
|
|
test();
|