view dwt/internal/cocoa/NSView.d @ 129:ad4e1fe71a5a

Fixed runtime errors
author Jacob Carlborg <doob@me.com>
date Sun, 18 Jan 2009 18:39:46 +0100
parents 62202ce0039f
children
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.NSView;

import dwt.dwthelper.utils;
import cocoa = dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSArray;
import dwt.internal.cocoa.NSEvent;
import dwt.internal.cocoa.NSImage;
import dwt.internal.cocoa.NSMenu;
import dwt.internal.cocoa.NSPasteboard;
import dwt.internal.cocoa.NSPoint;
import dwt.internal.cocoa.NSRect;
import dwt.internal.cocoa.NSResponder;
import dwt.internal.cocoa.NSSize;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSWindow;
import dwt.internal.cocoa.OS;
import dwt.internal.objc.cocoa.Cocoa;
import objc = dwt.internal.objc.runtime;

public class NSView : NSResponder {

public this() {
    super();
}

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

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

public void addSubview(NSView aView) {
    OS.objc_msgSend(this.id, OS.sel_addSubview_, aView !is null ? aView.id : null);
}

public void addSubview(NSView aView, NSWindowOrderingMode place, NSView otherView) {
    OS.objc_msgSend(this.id, OS.sel_addSubview_positioned_relativeTo_, aView !is null ? aView.id : null, place, otherView !is null ? otherView.id : null);
}

public void beginDocument() {
    OS.objc_msgSend(this.id, OS.sel_beginDocument);
}

public void beginPageInRect(NSRect aRect, NSPoint location) {
    OS.objc_msgSend(this.id, OS.sel_beginPageInRect_atPlacement_, aRect, location);
}

public NSRect bounds() {
    NSRect result = NSRect();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_bounds);
    return result;
}

public NSPoint convertPoint_fromView_(NSPoint aPoint, NSView aView) {
    NSPoint result = NSPoint();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertPoint_fromView_, aPoint, aView !is null ? aView.id : null);
    return result;
}

public NSPoint convertPoint_toView_(NSPoint aPoint, NSView aView) {
    NSPoint result = NSPoint();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertPoint_toView_, aPoint, aView !is null ? aView.id : null);
    return result;
}

public NSPoint convertPointFromBase(NSPoint aPoint) {
    NSPoint result = NSPoint();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertPointFromBase_, aPoint);
    return result;
}

public NSPoint convertPointToBase(NSPoint aPoint) {
    NSPoint result = NSPoint();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertPointToBase_, aPoint);
    return result;
}

public NSRect convertRect_fromView_(NSRect aRect, NSView aView) {
    NSRect result = NSRect();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertRect_fromView_, aRect, aView !is null ? aView.id : null);
    return result;
}

public NSRect convertRect_toView_(NSRect aRect, NSView aView) {
    NSRect result = NSRect();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertRect_toView_, aRect, aView !is null ? aView.id : null);
    return result;
}

public NSRect convertRectFromBase(NSRect aRect) {
    NSRect result = NSRect();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertRectFromBase_, aRect);
    return result;
}

public NSRect convertRectToBase(NSRect aRect) {
    NSRect result = NSRect();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertRectToBase_, aRect);
    return result;
}

public NSSize convertSize_fromView_(NSSize aSize, NSView aView) {
    NSSize result = NSSize();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertSize_fromView_, aSize, aView !is null ? aView.id : null);
    return result;
}

public NSSize convertSize_toView_(NSSize aSize, NSView aView) {
    NSSize result = NSSize();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertSize_toView_, aSize, aView !is null ? aView.id : null);
    return result;
}

public NSSize convertSizeFromBase(NSSize aSize) {
    NSSize result = NSSize();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertSizeFromBase_, aSize);
    return result;
}

public NSSize convertSizeToBase(NSSize aSize) {
    NSSize result = NSSize();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_convertSizeToBase_, aSize);
    return result;
}

public void displayIfNeeded() {
    OS.objc_msgSend(this.id, OS.sel_displayIfNeeded);
}

