Summary: | [Widgets] Add option to fill ToolItems in vertical ToolBar to fit width | ||
---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Chris Gross <schtoo> |
Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> |
Status: | NEW --- | QA Contact: | Felipe Heidrich <eclipse.felipe> |
Severity: | enhancement | ||
Priority: | P4 | Keywords: | triaged |
Version: | 3.0 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Chris Gross
2004-08-01 17:34:56 EDT
It looks like Windows won't let you do this (after all the hacking we just did, fighting with the tool bar). FH to investigate (low priority?). I'm not sure how to implement it. low priority (enhancement). Here is some code (win32 specific) I was playing with: public static void main(String[] args) { final Display display= new Display(); final Shell shell= new Shell(display); final ToolBar toolBar= new ToolBar(shell, SWT.VERTICAL |SWT.BORDER | SWT.FLAT); int TB_SETBUTTONWIDTH = 0x400 + 59;//0X43B int width = 100 + (101 << 16); org.eclipse.swt.internal.win32.OS.SendMessage(toolBar.handle, TB_SETBUTTONWIDTH, 0, width);//doesn't do anything new ToolItem (toolBar, SWT.PUSH).setText("Plus"); new ToolItem (toolBar, SWT.SEPARATOR); new ToolItem (toolBar, SWT.PUSH).setText("Java Perspect"); new ToolItem (toolBar, SWT.PUSH).setText("CVS Perspect"); new ToolItem (toolBar, SWT.PUSH).setText("Debug Perspect"); toolBar.pack(); shell.addListener(SWT.MouseDown, new Listener() { public void handleEvent(Event event) { ToolItem[] items = toolBar.getItems(); int width = 0; for (int i= 0; i < items.length; i++) { ToolItem item = items[i]; int w = item.getBounds().width; if (w > width) width = w; } TBBUTTONINFO info = new TBBUTTONINFO (); info.cbSize = TBBUTTONINFO.sizeof; info.dwMask = OS.TBIF_SIZE; info.cx = (short) width; int hwnd = toolBar.handle; for (int i= 0; i < items.length; i++) { OS.SendMessage (hwnd, OS.TB_SETBUTTONINFO, i, info); } } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } *** This bug has been marked as a duplicate of bug 139318 *** Oops, not a dup. Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info. This is a one-off bulk update. (The last one in the triage migration). Moving bugs from swt-triaged@eclipse to platform-swt-inbox@eclipse.org and adding "triaged" keyword as per new triage process: https://wiki.eclipse.org/SWT/Devel/Triage See Bug 518478 for details. Tag for notification/mail filters: @TriageBulkUpdate |