summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod <carolyn>2001-11-14 22:09:53 +0000
committerCarolyn MacLeod <carolyn>2001-11-14 22:09:53 +0000
commitb93aae098c69625ec0e9de0aba3e486de280e758 (patch)
treed1ce21731660cd062bba9754bc02872f37024e50
parentd308e4bce61924c5861b34eb2d67c75112be4687 (diff)
downloadeclipse.platform.swt-b93aae098c69625ec0e9de0aba3e486de280e758.tar.gz
eclipse.platform.swt-b93aae098c69625ec0e9de0aba3e486de280e758.tar.xz
eclipse.platform.swt-b93aae098c69625ec0e9de0aba3e486de280e758.zip
*** empty log message ***
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java27
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java13
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java5
4 files changed, 28 insertions, 21 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java
index 15bb5d3add..9f1d680841 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java
@@ -239,24 +239,24 @@ public int indexOf (CoolItem item) {
* appropriately.
*/
void insertItemIntoRow(CoolItem item, Vector row, int x_root, int rowY) {
+ int barWidth = getSize().x;
+ int height = item.getSize().y;
if (row.size() == 0) {
- Point size = item.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- item.setBounds(0, rowY, getSize().x, size.y);
+ item.setBounds(0, rowY, barWidth, height);
row.addElement(item);
return;
}
- int x = x_root - toDisplay(new Point(0, 0)).x;
+ int x = Math.max(0, x_root - toDisplay(new Point(0, 0)).x);
/* Find the insertion index and add the item. */
- int index = 0;
- for (int i = 0; i < row.size(); i++) {
- CoolItem next = (CoolItem) row.elementAt(i);
- if (x < next.getBounds().x) break;
- index++;
+ int index;
+ for (index = 0; index < row.size(); index++) {
+ CoolItem next = (CoolItem) row.elementAt(index);
+ if (x < next.getBounds().x) break;
}
row.insertElementAt(item, index);
-
+
/* Adjust the width of the item to the left. */
if (index > 0) {
CoolItem left = (CoolItem) row.elementAt(index - 1);
@@ -277,12 +277,15 @@ void insertItemIntoRow(CoolItem item, Vector row, int x_root, int rowY) {
width = right.getBounds().x - x;
if (width < CoolItem.MINIMUM_WIDTH) {
moveRight(right, CoolItem.MINIMUM_WIDTH - width);
- width = CoolItem.MINIMUM_WIDTH;
+ width = right.getBounds().x - x;
}
+ item.setBounds(x, rowY, width, height);
+ if (width < CoolItem.MINIMUM_WIDTH) moveLeft(item, CoolItem.MINIMUM_WIDTH - width);
} else {
- width = getBounds().width - x;
+ width = Math.max(CoolItem.MINIMUM_WIDTH, barWidth - x);
+ item.setBounds(x, rowY, width, height);
+ if (x + width > barWidth) moveLeft(item, x + width - barWidth);
}
- item.setBounds(x, rowY, width, item.getBounds().height);
item.requestedWidth = width;
}
void createItem (CoolItem item, int index) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
index 20de4b4338..7fb5632615 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolItem.java
@@ -35,7 +35,6 @@ public /*final*/ class CoolItem extends Item {
static final int MARGIN_WIDTH = 4;
static final int MARGIN_HEIGHT = 2;
- static final int DEFAULT_HEIGHT = (2 * MARGIN_HEIGHT) + 28;
static final int GRABBER_WIDTH = 2;
static final int MINIMUM_WIDTH = (2 * MARGIN_WIDTH) + GRABBER_WIDTH;
@@ -149,7 +148,7 @@ void createHandle (int index) {
int [] argList = {
OS.XmNancestorSensitive, 1,
OS.XmNwidth, MINIMUM_WIDTH,
- OS.XmNheight, DEFAULT_HEIGHT,
+ OS.XmNheight, 1,
OS.XmNpositionIndex, index,
OS.XmNtraversalOn, 0,
};
@@ -294,8 +293,10 @@ int processMouseMove (int callData) {
return 0;
}
int processMouseUp (int callData) {
- dragging = false;
- parent.setCursor(parent.hoverCursor);
+ if (dragging) {
+ dragging = false;
+ parent.setCursor(parent.hoverCursor);
+ }
return 0;
}
int processPaint (int callData) {
@@ -391,8 +392,8 @@ public void setControl (Control control) {
public void setSize (int width, int height) {
checkWidget();
width = Math.max (width, MINIMUM_WIDTH);
- requestedWidth = width;
- height = Math.max (height, DEFAULT_HEIGHT);
+ preferredWidth = requestedWidth = width;
+ height = Math.max (height, 1);
OS.XtResizeWidget (handle, width, height, 0);
if (control != null) {
int controlWidth = width - MINIMUM_WIDTH - MARGIN_WIDTH;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
index 2616b1d78c..aea3585ec9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
@@ -104,7 +104,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
RECT rect = new RECT ();
REBARBANDINFO rbBand = new REBARBANDINFO ();
rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_SIZE | OS.RBBIM_CHILDSIZE | OS.RBBIM_STYLE;
+ rbBand.fMask = OS.RBBIM_IDEALSIZE | OS.RBBIM_CHILDSIZE | OS.RBBIM_STYLE;
int count = OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0);
for (int i=0; i<count; i++) {
OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand);
@@ -116,7 +116,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
} else if (i != 0) {
rowWidth += 2;
}
- rowWidth += rbBand.cx;
+ rowWidth += rbBand.cxIdeal + rect.left + rect.right;
rowHeight = Math.max (rowHeight, rbBand.cyMinChild + rect.top + rect.bottom);
}
width = Math.max (width, rowWidth);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java
index 5e877cb140..2317d0f482 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java
@@ -338,10 +338,13 @@ public void setSize (int width, int height) {
int index = parent.indexOf (this);
if (index == -1) return;
int hwnd = parent.handle;
+ RECT rect = new RECT ();
+ OS.SendMessage (hwnd, OS.RB_GETBANDBORDERS, index, rect);
REBARBANDINFO rbBand = new REBARBANDINFO ();
rbBand.cbSize = REBARBANDINFO.sizeof;
- rbBand.fMask = OS.RBBIM_CHILDSIZE | OS.RBBIM_SIZE;
+ rbBand.fMask = OS.RBBIM_CHILDSIZE | OS.RBBIM_SIZE | OS.RBBIM_IDEALSIZE;
rbBand.cx = width;
+ rbBand.cxIdeal = width - rect.left - rect.right;
rbBand.cyChild = rbBand.cyMinChild = rbBand.cyMaxChild = height;
OS.SendMessage (hwnd, OS.RB_SETBANDINFO, index, rbBand);
}