org.eclipse.swt.widgets.Menu.getStyle()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中org.eclipse.swt.widgets.Menu.getStyle()方法的一些代码示例,展示了Menu.getStyle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Menu.getStyle()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Menu
类名称:Menu
方法名:getStyle

暂无

代码示例

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

private static boolean isDropDownMenu( Menu menu ) {
 return ( menu.getStyle() & SWT.DROP_DOWN ) != 0;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

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;
 }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

private static boolean isMenuBar( Menu menu ) {
 return ( menu.getStyle() & SWT.BAR ) != 0;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

private static boolean isPopupMenu( Menu menu ) {
 return ( menu.getStyle() & SWT.POP_UP ) != 0;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

private static boolean isTopLevelMenuBarItem( final MenuItem menuItem ) {
 return ( menuItem.getParent().getStyle() & SWT.BAR ) != 0;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt

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;
  }
}

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

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;
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

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;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

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;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

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;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

@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;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

@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;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

@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;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

@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 ());
      }
    }
  }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

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 );
 }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

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;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

SWT.error( SWT.ERROR_INVALID_PARENT );
if( ( menuBar.getStyle() & SWT.BAR ) == 0 ) {
 SWT.error( SWT.ERROR_MENU_NOT_BAR );

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

@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);
  }
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

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);
    }
  }
}

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

if ((menu.getStyle() & SWT.BAR) != 0) {

相关文章