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

x33g5p2x  于2022-01-25 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(126)

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

[英]Returns true if the receiver is enabled and all of the receiver's ancestors are enabled, and false otherwise. A disabled menu item is typically not selectable from the user interface and draws with an inactive or "grayed" look.
[中]如果接收器已启用且接收器的所有祖先均已启用,则返回true,否则返回false。禁用的菜单项通常无法从用户界面中选择,并以非活动或“灰色”外观绘制。

代码示例

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

@Override
public void handleEvent( Event event ) {
 if( isRelevantEvent( event ) && menuItem.isEnabled() ) {
  menuItem.handleAcceleratorActivation();
  event.type = SWT.NONE;
 }
}

代码示例来源:origin: org.codehaus.openxma/xmartserver

/**
 * Detach the MenuItem from its visual representation.
 * The change must be propagated to the GUI.
 * @param item to remove
 */
public void detachMenu(IMenuItem item) {
  if(menuW==null) return;
  MenuItem itemW = (MenuItem) item.getAttached();
  if (itemW != null) {
    if(menuW.isEnabled()) {
      ((at.spardat.xma.appshell.MenuItem)item).localEnabled=itemW.isEnabled();
    }
    itemW.dispose();
  }
}

代码示例来源:origin: org.codehaus.openxma/xmartclient

/**
 * Detach the MenuItem from its visual representation.
 * The change must be propagated to the GUI.
 * @param item to remove
 */
public void detachMenu(IMenuItem item) {
  if(menuW==null) return;
  MenuItem itemW = (MenuItem) item.getAttached();
  if (itemW != null) {
    if(menuW.isEnabled()) {
      ((at.spardat.xma.appshell.MenuItem)item).localEnabled=itemW.isEnabled();
    }
    itemW.dispose();
  }
}

代码示例来源: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

LRESULT WM_COMMAND (int /*long*/ wParam, int /*long*/ lParam) {
  /*
  * When the WM_COMMAND message is sent from a
  * menu, the HWND parameter in LPARAM is zero.
  */
  if (lParam == 0) {
    Decorations shell = menuShell ();
    if (shell.isEnabled ()) {
      int id = OS.LOWORD (wParam);
      MenuItem item = display.getMenuItem (id);
      if (item != null && item.isEnabled ()) {
        return item.wmCommandChild (wParam, lParam);
      }
    }
    return null;
  }
  Control control = display.getControl (lParam);
  if (control == null) return null;
  return control.wmCommandChild (wParam, lParam);
}

代码示例来源:origin: org.codehaus.openxma/xmartserver

/**
 * Returns <code>true</code> if the given menu item is enabled and <code>false</code>
 * otherwise. A disabled menu item is not selectable from the user interface
 * and draws with an inactive or "grayed" look. A menu item is disabled, if
 * it is either directly disabled or any of its parents is disabled.
 * @since 2.2.0
 */
protected boolean isMenuItemEnabled(IMenuItem item) {
  if(!menuW.isEnabled()) return false;
  MenuItem itemW = (MenuItem) item.getAttached();
  if(itemW!=null&&menuW.isEnabled()) {
    ((at.spardat.xma.appshell.MenuItem)item).localEnabled=itemW.isEnabled();
  }
  if(item.isLocalEnabled()&&item.getParent()!=null) {
    return isMenuItemEnabled(item.getParent());
  }
  return item.isLocalEnabled();
}

代码示例来源:origin: org.codehaus.openxma/xmartclient

/**
 * Returns <code>true</code> if the given menu item is enabled and <code>false</code>
 * otherwise. A disabled menu item is not selectable from the user interface
 * and draws with an inactive or "grayed" look. A menu item is disabled, if
 * it is either directly disabled or any of its parents is disabled.
 * @since 2.2.0
 */
protected boolean isMenuItemEnabled(IMenuItem item) {
  if(!menuW.isEnabled()) return false;
  MenuItem itemW = (MenuItem) item.getAttached();
  if(itemW!=null&&menuW.isEnabled()) {
    ((at.spardat.xma.appshell.MenuItem)item).localEnabled=itemW.isEnabled();
  }
  if(item.isLocalEnabled()&&item.getParent()!=null) {
    return isMenuItemEnabled(item.getParent());
  }
  return item.isLocalEnabled();
}

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

if (lphi.iContextType == OS.HELPINFO_MENUITEM) {
  MenuItem item = display.getMenuItem (lphi.iCtrlId);
  if (item != null && item.isEnabled ()) {
    Widget widget = null;
    if (item.hooks (SWT.Help)) {

相关文章