Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover2001-08-23 14:28:31 +0000
committerSteve Northover2001-08-23 14:28:31 +0000
commita9edf98be63af8d74fda70d77950dcbcc8001e09 (patch)
treefffa5ff6a3bc869563e7a531f0c91728426bb2b3
parent1868eb68e1f2eedc867133b8d0c2d3b468649383 (diff)
downloadeclipse.platform.swt-a9edf98be63af8d74fda70d77950dcbcc8001e09.tar.gz
eclipse.platform.swt-a9edf98be63af8d74fda70d77950dcbcc8001e09.tar.xz
eclipse.platform.swt-a9edf98be63af8d74fda70d77950dcbcc8001e09.zip
*** empty log message ***
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java21
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java12
2 files changed, 9 insertions, 24 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java
index 95b7f53c5e..2a433e79bf 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java
@@ -60,14 +60,6 @@ Scrollable () {
public Scrollable (Composite parent, int style) {
super (parent, style);
}
-int computeHBarHeight(boolean hasVBar) {
- Display display = getDisplay ();
- int height = display.scrolledInsetY + display.scrolledMarginY;
- if (!hasVBar)
- height -= display.scrolledInsetY * 2;
- return height;
-}
-
/**
* Given a desired <em>client area</em> for the receiver
* (as described by the arguments), returns the bounding
@@ -101,30 +93,25 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
if (hasHBar) {
Display display = getDisplay ();
trimY -= display.scrolledInsetY;
- trimHeight += computeHBarHeight(hasVBar);
+ trimHeight += display.scrolledInsetY + display.scrolledMarginY;
if (!hasVBar) {
trimX -= display.scrolledInsetX;
trimWidth += display.scrolledInsetX * 2;
+ trimHeight -= display.scrolledInsetY * 2;
}
}
if (hasVBar) {
Display display = getDisplay ();
trimX -= display.scrolledInsetX;
- trimWidth += computeVBarWidth(hasHBar);
+ trimWidth += display.scrolledInsetX + display.scrolledMarginX;
if (!hasHBar) {
trimY -= display.scrolledInsetY;
trimHeight += display.scrolledInsetY * 2;
+ trimWidth -= display.scrolledInsetX * 2;
}
}
return new Rectangle (trimX, trimY, trimWidth, trimHeight);
}
-int computeVBarWidth(boolean hasHBar) {
- Display display = getDisplay ();
- int width = display.scrolledInsetX + display.scrolledMarginX;
- if (!hasHBar)
- width -= display.scrolledInsetX * 2;
- return width;
-}
ScrollBar createScrollBar (int type) {
return new ScrollBar (this, type);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
index f23ed4ece2..010e596927 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/SelectableItemWidget.java
@@ -206,6 +206,7 @@ public Point computeSize(int wHint, int hHint, boolean changed) {
int width = getContentWidth();
int height = getItemCount() * getItemHeight();
int style = getStyle();
+ int scrollBarWidth = computeTrim(0, 0, 0, 0).width;
if (width == 0) {
width = DEFAULT_WIDTH;
@@ -219,14 +220,11 @@ public Point computeSize(int wHint, int hHint, boolean changed) {
if (hHint != SWT.DEFAULT) {
height = hHint;
}
- boolean hasVBar = (style & SWT.V_SCROLL) != 0;
- boolean hasHBar = (style & SWT.H_SCROLL) != 0;
-
- if (hasVBar) {
- width += computeVBarWidth(hasHBar);
+ if ((getStyle() & SWT.V_SCROLL) != 0) {
+ width += scrollBarWidth;
}
- if (hasHBar) {
- height += computeHBarHeight(hasVBar);
+ if ((getStyle() & SWT.H_SCROLL) != 0) {
+ height += scrollBarWidth;
}
return new Point(width, height);
}

Back to the top