Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSAppleEventDescriptor.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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSAppleEventDescriptor.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,282 @@ +/******************************************************************************* + * 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.NSAppleEventDescriptor; + +import dwt.internal.c.carboncore.MacTypes : FourCharCode; +import dwt.internal.cocoa.NSData; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSObject; +import dwt.internal.cocoa.NSString; +import objc = dwt.internal.objc.runtime; + +alias FourCharCode AEKeyword; + +public class NSAppleEventDescriptor : NSObject +{ + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public objc.id aeDesc () + { + return OS.objc_msgSend(this.id, OS.sel_aeDesc); + } + + public static NSAppleEventDescriptor appleEventWithEventClass (objc.id eventClass, objc.id eventID, NSAppleEventDescriptor targetDescriptor, + short returnID, objc.id transactionID) + { + objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, + OS.sel_appleEventWithEventClass_1eventID_1targetDescriptor_1returnID_1transactionID_1, eventClass, eventID, + targetDescriptor !is null ? targetDescriptor.id : null, returnID, transactionID); + return result !is null ? new NSAppleEventDescriptor(result) : null; + } + + public NSAppleEventDescriptor attributeDescriptorForKeyword (objc.id keyword) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_attributeDescriptorForKeyword_1, keyword); + return result is this.id ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); + } + + public bool boolValue () + { + return OS.objc_msgSend(this.id, OS.sel_boolValue) !is null; + } + + public NSAppleEventDescriptor coerceToDescriptorType (objc.id descriptorType) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_coerceToDescriptorType_1, descriptorType); + return result is this.id ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); + } + + public NSData data () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_data); + return result !is null ? new NSData(result) : null; + } + + public NSAppleEventDescriptor descriptorAtIndex (NSInteger index) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptorAtIndex_1, index); + return result is this.id ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); + } + + public NSAppleEventDescriptor descriptorForKeyword (objc.id keyword) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptorForKeyword_1, keyword); + return result is this.id ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); + } + + public objc.id descriptorType () + { + return OS.objc_msgSend(this.id, OS.sel_descriptorType); + } + + public static NSAppleEventDescriptor descriptorWithBoolean (bool b) + { + objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithBoolean_1, b); + return result !is null ? new NSAppleEventDescriptor(result) : null; + } + + public static NSAppleEventDescriptor static_descriptorWithDescriptorType_bytes_length_ (objc.id descriptorType, /*const*/void* bytes, NSUInteger byteCount) + { + objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithDescriptorType_1bytes_1length_1, descriptorType, bytes, + byteCount); + return result !is null ? new NSAppleEventDescriptor(result) : null; + } + + public static NSAppleEventDescriptor static_descriptorWithDescriptorType_data_ (objc.id descriptorType, NSData data) + { + objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithDescriptorType_1data_1, descriptorType, + data !is null ? data.id : 0); + return result !is null ? new NSAppleEventDescriptor(result) : null; + } + + public static NSAppleEventDescriptor descriptorWithEnumCode (objc.id enumerator) + { + objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithEnumCode_1, enumerator); + return result !is null ? new NSAppleEventDescriptor(result) : null; + } + + public static NSAppleEventDescriptor descriptorWithInt32 (int signedInt) + { + objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithInt32_1, signedInt); + return result !is null ? new NSAppleEventDescriptor(result) : null; + } + + public static NSAppleEventDescriptor descriptorWithString (NSString str) + { + objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithString_1, str !is null ? str.id : 0); + return result !is null ? new NSAppleEventDescriptor(result) : null; + } + + public static NSAppleEventDescriptor descriptorWithTypeCode (objc.id typeCode) + { + objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithTypeCode_1, typeCode); + return result !is null ? new NSAppleEventDescriptor(result) : null; + } + + public objc.id enumCodeValue () + { + return OS.objc_msgSend(this.id, OS.sel_enumCodeValue); + } + + public objc.id eventClass () + { + return OS.objc_msgSend(this.id, OS.sel_eventClass); + } + + public objc.id eventID () + { + return OS.objc_msgSend(this.id, OS.sel_eventID); + } + + public NSAppleEventDescriptor initListDescriptor () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initListDescriptor); + return result !is null ? this : null; + } + + public NSAppleEventDescriptor initRecordDescriptor () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initRecordDescriptor); + return result !is null ? this : null; + } + + public NSAppleEventDescriptor initWithAEDescNoCopy (objc.id aeDesc) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithAEDescNoCopy_1, aeDesc); + return result !is null ? this : null; + } + + public NSAppleEventDescriptor initWithDescriptorType_bytes_length_ (objc.id descriptorType, /*const*/void* bytes, NSUInteger byteCount) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDescriptorType_1bytes_1length_1, descriptorType, bytes, byteCount); + return result !is null ? this : null; + } + + public NSAppleEventDescriptor initWithDescriptorType_data_ (objc.id descriptorType, NSData data) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDescriptorType_1data_1, descriptorType, data !is null ? data.id : null); + return result !is null ? this : null; + } + + public NSAppleEventDescriptor initWithEventClass (objc.id eventClass, objc.id eventID, NSAppleEventDescriptor targetDescriptor, objc.id returnID, + objc.id transactionID) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithEventClass_1eventID_1targetDescriptor_1returnID_1transactionID_1, eventClass, + eventID, targetDescriptor !is null ? targetDescriptor.id : null, returnID, transactionID); + return result !is null ? this : null; + } + + public void insertDescriptor (NSAppleEventDescriptor descriptor, NSInteger index) + { + OS.objc_msgSend(this.id, OS.sel_insertDescriptor_1atIndex_1, descriptor !is null ? descriptor.id : null, index); + } + + public int int32Value () + { + return cast(int) OS.objc_msgSend(this.id, OS.sel_int32Value); + } + + public AEKeyword keywordForDescriptorAtIndex (NSInteger index) + { + return OS.objc_msgSend(this.id, OS.sel_keywordForDescriptorAtIndex_1, index); + } + + public static NSAppleEventDescriptor listDescriptor () + { + objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_listDescriptor); + return result !is null ? new NSAppleEventDescriptor(result) : null; + } + + public static NSAppleEventDescriptor nullDescriptor () + { + objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_nullDescriptor); + return result !is null ? new NSAppleEventDescriptor(result) : null; + } + + public NSInteger numberOfItems () + { + return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfItems); + } + + public NSAppleEventDescriptor paramDescriptorForKeyword (objc.id keyword) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_paramDescriptorForKeyword_1, keyword); + return result is this.id ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); + } + + public static NSAppleEventDescriptor recordDescriptor () + { + objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_recordDescriptor); + return result !is null ? new NSAppleEventDescriptor(result) : null; + } + + public void removeDescriptorAtIndex (NSInteger index) + { + OS.objc_msgSend(this.id, OS.sel_removeDescriptorAtIndex_1, index); + } + + public void removeDescriptorWithKeyword (objc.id keyword) + { + OS.objc_msgSend(this.id, OS.sel_removeDescriptorWithKeyword_1, keyword); + } + + public void removeParamDescriptorWithKeyword (objc.id keyword) + { + OS.objc_msgSend(this.id, OS.sel_removeParamDescriptorWithKeyword_1, keyword); + } + + public short returnID () + { + return cast(short) OS.objc_msgSend(this.id, OS.sel_returnID); + } + + public void setAttributeDescriptor (NSAppleEventDescriptor descriptor, objc.id keyword) + { + OS.objc_msgSend(this.id, OS.sel_setAttributeDescriptor_1forKeyword_1, descriptor !is null ? descriptor.id : null, keyword); + } + + public void setDescriptor (NSAppleEventDescriptor descriptor, objc.id keyword) + { + OS.objc_msgSend(this.id, OS.sel_setDescriptor_1forKeyword_1, descriptor !is null ? descriptor.id : null, keyword); + } + + public void setParamDescriptor (NSAppleEventDescriptor descriptor, objc.id keyword) + { + OS.objc_msgSend(this.id, OS.sel_setParamDescriptor_1forKeyword_1, descriptor !is null ? descriptor.id : null, keyword); + } + + public NSString StringValue () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_StringValue); + return result !is null ? new NSString(result) : null; + } + + public objc.id transactionID () + { + return OS.objc_msgSend(this.id, OS.sel_transactionID); + } + + public objc.id typeCodeValue () + { + return OS.objc_msgSend(this.id, OS.sel_typeCodeValue); + } +}