view dwt/internal/cocoa/NSInputManager.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 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.NSInputManager;

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSEvent;
import dwt.internal.cocoa.NSImage;
import dwt.internal.cocoa.NSInputServer;
import dwt.internal.cocoa.NSObject;
import dwt.internal.cocoa.NSRange;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSInputManager : NSObject
{

    public this ()
    {
        super();
    }

    public this (objc.id id)
    {
        super(id);
    }

    public static NSInputManager currentInputManager ()
    {
        objc.id result = OS.objc_msgSend(OS.class_NSInputManager, OS.sel_currentInputManager);
        return result !is null ? new NSInputManager(result) : null;
    }

    public static void cycleToNextInputLanguage (id sender)
    {
        OS.objc_msgSend(OS.class_NSInputManager, OS.sel_cycleToNextInputLanguage_1, sender !is null ? sender.id : null);
    }

    public static void cycleToNextInputServerInLanguage (id sender)
    {
        OS.objc_msgSend(OS.class_NSInputManager, OS.sel_cycleToNextInputServerInLanguage_1, sender !is null ? sender.id : null);
    }

    public bool handleMouseEvent (NSEvent theMouseEvent)
    {
        return OS.objc_msgSend(this.id, OS.sel_handleMouseEvent_1, theMouseEvent !is null ? theMouseEvent.id : null) !is null;
    }

    public NSImage image ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_image);
        return result !is null ? new NSImage(result) : null;
    }

    public NSInputManager initWithName (NSString inputServerName, NSString hostName)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithName_1host_1, inputServerName !is null ? inputServerName.id : null,
                hostName !is null ? hostName.id : null);
        return result is this.id ? this : (result !is null ? new NSInputManager(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 NSString localizedInputManagerName ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_localizedInputManagerName);
        return result !is null ? new NSString(result) : null;
    }

    public void markedTextAbandoned (id cli)
    {
        OS.objc_msgSend(this.id, OS.sel_markedTextAbandoned_1, cli !is null ? cli.id : null);
    }

    public void markedTextSelectionChanged (NSRange newSel, id cli)
    {
        OS.objc_msgSend(this.id, OS.sel_markedTextSelectionChanged_1client_1, newSel, cli !is null ? cli.id : null);
    }

    public NSInputServer server ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_server);
        return result !is null ? new NSInputServer(result) : null;
    }

    public bool wantsToDelayTextChangeNotifications ()
    {
        return OS.objc_msgSend(this.id, OS.sel_wantsToDelayTextChangeNotifications) !is null;
    }

    public bool wantsToHandleMouseEvents ()
    {
        return OS.objc_msgSend(this.id, OS.sel_wantsToHandleMouseEvents) !is null;
    }

    public bool wantsToInterpretAllKeystrokes ()
    {
        return OS.objc_msgSend(this.id, OS.sel_wantsToInterpretAllKeystrokes) !is null;
    }

}