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

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSArray;
import dwt.internal.cocoa.NSAttributedString;
import dwt.internal.cocoa.NSBitmapImageRep;
import dwt.internal.cocoa.NSClipView;
import dwt.internal.cocoa.NSComparisonResult;
import dwt.internal.cocoa.NSCursor;
import dwt.internal.cocoa.NSData;
import dwt.internal.cocoa.NSDictionary;
import dwt.internal.cocoa.NSEvent;
import dwt.internal.cocoa.NSFocusRingType;
import dwt.internal.cocoa.NSGraphicsContext;
import dwt.internal.cocoa.NSImage;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSMenu;
import dwt.internal.cocoa.NSMenuItem;
import dwt.internal.cocoa.NSPasteboard;
import dwt.internal.cocoa.NSPoint;
import dwt.internal.cocoa.NSRange : NSRangePointer;
import dwt.internal.cocoa.NSRect;
import dwt.internal.cocoa.NSResponder;
import dwt.internal.cocoa.NSRulerMarker;
import dwt.internal.cocoa.NSRulerView;
import dwt.internal.cocoa.NSScreen;
import dwt.internal.cocoa.NSScrollView;
import dwt.internal.cocoa.NSShadow;
import dwt.internal.cocoa.NSSize;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSTrackingArea;
import dwt.internal.cocoa.NSWindow;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

alias NSInteger NSToolTipTag;
alias NSInteger NSTrackingRectTag;



enum NSBorderType
{
    NSNoBorder = 0,
    NSLineBorder = 1,
    NSBezelBorder = 2,
    NSGrooveBorder = 3
}

alias NSBorderType.NSNoBorder NSNoBorder;
alias NSBorderType.NSLineBorder NSLineBorder;
alias NSBorderType.NSBezelBorder NSBezelBorder;
alias NSBorderType.NSGrooveBorder NSGrooveBorder;



public class NSView : NSResponder
{

    public this ()
    {
        super();
    }

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

    public bool acceptsFirstMouse (NSEvent theEvent)
    {
        return OS.objc_msgSend(this.id, OS.sel_acceptsFirstMouse_1, theEvent !is null ? theEvent.id : null) !is null;
    }

    public void addCursorRect (NSRect aRect, NSCursor anObj)
    {
        OS.objc_msgSend(this.id, OS.sel_addCursorRect_1cursor_1, aRect, anObj !is null ? anObj.id : null);
    }

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

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

    public NSToolTipTag addToolTipRect (NSRect aRect, id anObject, void* data)
    {
        return cast(NSToolTipTag) OS.objc_msgSend(this.id, OS.sel_addToolTipRect_1owner_1userData_1, aRect, anObject !is null ? anObject.id : null, data);
    }

    public void addTrackingArea (NSTrackingArea trackingArea)
    {
        OS.objc_msgSend(this.id, OS.sel_addTrackingArea_1, trackingArea !is null ? trackingArea.id : null);
    }

    public NSTrackingRectTag addTrackingRect (NSRect aRect, id anObject, void* data, bool flag)
    {
        return cast(NSTrackingRectTag) OS.objc_msgSend(this.id, OS.sel_addTrackingRect_1owner_1userData_1assumeInside_1, aRect, anObject !is null ? anObject.id : null, data,
                flag);
    }

    public void adjustPageHeightNew (CGFloat* newBottom, CGFloat oldTop, CGFloat oldBottom, CGFloat bottomLimit)
    {
        OS.objc_msgSend(this.id, OS.sel_adjustPageHeightNew_1top_1bottom_1limit_1, newBottom, oldTop, oldBottom, bottomLimit);
    }

    public void adjustPageWidthNew (CGFloat* newRight, CGFloat oldLeft, CGFloat oldRight, CGFloat rightLimit)
    {
        OS.objc_msgSend(this.id, OS.sel_adjustPageWidthNew_1left_1right_1limit_1, newRight, oldLeft, oldRight, rightLimit);
    }

    public NSRect adjustScroll (NSRect newVisible)
    {
        NSRect result;
        OS.objc_msgSend_stret(result, this.id, OS.sel_adjustScroll_1, newVisible);
        return result;
    }

