/** * 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 (); }
/** * 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(); }
/** * 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 (); }
/** * 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 (); }
/** * 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 (); }
/** * 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 (); }
/** * 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(); } }
/** * 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(); } }
/** * 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); } } }
/** * 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); } } }
@Override boolean translateAccelerator (MSG msg) { if (!isEnabled () || !isActive ()) return false; if (menuBar != null && !menuBar.isEnabled ()) return false; return translateMDIAccelerator (msg) || translateMenuAccelerator (msg); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
@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); }
/** * 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); } }
/** * 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); } }
/** * 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 (); }
/** * 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 (); }
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; } }