static Image getImage( ToolItem item ) { Image result; if( item.getEnabled() && item.getParent().getEnabled() ) { result = item.getImage(); } else { result = item.getDisabledImage(); if( result == null ) { result = item.getImage(); } } return result; }
static Image getImage( final ToolItem toolItem ) { Image result; if( toolItem.getEnabled() && toolItem.getParent().getEnabled() ) { result = toolItem.getImage(); } else { result = toolItem.getDisabledImage(); if( result == null ) { result = toolItem.getImage(); } } return result; }
@Override public void setImage (Image image) { checkWidget(); if ((style & SWT.SEPARATOR) != 0) return; if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); super.setImage (image); updateImages (getEnabled () && parent.getEnabled ()); }
/** * Sets the receiver's disabled image to the argument, which may be * null indicating that no disabled image should be displayed. * <p> * The disabled image is displayed when the receiver is disabled. * </p> * * @param image the disabled image to display on the receiver (may be null) * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li> * </ul> * @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> */ public void setDisabledImage (Image image) { checkWidget(); if ((style & SWT.SEPARATOR) != 0) return; if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); disabledImage = image; updateImages (getEnabled () && parent.getEnabled ()); }
if (image != null) updateImages (enabled && parent.getEnabled ());
/** * Sets the receiver's hot image to the argument, which may be * null indicating that no hot image should be displayed. * <p> * The hot image is displayed when the mouse enters the receiver. * </p> * * @param image the hot image to display on the receiver (may be null) * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li> * </ul> * @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> */ public void setHotImage (Image image) { checkWidget(); if ((style & SWT.SEPARATOR) != 0) return; if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); hotImage = image; updateImages (getEnabled () && parent.getEnabled ()); }
if (!getEnabled () || !parent.getEnabled ()) { updateImages (false);
button.setImagePosition(OS.NSImageOverlaps); button.setTitle(NSString.string()); button.setEnabled(parent.getEnabled()); widget.addSubview(button); view = widget;