    public void allocateGState ()
    {
        OS.objc_msgSend(this.id, OS.sel_allocateGState);
    }

    public CGFloat alphaValue ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_alphaValue);
    }

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

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

    public NSUInteger autoresizingMask ()
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_autoresizingMask);
    }

    public bool autoscroll (NSEvent theEvent)
    {
        return OS.objc_msgSend(this.id, OS.sel_autoscroll_1, theEvent !is null ? theEvent.id : null) !is null;
    }

    public NSArray backgroundFilters ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_backgroundFilters);
        return result !is null ? new NSArray(result) : 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_1atPlacement_1, aRect, location);
    }

    public NSBitmapImageRep bitmapImageRepForCachingDisplayInRect (NSRect rect)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_bitmapImageRepForCachingDisplayInRect_1, rect);
        return result !is null ? new NSBitmapImageRep(result) : null;
    }

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

    public CGFloat boundsRotation ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_boundsRotation);
    }

    public void cacheDisplayInRect (NSRect rect, NSBitmapImageRep bitmapImageRep)
    {
        OS.objc_msgSend(this.id, OS.sel_cacheDisplayInRect_1toBitmapImageRep_1, rect, bitmapImageRep !is null ? bitmapImageRep.id : null);
    }

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

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

    public NSRect centerScanRect (NSRect aRect)
    {
        NSRect result;
        OS.objc_msgSend_stret(result, this.id, OS.sel_centerScanRect_1, aRect);
        return result;
    }

    //public CIFilter compositingFilter() {
    //  objc.id result = OS.objc_msgSend(this.id, OS.sel_compositingFilter);
    //  return result !is null ? new CIFilter(result) : null;
    //}

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

    public NSPoint convertPoint_fromView_ (NSPoint aPoint, NSView aView)
    {
        NSPoint result;
        OS.objc_msgSend_struct(result, this.id, OS.sel_convertPoint_1fromView_1, aPoint, aView !is null ? aView.id : null);
        return result;
    }

    public NSPoint convertPoint_toView_ (NSPoint aPoint, NSView aView)
    {
        NSPoint result;
        OS.objc_msgSend_struct(result, this.id, OS.sel_convertPoint_1toView_1, aPoint, aView !is null ? aView.id : null);
        return result;
    }

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

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

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

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

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

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

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

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

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

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

    public NSData dataWithEPSInsideRect (NSRect rect)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_dataWithEPSInsideRect_1, rect);
        return result !is null ? new NSData(result) : null;
    }

    public NSData dataWithPDFInsideRect (NSRect rect)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_dataWithPDFInsideRect_1, rect);
        return result !is null ? new NSData(result) : null;
    }

    public static NSFocusRingType defaultFocusRingType ()
    {
        return cast(NSFocusRingType) OS.objc_msgSend(OS.class_NSView, OS.sel_defaultFocusRingType);
    }

    public static NSMenu defaultMenu ()
    {
        objc.id result = OS.objc_msgSend(OS.class_NSView, OS.sel_defaultMenu);
        return result !is null ? new NSMenu(result) : null;
    }

    public void didAddSubview (NSView subview)
    {
        OS.objc_msgSend(this.id, OS.sel_didAddSubview_1, subview !is null ? subview.id : null);
    }

    public void discardCursorRects ()
    {
        OS.objc_msgSend(this.id, OS.sel_discardCursorRects);
    }

    public void display ()
    {
        OS.objc_msgSend(this.id, OS.sel_display);
    }

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

    public void displayIfNeededIgnoringOpacity ()
    {
        OS.objc_msgSend(this.id, OS.sel_displayIfNeededIgnoringOpacity);
    }

    public void displayIfNeededInRect (NSRect rect)
    {
        OS.objc_msgSend(this.id, OS.sel_displayIfNeededInRect_1, rect);
    }

    public void displayIfNeededInRectIgnoringOpacity (NSRect rect)
    {
        OS.objc_msgSend(this.id, OS.sel_displayIfNeededInRectIgnoringOpacity_1, rect);
    }

    public void displayRect (NSRect rect)
    {
        OS.objc_msgSend(this.id, OS.sel_displayRect_1, rect);
    }

    public void displayRectIgnoringOpacity_ (NSRect rect)
    {
        OS.objc_msgSend(this.id, OS.sel_displayRectIgnoringOpacity_1, rect);
    }

    public void displayRectIgnoringOpacity_inContext_ (NSRect aRect, NSGraphicsContext context)
    {
        OS.objc_msgSend(this.id, OS.sel_displayRectIgnoringOpacity_1inContext_1, aRect, context !is null ? context.id : null);
    }

    public bool dragFile (NSString filename, NSRect rect, bool aFlag, NSEvent event)
    {
        return OS.objc_msgSend(this.id, OS.sel_dragFile_1fromRect_1slideBack_1event_1, filename !is null ? filename.id : null, rect, aFlag,
                event !is null ? event.id : null) !is null;
    }

    public void dragImage (NSImage anImage, NSPoint viewLocation, NSSize initialOffset, NSEvent event, NSPasteboard pboard, id sourceObj,
            bool slideFlag)
    {
        OS.objc_msgSend(this.id, OS.sel_dragImage_1at_1offset_1event_1pasteboard_1source_1slideBack_1, 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 bool dragPromisedFilesOfTypes (NSArray typeArray, NSRect rect, id sourceObject, bool aFlag, NSEvent event)
    {
        return OS.objc_msgSend(this.id, OS.sel_dragPromisedFilesOfTypes_1fromRect_1source_1slideBack_1event_1,
                typeArray !is null ? typeArray.id : null, rect, sourceObject !is null ? sourceObject.id : null, aFlag,
                event !is null ? event.id : null) !is null;
    }

    public void drawPageBorderWithSize (NSSize borderSize)
    {
        OS.objc_msgSend(this.id, OS.sel_drawPageBorderWithSize_1, borderSize);
    }

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

    public void drawSheetBorderWithSize (NSSize borderSize)
    {
        OS.objc_msgSend(this.id, OS.sel_drawSheetBorderWithSize_1, borderSize);
    }

    public NSMenuItem enclosingMenuItem ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_enclosingMenuItem);
        return result !is null ? new NSMenuItem(result) : null;
    }

    public NSScrollView enclosingScrollView ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_enclosingScrollView);
        return result !is null ? new NSScrollView(result) : null;
    }

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

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

    public bool enterFullScreenMode (NSScreen screen, NSDictionary options)
    {
        return OS.objc_msgSend(this.id, OS.sel_enterFullScreenMode_1withOptions_1, screen !is null ? screen.id : null,
                options !is null ? options.id : null) !is null;
    }

    public void exitFullScreenModeWithOptions (NSDictionary options)
    {
        OS.objc_msgSend(this.id, OS.sel_exitFullScreenModeWithOptions_1, options !is null ? options.id : null);
    }

    public NSFocusRingType focusRingType ()
    {
        return cast(NSFocusRingType) OS.objc_msgSend(this.id, OS.sel_focusRingType);
    }

    public static NSView focusView ()
    {
        objc.id result = OS.objc_msgSend(OS.class_NSView, OS.sel_focusView);
        return result !is null ? new NSView(result) : null;
    }

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

    public CGFloat frameCenterRotation ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_frameCenterRotation);
    }

    public CGFloat frameRotation ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_frameRotation);
    }

    public NSInteger gState ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_gState);
    }

    public void getRectsBeingDrawn (/*const NSRect** */objc.id** rects, NSInteger* count)
    {
        OS.objc_msgSend(this.id, OS.sel_getRectsBeingDrawn_1count_1, rects, count);
    }

    public void getRectsExposedDuringLiveResize (/*NSRect[4]*/NSRect* exposedRects, NSInteger* count)
    {
        OS.objc_msgSend(this.id, OS.sel_getRectsExposedDuringLiveResize_1count_1, exposedRects, count);
    }

    public CGFloat heightAdjustLimit ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_heightAdjustLimit);
    }

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

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

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

    public bool isDescendantOf (NSView aView)
    {
        return OS.objc_msgSend(this.id, OS.sel_isDescendantOf_1, aView !is null ? aView.id : null) !is null;
    }

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

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

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

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

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

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

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

    public bool knowsPageRange (NSRangePointer range)
    {
        return OS.objc_msgSend(this.id, OS.sel_knowsPageRange_1, range) !is null;
    }

    //public CALayer layer() {
    //  objc.id result = OS.objc_msgSend(this.id, OS.sel_layer);
    //  return result !is null ? new CALayer(result) : null;
    //}

    public NSPoint locationOfPrintRect (NSRect aRect)
    {
        NSPoint result;
        OS.objc_msgSend_stret(result, this.id, OS.sel_locationOfPrintRect_1, aRect);
        return result;
    }

    public void lockFocus ()
    {
        OS.objc_msgSend(this.id, OS.sel_lockFocus);
    }

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

    public bool lockFocusIfCanDrawInContext (NSGraphicsContext context)
    {
        return OS.objc_msgSend(this.id, OS.sel_lockFocusIfCanDrawInContext_1, context !is null ? context.id : null) !is null;
    }

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

    public bool mouse (NSPoint aPoint, NSRect aRect)
    {
        return OS.objc_msgSend(this.id, OS.sel_mouse_1inRect_1, aPoint, aRect) !is null;
    }

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

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

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

    public bool needsToDrawRect (NSRect aRect)
    {
        return OS.objc_msgSend(this.id, OS.sel_needsToDrawRect_1, aRect) !is null;
    }

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

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

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

    public NSAttributedString pageFooter ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_pageFooter);
        return result !is null ? new NSAttributedString(result) : null;
    }

    public NSAttributedString pageHeader ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_pageHeader);
        return result !is null ? new NSAttributedString(result) : null;
    }

    public bool performKeyEquivalent (NSEvent theEvent)
    {
        return OS.objc_msgSend(this.id, OS.sel_performKeyEquivalent_1, theEvent !is null ? theEvent.id : null) !is null;
    }

    public bool performMnemonic (NSString theString)
    {
        return OS.objc_msgSend(this.id, OS.sel_performMnemonic_1, theString !is null ? theString.id : null) !is null;
    }

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

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

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

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

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

    public void print (id sender)
    {
        OS.objc_msgSend(this.id, OS.sel_print_1, sender !is null ? sender.id : null);
    }

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

    public NSRect rectForPage (NSInteger page)
    {
        NSRect result;
        OS.objc_msgSend_stret(result, this.id, OS.sel_rectForPage_1, page);
        return result;
    }

    public NSRect rectPreservedDuringLiveResize ()
    {
        NSRect result;
        OS.objc_msgSend_stret(result, this.id, OS.sel_rectPreservedDuringLiveResize);
        return result;
    }

    public void reflectScrolledClipView (NSClipView aClipView)
    {
        OS.objc_msgSend(this.id, OS.sel_reflectScrolledClipView_1, aClipView !is null ? aClipView.id : null);
    }

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

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

    public void releaseGState ()
    {
        OS.objc_msgSend(this.id, OS.sel_releaseGState);
    }

    public void removeAllToolTips ()
    {
        OS.objc_msgSend(this.id, OS.sel_removeAllToolTips);
    }

    public void removeCursorRect (NSRect aRect, NSCursor anObj)
    {
        OS.objc_msgSend(this.id, OS.sel_removeCursorRect_1cursor_1, aRect, anObj !is null ? anObj.id : null);
    }

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

    public void removeFromSuperviewWithoutNeedingDisplay ()
    {
        OS.objc_msgSend(this.id, OS.sel_removeFromSuperviewWithoutNeedingDisplay);
    }

    public void removeToolTip (NSToolTipTag tag)
    {
        OS.objc_msgSend(this.id, OS.sel_removeToolTip_1, tag);
    }

    public void removeTrackingArea (NSTrackingArea trackingArea)
    {
        OS.objc_msgSend(this.id, OS.sel_removeTrackingArea_1, trackingArea !is null ? trackingArea.id : null);
    }

    public void removeTrackingRect (NSTrackingRectTag tag)
    {
        OS.objc_msgSend(this.id, OS.sel_removeTrackingRect_1, tag);
    }

    public void renewGState ()
    {
        OS.objc_msgSend(this.id, OS.sel_renewGState);
    }

    public void replaceSubview (NSView oldView, NSView newView)
    {
        OS.objc_msgSend(this.id, OS.sel_replaceSubview_1with_1, oldView !is null ? oldView.id : null, newView !is null ? newView.id : null);
    }

    public void resetCursorRects ()
    {
        OS.objc_msgSend(this.id, OS.sel_resetCursorRects);
    }

    public void resizeSubviewsWithOldSize (NSSize oldSize)
    {
        OS.objc_msgSend(this.id, OS.sel_resizeSubviewsWithOldSize_1, oldSize);
    }

    public void resizeWithOldSuperviewSize (NSSize oldSize)
    {
        OS.objc_msgSend(this.id, OS.sel_resizeWithOldSuperviewSize_1, oldSize);
    }

    public void rotateByAngle (CGFloat angle)
    {
        OS.objc_msgSend(this.id, OS.sel_rotateByAngle_1, angle);
    }

    public void rulerView_didAddMarker_ (NSRulerView ruler, NSRulerMarker marker)
    {
        OS.objc_msgSend(this.id, OS.sel_rulerView_1didAddMarker_1, ruler !is null ? ruler.id : null, marker !is null ? marker.id : null);
    }

    public void rulerView_didMoveMarker_ (NSRulerView ruler, NSRulerMarker marker)
    {
        OS.objc_msgSend(this.id, OS.sel_rulerView_1didMoveMarker_1, ruler !is null ? ruler.id : null, marker !is null ? marker.id : null);
    }

    public void rulerView_didRemoveMarker_ (NSRulerView ruler, NSRulerMarker marker)
    {
        OS.objc_msgSend(this.id, OS.sel_rulerView_1didRemoveMarker_1, ruler !is null ? ruler.id : null, marker !is null ? marker.id : null);
    }

    public void rulerView_handleMouseDown_ (NSRulerView ruler, NSEvent event)
    {
        OS.objc_msgSend(this.id, OS.sel_rulerView_1handleMouseDown_1, ruler !is null ? ruler.id : null, event !is null ? event.id : null);
    }

    public bool rulerView_shouldAddMarker_ (NSRulerView ruler, NSRulerMarker marker)
    {
        return OS.objc_msgSend(this.id, OS.sel_rulerView_1shouldAddMarker_1, ruler !is null ? ruler.id : null, marker !is null ? marker.id : null) !is null;
    }

    public bool rulerView_shouldMoveMarker_ (NSRulerView ruler, NSRulerMarker marker)
    {
        return OS.objc_msgSend(this.id, OS.sel_rulerView_1shouldMoveMarker_1, ruler !is null ? ruler.id : null, marker !is null ? marker.id : null) !is null;
    }

    public bool rulerView_shouldRemoveMarker_ (NSRulerView ruler, NSRulerMarker marker)
    {
        return OS.objc_msgSend(this.id, OS.sel_rulerView_1shouldRemoveMarker_1, ruler !is null ? ruler.id : null, marker !is null ? marker.id : null) !is null;
    }

    public CGFloat rulerView_willAddMarker_atLocation_ (NSRulerView ruler, NSRulerMarker marker, CGFloat location)
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_rulerView_1willAddMarker_1atLocation_1, ruler !is null ? ruler.id : null,
                marker !is null ? marker.id : null, location);
    }

    public CGFloat rulerView_willMoveMarker_toLocation_ (NSRulerView ruler, NSRulerMarker marker, CGFloat location)
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_rulerView_1willMoveMarker_1toLocation_1, ruler !is null ? ruler.id : null,
                marker !is null ? marker.id : null, location);
    }

    public void rulerView_willSetClientView_ (NSRulerView ruler, NSView newClient)
    {
        OS.objc_msgSend(this.id, OS.sel_rulerView_1willSetClientView_1, ruler !is null ? ruler.id : null, newClient !is null ? newClient.id : null);
    }

    public void scaleUnitSquareToSize (NSSize newUnitSize)
    {
        OS.objc_msgSend(this.id, OS.sel_scaleUnitSquareToSize_1, newUnitSize);
    }

    public void scrollClipView (NSClipView aClipView, NSPoint aPoint)
    {
        OS.objc_msgSend(this.id, OS.sel_scrollClipView_1toPoint_1, aClipView !is null ? aClipView.id : null, aPoint);
    }

    public void scrollPoint (NSPoint aPoint)
    {
        OS.objc_msgSend(this.id, OS.sel_scrollPoint_1, aPoint);
    }

    public void scrollRect (NSRect aRect, NSSize delta)
    {
        OS.objc_msgSend(this.id, OS.sel_scrollRect_1by_1, aRect, delta);
    }

    public bool scrollRectToVisible (NSRect aRect)
    {
        return OS.objc_msgSend(this.id, OS.sel_scrollRectToVisible_1, aRect) !is null;
    }

    public void setAlphaValue (CGFloat viewAlpha)
    {
        OS.objc_msgSend(this.id, OS.sel_setAlphaValue_1, viewAlpha);
    }

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

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

    public void setBackgroundFilters (NSArray filters)
    {
        OS.objc_msgSend(this.id, OS.sel_setBackgroundFilters_1, filters !is null ? filters.id : null);
    }

    public void setBounds (NSRect aRect)
    {
        OS.objc_msgSend(this.id, OS.sel_setBounds_1, aRect);
    }

    public void setBoundsOrigin (NSPoint newOrigin)
    {
        OS.objc_msgSend(this.id, OS.sel_setBoundsOrigin_1, newOrigin);
    }

    public void setBoundsRotation (CGFloat angle)
    {
        OS.objc_msgSend(this.id, OS.sel_setBoundsRotation_1, angle);
    }

    public void setBoundsSize (NSSize newSize)
    {
        OS.objc_msgSend(this.id, OS.sel_setBoundsSize_1, newSize);
    }

    //public void setCompositingFilter(CIFilter filter) {
    //  OS.objc_msgSend(this.id, OS.sel_setCompositingFilter_1, filter !is null ? filter.id : null);
    //}

    public void setContentFilters (NSArray filters)
    {
        OS.objc_msgSend(this.id, OS.sel_setContentFilters_1, filters !is null ? filters.id : null);
    }

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

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

    public void setFrameCenterRotation (CGFloat angle)
    {
        OS.objc_msgSend(this.id, OS.sel_setFrameCenterRotation_1, angle);
    }

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

    public void setFrameRotation (CGFloat angle)
    {
        OS.objc_msgSend(this.id, OS.sel_setFrameRotation_1, angle);
    }

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

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

    public void setKeyboardFocusRingNeedsDisplayInRect (NSRect rect)
    {
        OS.objc_msgSend(this.id, OS.sel_setKeyboardFocusRingNeedsDisplayInRect_1, rect);
    }

    //public void setLayer(CALayer newLayer) {
    //  OS.objc_msgSend(this.id, OS.sel_setLayer_1, newLayer !is null ? newLayer.id : null);
    //}

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

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

    public void setNextKeyView (NSView next)
    {
        OS.objc_msgSend(this.id, OS.sel_setNextKeyView_1, next !is null ? next.id : null);
    }

    public void setPostsBoundsChangedNotifications (bool flag)
    {
        OS.objc_msgSend(this.id, OS.sel_setPostsBoundsChangedNotifications_1, flag);
    }

    public void setPostsFrameChangedNotifications (bool flag)
    {
        OS.objc_msgSend(this.id, OS.sel_setPostsFrameChangedNotifications_1, flag);
    }

    public void setShadow (NSShadow shadow)
    {
        OS.objc_msgSend(this.id, OS.sel_setShadow_1, shadow !is null ? shadow.id : null);
    }

    public void setSubviews (NSArray newSubviews)
    {
        OS.objc_msgSend(this.id, OS.sel_setSubviews_1, newSubviews !is null ? newSubviews.id : null);
    }

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

    public void setUpGState ()
    {
        OS.objc_msgSend(this.id, OS.sel_setUpGState);
    }

    public void setWantsLayer (bool flag)
    {
        OS.objc_msgSend(this.id, OS.sel_setWantsLayer_1, flag);
    }

    public NSShadow shadow ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_shadow);
        return result !is null ? new NSShadow(result) : null;
    }

    public bool shouldDelayWindowOrderingForEvent (NSEvent theEvent)
    {
        return OS.objc_msgSend(this.id, OS.sel_shouldDelayWindowOrderingForEvent_1, theEvent !is null ? theEvent.id : null) !is null;
    }

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

    public void sortSubviewsUsingFunction (/*NSComparisonResult (*)(id, id, void *) */NSComparisonResult function(objc.id, objc.id, void*) compare, void* context)
    {
        OS.objc_msgSend(this.id, OS.sel_sortSubviewsUsingFunction_1context_1, compare, context);
    }

    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 NSInteger tag ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_tag);
    }

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

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

    public void translateOriginToPoint (NSPoint translation)
    {
        OS.objc_msgSend(this.id, OS.sel_translateOriginToPoint_1, translation);
    }

    public void translateRectsNeedingDisplayInRect (NSRect clipRect, NSSize delta)
    {
        OS.objc_msgSend(this.id, OS.sel_translateRectsNeedingDisplayInRect_1by_1, clipRect, delta);
    }

    public void unlockFocus ()
    {
        OS.objc_msgSend(this.id, OS.sel_unlockFocus);
    }

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

    public void updateTrackingAreas ()
    {
        OS.objc_msgSend(this.id, OS.sel_updateTrackingAreas);
    }

    public void viewDidEndLiveResize ()
    {
        OS.objc_msgSend(this.id, OS.sel_viewDidEndLiveResize);
    }

    public void viewDidHide ()
    {
        OS.objc_msgSend(this.id, OS.sel_viewDidHide);
    }

    public void viewDidMoveToSuperview ()
    {
        OS.objc_msgSend(this.id, OS.sel_viewDidMoveToSuperview);
    }

    public void viewDidMoveToWindow ()
    {
        OS.objc_msgSend(this.id, OS.sel_viewDidMoveToWindow);
    }

    public void viewDidUnhide ()
    {
        OS.objc_msgSend(this.id, OS.sel_viewDidUnhide);
    }

    public void viewWillDraw ()
    {
        OS.objc_msgSend(this.id, OS.sel_viewWillDraw);
    }

    public void viewWillMoveToSuperview (NSView newSuperview)
    {
        OS.objc_msgSend(this.id, OS.sel_viewWillMoveToSuperview_1, newSuperview !is null ? newSuperview.id : null);
    }

    public void viewWillMoveToWindow (NSWindow newWindow)
    {
        OS.objc_msgSend(this.id, OS.sel_viewWillMoveToWindow_1, newWindow !is null ? newWindow.id : null);
    }

    public void viewWillStartLiveResize ()
    {
        OS.objc_msgSend(this.id, OS.sel_viewWillStartLiveResize);
    }

    public id viewWithTag (NSInteger aTag)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_viewWithTag_1, aTag);
        return result !is null ? new id(result) : null;
    }

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

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

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

    public CGFloat widthAdjustLimit ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_widthAdjustLimit);
    }

    public void willRemoveSubview (NSView subview)
    {
        OS.objc_msgSend(this.id, OS.sel_willRemoveSubview_1, subview !is null ? subview.id : null);
    }

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

    public void writeEPSInsideRect (NSRect rect, NSPasteboard pasteboard)
    {
        OS.objc_msgSend(this.id, OS.sel_writeEPSInsideRect_1toPasteboard_1, rect, pasteboard !is null ? pasteboard.id : null);
    }

    public void writePDFInsideRect (NSRect rect, NSPasteboard pasteboard)
    {
        OS.objc_msgSend(this.id, OS.sel_writePDFInsideRect_1toPasteboard_1, rect, pasteboard !is null ? pasteboard.id : null);
    }

}