diff dwt/internal/cocoa/NSHelpManager.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/NSHelpManager.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * 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.NSHelpManager;
+
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSAttributedString;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.NSPoint;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSHelpManager : NSObject
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public NSAttributedString contextHelpForObject (id object)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_contextHelpForObject_1, object !is null ? object.id : null);
+        return result !is null ? new NSAttributedString(result) : null;
+    }
+
+    public void findString (NSString query, NSString book)
+    {
+        OS.objc_msgSend(this.id, OS.sel_findString_1inBook_1, query !is null ? query.id : null, book !is null ? book.id : null);
+    }
+
+    public static bool isContextHelpModeActive ()
+    {
+        return OS.objc_msgSend(OS.class_NSHelpManager, OS.sel_isContextHelpModeActive) !is null;
+    }
+
+    public void openHelpAnchor (NSString anchor, NSString book)
+    {
+        OS.objc_msgSend(this.id, OS.sel_openHelpAnchor_1inBook_1, anchor !is null ? anchor.id : null, book !is null ? book.id : null);
+    }
+
+    public void removeContextHelpForObject (id object)
+    {
+        OS.objc_msgSend(this.id, OS.sel_removeContextHelpForObject_1, object !is null ? object.id : null);
+    }
+
+    public void setContextHelp (NSAttributedString attrString, id object)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setContextHelp_1forObject_1, attrString !is null ? attrString.id : null, object !is null ? object.id : null);
+    }
+
+    public static void setContextHelpModeActive (bool active)
+    {
+        OS.objc_msgSend(OS.class_NSHelpManager, OS.sel_setContextHelpModeActive_1, active);
+    }
+
+    public static NSHelpManager sharedHelpManager ()
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSHelpManager, OS.sel_sharedHelpManager);
+        return result !is null ? new NSHelpManager(result) : null;
+    }
+
+    public bool showContextHelpForObject (id object, NSPoint pt)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_showContextHelpForObject_1locationHint_1, object !is null ? object.id : null, pt) !is null;
+    }
+
+}