view dwt/internal/cocoa/NSHelpManager.d @ 1:8b48be5454ce

The internal cocoa classes compile now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Tue, 19 Aug 2008 17:35:17 +0200
parents 380af2bdd8e5
children f565d3a95c0a
line wrap: on
line source

/*******************************************************************************
 * 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;
    }

}