Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSColorList.d @ 13:f565d3a95c0a
Ported dwt.internal
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Fri, 22 Aug 2008 16:46:34 +0200 |
parents | 8b48be5454ce |
children |
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.NSColorList; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSColor; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSColorList : NSObject { public this () { super(); } public this (objc.id id) { super(id); } public NSArray allKeys () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_allKeys); return result !is null ? new NSArray(result) : null; } public static NSArray availableColorLists () { objc.id result = OS.objc_msgSend(OS.class_NSColorList, OS.sel_availableColorLists); return result !is null ? new NSArray(result) : null; } public static NSColorList colorListNamed (NSString name) { objc.id result = OS.objc_msgSend(OS.class_NSColorList, OS.sel_colorListNamed_1, name !is null ? name.id_ : null); return result !is null ? new NSColorList(result) : null; } public NSColor colorWithKey (NSString key) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_colorWithKey_1, key !is null ? key.id_ : null); return result !is null ? new NSColor(result) : null; } public NSColorList initWithName_ (NSString name) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithName_1, name !is null ? name.id_ : null); return result !is null ? this : null; } public NSColorList initWithName_fromFile_ (NSString name, NSString path) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithName_1fromFile_1, name !is null ? name.id_ : null, path !is null ? path.id_ : null); return result !is null ? this : null; } public void insertColor (NSColor color, NSString key, NSUInteger loc) { OS.objc_msgSend(this.id_, OS.sel_insertColor_1key_1atIndex_1, color !is null ? color.id_ : null, key !is null ? key.id_ : null, loc); } public bool isEditable () { return OS.objc_msgSend(this.id_, OS.sel_isEditable) !is null; } public NSString name () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_name); return result !is null ? new NSString(result) : null; } public void removeColorWithKey (NSString key) { OS.objc_msgSend(this.id_, OS.sel_removeColorWithKey_1, key !is null ? key.id_ : null); } public void removeFile () { OS.objc_msgSend(this.id_, OS.sel_removeFile); } public void setColor (NSColor color, NSString key) { OS.objc_msgSend(this.id_, OS.sel_setColor_1forKey_1, color !is null ? color.id_ : null, key !is null ? key.id_ : null); } public bool writeToFile (NSString path) { return OS.objc_msgSend(this.id_, OS.sel_writeToFile_1, path !is null ? path.id_ : null) !is null; } }