Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSColor.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D Programming language: * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.internal.cocoa.NSColor; import dwt.internal.cocoa.CGFloat; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSColorSpace; import dwt.internal.cocoa.NSDictionary; import dwt.internal.cocoa.NSImage; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.NSPasteboard; import dwt.internal.cocoa.NSRect; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSColor : NSObject { public this () { super(); } public this (objc.id id) { super(id); } public CGFloat alphaComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_alphaComponent); } public static NSColor alternateSelectedControlColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_alternateSelectedControlColor); return result !is null ? new NSColor(result) : null; } public static NSColor alternateSelectedControlTextColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_alternateSelectedControlTextColor); return result !is null ? new NSColor(result) : null; } public static NSColor blackColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_blackColor); return result !is null ? new NSColor(result) : null; } public CGFloat blackComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_blackComponent); } public NSColor blendedColorWithFraction (CGFloat fraction, NSColor color) { objc.id result = OS.objc_msgSend(this.id, OS.sel_blendedColorWithFraction_1ofColor_1, fraction, color !is null ? color.id : null); return result is this.id ? this : (result !is null ? new NSColor(result) : null); } public static NSColor blueColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_blueColor); return result !is null ? new NSColor(result) : null; } public CGFloat blueComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_blueComponent); } public CGFloat brightnessComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_brightnessComponent); } public static NSColor brownColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_brownColor); return result !is null ? new NSColor(result) : null; } public NSString catalogNameComponent () { objc.id result = OS.objc_msgSend(this.id, OS.sel_catalogNameComponent); return result !is null ? new NSString(result) : null; } public static NSColor clearColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_clearColor); return result !is null ? new NSColor(result) : null; } public static NSColor colorForControlTint (objc.id controlTint) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorForControlTint_1, controlTint); return result !is null ? new NSColor(result) : null; } public static NSColor colorFromPasteboard (NSPasteboard pasteBoard) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorFromPasteboard_1, pasteBoard !is null ? pasteBoard.id : null); return result !is null ? new NSColor(result) : null; } public NSString colorNameComponent () { objc.id result = OS.objc_msgSend(this.id, OS.sel_colorNameComponent); return result !is null ? new NSString(result) : null; } public NSColorSpace colorSpace () { objc.id result = OS.objc_msgSend(this.id, OS.sel_colorSpace); return result !is null ? new NSColorSpace(result) : null; } public NSString colorSpaceName () { objc.id result = OS.objc_msgSend(this.id, OS.sel_colorSpaceName); return result !is null ? new NSString(result) : null; } public NSColor colorUsingColorSpace (NSColorSpace space) { objc.id result = OS.objc_msgSend(this.id, OS.sel_colorUsingColorSpace_1, space !is null ? space.id : null); return result is this.id ? this : (result !is null ? new NSColor(result) : null); } public NSColor colorUsingColorSpaceName_ (NSString colorSpace) { objc.id result = OS.objc_msgSend(this.id, OS.sel_colorUsingColorSpaceName_1, colorSpace !is null ? colorSpace.id : null); return result is this.id ? this : (result !is null ? new NSColor(result) : null); } public NSColor colorUsingColorSpaceName_device_ (NSString colorSpace, NSDictionary deviceDescription) { objc.id result = OS.objc_msgSend(this.id, OS.sel_colorUsingColorSpaceName_1device_1, colorSpace !is null ? colorSpace.id : null, deviceDescription !is null ? deviceDescription.id : null); return result is this.id ? this : (result !is null ? new NSColor(result) : null); } public NSColor colorWithAlphaComponent (CGFloat alpha) { objc.id result = OS.objc_msgSend(this.id, OS.sel_colorWithAlphaComponent_1, alpha); return result is this.id ? this : (result !is null ? new NSColor(result) : null); } public static NSColor colorWithCIColor (CIColor color) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithCIColor_1, color !is null ? color.id : null); return result !is null ? new NSColor(result) : null; } public static NSColor colorWithCalibratedHue (CGFloat hue, CGFloat saturation, CGFloat brightness, CGFloat alpha) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithCalibratedHue_1saturation_1brightness_1alpha_1, hue, saturation, brightness, alpha); return result !is null ? new NSColor(result) : null; } public static NSColor colorWithCalibratedRed (CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithCalibratedRed_1green_1blue_1alpha_1, red, green, blue, alpha); return result !is null ? new NSColor(result) : null; } public static NSColor colorWithCalibratedWhite (CGFloat white, CGFloat alpha) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithCalibratedWhite_1alpha_1, white, alpha); return result !is null ? new NSColor(result) : null; } public static NSColor colorWithCatalogName (NSString listName, NSString colorName) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithCatalogName_1colorName_1, listName !is null ? listName.id : null, colorName !is null ? colorName.id : null); return result !is null ? new NSColor(result) : null; } public static NSColor colorWithColorSpace (NSColorSpace space, /*const*/CGFloat* components, NSInteger numberOfComponents) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithColorSpace_1components_1count_1, space !is null ? space.id : null, components, numberOfComponents); return result !is null ? new NSColor(result) : null; } public static NSColor colorWithDeviceCyan (CGFloat cyan, CGFloat magenta, CGFloat yellow, CGFloat black, CGFloat alpha) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithDeviceCyan_1magenta_1yellow_1black_1alpha_1, cyan, magenta, yellow, black, alpha); return result !is null ? new NSColor(result) : null; } public static NSColor colorWithDeviceHue (CGFloat hue, CGFloat saturation, CGFloat brightness, CGFloat alpha) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithDeviceHue_1saturation_1brightness_1alpha_1, hue, saturation, brightness, alpha); return result !is null ? new NSColor(result) : null; } public static NSColor colorWithDeviceRed (CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithDeviceRed_1green_1blue_1alpha_1, red, green, blue, alpha); return result !is null ? new NSColor(result) : null; } public static NSColor colorWithDeviceWhite (CGFloat white, CGFloat alpha) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithDeviceWhite_1alpha_1, white, alpha); return result !is null ? new NSColor(result) : null; } public static NSColor colorWithPatternImage (NSImage image) { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_colorWithPatternImage_1, image !is null ? image.id : null); return result !is null ? new NSColor(result) : null; } public static NSArray controlAlternatingRowBackgroundColors () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_controlAlternatingRowBackgroundColors); return result !is null ? new NSArray(result) : null; } public static NSColor controlBackgroundColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_controlBackgroundColor); return result !is null ? new NSColor(result) : null; } public static NSColor controlColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_controlColor); return result !is null ? new NSColor(result) : null; } public static NSColor controlDarkShadowColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_controlDarkShadowColor); return result !is null ? new NSColor(result) : null; } public static NSColor controlHighlightColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_controlHighlightColor); return result !is null ? new NSColor(result) : null; } public static NSColor controlLightHighlightColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_controlLightHighlightColor); return result !is null ? new NSColor(result) : null; } public static NSColor controlShadowColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_controlShadowColor); return result !is null ? new NSColor(result) : null; } public static NSColor controlTextColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_controlTextColor); return result !is null ? new NSColor(result) : null; } public static objc.id currentControlTint () { return OS.objc_msgSend(OS.class_NSColor, OS.sel_currentControlTint); } public static NSColor cyanColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_cyanColor); return result !is null ? new NSColor(result) : null; } public CGFloat cyanComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_cyanComponent); } public static NSColor darkGrayColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_darkGrayColor); return result !is null ? new NSColor(result) : null; } public static NSColor disabledControlTextColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_disabledControlTextColor); return result !is null ? new NSColor(result) : null; } public void drawSwatchInRect (NSRect rect) { OS.objc_msgSend(this.id, OS.sel_drawSwatchInRect_1, rect); } public void getComponents (CGFloat[] components) { OS.objc_msgSend(this.id, OS.sel_getComponents_1, components); } public void getCyan (CGFloat* cyan, CGFloat* magenta, CGFloat* yellow, CGFloat* black, CGFloat* alpha) { OS.objc_msgSend(this.id, OS.sel_getCyan_1magenta_1yellow_1black_1alpha_1, cyan, magenta, yellow, black, alpha); } public void getHue (CGFloat* hue, CGFloat* saturation, CGFloat* brightness, CGFloat* alpha) { OS.objc_msgSend(this.id, OS.sel_getHue_1saturation_1brightness_1alpha_1, hue, saturation, brightness, alpha); } public void getRed (CGFloat* red, CGFloat* green, CGFloat* blue, CGFloat* alpha) { OS.objc_msgSend(this.id, OS.sel_getRed_1green_1blue_1alpha_1, red, green, blue, alpha); } public void getWhite (CGFloat* white, CGFloat* alpha) { OS.objc_msgSend(this.id, OS.sel_getWhite_1alpha_1, white, alpha); } public static NSColor grayColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_grayColor); return result !is null ? new NSColor(result) : null; } public static NSColor greenColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_greenColor); return result !is null ? new NSColor(result) : null; } public CGFloat greenComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_greenComponent); } public static NSColor gridColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_gridColor); return result !is null ? new NSColor(result) : null; } public static NSColor headerColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_headerColor); return result !is null ? new NSColor(result) : null; } public static NSColor headerTextColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_headerTextColor); return result !is null ? new NSColor(result) : null; } public static NSColor highlightColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_highlightColor); return result !is null ? new NSColor(result) : null; } public NSColor highlightWithLevel (CGFloat val) { objc.id result = OS.objc_msgSend(this.id, OS.sel_highlightWithLevel_1, val); return result is this.id ? this : (result !is null ? new NSColor(result) : null); } public CGFloat hueComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_hueComponent); } public static bool ignoresAlpha () { return OS.objc_msgSend(OS.class_NSColor, OS.sel_ignoresAlpha) !is null; } public static NSColor keyboardFocusIndicatorColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_keyboardFocusIndicatorColor); return result !is null ? new NSColor(result) : null; } public static NSColor knobColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_knobColor); return result !is null ? new NSColor(result) : null; } public static NSColor lightGrayColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_lightGrayColor); return result !is null ? new NSColor(result) : null; } public NSString localizedCatalogNameComponent () { objc.id result = OS.objc_msgSend(this.id, OS.sel_localizedCatalogNameComponent); return result !is null ? new NSString(result) : null; } public NSString localizedColorNameComponent () { objc.id result = OS.objc_msgSend(this.id, OS.sel_localizedColorNameComponent); return result !is null ? new NSString(result) : null; } public static NSColor magentaColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_magentaColor); return result !is null ? new NSColor(result) : null; } public CGFloat magentaComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_magentaComponent); } public NSInteger numberOfComponents () { return OS.objc_msgSend(this.id, OS.sel_numberOfComponents); } public static NSColor orangeColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_orangeColor); return result !is null ? new NSColor(result) : null; } public NSImage patternImage () { objc.id result = OS.objc_msgSend(this.id, OS.sel_patternImage); return result !is null ? new NSImage(result) : null; } public static NSColor purpleColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_purpleColor); return result !is null ? new NSColor(result) : null; } public static NSColor redColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_redColor); return result !is null ? new NSColor(result) : null; } public CGFloat redComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_redComponent); } public CGFloat saturationComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_saturationComponent); } public static NSColor scrollBarColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_scrollBarColor); return result !is null ? new NSColor(result) : null; } public static NSColor secondarySelectedControlColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_secondarySelectedControlColor); return result !is null ? new NSColor(result) : null; } public static NSColor selectedControlColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_selectedControlColor); return result !is null ? new NSColor(result) : null; } public static NSColor selectedControlTextColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_selectedControlTextColor); return result !is null ? new NSColor(result) : null; } public static NSColor selectedKnobColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_selectedKnobColor); return result !is null ? new NSColor(result) : null; } public static NSColor selectedMenuItemColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_selectedMenuItemColor); return result !is null ? new NSColor(result) : null; } public static NSColor selectedMenuItemTextColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_selectedMenuItemTextColor); return result !is null ? new NSColor(result) : null; } public static NSColor selectedTextBackgroundColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_selectedTextBackgroundColor); return result !is null ? new NSColor(result) : null; } public static NSColor selectedTextColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_selectedTextColor); return result !is null ? new NSColor(result) : null; } public void set () { OS.objc_msgSend(this.id, OS.sel_set); } public void setFill () { OS.objc_msgSend(this.id, OS.sel_setFill); } public static void setIgnoresAlpha (bool flag) { OS.objc_msgSend(OS.class_NSColor, OS.sel_setIgnoresAlpha_1, flag); } public void setStroke () { OS.objc_msgSend(this.id, OS.sel_setStroke); } public static NSColor shadowColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_shadowColor); return result !is null ? new NSColor(result) : null; } public NSColor shadowWithLevel (CGFloat val) { objc.id result = OS.objc_msgSend(this.id, OS.sel_shadowWithLevel_1, val); return result is this.id ? this : (result !is null ? new NSColor(result) : null); } public static NSColor textBackgroundColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_textBackgroundColor); return result !is null ? new NSColor(result) : null; } public static NSColor textColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_textColor); return result !is null ? new NSColor(result) : null; } public static NSColor whiteColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_whiteColor); return result !is null ? new NSColor(result) : null; } public CGFloat whiteComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_whiteComponent); } public static NSColor windowBackgroundColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_windowBackgroundColor); return result !is null ? new NSColor(result) : null; } public static NSColor windowFrameColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_windowFrameColor); return result !is null ? new NSColor(result) : null; } public static NSColor windowFrameTextColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_windowFrameTextColor); return result !is null ? new NSColor(result) : null; } public void writeToPasteboard (NSPasteboard pasteBoard) { OS.objc_msgSend(this.id, OS.sel_writeToPasteboard_1, pasteBoard !is null ? pasteBoard.id : null); } public static NSColor yellowColor () { objc.id result = OS.objc_msgSend(OS.class_NSColor, OS.sel_yellowColor); return result !is null ? new NSColor(result) : null; } public CGFloat yellowComponent () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_yellowComponent); } }