diff dwt/internal/cocoa/NSSpellChecker.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/NSSpellChecker.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.NSSpellChecker;
+
+import dwt.internal.cocoa.NSArray;
+import dwt.internal.cocoa.NSDictionary;
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.NSPanel;
+import dwt.internal.cocoa.NSRange;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.NSView;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSSpellChecker : NSObject
+{
+
+    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 NSArray availableLanguages ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_availableLanguages);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public NSRange checkGrammarOfString (NSString stringToCheck, NSInteger startingOffset, NSString language, bool wrapFlag, NSInteger tag, /*NSArray** */objc.id** details)
+    {
+        NSRange result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_checkGrammarOfString_1startingAt_1language_1wrap_1inSpellDocumentWithTag_1details_1,
+                stringToCheck !is null ? stringToCheck.id : null, startingOffset, language !is null ? language.id : null, wrapFlag, tag, details);
+        return result;
+    }
+
+    public NSRange checkSpellingOfString_startingAt_ (NSString stringToCheck, NSInteger startingOffset)
+    {
+        NSRange result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_checkSpellingOfString_1startingAt_1, stringToCheck !is null ? stringToCheck.id : null,
+                startingOffset);
+        return result;
+    }
+
+    public NSRange checkSpellingOfString_startingAt_language_wrap_inSpellDocumentWithTag_wordCount_ (NSString stringToCheck, NSInteger startingOffset,
+            NSString language, bool wrapFlag, NSInteger tag, NSInteger* wordCount)
+    {
+        NSRange result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_checkSpellingOfString_1startingAt_1language_1wrap_1inSpellDocumentWithTag_1wordCount_1,
+                stringToCheck !is null ? stringToCheck.id : null, startingOffset, language !is null ? language.id : null, wrapFlag, tag, wordCount);
+        return result;
+    }
+
+    public void closeSpellDocumentWithTag (NSInteger tag)
+    {
+        OS.objc_msgSend(this.id, OS.sel_closeSpellDocumentWithTag_1, tag);
+    }
+
+    public NSArray completionsForPartialWordRange (NSRange range, NSString string, NSString language, NSInteger tag)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_completionsForPartialWordRange_1inString_1language_1inSpellDocumentWithTag_1, range,
+                string !is null ? string.id : null, language !is null ? language.id : null, tag);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public NSInteger countWordsInString (NSString stringToCount, NSString language)
+    {
+        return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_countWordsInString_1language_1, stringToCount !is null ? stringToCount.id : null,
+                language !is null ? language.id : null);
+    }
+
+    public void forgetWord (NSString word)
+    {
+        OS.objc_msgSend(this.id, OS.sel_forgetWord_1, word !is null ? word.id : null);
+    }
+
+    public NSArray guessesForWord (NSString word)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_guessesForWord_1, word !is null ? word.id : null);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public bool hasLearnedWord (NSString word)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_hasLearnedWord_1, word !is null ? word.id : null) !is null;
+    }
+
+    public void ignoreWord (NSString wordToIgnore, NSInteger tag)
+    {
+        OS.objc_msgSend(this.id, OS.sel_ignoreWord_1inSpellDocumentWithTag_1, wordToIgnore !is null ? wordToIgnore.id : null, tag);
+    }
+
+    public NSArray ignoredWordsInSpellDocumentWithTag (NSInteger tag)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_ignoredWordsInSpellDocumentWithTag_1, tag);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public NSString language ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_language);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public void learnWord (NSString word)
+    {
+        OS.objc_msgSend(this.id, OS.sel_learnWord_1, word !is null ? word.id : null);
+    }
+
+    public void setAccessoryView (NSView aView)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setAccessoryView_1, aView !is null ? aView.id : null);
+    }
+
+    public void setIgnoredWords (NSArray words, NSInteger tag)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setIgnoredWords_1inSpellDocumentWithTag_1, words !is null ? words.id : null, tag);
+    }
+
+    public bool setLanguage (NSString language)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_setLanguage_1, language !is null ? language.id : null) !is null;
+    }
+
+    public void setWordFieldStringValue (NSString aString)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setWordFieldStringValue_1, aString !is null ? aString.id : null);
+    }
+
+    public static NSSpellChecker sharedSpellChecker ()
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSSpellChecker, OS.sel_sharedSpellChecker);
+        return result !is null ? new NSSpellChecker(result) : null;
+    }
+
+    public static bool sharedSpellCheckerExists ()
+    {
+        return OS.objc_msgSend(OS.class_NSSpellChecker, OS.sel_sharedSpellCheckerExists) !is null;
+    }
+
+    public NSPanel spellingPanel ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_spellingPanel);
+        return result !is null ? new NSPanel(result) : null;
+    }
+
+    public static NSInteger uniqueSpellDocumentTag ()
+    {
+        return cast(NSInteger) OS.objc_msgSend(OS.class_NSSpellChecker, OS.sel_uniqueSpellDocumentTag);
+    }
+
+    public void unlearnWord (NSString word)
+    {
+        OS.objc_msgSend(this.id, OS.sel_unlearnWord_1, word !is null ? word.id : null);
+    }
+
+    public void updateSpellingPanelWithGrammarString (NSString string, NSDictionary detail)
+    {
+        OS.objc_msgSend(this.id, OS.sel_updateSpellingPanelWithGrammarString_1detail_1, string !is null ? string.id : null,
+                detail !is null ? detail.id : null);
+    }
+
+    public void updateSpellingPanelWithMisspelledWord (NSString word)
+    {
+        OS.objc_msgSend(this.id, OS.sel_updateSpellingPanelWithMisspelledWord_1, word !is null ? word.id : null);
+    }
+
+}