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

import dwt.internal.cocoa.NSDictionary;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSNotificationCenter;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSDistributedNotificationCenter : NSNotificationCenter
{

    public this ()
    {
        super();
    }

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

    public void addObserver_selector_name_object_ (id observer, objc.SEL aSelector, NSString aName, NSString anObject)
    {
        OS.objc_msgSend(this.id, OS.sel_addObserver_1selector_1name_1object_1, observer !is null ? observer.id : null, aSelector,
                aName !is null ? aName.id : null, anObject !is null ? anObject.id : null);
    }

    public void addObserver_selector_name_object_suspensionBehavior_ (id observer, objc.SEL selector, NSString name, NSString object,
            objc.id suspensionBehavior)
    {
        OS.objc_msgSend(this.id, OS.sel_addObserver_1selector_1name_1object_1suspensionBehavior_1, observer !is null ? observer.id : null, selector,
                name !is null ? name.id : null, object !is null ? object.id : null, suspensionBehavior);
    }

    public static NSNotificationCenter defaultCenter ()
    {
        objc.id result = OS.objc_msgSend(OS.class_NSDistributedNotificationCenter, OS.sel_defaultCenter);
        return result !is null ? new NSNotificationCenter(result) : null;
    }

    public static NSDistributedNotificationCenter notificationCenterForType (NSString notificationCenterType)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSDistributedNotificationCenter, OS.sel_notificationCenterForType_1,
                notificationCenterType !is null ? notificationCenterType.id : null);
        return result !is null ? new NSDistributedNotificationCenter(result) : null;
    }

    public void postNotificationName_object_ (NSString aName, NSString anObject)
    {
        OS.objc_msgSend(this.id, OS.sel_postNotificationName_1object_1, aName !is null ? aName.id : null, anObject !is null ? anObject.id : null);
    }

    public void postNotificationName_object_userInfo_ (NSString aName, NSString anObject, NSDictionary aUserInfo)
    {
        OS.objc_msgSend(this.id, OS.sel_postNotificationName_1object_1userInfo_1, aName !is null ? aName.id : null,
                anObject !is null ? anObject.id : null, aUserInfo !is null ? aUserInfo.id : null);
    }

    public void postNotificationName_object_userInfo_deliverImmediately_ (NSString name, NSString object, NSDictionary userInfo,
            bool deliverImmediately)
    {
        OS.objc_msgSend(this.id, OS.sel_postNotificationName_1object_1userInfo_1deliverImmediately_1, name !is null ? name.id : null,
                object !is null ? object.id : null, userInfo !is null ? userInfo.id : null, deliverImmediately);
    }

    public void postNotificationName_object_userInfo_options_ (NSString name, NSString object, NSDictionary userInfo, NSUInteger options)
    {
        OS.objc_msgSend(this.id, OS.sel_postNotificationName_1object_1userInfo_1options_1, name !is null ? name.id : null,
                object !is null ? object.id : null, userInfo !is null ? userInfo.id : null, options);
    }

    public void removeObserver (id observer, NSString aName, NSString anObject)
    {
        OS.objc_msgSend(this.id, OS.sel_removeObserver_1name_1object_1, observer !is null ? observer.id : null, aName !is null ? aName.id : null,
                anObject !is null ? anObject.id : null);
    }

    public void setSuspended (bool suspended)
    {
        OS.objc_msgSend(this.id, OS.sel_setSuspended_1, suspended);
    }

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

}