view dwt/internal/cocoa/NSObject.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents 642f460a0908
children 62202ce0039f
line wrap: on
line source

/*******************************************************************************
 * Copyright (c) 2000, 2008 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 <doob@me.com>
 *******************************************************************************/
module dwt.internal.cocoa.NSObject;

import dwt.dwthelper.utils;
import dwt.internal.cocoa.DOMEvent;
import cocoa = dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSArray;
import dwt.internal.cocoa.NSImage;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSNotification;
import dwt.internal.cocoa.NSOutlineView;
import dwt.internal.cocoa.NSPasteboard;
import dwt.internal.cocoa.NSPoint;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSTableColumn;
import dwt.internal.cocoa.NSTableView;
import dwt.internal.cocoa.NSURL;
import dwt.internal.cocoa.NSWindow;
import dwt.internal.cocoa.OS;
import dwt.internal.cocoa.Protocol;
import dwt.internal.objc.cocoa.Cocoa;
import objc = dwt.internal.objc.runtime;

public class NSObject : cocoa.id {

public this() {
    super();
}

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

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

public NSObject alloc() {
    this.id = OS.objc_msgSend(objc_getClass(), OS.sel_alloc);
    return this;
}

public void applicationWillResignActive(NSNotification notification) {
    OS.objc_msgSend(this.id, OS.sel_applicationWillResignActive_, notification !is null ? notification.id : null);
}

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

public NSPoint draggedImageLocation() {
    NSPoint result = NSPoint();
    OS.objc_msgSend_stret(result, this.id, OS.sel_draggedImageLocation);
    return result;
}

public NSWindow draggingDestinationWindow() {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_draggingDestinationWindow);
    return result !is null ? new NSWindow(result) : null;
}

public void draggingEnded(cocoa.id  sender) {
    OS.objc_msgSend(this.id, OS.sel_draggingEnded_, sender !is null ? sender.id : null);
}

public NSDragOperation draggingEntered(cocoa.id  sender) {
    return OS.objc_msgSend(this.id, OS.sel_draggingEntered_, sender !is null ? sender.id : null);
}

public void draggingExited(dwt.internal.cocoa.id.id  sender) {
    OS.objc_msgSend(this.id, OS.sel_draggingExited_, sender !is null ? sender.id : null);
}

public NSPoint draggingLocation() {
    NSPoint result = NSPoint();
    OS.objc_msgSend_stret(result, this.id, OS.sel_draggingLocation);
    return result;
}

public NSPasteboard draggingPasteboard() {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_draggingPasteboard);
    return result !is null ? new NSPasteboard(result) : null;
}

public NSInteger draggingSequenceNumber() {
    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_draggingSequenceNumber);
}

public cocoa.id draggingSource() {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_draggingSource);
    return result !is null ? new id(result) : null;
}

public NSDragOperation draggingSourceOperationMask() {
    return cast(NSDragOperation) OS.objc_msgSend(this.id, OS.sel_draggingSourceOperationMask);
}

public NSArray namesOfPromisedFilesDroppedAtDestination(NSURL dropDestination) {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_namesOfPromisedFilesDroppedAtDestination_, dropDestination !is null ? dropDestination.id : null);
    return result !is null ? new NSArray(result) : null;
}

public void outlineView(NSOutlineView outlineView, NSTableColumn tableColumn) {
    OS.objc_msgSend(this.id, OS.sel_outlineView_didClickTableColumn_, outlineView !is null ? outlineView.id : null, tableColumn !is null ? tableColumn.id : null);
}

public void outlineViewColumnDidMove(NSNotification notification) {
    OS.objc_msgSend(this.id, OS.sel_outlineViewColumnDidMove_, notification !is null ? notification.id : null);
}

public void outlineViewColumnDidResize(NSNotification notification) {
    OS.objc_msgSend(this.id, OS.sel_outlineViewColumnDidResize_, notification !is null ? notification.id : null);
}

public void tableView(NSTableView tableView, NSTableColumn tableColumn) {
    OS.objc_msgSend(this.id, OS.sel_tableView_didClickTableColumn_, tableView !is null ? tableView.id : null, tableColumn !is null ? tableColumn.id : null);
}

public void tableViewColumnDidMove(NSNotification notification) {
    OS.objc_msgSend(this.id, OS.sel_tableViewColumnDidMove_, notification !is null ? notification.id : null);
}

public void tableViewColumnDidResize(NSNotification notification) {
    OS.objc_msgSend(this.id, OS.sel_tableViewColumnDidResize_, notification !is null ? notification.id : null);
}

public NSObject autorelease() {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_autorelease);
    return result is this.id ? this : (result !is null ? new NSObject(result) : null);
}

public NSString className() {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_className);
    return result !is null ? new NSString(result) : null;
}

public bool conformsToProtocol(Protocol aProtocol) {
    return OS.objc_msgSend_bool(this.id, OS.sel_conformsToProtocol_, aProtocol !is null ? aProtocol.id : null);
}

public cocoa.id copy() {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_copy);
    return result !is null ? new id(result) : null;
}

public NSString description() {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_description);
    return result !is null ? new NSString(result) : null;
}

public NSObject init() {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_init);
    return result is this.id ? this : (result !is null ? new NSObject(result) : null);
}

public bool isEqual(cocoa.id object) {
    return OS.objc_msgSend_bool(this.id, OS.sel_isEqual_, object !is null ? object.id : null);
}

public bool isEqualTo(cocoa.id object) {
    return OS.objc_msgSend_bool(this.id, OS.sel_isEqualTo_, object !is null ? object.id : null);
}

public bool isKindOfClass(objc.Class aClass) {
    return OS.objc_msgSend_bool(this.id, OS.sel_isKindOfClass_, aClass);
}

public void performSelectorOnMainThread(objc.SEL aSelector, cocoa.id arg, bool wait) {
    OS.objc_msgSend(this.id, OS.sel_performSelectorOnMainThread_withObject_waitUntilDone_, aSelector, arg !is null ? arg.id : null, wait);
}

public void release() {
    OS.objc_msgSend(this.id, OS.sel_release);
}

public bool respondsToSelector(objc.SEL aSelector) {
    return OS.objc_msgSend_bool(this.id, OS.sel_respondsToSelector_, aSelector);
}

public cocoa.id retain() {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_retain);
    return result !is null ? new id(result) : null;
}

public NSUInteger retainCount() {
    return OS.objc_msgSend(this.id, OS.sel_retainCount);
}

public objc.Class superclass() {
    return cast(objc.Class) OS.objc_msgSend(this.id, OS.sel_superclass);
}

public void addEventListener(NSString type, cocoa.id  listener, bool useCapture) {
    OS.objc_msgSend(this.id, OS.sel_addEventListener_listener_useCapture_, type !is null ? type.id : null, listener !is null ? listener.id : null, useCapture);
}

public void handleEvent(DOMEvent evt) {
    OS.objc_msgSend(this.id, OS.sel_handleEvent_, evt !is null ? evt.id : null);
}

}