diff dwt/internal/cocoa/NSSound.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/NSSound.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * 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.NSSound;
+
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSArray;
+import dwt.internal.cocoa.NSData;
+import dwt.internal.cocoa.NSDate : NSTimeInterval;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.NSPasteboard;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.NSURL;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSSound : NSObject
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public static bool canInitWithPasteboard (NSPasteboard pasteboard)
+    {
+        return OS.objc_msgSend(OS.class_NSSound, OS.sel_canInitWithPasteboard_1, pasteboard !is null ? pasteboard.id : null) !is null;
+    }
+
+    public NSArray channelMapping ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_channelMapping);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public NSTimeInterval currentTime ()
+    {
+        return cast(NSTimeInterval) OS.objc_msgSend_fpret(this.id, OS.sel_currentTime);
+    }
+
+    public id delegatee ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSTimeInterval duration ()
+    {
+        return cast(NSTimeInterval) OS.objc_msgSend_fpret(this.id, OS.sel_duration);
+    }
+
+    public id initWithContentsOfFile (NSString path, bool byRef)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfFile_1byReference_1, path !is null ? path.id : null, byRef);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initWithContentsOfURL (NSURL url, bool byRef)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfURL_1byReference_1, url !is null ? url.id : null, byRef);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initWithData (NSData data)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithData_1, data !is null ? data.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initWithPasteboard (NSPasteboard pasteboard)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithPasteboard_1, pasteboard !is null ? pasteboard.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public bool isPlaying ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isPlaying) !is null;
+    }
+
+    public bool loops ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_loops) !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 bool pause ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_pause) !is null;
+    }
+
+    public bool play ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_play) !is null;
+    }
+
+    public NSString playbackDeviceIdentifier ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_playbackDeviceIdentifier);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public bool resume ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_resume) !is null;
+    }
+
+    public void setChannelMapping (NSArray channelMapping)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setChannelMapping_1, channelMapping !is null ? channelMapping.id : null);
+    }
+
+    public void setCurrentTime (NSTimeInterval seconds)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setCurrentTime_1, seconds);
+    }
+
+    public void setDelegate (id aDelegate)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setDelegate_1, aDelegate !is null ? aDelegate.id : null);
+    }
+
+    public void setLoops (bool val)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setLoops_1, val);
+    }
+
+    public bool setName (NSString string)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_setName_1, string !is null ? string.id : null) !is null;
+    }
+
+    public void setPlaybackDeviceIdentifier (NSString deviceUID)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setPlaybackDeviceIdentifier_1, deviceUID !is null ? deviceUID.id : null);
+    }
+
+    public void setVolume (float volume)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setVolume_1, volume);
+    }
+
+    public static id soundNamed (NSString name)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundNamed_1, name !is null ? name.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public static NSArray soundUnfilteredFileTypes ()
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundUnfilteredFileTypes);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public static NSArray soundUnfilteredPasteboardTypes ()
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundUnfilteredPasteboardTypes);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public static NSArray soundUnfilteredTypes ()
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSound, OS.sel_soundUnfilteredTypes);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public bool stop ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_stop) !is null;
+    }
+
+    public float volume ()
+    {
+        return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_volume);
+    }
+
+    public void writeToPasteboard (NSPasteboard pasteboard)
+    {
+        OS.objc_msgSend(this.id, OS.sel_writeToPasteboard_1, pasteboard !is null ? pasteboard.id : null);
+    }
+
+}