本文整理了Java中org.eclipse.swt.widgets.Menu.isEnabled()
方法的一些代码示例,展示了Menu.isEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Menu.isEnabled()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Menu
类名称:Menu
方法名:isEnabled
[英]Returns true
if the receiver is enabled and all of the receiver's ancestors are enabled, and false
otherwise. A disabled menu is typically not selectable from the user interface and draws with an inactive or "grayed" look.
[中]如果接收器已启用且接收器的所有祖先均已启用,则返回true
,否则返回false
。禁用的菜单通常无法从用户界面中选择,并以非活动或“灰色”外观绘制。
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Returns <code>true</code> if the receiver is enabled and all
* of the receiver's ancestors are enabled, and <code>false</code>
* otherwise. A disabled menu item is typically not selectable from the
* user interface and draws with an inactive or "grayed" look.
*
* @return the receiver's enabled state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getEnabled
*/
public boolean isEnabled () {
return getEnabled () && parent.isEnabled ();
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
/**
* Returns <code>true</code> if the receiver is enabled and all
* of the receiver's ancestors are enabled, and <code>false</code>
* otherwise. A disabled menu item is typically not selectable from the
* user interface and draws with an inactive or "grayed" look.
*
* @return the receiver's enabled state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getEnabled
*/
public boolean isEnabled() {
return getEnabled() && parent.isEnabled();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Returns <code>true</code> if the receiver is enabled and all
* of the receiver's ancestors are enabled, and <code>false</code>
* otherwise. A disabled menu item is typically not selectable from the
* user interface and draws with an inactive or "grayed" look.
*
* @return the receiver's enabled state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getEnabled
*/
public boolean isEnabled () {
return getEnabled () && parent.isEnabled ();
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Returns <code>true</code> if the receiver is enabled and all
* of the receiver's ancestors are enabled, and <code>false</code>
* otherwise. A disabled menu item is typically not selectable from the
* user interface and draws with an inactive or "grayed" look.
*
* @return the receiver's enabled state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getEnabled
*/
public boolean isEnabled () {
return getEnabled () && parent.isEnabled ();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Returns <code>true</code> if the receiver is enabled and all
* of the receiver's ancestors are enabled, and <code>false</code>
* otherwise. A disabled menu item is typically not selectable from the
* user interface and draws with an inactive or "grayed" look.
*
* @return the receiver's enabled state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getEnabled
*/
public boolean isEnabled () {
return getEnabled () && parent.isEnabled ();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Returns <code>true</code> if the receiver is enabled and all
* of the receiver's ancestors are enabled, and <code>false</code>
* otherwise. A disabled menu item is typically not selectable from the
* user interface and draws with an inactive or "grayed" look.
*
* @return the receiver's enabled state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getEnabled
*/
public boolean isEnabled () {
return getEnabled () && parent.isEnabled ();
}
代码示例来源: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.codehaus.openxma/xmartserver
/**
* Enables the given menu item if the argument enabled is <code>true</code>,
* and disables it otherwise. A disabled menu item is
* not selectable from the user interface and
* draws with an inactive or "grayed" look.
* Disabling a menu item makes all its children not selectable, too.
* @since 2.2.0
*/
protected void setMenuItemEnabled(IMenuItem item,boolean enabled) {
((at.spardat.xma.appshell.MenuItem)item).localEnabled=enabled;
MenuItem itemW = (MenuItem) item.getAttached();
if(itemW!=null) {
if(menuW.isEnabled()||item.getParentAttached()!=null) {
itemW.setEnabled(enabled);
}
}
}
代码示例来源:origin: org.codehaus.openxma/xmartclient
/**
* Enables the given menu item if the argument enabled is <code>true</code>,
* and disables it otherwise. A disabled menu item is
* not selectable from the user interface and
* draws with an inactive or "grayed" look.
* Disabling a menu item makes all its children not selectable, too.
* @since 2.2.0
*/
protected void setMenuItemEnabled(IMenuItem item,boolean enabled) {
((at.spardat.xma.appshell.MenuItem)item).localEnabled=enabled;
MenuItem itemW = (MenuItem) item.getAttached();
if(itemW!=null) {
if(menuW.isEnabled()||item.getParentAttached()!=null) {
itemW.setEnabled(enabled);
}
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
@Override
boolean translateAccelerator (MSG msg) {
if (!isEnabled () || !isActive ()) return false;
if (menuBar != null && !menuBar.isEnabled ()) return false;
return translateMDIAccelerator (msg) || translateMenuAccelerator (msg);
}
代码示例来源: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.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.eclipse.rap/org.eclipse.rap.rwt
/**
* Returns <code>true</code> if the receiver is enabled and all
* of the receiver's ancestors are enabled, and <code>false</code>
* otherwise. A disabled menu is typically not selectable from the
* user interface and draws with an inactive or "grayed" look.
*
* @return the receiver's enabled state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getEnabled
*/
public boolean isEnabled() {
checkWidget();
Menu parentMenu = getParentMenu();
if( parentMenu == null ) {
return getEnabled();
}
return getEnabled() && parentMenu.isEnabled();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
@Override
boolean translateAccelerator (MSG msg) {
if (!isEnabled () || !isActive ()) return false;
if (menuBar != null && !menuBar.isEnabled ()) return false;
if (translateMDIAccelerator (msg) || translateMenuAccelerator (msg)) return true;
Decorations decorations = parent.menuShell ();
return decorations.translateAccelerator (msg);
}
代码示例来源:origin: org.codehaus.openxma/xmartserver
/**
* Completely enable/disable the menu.
* @param enabled true: enable, false: disable.
*/
protected void setMenuEnabled(boolean enabled) {
if(menuW==null) return;
boolean wasEnabled=menuW.isEnabled();
menuW.setEnabled(enabled);
MenuItem[] items = menuW.getItems();
//disable the items of the shell bar menu
for (int i = 0; i < items.length; i++) {
MenuItem item = items[i];
at.spardat.xma.appshell.MenuItem xmaItem = (at.spardat.xma.appshell.MenuItem) item.getData();
if(wasEnabled) { xmaItem.localEnabled=item.getEnabled(); }
item.setEnabled(enabled&&xmaItem.localEnabled);
}
}
代码示例来源:origin: org.codehaus.openxma/xmartclient
/**
* Completely enable/disable the menu.
* @param enabled true: enable, false: disable.
*/
protected void setMenuEnabled(boolean enabled) {
if(menuW==null) return;
boolean wasEnabled=menuW.isEnabled();
menuW.setEnabled(enabled);
MenuItem[] items = menuW.getItems();
//disable the items of the shell bar menu
for (int i = 0; i < items.length; i++) {
MenuItem item = items[i];
at.spardat.xma.appshell.MenuItem xmaItem = (at.spardat.xma.appshell.MenuItem) item.getData();
if(wasEnabled) { xmaItem.localEnabled=item.getEnabled(); }
item.setEnabled(enabled&&xmaItem.localEnabled);
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Returns <code>true</code> if the receiver is enabled and all
* of the receiver's ancestors are enabled, and <code>false</code>
* otherwise. A disabled menu is typically not selectable from the
* user interface and draws with an inactive or "grayed" look.
*
* @return the receiver's enabled state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getEnabled
*/
public boolean isEnabled () {
checkWidget();
Menu parentMenu = getParentMenu ();
if (parentMenu == null) {
return getEnabled () && parent.isEnabled ();
}
return getEnabled () && parentMenu.isEnabled ();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Returns <code>true</code> if the receiver is enabled and all
* of the receiver's ancestors are enabled, and <code>false</code>
* otherwise. A disabled menu is typically not selectable from the
* user interface and draws with an inactive or "grayed" look.
*
* @return the receiver's enabled state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getEnabled
*/
public boolean isEnabled () {
checkWidget ();
Menu parentMenu = getParentMenu ();
if (parentMenu == null) {
return getEnabled () && parent.isEnabled ();
}
return getEnabled () && parentMenu.isEnabled ();
}
代码示例来源: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;
}
}
内容来源于网络,如有侵权,请联系作者删除!