本文整理汇总了Java中org.eclipse.swt.widgets.ToolBar.toDisplay方法的典型用法代码示例。如果您正苦于以下问题:Java ToolBar.toDisplay方法的具体用法?Java ToolBar.toDisplay怎么用?Java ToolBar.toDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.ToolBar
的用法示例。
在下文中一共展示了ToolBar.toDisplay方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import org.eclipse.swt.widgets.ToolBar; //导入方法依赖的package包/类
protected void open(final Decorations parent, final SelectionEvent trigger) {
// final boolean asMenu = trigger.detail == SWT.ARROW;
final boolean init = mainMenu == null;
// if (!asMenu) {
// openView();
// } else {
final ToolItem target = (ToolItem) trigger.widget;
final ToolBar toolBar = target.getParent();
if (init) {
mainMenu = new Menu(parent, SWT.POP_UP);
// AD: again. In the first call, the mainMenu was perhaps not
// yet initialized
fillMenu();
// mainMenu.addMenuListener(tooltipListener);
}
final Point point = toolBar.toDisplay(new Point(trigger.x, trigger.y));
mainMenu.setLocation(point.x, point.y);
mainMenu.setVisible(true);
// }
}
示例2: widgetSelected
import org.eclipse.swt.widgets.ToolBar; //导入方法依赖的package包/类
/**
* Handle selection events.
*/
public void widgetSelected(SelectionEvent event) {
/**
* A selection event will be fired when a drop down tool
* item is selected in the main area and in the drop
* down arrow. Examine the event detail to determine
* where the widget was selected.
*/
if (event.detail == SWT.ARROW) {
/*
* The drop down arrow was selected.
*/
if (visible) {
// Hide the menu to give the Arrow the appearance of being a toggle button.
setMenuVisible(false);
} else {
// Position the menu below and vertically aligned with the the drop down tool button.
final ToolItem toolItem = (ToolItem) event.widget;
final ToolBar toolBar = toolItem.getParent();
Rectangle toolItemBounds = toolItem.getBounds();
Point point = toolBar.toDisplay(new Point(toolItemBounds.x, toolItemBounds.y));
menu.setLocation(point.x, point.y + toolItemBounds.height);
setMenuVisible(true);
}
} else {
/*
* Main area of drop down tool item selected.
* An application would invoke the code to perform the action for the tool item.
*/
}
}
示例3: openToolTipMenu10Reopen
import org.eclipse.swt.widgets.ToolBar; //导入方法依赖的package包/类
private void openToolTipMenu10Reopen(final ToolItem toolItem) {
_menuParentItem = toolItem;
final ToolBar menuParentControl = _menuParentItem.getParent();
final Rectangle toolItemBounds = _menuParentItem.getBounds();
Point topLeft = new Point(toolItemBounds.x, toolItemBounds.y + toolItemBounds.height);
topLeft = menuParentControl.toDisplay(topLeft);
final Menu menu = getMenu(menuParentControl);
menu.setLocation(topLeft.x, topLeft.y);
menu.setVisible(true);
}