本文整理了Java中org.eclipse.swt.widgets.Shell.getMenuBar()
方法的一些代码示例,展示了Shell.getMenuBar()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.getMenuBar()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:getMenuBar
暂无
代码示例来源:origin: stefanhaustein/flowgrid
@Override
public void widgetSelected(SelectionEvent e) {
flowgrid.shell().getMenuBar().setVisible(true);
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
private Rectangle getMenuBounds() {
Rectangle result = null;
if( getMenuBar() == null ) {
result = new Rectangle( 0, 0, 0, 0 );
} else {
Rectangle bounds = getBounds();
int hTop = ( style & SWT.TITLE ) != 0 ? 1 : 0;
hTop += getTitleBarHeight();
BoxDimensions padding = getPadding();
BoxDimensions border = getBorder();
int paddingWidth = padding.left + padding.right;
int borderWidth = border.left + border.right;
result = new Rectangle( padding.left,
hTop + padding.top,
bounds.width - paddingWidth - borderWidth,
getMenuBarHeight() );
}
return result;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
public int getMenuBarHeight( Shell shell ) {
int result = 0;
if( shell.getMenuBar() != null ) {
Font font = getCssFont( "Shell", "font", shell );
int fontHeight = TextSizeUtil.getCharHeight( font );
BoxDimensions padding = getMenuBarItemPadding();
result = Math.max( MENU_BAR_MIN_HEIGHT, fontHeight + padding.top + padding.bottom );
}
return result;
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
private static void preserveMenuBounds( Shell shell ) {
Menu menuBar = shell.getMenuBar();
if( menuBar != null ) {
IShellAdapter shellAdapter = shell.getAdapter( IShellAdapter.class );
getAdapter( menuBar ).preserve( Props.BOUNDS, shellAdapter.getMenuBounds() );
}
}
代码示例来源:origin: stackoverflow.com
Menu menuBar = shell.getMenuBar();
if (menuBar == null) {
menuBar = new Menu(shell, SWT.BAR);
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
@Override
public void setShowMenuBar(boolean show) {
showMenuBar = show;
WorkbenchWindow win = (WorkbenchWindow) getWindow();
Shell shell = win.getShell();
if (shell != null) {
boolean showing = shell.getMenuBar() != null;
if (show != showing) {
if (show) {
shell.setMenuBar(null);
} else {
shell.setMenuBar(null);
}
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
Menu createFileMenu() {
Menu bar = shell.getMenuBar ();
Menu menu = new Menu (bar);
MenuItem item;
// Open
item = new MenuItem (menu, SWT.PUSH);
item.setText (resources.getString("Open_menuitem"));
item.setAccelerator(SWT.MOD1 + 'O');
item.addSelectionListener(widgetSelectedAdapter(event -> openFile()));
// Exit
item = new MenuItem (menu, SWT.PUSH);
item.setText (resources.getString("Exit_menuitem"));
item.addSelectionListener (widgetSelectedAdapter(e -> menuFileExit ()));
return menu;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
private int TranslateAccelerator(int /*long*/ lpmsg, int wID){
Menu menubar = getShell().getMenuBar();
if (menubar == null || menubar.isDisposed() || !menubar.isEnabled()) return COM.S_FALSE;
if (wID < 0) return COM.S_FALSE;
Shell shell = menubar.getShell();
int /*long*/ hwnd = shell.handle;
int /*long*/ hAccel = OS.SendMessage(hwnd, OS.WM_APP+1, 0, 0);
if (hAccel == 0) return COM.S_FALSE;
MSG msg = new MSG();
OS.MoveMemory(msg, lpmsg, MSG.sizeof);
int result = OS.TranslateAccelerator(hwnd, hAccel, msg);
return result == 0 ? COM.S_FALSE : COM.S_OK;
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07
public void preserveValues( final Widget widget ) {
ControlLCAUtil.preserveValues( ( Control )widget );
Shell shell = ( Shell )widget;
IWidgetAdapter adapter = WidgetUtil.getAdapter( shell );
adapter.preserve( PROP_ACTIVE_CONTROL, getActiveControl( shell ) );
adapter.preserve( PROP_ACTIVE_SHELL, shell.getDisplay().getActiveShell() );
adapter.preserve( PROP_TEXT, shell.getText() );
adapter.preserve( PROP_IMAGE, shell.getImage() );
adapter.preserve( PROP_ALPHA, new Integer( shell.getAlpha() ) );
adapter.preserve( PROP_MODE, getMode( shell ) );
adapter.preserve( PROP_FULLSCREEN,
Boolean.valueOf( shell.getFullScreen() ) );
adapter.preserve( PROP_SHELL_LISTENER,
Boolean.valueOf( ShellEvent.hasListener( shell ) ) );
adapter.preserve( PROP_SHELL_MENU, shell.getMenuBar() );
adapter.preserve( PROP_MINIMUM_SIZE, shell.getMinimumSize() );
WidgetLCAUtil.preserveCustomVariant( shell );
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
int OnUIDeactivate(int fUndoable) {
// currently, we are ignoring the fUndoable flag
if (frame == null || frame.isDisposed()) return COM.S_OK;
state = STATE_INPLACEACTIVE;
frame.SetActiveObject(0,0);
redraw();
Shell shell = getShell();
if (isFocusControl() || frame.isFocusControl()) {
shell.traverse(SWT.TRAVERSE_TAB_NEXT);
}
Menu menubar = shell.getMenuBar();
if (menubar == null || menubar.isDisposed())
return COM.S_OK;
int /*long*/ shellHandle = shell.handle;
OS.SetMenu(shellHandle, menubar.handle);
return COM.OleSetMenuDescriptor(0, shellHandle, 0, 0, 0);
}
private void onTraverse(Event event) {
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
private int SetMenu(int /*long*/ hmenuShared, int /*long*/ holemenu, int /*long*/ hwndActiveObject) {
int /*long*/ inPlaceActiveObject = 0;
if (objIOleInPlaceActiveObject != null)
inPlaceActiveObject = objIOleInPlaceActiveObject.getAddress();
Menu menubar = getShell().getMenuBar();
if (menubar == null || menubar.isDisposed()){
return COM.OleSetMenuDescriptor(0, getShell().handle, hwndActiveObject, iOleInPlaceFrame.getAddress(), inPlaceActiveObject);
}
int /*long*/ handle = menubar.getShell().handle;
if (hmenuShared == 0 && holemenu == 0) {
// re-instate the original menu - this occurs on deactivation
hmenuShared = menubar.handle;
}
if (hmenuShared == 0) return COM.E_FAIL;
shellHandle = handle;
oldMenuHandle = menubar.handle;
newMenuHandle = hmenuShared;
return COM.OleSetMenuDescriptor(holemenu, handle, hwndActiveObject, iOleInPlaceFrame.getAddress(), inPlaceActiveObject);
}
/**
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
private int RemoveMenus(int /*long*/ hmenuShared) {
Menu menubar = getShell().getMenuBar();
if (menubar == null || menubar.isDisposed()) return COM.S_FALSE;
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
frameInfo.hwndFrame = frame.handle;
Shell shell = getShell();
Menu menubar = shell.getMenuBar();
if (menubar != null && !menubar.isDisposed()) {
int /*long*/ hwnd = shell.handle;
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
Menu menubar = getShell().getMenuBar();
if (menubar != null && !menubar.isDisposed() && menubar.isEnabled()) {
Shell shell = menubar.getShell();
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
private int InsertMenus(int /*long*/ hmenuShared, int /*long*/ lpMenuWidths) {
Menu menubar = getShell().getMenuBar();
if (menubar == null || menubar.isDisposed()) {
COM.MoveMemory(lpMenuWidths, new int[] {0}, 4);
内容来源于网络,如有侵权,请联系作者删除!