diff dwt/internal/cocoa/NSSpeechSynthesizer.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/NSSpeechSynthesizer.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * 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.NSSpeechSynthesizer;
+
+import dwt.internal.cocoa.NSArray;
+import dwt.internal.cocoa.NSDictionary;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.NSURL;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+
+
+enum NSSpeechBoundar : NSUInteger
+{
+    NSSpeechImmediateBoundary = 0,
+    NSSpeechWordBoundary,
+    NSSpeechSentenceBoundary
+}
+
+alias NSSpeechBoundar.NSSpeechImmediateBoundary NSSpeechImmediateBoundary;
+alias NSSpeechBoundar.NSSpeechWordBoundary NSSpeechWordBoundary;
+alias NSSpeechBoundar.NSSpeechSentenceBoundary NSSpeechSentenceBoundary;
+
+
+
+public class NSSpeechSynthesizer : NSObject
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public void addSpeechDictionary (NSDictionary speechDictionary)
+    {
+        OS.objc_msgSend(this.id, OS.sel_addSpeechDictionary_1, speechDictionary !is null ? speechDictionary.id : null);
+    }
+
+    public static NSDictionary attributesForVoice (NSString voice)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSpeechSynthesizer, OS.sel_attributesForVoice_1, voice !is null ? voice.id : null);
+        return result !is null ? new NSDictionary(result) : null;
+    }
+
+    public static NSArray availableVoices ()
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSpeechSynthesizer, OS.sel_availableVoices);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public void continueSpeaking ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_continueSpeaking);
+    }
+
+    public static NSString defaultVoice ()
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSpeechSynthesizer, OS.sel_defaultVoice);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public id delegatee ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initWithVoice (NSString voice)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithVoice_1, voice !is null ? voice.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public static bool isAnyApplicationSpeaking ()
+    {
+        return OS.objc_msgSend(OS.class_NSSpeechSynthesizer, OS.sel_isAnyApplicationSpeaking) !is null;
+    }
+
+    public bool isSpeaking ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isSpeaking) !is null;
+    }
+
+    public id objectForProperty (NSString property, objc.id** outError)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_objectForProperty_1error_1, property !is null ? property.id : null, outError);
+        return result !is null ? new id(result) : null;
+    }
+
+    public void pauseSpeakingAtBoundary (NSSpeechBoundar boundary)
+    {
+        OS.objc_msgSend(this.id, OS.sel_pauseSpeakingAtBoundary_1, boundary);
+    }
+
+    public NSString phonemesFromText (NSString text)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_phonemesFromText_1, text !is null ? text.id : null);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public float rate ()
+    {
+        return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_rate);
+    }
+
+    public void setDelegate (id anObject)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setDelegate_1, anObject !is null ? anObject.id : null);
+    }
+
+    public bool setObject (id object, NSString property, objc.id** outError)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_setObject_1forProperty_1error_1, object !is null ? object.id : null,
+                property !is null ? property.id : null, outError) !is null;
+    }
+
+    public void setRate (float rate)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setRate_1, rate);
+    }
+
+    public void setUsesFeedbackWindow (bool flag)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setUsesFeedbackWindow_1, flag);
+    }
+
+    public bool setVoice (NSString voice)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_setVoice_1, voice !is null ? voice.id : null) !is null;
+    }
+
+    public void setVolume (float volume)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setVolume_1, volume);
+    }
+
+    public bool startSpeakingString_ (NSString string)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_startSpeakingString_1, string !is null ? string.id : null) !is null;
+    }
+
+    public bool startSpeakingString_toURL_ (NSString string, NSURL url)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_startSpeakingString_1toURL_1, string !is null ? string.id : null, url !is null ? url.id : null) !is null;
+    }
+
+    public void stopSpeaking ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_stopSpeaking);
+    }
+
+    public void stopSpeakingAtBoundary (NSSpeechBoundar boundary)
+    {
+        OS.objc_msgSend(this.id, OS.sel_stopSpeakingAtBoundary_1, boundary);
+    }
+
+    public bool usesFeedbackWindow ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_usesFeedbackWindow) !is null;
+    }
+
+    public NSString voice ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_voice);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public float volume ()
+    {
+        return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_volume);
+    }
+
+}