/** * Invokes platform specific functionality to allocate a new color. * <p> * <b>IMPORTANT:</b> This method is <em>not</em> part of the public * API for <code>Color</code>. It is marked public only so that it * can be shared within the packages provided by SWT. It is not * available on all platforms, and should never be called from * application code. * </p> * * @param device the device on which to allocate the color * @param handle the handle for the color * @return a new color object containing the specified device and handle * * @noreference This method is not intended to be referenced by clients. */ public static Color win32_new(Device device, int handle) { return win32_new(device, handle, 255); }
/** * Returns the receiver's foreground color. * * @return the color used for drawing foreground things * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ public Color getForeground() { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); return Color.win32_new(data.device, data.foreground); }
/** * Returns the background color. * * @return the receiver's background color * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ public Color getBackground() { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); return Color.win32_new(data.device, data.background); }
Color internalGetLinkForeground() { if (linkForeground != -1) { return Color.win32_new (display, linkForeground); } if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) { return Color.win32_new (display, OS.GetSysColor (OS.COLOR_HOTLIGHT)); } // Create and cache the linkForeground Color native handle for re-use. Color color = new Color (display, LAST_FALLBACK_LINK_FOREGROUND); linkForeground = color.handle; return color; }
case SWT.COLOR_DARK_GRAY: pixel = 0x00808080; break; return Color.win32_new (this, pixel, alpha);
/** * Returns the foreground color that the receiver will use to draw. * * @return the receiver's foreground color * * @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 Color getForeground () { checkWidget (); return Color.win32_new (display, getForegroundPixel ()); }
@Override void createHandle () { super.createHandle (); state |= THEME_BACKGROUND; layout = new TextLayout (display); disabledColor = Color.win32_new (display, OS.GetSysColor (OS.COLOR_GRAYTEXT)); offsets = new Point [0]; ids = new String [0]; mnemonics = new int [0]; selection = new Point (-1, -1); focusIndex = mouseDownIndex = -1; }
/** * Returns the foreground color that the receiver will use to draw. * * @return the receiver's foreground color * * @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*/ Color getForeground () { checkWidget (); return Color.win32_new (display, foreground != -1 ? foreground : defaultForeground ()); }
/** * Returns the receiver's background color. * * @return the background color * * @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> * * @since 3.3 */ /*public*/ Color getBackground () { checkWidget (); return Color.win32_new (display, background != -1 ? background : defaultBackground ()); }
/** * Returns the receiver's background color. * <p> * Note: This operation is a hint and may be overridden by the platform. * For example, on some versions of Windows the background of a TabFolder, * is a gradient rather than a solid color. * </p> * @return the background color * * @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 Color getBackground () { checkWidget (); if (backgroundAlpha == 0) { Color color = Color.win32_new (display, background, 0); return color; } else { Control control = findBackgroundControl (); if (control == null) control = this; return Color.win32_new (display, control.getBackgroundPixel (), backgroundAlpha); } }
/** * Returns the foreground color that the receiver will use to draw. * * @return the receiver's foreground color * * @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> * * @since 2.0 */ public Color getForeground () { checkWidget (); if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); if (foreground == -1) return parent.getForeground (); return Color.win32_new (display, foreground); }
/** * Returns the foreground color that the receiver will use to draw. * * @return the receiver's foreground color * * @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> * * @since 2.0 * */ public Color getForeground () { checkWidget (); if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); if (foreground == -1) return parent.getForeground (); return Color.win32_new (display, foreground); }
/** * Returns the receiver's background color. * * @return the background color * * @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> * * @since 2.0 */ public Color getBackground () { checkWidget (); if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); if (background == -1) return parent.getBackground (); return Color.win32_new (display, background); }
/** * Returns the receiver's background color. * * @return the background color * * @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> * * @since 2.0 * */ public Color getBackground () { checkWidget (); if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); if (background == -1) return parent.getBackground (); return Color.win32_new (display, background); }
/** * * Returns the foreground color at the given column index in the receiver. * * @param index the column index * @return the foreground color * * @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> * * @since 3.0 */ public Color getForeground (int index) { checkWidget (); if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count -1) return getForeground (); int pixel = cellForeground != null ? cellForeground [index] : -1; return pixel == -1 ? getForeground () : Color.win32_new (display, pixel); }
/** * Returns the background color at the given column index in the receiver. * * @param index the column index * @return the background color * * @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> * * @since 3.1 */ public Color getBackground (int index) { checkWidget (); if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count - 1) return getBackground (); int pixel = cellBackground != null ? cellBackground [index] : -1; return pixel == -1 ? getBackground () : Color.win32_new (display, pixel); }
/** * Returns the background color at the given column index in the receiver. * * @param index the column index * @return the background color * * @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> * * @since 3.0 */ public Color getBackground (int index) { checkWidget (); if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count - 1) return getBackground (); int pixel = cellBackground != null ? cellBackground [index] : -1; return pixel == -1 ? getBackground () : Color.win32_new (display, pixel); }
/** * * Returns the foreground color at the given column index in the receiver. * * @param index the column index * @return the foreground color * * @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> * * @since 3.1 */ public Color getForeground (int index) { checkWidget (); if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count -1) return getForeground (); int pixel = cellForeground != null ? cellForeground [index] : -1; return pixel == -1 ? getForeground () : Color.win32_new (display, pixel); }
@Override public Color getBackground () { if (objIUnknown != null) { // !! We are getting the OLE_COLOR - should we change this to the COLORREF value? OleAutomation oleObject= new OleAutomation(this); Variant varBackColor = oleObject.getProperty(COM.DISPID_BACKCOLOR); oleObject.dispose(); if (varBackColor != null){ int[] colorRef = new int[1]; if (COM.OleTranslateColor(varBackColor.getInt(), getDisplay().hPalette, colorRef) == COM.S_OK) return Color.win32_new(getDisplay(), colorRef[0]); } } return super.getBackground(); } @Override
@Override public Color getForeground () { if (objIUnknown != null) { // !! We are getting the OLE_COLOR - should we change this to the COLORREF value? OleAutomation oleObject= new OleAutomation(this); Variant varForeColor = oleObject.getProperty(COM.DISPID_FORECOLOR); oleObject.dispose(); if (varForeColor != null){ int[] colorRef = new int[1]; if (COM.OleTranslateColor(varForeColor.getInt(), getDisplay().hPalette, colorRef) == COM.S_OK) return Color.win32_new(getDisplay(), colorRef[0]); } } return super.getForeground(); } protected int /*long*/ getLicenseInfo(GUID clsid) {