/** Creates the cool and tool bar. These build the menu bar of the Riena sub-application. */ private void create() { menuCoolBar = new CoolBar(this, SWT.FLAT); menuCoolItem = CoolbarUtils.initCoolBar(menuCoolBar, getMenuBarFont()); menuToolBar = (ToolBar) menuCoolItem.getControl(); final ToolBarMenuListener listener = new ToolBarMenuListener(); menuToolBar.addMouseListener(listener); SWTFacade.getDefault().addMouseTrackListener(menuToolBar, listener); menuToolBar.addTraverseListener(listener); fillMenuBar(listener); }
/** * Calculates and sets the size of the given cool item. * * @param item item of cool bar */ private void calcSize(final CoolItem item) { final Control control = item.getControl(); Point pt = control.computeSize(SWT.DEFAULT, SWT.DEFAULT); pt = item.computeSize(pt.x, pt.y); item.setSize(pt); }