[StScrollView] Add support for GtkPolicyType for scrollbars

Previously we were hacking out the vertical scrollbar, this patch
allow us to sanely say in which directions we want to scroll.

Note this patch intentionally changes St to depend on GTK+ in the
API.  I believe this is a correct long term change where we should
view St as co-evolving with GTK+ rather than replacing or paralleling.

https://bugzilla.gnome.org/show_bug.cgi?id=609015
This commit is contained in:
Colin Walters
2010-02-16 11:04:07 -05:00
parent cfd63c7d4c
commit 18c5405b79
5 changed files with 151 additions and 7 deletions

View File

@@ -14,9 +14,19 @@ let vbox = new St.BoxLayout({ vertical: true,
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 });
toggle.connect('notify::checked', function () {
v.set_policy(toggle.checked ? St.ScrollPolicy.AUTOMATIC
: St.ScrollPolicy.NEVER,
St.ScrollPolicy.AUTOMATIC);
});
let b = new St.BoxLayout({ vertical: true,
style: "border: 2px solid #880000; border-radius: 10px; padding: 0px 5px;" });
v.add_actor(b);