Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSColorPanel.d @ 1:8b48be5454ce
The internal cocoa classes compile now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Tue, 19 Aug 2008 17:35:17 +0200 |
parents | 380af2bdd8e5 |
children | f565d3a95c0a |
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.NSColorPanel; import dwt.internal.cocoa.CGFloat; import dwt.internal.cocoa.id; import dwt.internal.cocoa.NSColor; import dwt.internal.cocoa.NSColorList; import dwt.internal.cocoa.NSEvent; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSPanel; import dwt.internal.cocoa.NSView; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; alias NSInteger NSColorPanelMode; public class NSColorPanel : NSPanel { public this () { super(); } public this (objc.id id) { super(id); } public NSView accessoryView () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_accessoryView); return result !is null ? new NSView(result) : null; } public CGFloat alpha () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_alpha); } public void attachColorList (NSColorList colorList) { OS.objc_msgSend(this.id_, OS.sel_attachColorList_1, colorList !is null ? colorList.id_ : null); } public NSColor color () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_color); return result !is null ? new NSColor(result) : null; } public void detachColorList (NSColorList colorList) { OS.objc_msgSend(this.id_, OS.sel_detachColorList_1, colorList !is null ? colorList.id_ : null); } public static bool dragColor (NSColor color, NSEvent theEvent, NSView sourceView) { return OS.objc_msgSend(OS.class_NSColorPanel, OS.sel_dragColor_1withEvent_1fromView_1, color !is null ? color.id_ : null, theEvent !is null ? theEvent.id_ : null, sourceView !is null ? sourceView.id_ : null) !is null; } public bool isContinuous () { return OS.objc_msgSend(this.id_, OS.sel_isContinuous) !is null; } public objc.id mode () { return OS.objc_msgSend(this.id_, OS.sel_mode); } public void setAccessoryView (NSView aView) { OS.objc_msgSend(this.id_, OS.sel_setAccessoryView_1, aView !is null ? aView.id_ : null); } public void setAction (objc.SEL aSelector) { OS.objc_msgSend(this.id_, OS.sel_setAction_1, aSelector); } public void setColor (NSColor color) { OS.objc_msgSend(this.id_, OS.sel_setColor_1, color !is null ? color.id_ : null); } public void setContinuous (bool flag) { OS.objc_msgSend(this.id_, OS.sel_setContinuous_1, flag); } public void setMode (objc.id mode) { OS.objc_msgSend(this.id_, OS.sel_setMode_1, mode); } public static void setPickerMask (NSUInteger mask) { OS.objc_msgSend(OS.class_NSColorPanel, OS.sel_setPickerMask_1, mask); } public static void setPickerMode (NSColorPanelMode mode) { OS.objc_msgSend(OS.class_NSColorPanel, OS.sel_setPickerMode_1, mode); } public void setShowsAlpha (bool flag) { OS.objc_msgSend(this.id_, OS.sel_setShowsAlpha_1, flag); } public void setTarget (id anObject) { OS.objc_msgSend(this.id_, OS.sel_setTarget_1, anObject !is null ? anObject.id_ : null); } public static NSColorPanel sharedColorPanel () { objc.id result = OS.objc_msgSend(OS.class_NSColorPanel, OS.sel_sharedColorPanel); return result !is null ? new NSColorPanel(result) : null; } public static bool sharedColorPanelExists () { return OS.objc_msgSend(OS.class_NSColorPanel, OS.sel_sharedColorPanelExists) !is null; } public bool showsAlpha () { return OS.objc_msgSend(this.id_, OS.sel_showsAlpha) !is null; } }