st-scroll-view: Add :overlay-scrollbars property

If enabled, scrollbars take away from the allocation given to the
view's content. This is usually preferrable to painting the bars on
top of the content, but there are exceptions, for instance when the
content needs to be centered with regard to the view as a whole.
Add a :overlay-scrollbars property to account for those cases.

https://bugzilla.gnome.org/show_bug.cgi?id=694261
This commit is contained in:
Florian Müllner
2013-02-21 22:30:09 +01:00
parent 7425b382d6
commit 1bd8c67041
3 changed files with 91 additions and 8 deletions

View File

@@ -339,6 +339,10 @@ function test() {
let vfade = new St.Button({ label: 'No', style: 'text-decoration: underline; color: #4444ff;' });
fadeBox.add(vfade);
fadeBox.add(new St.Label({ text: 'Overlay scrollbars: '}));
let overlay = new St.Button({ label: 'No', style: 'text-decoration: underline; color: #4444ff;' });
fadeBox.add(overlay);
function togglePadding(button) {
switch(button.label) {
case 'No':
@@ -388,6 +392,20 @@ function test() {
vfade.connect('clicked', function() { toggleFade(vfade); });
toggleFade(vfade);
function toggleOverlay(button) {
switch(button.label) {
case 'No':
button.label = 'Yes';
break;
case 'Yes':
button.label = 'No';
break;
}
scrollView.overlay_scrollbars = (button.label == 'Yes');
}
overlay.connect('clicked', function() { toggleOverlay(overlay); });
UI.main(stage);
}
test();