summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets
diff options
context:
space:
mode:
authorMarkus Keller <markus_keller@ch.ibm.com>2012-11-08 20:10:13 +0100
committerMarkus Keller <markus_keller@ch.ibm.com>2012-11-08 20:10:13 +0100
commit73ee56991535559e50652ecc6391cdfa11c08af2 (patch)
treedb0d66bdc562b50567cb02e0a1fe3069874d60e3 /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets
parent43b30ece21092f7a44517a30edc679c7c981f51e (diff)
downloadeclipse.platform.swt-73ee56991535559e50652ecc6391cdfa11c08af2.tar.gz
eclipse.platform.swt-73ee56991535559e50652ecc6391cdfa11c08af2.tar.xz
eclipse.platform.swt-73ee56991535559e50652ecc6391cdfa11c08af2.zip
Bug 39934: [ScrolledComposite] ScrolledComposite page increment should default to size of client area
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledCompositeLayout.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledCompositeLayout.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledCompositeLayout.java
index 0af014860e..c99710d11f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledCompositeLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ScrolledCompositeLayout.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -78,9 +78,12 @@ protected void layout(Composite composite, boolean flushCache) {
contentRect.height = Math.max(sc.minHeight, hostRect.height);
}
+ GC gc = new GC (sc);
if (hBar != null) {
hBar.setMaximum (contentRect.width);
hBar.setThumb (Math.min (contentRect.width, hostRect.width));
+ hBar.setIncrement (gc.getFontMetrics ().getAverageCharWidth ());
+ hBar.setPageIncrement (hostRect.width);
int hPage = contentRect.width - hostRect.width;
int hSelection = hBar.getSelection ();
if (hSelection >= hPage) {
@@ -95,6 +98,8 @@ protected void layout(Composite composite, boolean flushCache) {
if (vBar != null) {
vBar.setMaximum (contentRect.height);
vBar.setThumb (Math.min (contentRect.height, hostRect.height));
+ vBar.setIncrement (gc.getFontMetrics ().getHeight ());
+ vBar.setPageIncrement (hostRect.height);
int vPage = contentRect.height - hostRect.height;
int vSelection = vBar.getSelection ();
if (vSelection >= vPage) {
@@ -105,6 +110,7 @@ protected void layout(Composite composite, boolean flushCache) {
contentRect.y = -vSelection;
}
}
+ gc.dispose ();
sc.content.setBounds (contentRect);
inLayout = false;