public void dragImage(NSImage anImage, NSPoint viewLocation, NSSize initialOffset, NSEvent event, NSPasteboard pboard, cocoa.id sourceObj, bool slideFlag) {
    OS.objc_msgSend(this.id, OS.sel_dragImage_at_offset_event_pasteboard_source_slideBack_, anImage !is null ? anImage.id : null, viewLocation, initialOffset, event !is null ? event.id : null, pboard !is null ? pboard.id : null, sourceObj !is null ? sourceObj.id : null, slideFlag);
}

public void drawRect(NSRect rect) {
    OS.objc_msgSend(this.id, OS.sel_drawRect_, rect);
}

public void endDocument() {
    OS.objc_msgSend(this.id, OS.sel_endDocument);
}

public void endPage() {
    OS.objc_msgSend(this.id, OS.sel_endPage);
}

public NSRect frame() {
    NSRect result = NSRect();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_frame);
    return result;
}

public NSView hitTest(NSPoint aPoint) {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_hitTest_, aPoint);
    return result is this.id ? this : (result !is null ? new NSView(result) : null);
}

public NSView initWithFrame(NSRect frameRect) {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithFrame_, frameRect);
    return result is this.id ? this : (result !is null ? new NSView(result) : null);
}

public bool isFlipped() {
    return OS.objc_msgSend_bool(this.id, OS.sel_isFlipped);
}

public bool isOpaque() {
    return OS.objc_msgSend_bool(this.id, OS.sel_isOpaque);
}

public NSMenu menuForEvent(NSEvent event) {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_menuForEvent_, event !is null ? event.id : null);
    return result !is null ? new NSMenu(result) : null;
}

public void registerForDraggedTypes(NSArray newTypes) {
    OS.objc_msgSend(this.id, OS.sel_registerForDraggedTypes_, newTypes !is null ? newTypes.id : null);
}

public void removeFromSuperview() {
    OS.objc_msgSend(this.id, OS.sel_removeFromSuperview);
}

public bool scrollRectToVisible(NSRect aRect) {
    return OS.objc_msgSend_bool(this.id, OS.sel_scrollRectToVisible_, aRect);
}

public void setAutoresizesSubviews(bool flag) {
    OS.objc_msgSend(this.id, OS.sel_setAutoresizesSubviews_, flag);
}

public void setAutoresizingMask(NSUInteger mask) {
    OS.objc_msgSend(this.id, OS.sel_setAutoresizingMask_, mask);
}

public void setFocusRingType(NSFocusRingType focusRingType) {
    OS.objc_msgSend(this.id, OS.sel_setFocusRingType_, focusRingType);
}

public void setFrame(NSRect frameRect) {
    OS.objc_msgSend(this.id, OS.sel_setFrame_, frameRect);
}

public void setFrameOrigin(NSPoint newOrigin) {
    OS.objc_msgSend(this.id, OS.sel_setFrameOrigin_, newOrigin);
}

public void setFrameSize(NSSize newSize) {
    OS.objc_msgSend(this.id, OS.sel_setFrameSize_, newSize);
}

public void setHidden(bool flag) {
    OS.objc_msgSend(this.id, OS.sel_setHidden_, flag);
}

public void setNeedsDisplay(bool flag) {
    OS.objc_msgSend(this.id, OS.sel_setNeedsDisplay_, flag);
}

public void setNeedsDisplayInRect(NSRect invalidRect) {
    OS.objc_msgSend(this.id, OS.sel_setNeedsDisplayInRect_, invalidRect);
}

public void setToolTip(NSString string) {
    OS.objc_msgSend(this.id, OS.sel_setToolTip_, string !is null ? string.id : null);
}

public NSArray subviews() {
	objc.id result = OS.objc_msgSend(this.id, OS.sel_subviews);
	return result !is null ? new NSArray(result) : null;
}

public NSView superview() {
    objc.id result = OS.objc_msgSend(this.id, OS.sel_superview);
    return result is this.id ? this : (result !is null ? new NSView(result) : null);
}

public void unregisterDraggedTypes() {
    OS.objc_msgSend(this.id, OS.sel_unregisterDraggedTypes);
}

public NSRect visibleRect() {
    NSRect result = NSRect();
    OS.objc_msgSend_stret(&result, this.id, OS.sel_visibleRect);
    return result;
}

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

}