diff options
author | Felipe Heidrich <fheidric> | 2009-10-13 19:01:50 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2009-10-13 19:01:50 +0000 |
commit | c209da00e7b11bc418228f7c75fb30fe33475cec (patch) | |
tree | c647144473d4433647c74a5393efc79b70ff11b8 | |
parent | a1db85c3c33a946fae6b082e7c4350bca55a1860 (diff) | |
download | eclipse.platform.swt-c209da00e7b11bc418228f7c75fb30fe33475cec.tar.gz eclipse.platform.swt-c209da00e7b11bc418228f7c75fb30fe33475cec.tar.xz eclipse.platform.swt-c209da00e7b11bc418228f7c75fb30fe33475cec.zip |
Bug 160870 - [Contributions] ToolItem.setWidth fails when ToolItem on ViewPart toolbar (backport 3.5.2)
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java | 17 | ||||
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java | 3 |
2 files changed, 19 insertions, 1 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 cb95765513..3b3e279750 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 @@ -735,6 +735,23 @@ void layoutItems () { } } } + + if ((style & (SWT.WRAP | SWT.VERTICAL)) != 0) { + int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); + if ((bits & OS.TBSTYLE_LIST) != 0) { + TBBUTTONINFO info = new TBBUTTONINFO (); + info.cbSize = TBBUTTONINFO.sizeof; + info.dwMask = OS.TBIF_SIZE; + for (int i=0; i<items.length; i++) { + ToolItem item = items [i]; + if (item != null && item.control != null && item.cx > 0) { + info.cx = item.cx; + OS.SendMessage (handle, OS.TB_SETBUTTONINFO, item.id, info); + } + } + } + } + for (int i=0; i<items.length; i++) { ToolItem item = items [i]; if (item != null) item.resizeControl (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java index 27386a4545..016a4ccbbe 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java @@ -44,6 +44,7 @@ public class ToolItem extends Item { Image disabledImage, hotImage; Image disabledImage2; int id; + short cx; /** * Constructs a new instance of this class given its parent @@ -877,7 +878,7 @@ public void setWidth (int width) { TBBUTTONINFO info = new TBBUTTONINFO (); info.cbSize = TBBUTTONINFO.sizeof; info.dwMask = OS.TBIF_SIZE; - info.cx = (short) width; + info.cx = cx = (short) width; OS.SendMessage (hwnd, OS.TB_SETBUTTONINFO, id, info); parent.layoutItems (); } |