summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover <steve>2005-05-09 17:28:48 +0000
committerSteve Northover <steve>2005-05-09 17:28:48 +0000
commitdcd9f7243ae1ad05751547f983b76748a1e6687b (patch)
tree7b209a3898e0c746bbb65bd3893b67691e9cff86
parentb5bb05ad266e20ce12a3e375629219edda2009e7 (diff)
downloadeclipse.platform.swt-dcd9f7243ae1ad05751547f983b76748a1e6687b.tar.gz
eclipse.platform.swt-dcd9f7243ae1ad05751547f983b76748a1e6687b.tar.xz
eclipse.platform.swt-dcd9f7243ae1ad05751547f983b76748a1e6687b.zip
93501
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
index 10c9b33646..5e4b73b44e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
@@ -560,16 +560,27 @@ void layoutItems () {
OS.SendMessage (handle, OS.TB_AUTOSIZE, 0, 0);
}
/*
- * When the tool bar is vertical, make the width
- * of each button be the width of the widest.
+ * When the tool bar is vertical, make the width of each button
+ * be the width of the widest button in the tool bar. Note that
+ * when the tool bar contains a drop down item, it needs to take
+ * into account extra padding.
*/
if ((style & SWT.VERTICAL) != 0) {
TBBUTTONINFO info = new TBBUTTONINFO ();
info.cbSize = TBBUTTONINFO.sizeof;
info.dwMask = OS.TBIF_SIZE;
int size = OS.SendMessage (handle, OS.TB_GETBUTTONSIZE, 0, 0);
- int padding = OS.SendMessage (handle, OS.TB_GETPADDING, 0, 0);
- info.cx = (short) ((size & 0xFFFF) + (padding & 0xFFFF) * 2);
+ info.cx = (short) (size & 0xFFFF);
+ int index = 0;
+ while (index < items.length) {
+ ToolItem item = items [index];
+ if (item != null && (item.style & SWT.DROP_DOWN) != 0) break;
+ index++;
+ }
+ if (index < items.length) {
+ int padding = OS.SendMessage (handle, OS.TB_GETPADDING, 0, 0);
+ info.cx += (padding & 0xFFFF) * 2;
+ }
for (int i=0; i<items.length; i++) {
ToolItem item = items [i];
if (item != null && (item.style & SWT.SEPARATOR) == 0) {