private static boolean isDropDownMenu( Menu menu ) { return ( menu.getStyle() & SWT.DROP_DOWN ) != 0; }
private static MenuDelegateLCA getDelegateLCA( final Widget widget ) { MenuDelegateLCA result; Menu menu = ( Menu )widget; int style = menu.getStyle(); if( ( style & SWT.BAR ) != 0 ) { result = MENU_BAR_LCA; } else if( ( style & SWT.DROP_DOWN ) != 0 ) { result = DROP_DOWN_MENU_LCA; } else { result = POPUP_MENU_LCA; } return result; } }
private static boolean isMenuBar( Menu menu ) { return ( menu.getStyle() & SWT.BAR ) != 0; }
private static boolean isPopupMenu( Menu menu ) { return ( menu.getStyle() & SWT.POP_UP ) != 0; }
private static boolean isTopLevelMenuBarItem( final MenuItem menuItem ) { return ( menuItem.getParent().getStyle() & SWT.BAR ) != 0; }
private void handleMenu(final Event event, final Menu menu, final MMenu menuModel) { if ((menu.getStyle() & SWT.BAR) != 0) { // don't process the menu bar, it's not fair :-) return; } switch (event.type) { case SWT.Show: cleanUp(menu); showMenu(event, menu, menuModel); break; case SWT.Hide: // TODO we'll clean up on show break; } }
private void handleMenu(final Event event, final Menu menu, final MMenu menuModel) { if ((menu.getStyle() & SWT.BAR) != 0) { // don't process the menu bar, it's not fair :-) return; } switch (event.type) { case SWT.Show: cleanUp(menu); showMenu(event, menu, menuModel); break; case SWT.Hide: // TODO we'll clean up on show break; } }
private boolean isTopLevelMenu() { if (menu != null && !menu.isDisposed() && menuItem != null && !menuItem.isDisposed()) { Menu parentMenu = menuItem.getParent(); return parentMenu != null && ((parentMenu.getStyle() & SWT.BAR) == SWT.BAR); } return false; }
private boolean isTopLevelMenu() { if (menu != null && !menu.isDisposed() && menuItem != null && !menuItem.isDisposed()) { Menu parentMenu = menuItem.getParent(); return parentMenu != null && ((parentMenu.getStyle() & SWT.BAR) == SWT.BAR); } return false; }
private boolean isTopLevelMenu() { if (menu != null && !menu.isDisposed() && menuItem != null && !menuItem.isDisposed()) { Menu parentMenu = menuItem.getParent(); return parentMenu != null && ((parentMenu.getStyle() & SWT.BAR) == SWT.BAR); } return false; }
@Override long /*int*/ gtk_activate (long /*int*/ widget) { if ((style & SWT.CASCADE) != 0 && menu != null) return 0; /* * Bug in GTK. When an ancestor menu is disabled and * the user types an accelerator key, GTK delivers the * the activate signal even though the menu item cannot * be invoked using the mouse. The fix is to ignore * activate signals when an ancestor menu is disabled. */ if (!isEnabled ()) return 0; if ((style & SWT.RADIO) != 0) { if ((parent.getStyle () & SWT.NO_RADIO_GROUP) == 0) { selectRadio (); } } sendSelectionEvent (SWT.Selection); return 0; }
@Override int /*long*/ gtk_activate (int /*long*/ widget) { if ((style & SWT.CASCADE) != 0 && menu != null) return 0; /* * Bug in GTK. When an ancestor menu is disabled and * the user types an accelerator key, GTK delivers the * the activate signal even though the menu item cannot * be invoked using the mouse. The fix is to ignore * activate signals when an ancestor menu is disabled. */ if (!isEnabled ()) return 0; if ((style & SWT.RADIO) != 0) { if ((parent.getStyle () & SWT.NO_RADIO_GROUP) == 0) { selectRadio (); } } sendSelectionEvent (SWT.Selection); return 0; }
@Override int /*long*/ gtk_activate (int /*long*/ widget) { if ((style & SWT.CASCADE) != 0 && menu != null) return 0; /* * Bug in GTK. When an ancestor menu is disabled and * the user types an accelerator key, GTK delivers the * the activate signal even though the menu item cannot * be invoked using the mouse. The fix is to ignore * activate signals when an ancestor menu is disabled. */ if (!isEnabled ()) return 0; if ((style & SWT.RADIO) != 0) { if ((parent.getStyle () & SWT.NO_RADIO_GROUP) == 0) { selectRadio (); } } sendSelectionEvent (SWT.Selection); return 0; }
@Override public void setOrientation (int orientation) { super.setOrientation (orientation); if (menus != null) { for (int i=0; i<menus.length; i++) { Menu menu = menus [i]; if (menu != null && !menu.isDisposed () && (menu.getStyle () & SWT.POP_UP) != 0) { menu._setOrientation (menu.getOrientation ()); } } } }
void renderInitialization( MenuItem menuItem ) throws IOException { MenuItemLCAUtil.newItem( menuItem, "org.eclipse.rwt.widgets.MenuItem", ITEM_TYPE_RADIO ); if( ( menuItem.getParent().getStyle() & SWT.NO_RADIO_GROUP ) != 0 ) { JSWriter writer = JSWriter.getWriterFor( menuItem ); writer.set( "noRadioGroup", true ); } }
LRESULT wmCommandChild (int /*long*/ wParam, int /*long*/ lParam) { if ((style & SWT.CHECK) != 0) { setSelection (!getSelection ()); } else { if ((style & SWT.RADIO) != 0) { if ((parent.getStyle () & SWT.NO_RADIO_GROUP) != 0) { setSelection (!getSelection ()); } else { selectRadio (); } } } sendSelectionEvent (SWT.Selection); return null; }
SWT.error( SWT.ERROR_INVALID_PARENT ); if( ( menuBar.getStyle() & SWT.BAR ) == 0 ) { SWT.error( SWT.ERROR_MENU_NOT_BAR );
@Override public void processContents(MElementContainer<MUIElement> container) { if (container.getChildren().size() == 0) { Object obj = container.getWidget(); if (obj instanceof MenuItem) { MenuItem mi = (MenuItem) obj; if (mi.getMenu() == null) { mi.setMenu(new Menu(mi)); } Menu menu = mi.getMenu(); MenuItem menuItem = new MenuItem(menu, SWT.PUSH); menuItem.setText(MenuManagerRendererFilter.NUL_MENU_ITEM); menuItem.setEnabled(false); } } super.processContents(container); Object obj = container.getWidget(); Object menuObj = container; if ((obj instanceof Menu) && (((Menu) obj).getStyle() & SWT.BAR) != 0 && (menuObj instanceof MMenu)) { MMenu menuModel = (MMenu) menuObj; IEclipseContext ctx = getContext(container); ExpressionContext eContext = new ExpressionContext(ctx); ArrayList<MMenuContribution> toContribute = new ArrayList<MMenuContribution>(); ContributionsAnalyzer.gatherMenuContributions(menuModel, application.getMenuContributions(), menuModel.getElementId(), toContribute, eContext, false); addMenuBarContributions(menuModel, toContribute, ctx, eContext); } }
void sendSelection () { if ((style & SWT.CHECK) != 0) { setSelection (!getSelection ()); } else { if ((style & SWT.RADIO) != 0) { if ((parent.getStyle () & SWT.NO_RADIO_GROUP) != 0) { setSelection (!getSelection ()); } else { selectRadio (); } } } Event event = new Event (); sendSelectionEvent (SWT.Selection, event, nsItemAction != 0); // Widget may be disposed at this point if (isDisposed()) return; if (nsItemAction != 0) { if (event.doit) { NSApplication app = NSApplication.sharedApplication(); app.sendAction(nsItemAction, nsItemTarget, app); } } }
if ((menu.getStyle() & SWT.BAR) != 0) {