view dstep/appkit/NSWindow.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents
children b9de51448c6b
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Sep 24, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.appkit.NSWindow;

import dstep.appkit.AppKitDefines;
import dstep.appkit.NSAnimation;
import dstep.appkit.NSButton;
import dstep.appkit.NSButtonCell;
import dstep.appkit.NSColor;
import dstep.appkit.NSDockTile;
import dstep.appkit.NSDrawer;
import dstep.appkit.NSEvent;
import dstep.appkit.NSGraphics;
import dstep.appkit.NSGraphicsContext;
import dstep.appkit.NSImage;
import dstep.appkit.NSMenu;
import dstep.appkit.NSPasteboard;
import dstep.appkit.NSResponder;
import dstep.appkit.NSScreen;
import dstep.appkit.NSText;
import dstep.appkit.NSToolbar;
import dstep.appkit.NSUserInterfaceValidation;
import dstep.appkit.NSView;
import dstep.appkit.NSWindowController;
import dstep.appkit.NSWindowScripting;
import dstep.applicationservices.ApplicationServices;
import dstep.foundation.NSArray;
import dstep.foundation.NSData;
import dstep.foundation.NSDate;
import dstep.foundation.NSDictionary;
import dstep.foundation.NSGeometry;
import dstep.foundation.NSNotification;
import dstep.foundation.NSObjCRuntime;
import dstep.foundation.NSScriptCommand;
import dstep.foundation.NSScriptStandardSuiteCommands;
import dstep.foundation.NSSet;
import dstep.foundation.NSString;
import dstep.foundation.NSURL;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

import bindings = dstep.appkit.NSWindow_bindings;

typedef NSUInteger NSWindowSharingType;
typedef NSUInteger NSWindowBackingLocation;
typedef NSUInteger NSWindowCollectionBehavior;
typedef NSUInteger NSSelectionDirection;
typedef NSUInteger NSWindowButton;

private
{
	NSString NSWindowDidBecomeKeyNotification_;
	NSString NSWindowDidBecomeMainNotification_;
	NSString NSWindowDidChangeScreenNotification_;
	NSString NSWindowDidDeminiaturizeNotification_;
	NSString NSWindowDidExposeNotification_;
	NSString NSWindowDidMiniaturizeNotification_;
	NSString NSWindowDidMoveNotification_;
	NSString NSWindowDidResignKeyNotification_;
	NSString NSWindowDidResignMainNotification_;
	NSString NSWindowDidResizeNotification_;
	NSString NSWindowDidUpdateNotification_;
	NSString NSWindowWillCloseNotification_;
	NSString NSWindowWillMiniaturizeNotification_;
	NSString NSWindowWillMoveNotification_;
	NSString NSWindowWillBeginSheetNotification_;
	NSString NSWindowDidEndSheetNotification_;
	NSString NSWindowDidChangeScreenProfileNotification_;
}

NSString NSWindowDidBecomeKeyNotification ()
{
	if (NSWindowDidBecomeKeyNotification_)
		return NSWindowDidBecomeKeyNotification_;

	return NSWindowDidBecomeKeyNotification_ = new NSString(bindings.NSWindowDidBecomeKeyNotification);
}

NSString NSWindowDidBecomeMainNotification ()
{
	if (NSWindowDidBecomeMainNotification_)
		return NSWindowDidBecomeMainNotification_;

	return NSWindowDidBecomeMainNotification_ = new NSString(bindings.NSWindowDidBecomeMainNotification);
}

NSString NSWindowDidChangeScreenNotification ()
{
	if (NSWindowDidChangeScreenNotification_)
		return NSWindowDidChangeScreenNotification_;

	return NSWindowDidChangeScreenNotification_ = new NSString(bindings.NSWindowDidChangeScreenNotification);
}

NSString NSWindowDidDeminiaturizeNotification ()
{
	if (NSWindowDidDeminiaturizeNotification_)
		return NSWindowDidDeminiaturizeNotification_;

	return NSWindowDidDeminiaturizeNotification_ = new NSString(bindings.NSWindowDidDeminiaturizeNotification);
}

NSString NSWindowDidExposeNotification ()
{
	if (NSWindowDidExposeNotification_)
		return NSWindowDidExposeNotification_;

	return NSWindowDidExposeNotification_ = new NSString(bindings.NSWindowDidExposeNotification);
}

NSString NSWindowDidMiniaturizeNotification ()
{
	if (NSWindowDidMiniaturizeNotification_)
		return NSWindowDidMiniaturizeNotification_;

	return NSWindowDidMiniaturizeNotification_ = new NSString(bindings.NSWindowDidMiniaturizeNotification);
}

NSString NSWindowDidMoveNotification ()
{
	if (NSWindowDidMoveNotification_)
		return NSWindowDidMoveNotification_;

	return NSWindowDidMoveNotification_ = new NSString(bindings.NSWindowDidMoveNotification);
}

NSString NSWindowDidResignKeyNotification ()
{
	if (NSWindowDidResignKeyNotification_)
		return NSWindowDidResignKeyNotification_;

	return NSWindowDidResignKeyNotification_ = new NSString(bindings.NSWindowDidResignKeyNotification);
}

NSString NSWindowDidResignMainNotification ()
{
	if (NSWindowDidResignMainNotification_)
		return NSWindowDidResignMainNotification_;

	return NSWindowDidResignMainNotification_ = new NSString(bindings.NSWindowDidResignMainNotification);
}

NSString NSWindowDidResizeNotification ()
{
	if (NSWindowDidResizeNotification_)
		return NSWindowDidResizeNotification_;

	return NSWindowDidResizeNotification_ = new NSString(bindings.NSWindowDidResizeNotification);
}

NSString NSWindowDidUpdateNotification ()
{
	if (NSWindowDidUpdateNotification_)
		return NSWindowDidUpdateNotification_;

	return NSWindowDidUpdateNotification_ = new NSString(bindings.NSWindowDidUpdateNotification);
}

NSString NSWindowWillCloseNotification ()
{
	if (NSWindowWillCloseNotification_)
		return NSWindowWillCloseNotification_;

	return NSWindowWillCloseNotification_ = new NSString(bindings.NSWindowWillCloseNotification);
}

NSString NSWindowWillMiniaturizeNotification ()
{
	if (NSWindowWillMiniaturizeNotification_)
		return NSWindowWillMiniaturizeNotification_;

	return NSWindowWillMiniaturizeNotification_ = new NSString(bindings.NSWindowWillMiniaturizeNotification);
}

NSString NSWindowWillMoveNotification ()
{
	if (NSWindowWillMoveNotification_)
		return NSWindowWillMoveNotification_;

	return NSWindowWillMoveNotification_ = new NSString(bindings.NSWindowWillMoveNotification);
}

NSString NSWindowWillBeginSheetNotification ()
{
	if (NSWindowWillBeginSheetNotification_)
		return NSWindowWillBeginSheetNotification_;

	return NSWindowWillBeginSheetNotification_ = new NSString(bindings.NSWindowWillBeginSheetNotification);
}

NSString NSWindowDidEndSheetNotification ()
{
	if (NSWindowDidEndSheetNotification_)
		return NSWindowDidEndSheetNotification_;

	return NSWindowDidEndSheetNotification_ = new NSString(bindings.NSWindowDidEndSheetNotification);
}

NSString NSWindowDidChangeScreenProfileNotification ()
{
	if (NSWindowDidChangeScreenProfileNotification_)
		return NSWindowDidChangeScreenProfileNotification_;

	return NSWindowDidChangeScreenProfileNotification_ = new NSString(bindings.NSWindowDidChangeScreenProfileNotification);
}

enum
{
	NSBorderlessWindowMask = 0,
	NSTitledWindowMask = 1 << 0,
	NSClosableWindowMask = 1 << 1,
	NSMiniaturizableWindowMask = 1 << 2,
	NSResizableWindowMask = 1 << 3
}

enum
{
	NSTexturedBackgroundWindowMask = 1 << 8
}

enum
{
	NSUnscaledWindowMask = 1 << 11
}

enum
{
	NSUnifiedTitleAndToolbarWindowMask = 1 << 12
}

enum
{
	NSDisplayWindowRunLoopOrdering = 600000,
	NSResetCursorRectsRunLoopOrdering = 700000
}

enum : NSUInteger
{
	NSWindowSharingNone = 0,
	NSWindowSharingReadOnly = 1,
	NSWindowSharingReadWrite = 2
}

enum : NSUInteger
{
	NSWindowBackingLocationDefault = 0,
	NSWindowBackingLocationVideoMemory = 1,
	NSWindowBackingLocationMainMemory = 2
}

enum : NSUInteger
{
	NSWindowCollectionBehaviorDefault = 0,
	NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0,
	NSWindowCollectionBehaviorMoveToActiveSpace = 1 << 1
}

enum : NSUInteger
{
	NSDirectSelection = 0,
	NSSelectingNext,
	NSSelectingPrevious
}

enum : NSUInteger
{
	NSWindowCloseButton,
	NSWindowMiniaturizeButton,
	NSWindowZoomButton,
	NSWindowToolbarButton,
	NSWindowDocumentIconButton
}

const TNSWindowDelegate = `

	bool windowShouldClose (Object sender)
	{
		return invokeObjcSelf!(bool, "windowShouldClose:", Object)(sender);
	}

	Object windowWillReturnFieldEditor (NSWindow sender, Object client)
	{
		return invokeObjcSelf!(Object, "windowWillReturnFieldEditor:toObject:", NSWindow, Object)(sender, client);
	}

	NSSize windowWillResize (NSWindow sender, NSSize frameSize)
	{
		return invokeObjcSelf!(NSSize, "windowWillResize:toSize:", NSWindow, NSSize)(sender, frameSize);
	}

	NSRect windowWillUseStandardFrame (NSWindow window, NSRect newFrame)
	{
		return invokeObjcSelf!(NSRect, "windowWillUseStandardFrame:defaultFrame:", NSWindow, NSRect)(window, newFrame);
	}

	bool windowShouldZoom (NSWindow window, NSRect newFrame)
	{
		return invokeObjcSelf!(bool, "windowShouldZoom:toFrame:", NSWindow, NSRect)(window, newFrame);
	}

	NSUndoManager windowWillReturnUndoManager (NSWindow window)
	{
		return invokeObjcSelf!(NSUndoManager, "windowWillReturnUndoManager:", NSWindow)(window);
	}

	NSRect window (NSWindow window, NSWindow sheet, NSRect rect)
	{
		return invokeObjcSelf!(NSRect, "window:willPositionSheet:usingRect:", NSWindow, NSWindow, NSRect)(window, sheet, rect);
	}

	bool window (NSWindow window, NSMenu menu)
	{
		return invokeObjcSelf!(bool, "window:shouldPopUpDocumentPathMenu:", NSWindow, NSMenu)(window, menu);
	}

	bool window (NSWindow window, NSEvent event, NSPoint dragImageLocation, NSPasteboard pasteboard)
	{
		return invokeObjcSelf!(bool, "window:shouldDragDocumentWithEvent:from:withPasteboard:", NSWindow, NSEvent, NSPoint, NSPasteboard)(window, event, dragImageLocation, pasteboard);
	}

	//mixin ObjcBindMethod!(windowShouldClose, "windowShouldClose:");
	//mixin ObjcBindMethod!(windowWillReturnFieldEditor, "windowWillReturnFieldEditor:toObject:");
	//mixin ObjcBindMethod!(windowWillResize, "windowWillResize:toSize:");
	//mixin ObjcBindMethod!(windowWillUseStandardFrame, "windowWillUseStandardFrame:defaultFrame:");
	//mixin ObjcBindMethod!(windowShouldZoom, "windowShouldZoom:toFrame:");
	//mixin ObjcBindMethod!(windowWillReturnUndoManager, "windowWillReturnUndoManager:");
	//mixin ObjcBindMethod!(window, "window:willPositionSheet:usingRect:");
	//mixin ObjcBindMethod!(window, "window:shouldPopUpDocumentPathMenu:");
	//mixin ObjcBindMethod!(window, "window:shouldDragDocumentWithEvent:from:withPasteboard:");

`;

const TNSCarbonExtensions = `

	typeof(this) initWithWindowRef (void* windowRef)
	{
		id result = invokeObjcSelf!(id, "initWithWindowRef:", void*)(windowRef);
		return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null);
	}

	this (void* windowRef)
	{
		super(typeof(this).alloc.initWithWindowRef(windowRef).objcObject);
	}

	void* windowRef ()
	{
		return invokeObjcSelf!(void*, "windowRef");
	}

	//mixin ObjcBindMethod!(initWithWindowRef, "initWithWindowRef:");
	//mixin ObjcBindMethod!(windowRef, "windowRef");

`;

const TNSWindowNotifications = `

	void windowDidResize (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidResize:", NSNotification)(notification);
	}

	void windowDidExpose (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidExpose:", NSNotification)(notification);
	}

	void windowWillMove (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowWillMove:", NSNotification)(notification);
	}

	void windowDidMove (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidMove:", NSNotification)(notification);
	}

	void windowDidBecomeKey (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidBecomeKey:", NSNotification)(notification);
	}

	void windowDidResignKey (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidResignKey:", NSNotification)(notification);
	}

	void windowDidBecomeMain (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidBecomeMain:", NSNotification)(notification);
	}

	void windowDidResignMain (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidResignMain:", NSNotification)(notification);
	}

	void windowWillClose (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowWillClose:", NSNotification)(notification);
	}

	void windowWillMiniaturize (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowWillMiniaturize:", NSNotification)(notification);
	}

	void windowDidMiniaturize (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidMiniaturize:", NSNotification)(notification);
	}

	void windowDidDeminiaturize (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidDeminiaturize:", NSNotification)(notification);
	}

	void windowDidUpdate (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidUpdate:", NSNotification)(notification);
	}

	void windowDidChangeScreen (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidChangeScreen:", NSNotification)(notification);
	}

	void windowDidChangeScreenProfile (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidChangeScreenProfile:", NSNotification)(notification);
	}

	void windowWillBeginSheet (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowWillBeginSheet:", NSNotification)(notification);
	}

	void windowDidEndSheet (NSNotification notification)
	{
		return invokeObjcSelf!(void, "windowDidEndSheet:", NSNotification)(notification);
	}

	//mixin ObjcBindMethod!(windowDidResize, "windowDidResize:");
	//mixin ObjcBindMethod!(windowDidExpose, "windowDidExpose:");
	//mixin ObjcBindMethod!(windowWillMove, "windowWillMove:");
	//mixin ObjcBindMethod!(windowDidMove, "windowDidMove:");
	//mixin ObjcBindMethod!(windowDidBecomeKey, "windowDidBecomeKey:");
	//mixin ObjcBindMethod!(windowDidResignKey, "windowDidResignKey:");
	//mixin ObjcBindMethod!(windowDidBecomeMain, "windowDidBecomeMain:");
	//mixin ObjcBindMethod!(windowDidResignMain, "windowDidResignMain:");
	//mixin ObjcBindMethod!(windowWillClose, "windowWillClose:");
	//mixin ObjcBindMethod!(windowWillMiniaturize, "windowWillMiniaturize:");
	//mixin ObjcBindMethod!(windowDidMiniaturize, "windowDidMiniaturize:");
	//mixin ObjcBindMethod!(windowDidDeminiaturize, "windowDidDeminiaturize:");
	//mixin ObjcBindMethod!(windowDidUpdate, "windowDidUpdate:");
	//mixin ObjcBindMethod!(windowDidChangeScreen, "windowDidChangeScreen:");
	//mixin ObjcBindMethod!(windowDidChangeScreenProfile, "windowDidChangeScreenProfile:");
	//mixin ObjcBindMethod!(windowWillBeginSheet, "windowWillBeginSheet:");
	//mixin ObjcBindMethod!(windowDidEndSheet, "windowDidEndSheet:");

`;

const TNSToolbarSupport = `

	void setToolbar (NSToolbar toolbar)
	{
		return invokeObjcSelf!(void, "setToolbar:", NSToolbar)(toolbar);
	}

	NSToolbar toolbar ()
	{
		return invokeObjcSelf!(NSToolbar, "toolbar");
	}

	void toggleToolbarShown (Object sender)
	{
		return invokeObjcSelf!(void, "toggleToolbarShown:", Object)(sender);
	}

	void runToolbarCustomizationPalette (Object sender)
	{
		return invokeObjcSelf!(void, "runToolbarCustomizationPalette:", Object)(sender);
	}

	void setShowsToolbarButton (bool show)
	{
		return invokeObjcSelf!(void, "setShowsToolbarButton:", bool)(show);
	}

	bool showsToolbarButton ()
	{
		return invokeObjcSelf!(bool, "showsToolbarButton");
	}

	//mixin ObjcBindMethod!(setToolbar, "setToolbar:");
	//mixin ObjcBindMethod!(toolbar, "toolbar");
	//mixin ObjcBindMethod!(toggleToolbarShown, "toggleToolbarShown:");
	//mixin ObjcBindMethod!(runToolbarCustomizationPalette, "runToolbarCustomizationPalette:");
	//mixin ObjcBindMethod!(setShowsToolbarButton, "setShowsToolbarButton:");
	//mixin ObjcBindMethod!(showsToolbarButton, "showsToolbarButton");

`;

class NSWindow : NSResponder
{
	mixin (ObjcWrap);

	static NSRect frameRectForContentRect (NSRect cRect, NSUInteger aStyle)
	{
		return invokeObjcSelfClass!(NSRect, "frameRectForContentRect:styleMask:", NSRect, NSUInteger)(cRect, aStyle);
	}

	static NSRect contentRectForFrameRect (NSRect fRect, NSUInteger aStyle)
	{
		return invokeObjcSelfClass!(NSRect, "contentRectForFrameRect:styleMask:", NSRect, NSUInteger)(fRect, aStyle);
	}

	static CGFloat minFrameWidthWithTitle (NSString aTitle, NSUInteger aStyle)
	{
		return invokeObjcSelfClass!(CGFloat, "minFrameWidthWithTitle:styleMask:", NSString, NSUInteger)(aTitle, aStyle);
	}

	static int defaultDepthLimit ()
	{
		return invokeObjcSelfClass!(int, "defaultDepthLimit");
	}

	NSRect frameRectForContentRect (NSRect contentRect)
	{
		return invokeObjcSelf!(NSRect, "frameRectForContentRect:", NSRect)(contentRect);
	}

	NSRect contentRectForFrameRect (NSRect frameRect)
	{
		return invokeObjcSelf!(NSRect, "contentRectForFrameRect:", NSRect)(frameRect);
	}

	NSWindow initWithContentRect (NSRect contentRect, NSUInteger aStyle, uint bufferingType, bool flag)
	{
		id result = invokeObjcSelf!(id, "initWithContentRect:styleMask:backing:defer:", NSRect, NSUInteger, uint, bool)(contentRect, aStyle, bufferingType, flag);
		return result is this.objcObject ? this : (result !is null ? new NSWindow(result) : null);
	}

	this (NSRect contentRect, NSUInteger aStyle, uint bufferingType, bool flag)
	{
		super(NSWindow.alloc.initWithContentRect(contentRect, aStyle, bufferingType, flag).objcObject);
	}

	NSWindow initWithContentRect (NSRect contentRect, NSUInteger aStyle, uint bufferingType, bool flag, NSScreen screen)
	{
		id result = invokeObjcSelf!(id, "initWithContentRect:styleMask:backing:defer:screen:", NSRect, NSUInteger, uint, bool, NSScreen)(contentRect, aStyle, bufferingType, flag, screen);
		return result is this.objcObject ? this : (result !is null ? new NSWindow(result) : null);
	}

	this (NSRect contentRect, NSUInteger aStyle, uint bufferingType, bool flag, NSScreen screen)
	{
		super(NSWindow.alloc.initWithContentRect(contentRect, aStyle, bufferingType, flag, screen).objcObject);
	}

	NSString title ()
	{
		return invokeObjcSelf!(NSString, "title");
	}

	void setTitle (NSString aString)
	{
		return invokeObjcSelf!(void, "setTitle:", NSString)(aString);
	}

	void setRepresentedURL (NSURL url)
	{
		return invokeObjcSelf!(void, "setRepresentedURL:", NSURL)(url);
	}

	NSURL representedURL ()
	{
		return invokeObjcSelf!(NSURL, "representedURL");
	}

	NSString representedFilename ()
	{
		return invokeObjcSelf!(NSString, "representedFilename");
	}

	void setRepresentedFilename (NSString aString)
	{
		return invokeObjcSelf!(void, "setRepresentedFilename:", NSString)(aString);
	}

	void setTitleWithRepresentedFilename (NSString filename)
	{
		return invokeObjcSelf!(void, "setTitleWithRepresentedFilename:", NSString)(filename);
	}

	void setExcludedFromWindowsMenu (bool flag)
	{
		return invokeObjcSelf!(void, "setExcludedFromWindowsMenu:", bool)(flag);
	}

	bool isExcludedFromWindowsMenu ()
	{
		return invokeObjcSelf!(bool, "isExcludedFromWindowsMenu");
	}

	void setContentView (NSView aView)
	{
		return invokeObjcSelf!(void, "setContentView:", NSView)(aView);
	}

	Object contentView ()
	{
		return invokeObjcSelf!(Object, "contentView");
	}

	void setDelegate (Object anObject)
	{
		return invokeObjcSelf!(void, "setDelegate:", Object)(anObject);
	}

	Object delegate_ ()
	{
		return invokeObjcSelf!(Object, "delegate");
	}

	NSInteger windowNumber ()
	{
		return invokeObjcSelf!(NSInteger, "windowNumber");
	}

	NSUInteger styleMask ()
	{
		return invokeObjcSelf!(NSUInteger, "styleMask");
	}

	NSText fieldEditor (bool createFlag, Object anObject)
	{
		return invokeObjcSelf!(NSText, "fieldEditor:forObject:", bool, Object)(createFlag, anObject);
	}

	void endEditingFor (Object anObject)
	{
		return invokeObjcSelf!(void, "endEditingFor:", Object)(anObject);
	}

	NSRect constrainFrameRect (NSRect frameRect, NSScreen screen)
	{
		return invokeObjcSelf!(NSRect, "constrainFrameRect:toScreen:", NSRect, NSScreen)(frameRect, screen);
	}

	void setFrame (NSRect frameRect, bool flag)
	{
		return invokeObjcSelf!(void, "setFrame:display:", NSRect, bool)(frameRect, flag);
	}

	void setContentSize (NSSize aSize)
	{
		return invokeObjcSelf!(void, "setContentSize:", NSSize)(aSize);
	}

	void setFrameOrigin (NSPoint aPoint)
	{
		return invokeObjcSelf!(void, "setFrameOrigin:", NSPoint)(aPoint);
	}

	void setFrameTopLeftPoint (NSPoint aPoint)
	{
		return invokeObjcSelf!(void, "setFrameTopLeftPoint:", NSPoint)(aPoint);
	}

	NSPoint cascadeTopLeftFromPoint (NSPoint topLeftPoint)
	{
		return invokeObjcSelf!(NSPoint, "cascadeTopLeftFromPoint:", NSPoint)(topLeftPoint);
	}

	NSRect frame ()
	{
		return invokeObjcSelf!(NSRect, "frame");
	}

	double animationResizeTime (NSRect newFrame)
	{
		return invokeObjcSelf!(double, "animationResizeTime:", NSRect)(newFrame);
	}

	void setFrame (NSRect frameRect, bool displayFlag, bool animateFlag)
	{
		return invokeObjcSelf!(void, "setFrame:display:animate:", NSRect, bool, bool)(frameRect, displayFlag, animateFlag);
	}

	void setShowsResizeIndicator (bool show)
	{
		return invokeObjcSelf!(void, "setShowsResizeIndicator:", bool)(show);
	}

	bool showsResizeIndicator ()
	{
		return invokeObjcSelf!(bool, "showsResizeIndicator");
	}

	void setResizeIncrements (NSSize increments)
	{
		return invokeObjcSelf!(void, "setResizeIncrements:", NSSize)(increments);
	}

	NSSize resizeIncrements ()
	{
		return invokeObjcSelf!(NSSize, "resizeIncrements");
	}

	void setAspectRatio (NSSize ratio)
	{
		return invokeObjcSelf!(void, "setAspectRatio:", NSSize)(ratio);
	}

	NSSize aspectRatio ()
	{
		return invokeObjcSelf!(NSSize, "aspectRatio");
	}

	void setContentResizeIncrements (NSSize increments)
	{
		return invokeObjcSelf!(void, "setContentResizeIncrements:", NSSize)(increments);
	}

	NSSize contentResizeIncrements ()
	{
		return invokeObjcSelf!(NSSize, "contentResizeIncrements");
	}

	void setContentAspectRatio (NSSize ratio)
	{
		return invokeObjcSelf!(void, "setContentAspectRatio:", NSSize)(ratio);
	}

	NSSize contentAspectRatio ()
	{
		return invokeObjcSelf!(NSSize, "contentAspectRatio");
	}

	void useOptimizedDrawing (bool flag)
	{
		return invokeObjcSelf!(void, "useOptimizedDrawing:", bool)(flag);
	}

	void disableFlushWindow ()
	{
		return invokeObjcSelf!(void, "disableFlushWindow");
	}

	void enableFlushWindow ()
	{
		return invokeObjcSelf!(void, "enableFlushWindow");
	}

	bool isFlushWindowDisabled ()
	{
		return invokeObjcSelf!(bool, "isFlushWindowDisabled");
	}

	void flushWindow ()
	{
		return invokeObjcSelf!(void, "flushWindow");
	}

	void flushWindowIfNeeded ()
	{
		return invokeObjcSelf!(void, "flushWindowIfNeeded");
	}

	void setViewsNeedDisplay (bool flag)
	{
		return invokeObjcSelf!(void, "setViewsNeedDisplay:", bool)(flag);
	}

	bool viewsNeedDisplay ()
	{
		return invokeObjcSelf!(bool, "viewsNeedDisplay");
	}

	void displayIfNeeded ()
	{
		return invokeObjcSelf!(void, "displayIfNeeded");
	}

	void display ()
	{
		return invokeObjcSelf!(void, "display");
	}

	void setAutodisplay (bool flag)
	{
		return invokeObjcSelf!(void, "setAutodisplay:", bool)(flag);
	}

	bool isAutodisplay ()
	{
		return invokeObjcSelf!(bool, "isAutodisplay");
	}

	bool preservesContentDuringLiveResize ()
	{
		return invokeObjcSelf!(bool, "preservesContentDuringLiveResize");
	}

	void setPreservesContentDuringLiveResize (bool flag)
	{
		return invokeObjcSelf!(void, "setPreservesContentDuringLiveResize:", bool)(flag);
	}

	void update ()
	{
		return invokeObjcSelf!(void, "update");
	}

	bool makeFirstResponder (NSResponder aResponder)
	{
		return invokeObjcSelf!(bool, "makeFirstResponder:", NSResponder)(aResponder);
	}

	NSResponder firstResponder ()
	{
		return invokeObjcSelf!(NSResponder, "firstResponder");
	}

	NSInteger resizeFlags ()
	{
		return invokeObjcSelf!(NSInteger, "resizeFlags");
	}

	void keyDown (NSEvent theEvent)
	{
		return invokeObjcSelf!(void, "keyDown:", NSEvent)(theEvent);
	}

	void close ()
	{
		return invokeObjcSelf!(void, "close");
	}

	void setReleasedWhenClosed (bool flag)
	{
		return invokeObjcSelf!(void, "setReleasedWhenClosed:", bool)(flag);
	}

	bool isReleasedWhenClosed ()
	{
		return invokeObjcSelf!(bool, "isReleasedWhenClosed");
	}

	void miniaturize (Object sender)
	{
		return invokeObjcSelf!(void, "miniaturize:", Object)(sender);
	}

	void deminiaturize (Object sender)
	{
		return invokeObjcSelf!(void, "deminiaturize:", Object)(sender);
	}

	bool isZoomed ()
	{
		return invokeObjcSelf!(bool, "isZoomed");
	}

	void zoom (Object sender)
	{
		return invokeObjcSelf!(void, "zoom:", Object)(sender);
	}

	bool isMiniaturized ()
	{
		return invokeObjcSelf!(bool, "isMiniaturized");
	}

	bool tryToPerform (SEL anAction, Object anObject)
	{
		return invokeObjcSelf!(bool, "tryToPerform:with:", SEL, Object)(anAction, anObject);
	}

	Object validRequestorForSendType (NSString sendType, NSString returnType)
	{
		return invokeObjcSelf!(Object, "validRequestorForSendType:returnType:", NSString, NSString)(sendType, returnType);
	}

	void setBackgroundColor (NSColor color)
	{
		return invokeObjcSelf!(void, "setBackgroundColor:", NSColor)(color);
	}

	NSColor backgroundColor ()
	{
		return invokeObjcSelf!(NSColor, "backgroundColor");
	}

	void setContentBorderThickness (CGFloat thickness, int edge)
	{
		return invokeObjcSelf!(void, "setContentBorderThickness:forEdge:", CGFloat, int)(thickness, edge);
	}

	CGFloat contentBorderThicknessForEdge (int edge)
	{
		return invokeObjcSelf!(CGFloat, "contentBorderThicknessForEdge:", int)(edge);
	}

	void setAutorecalculatesContentBorderThickness (bool flag, int edge)
	{
		return invokeObjcSelf!(void, "setAutorecalculatesContentBorderThickness:forEdge:", bool, int)(flag, edge);
	}

	bool autorecalculatesContentBorderThicknessForEdge (int edge)
	{
		return invokeObjcSelf!(bool, "autorecalculatesContentBorderThicknessForEdge:", int)(edge);
	}

	void setMovableByWindowBackground (bool flag)
	{
		return invokeObjcSelf!(void, "setMovableByWindowBackground:", bool)(flag);
	}

	bool isMovableByWindowBackground ()
	{
		return invokeObjcSelf!(bool, "isMovableByWindowBackground");
	}

	void setHidesOnDeactivate (bool flag)
	{
		return invokeObjcSelf!(void, "setHidesOnDeactivate:", bool)(flag);
	}

	bool hidesOnDeactivate ()
	{
		return invokeObjcSelf!(bool, "hidesOnDeactivate");
	}

	void setCanHide (bool flag)
	{
		return invokeObjcSelf!(void, "setCanHide:", bool)(flag);
	}

	bool canHide ()
	{
		return invokeObjcSelf!(bool, "canHide");
	}

	void center ()
	{
		return invokeObjcSelf!(void, "center");
	}

	void makeKeyAndOrderFront (Object sender)
	{
		return invokeObjcSelf!(void, "makeKeyAndOrderFront:", Object)(sender);
	}

	void orderFront (Object sender)
	{
		return invokeObjcSelf!(void, "orderFront:", Object)(sender);
	}

	void orderBack (Object sender)
	{
		return invokeObjcSelf!(void, "orderBack:", Object)(sender);
	}

	void orderOut (Object sender)
	{
		return invokeObjcSelf!(void, "orderOut:", Object)(sender);
	}

	void orderWindow (int place, NSInteger otherWin)
	{
		return invokeObjcSelf!(void, "orderWindow:relativeTo:", int, NSInteger)(place, otherWin);
	}

	void orderFrontRegardless ()
	{
		return invokeObjcSelf!(void, "orderFrontRegardless");
	}

	void setMiniwindowImage (NSImage image)
	{
		return invokeObjcSelf!(void, "setMiniwindowImage:", NSImage)(image);
	}

	void setMiniwindowTitle (NSString title)
	{
		return invokeObjcSelf!(void, "setMiniwindowTitle:", NSString)(title);
	}

	NSImage miniwindowImage ()
	{
		return invokeObjcSelf!(NSImage, "miniwindowImage");
	}

	NSString miniwindowTitle ()
	{
		return invokeObjcSelf!(NSString, "miniwindowTitle");
	}

	NSDockTile dockTile ()
	{
		return invokeObjcSelf!(NSDockTile, "dockTile");
	}

	void setDocumentEdited (bool flag)
	{
		return invokeObjcSelf!(void, "setDocumentEdited:", bool)(flag);
	}

	bool isDocumentEdited ()
	{
		return invokeObjcSelf!(bool, "isDocumentEdited");
	}

	bool isVisible ()
	{
		return invokeObjcSelf!(bool, "isVisible");
	}

	bool isKeyWindow ()
	{
		return invokeObjcSelf!(bool, "isKeyWindow");
	}

	bool isMainWindow ()
	{
		return invokeObjcSelf!(bool, "isMainWindow");
	}

	bool canBecomeKeyWindow ()
	{
		return invokeObjcSelf!(bool, "canBecomeKeyWindow");
	}

	bool canBecomeMainWindow ()
	{
		return invokeObjcSelf!(bool, "canBecomeMainWindow");
	}

	void makeKeyWindow ()
	{
		return invokeObjcSelf!(void, "makeKeyWindow");
	}

	void makeMainWindow ()
	{
		return invokeObjcSelf!(void, "makeMainWindow");
	}

	void becomeKeyWindow ()
	{
		return invokeObjcSelf!(void, "becomeKeyWindow");
	}

	void resignKeyWindow ()
	{
		return invokeObjcSelf!(void, "resignKeyWindow");
	}

	void becomeMainWindow ()
	{
		return invokeObjcSelf!(void, "becomeMainWindow");
	}

	void resignMainWindow ()
	{
		return invokeObjcSelf!(void, "resignMainWindow");
	}

	bool worksWhenModal ()
	{
		return invokeObjcSelf!(bool, "worksWhenModal");
	}

	NSPoint convertBaseToScreen (NSPoint aPoint)
	{
		return invokeObjcSelf!(NSPoint, "convertBaseToScreen:", NSPoint)(aPoint);
	}

	NSPoint convertScreenToBase (NSPoint aPoint)
	{
		return invokeObjcSelf!(NSPoint, "convertScreenToBase:", NSPoint)(aPoint);
	}

	void performClose (Object sender)
	{
		return invokeObjcSelf!(void, "performClose:", Object)(sender);
	}

	void performMiniaturize (Object sender)
	{
		return invokeObjcSelf!(void, "performMiniaturize:", Object)(sender);
	}

	void performZoom (Object sender)
	{
		return invokeObjcSelf!(void, "performZoom:", Object)(sender);
	}

	NSInteger gState ()
	{
		return invokeObjcSelf!(NSInteger, "gState");
	}

	void setOneShot (bool flag)
	{
		return invokeObjcSelf!(void, "setOneShot:", bool)(flag);
	}

	bool isOneShot ()
	{
		return invokeObjcSelf!(bool, "isOneShot");
	}

	NSData dataWithEPSInsideRect (NSRect rect)
	{
		return invokeObjcSelf!(NSData, "dataWithEPSInsideRect:", NSRect)(rect);
	}

	NSData dataWithPDFInsideRect (NSRect rect)
	{
		return invokeObjcSelf!(NSData, "dataWithPDFInsideRect:", NSRect)(rect);
	}

	void print (Object sender)
	{
		return invokeObjcSelf!(void, "print:", Object)(sender);
	}

	void disableCursorRects ()
	{
		return invokeObjcSelf!(void, "disableCursorRects");
	}

	void enableCursorRects ()
	{
		return invokeObjcSelf!(void, "enableCursorRects");
	}

	void discardCursorRects ()
	{
		return invokeObjcSelf!(void, "discardCursorRects");
	}

	bool areCursorRectsEnabled ()
	{
		return invokeObjcSelf!(bool, "areCursorRectsEnabled");
	}

	void invalidateCursorRectsForView (NSView aView)
	{
		return invokeObjcSelf!(void, "invalidateCursorRectsForView:", NSView)(aView);
	}

	void resetCursorRects ()
	{
		return invokeObjcSelf!(void, "resetCursorRects");
	}

	void setAllowsToolTipsWhenApplicationIsInactive (bool allowWhenInactive)
	{
		return invokeObjcSelf!(void, "setAllowsToolTipsWhenApplicationIsInactive:", bool)(allowWhenInactive);
	}

	bool allowsToolTipsWhenApplicationIsInactive ()
	{
		return invokeObjcSelf!(bool, "allowsToolTipsWhenApplicationIsInactive");
	}

	void setBackingType (uint bufferingType)
	{
		return invokeObjcSelf!(void, "setBackingType:", uint)(bufferingType);
	}

	uint backingType ()
	{
		return invokeObjcSelf!(uint, "backingType");
	}

	void setLevel (NSInteger newLevel)
	{
		return invokeObjcSelf!(void, "setLevel:", NSInteger)(newLevel);
	}

	NSInteger level ()
	{
		return invokeObjcSelf!(NSInteger, "level");
	}

	void setDepthLimit (int limit)
	{
		return invokeObjcSelf!(void, "setDepthLimit:", int)(limit);
	}

	int depthLimit ()
	{
		return invokeObjcSelf!(int, "depthLimit");
	}

	void setDynamicDepthLimit (bool flag)
	{
		return invokeObjcSelf!(void, "setDynamicDepthLimit:", bool)(flag);
	}

	bool hasDynamicDepthLimit ()
	{
		return invokeObjcSelf!(bool, "hasDynamicDepthLimit");
	}

	NSScreen screen ()
	{
		return invokeObjcSelf!(NSScreen, "screen");
	}

	NSScreen deepestScreen ()
	{
		return invokeObjcSelf!(NSScreen, "deepestScreen");
	}

	bool canStoreColor ()
	{
		return invokeObjcSelf!(bool, "canStoreColor");
	}

	void setHasShadow (bool hasShadow)
	{
		return invokeObjcSelf!(void, "setHasShadow:", bool)(hasShadow);
	}

	bool hasShadow ()
	{
		return invokeObjcSelf!(bool, "hasShadow");
	}

	void invalidateShadow ()
	{
		return invokeObjcSelf!(void, "invalidateShadow");
	}

	void setAlphaValue (CGFloat windowAlpha)
	{
		return invokeObjcSelf!(void, "setAlphaValue:", CGFloat)(windowAlpha);
	}

	CGFloat alphaValue ()
	{
		return invokeObjcSelf!(CGFloat, "alphaValue");
	}

	void setOpaque (bool isOpaque)
	{
		return invokeObjcSelf!(void, "setOpaque:", bool)(isOpaque);
	}

	bool isOpaque ()
	{
		return invokeObjcSelf!(bool, "isOpaque");
	}

	void setSharingType (uint type)
	{
		return invokeObjcSelf!(void, "setSharingType:", uint)(type);
	}

	uint sharingType ()
	{
		return invokeObjcSelf!(uint, "sharingType");
	}

	void setPreferredBackingLocation (uint backingLocation)
	{
		return invokeObjcSelf!(void, "setPreferredBackingLocation:", uint)(backingLocation);
	}

	uint preferredBackingLocation ()
	{
		return invokeObjcSelf!(uint, "preferredBackingLocation");
	}

	uint backingLocation ()
	{
		return invokeObjcSelf!(uint, "backingLocation");
	}

	bool displaysWhenScreenProfileChanges ()
	{
		return invokeObjcSelf!(bool, "displaysWhenScreenProfileChanges");
	}

	void setDisplaysWhenScreenProfileChanges (bool flag)
	{
		return invokeObjcSelf!(void, "setDisplaysWhenScreenProfileChanges:", bool)(flag);
	}

	void disableScreenUpdatesUntilFlush ()
	{
		return invokeObjcSelf!(void, "disableScreenUpdatesUntilFlush");
	}

	bool canBecomeVisibleWithoutLogin ()
	{
		return invokeObjcSelf!(bool, "canBecomeVisibleWithoutLogin");
	}

	void setCanBecomeVisibleWithoutLogin (bool flag)
	{
		return invokeObjcSelf!(void, "setCanBecomeVisibleWithoutLogin:", bool)(flag);
	}

	void setCollectionBehavior (uint behavior)
	{
		return invokeObjcSelf!(void, "setCollectionBehavior:", uint)(behavior);
	}

	uint collectionBehavior ()
	{
		return invokeObjcSelf!(uint, "collectionBehavior");
	}

	bool canBeVisibleOnAllSpaces ()
	{
		return invokeObjcSelf!(bool, "canBeVisibleOnAllSpaces");
	}

	void setCanBeVisibleOnAllSpaces (bool flag)
	{
		return invokeObjcSelf!(void, "setCanBeVisibleOnAllSpaces:", bool)(flag);
	}

	NSString stringWithSavedFrame ()
	{
		return invokeObjcSelf!(NSString, "stringWithSavedFrame");
	}

	void setFrameFromString (NSString string)
	{
		return invokeObjcSelf!(void, "setFrameFromString:", NSString)(string);
	}

	void saveFrameUsingName (NSString name)
	{
		return invokeObjcSelf!(void, "saveFrameUsingName:", NSString)(name);
	}

	bool setFrameUsingName (NSString name, bool force)
	{
		return invokeObjcSelf!(bool, "setFrameUsingName:force:", NSString, bool)(name, force);
	}

	bool setFrameUsingName (NSString name)
	{
		return invokeObjcSelf!(bool, "setFrameUsingName:", NSString)(name);
	}

	bool setFrameAutosaveName (NSString name)
	{
		return invokeObjcSelf!(bool, "setFrameAutosaveName:", NSString)(name);
	}

	NSString frameAutosaveName ()
	{
		return invokeObjcSelf!(NSString, "frameAutosaveName");
	}

	static void removeFrameUsingName (NSString name)
	{
		return invokeObjcSelfClass!(void, "removeFrameUsingName:", NSString)(name);
	}

	void cacheImageInRect (NSRect aRect)
	{
		return invokeObjcSelf!(void, "cacheImageInRect:", NSRect)(aRect);
	}

	void restoreCachedImage ()
	{
		return invokeObjcSelf!(void, "restoreCachedImage");
	}

	void discardCachedImage ()
	{
		return invokeObjcSelf!(void, "discardCachedImage");
	}

	NSSize minSize ()
	{
		return invokeObjcSelf!(NSSize, "minSize");
	}

	NSSize maxSize ()
	{
		return invokeObjcSelf!(NSSize, "maxSize");
	}

	void setMinSize (NSSize size)
	{
		return invokeObjcSelf!(void, "setMinSize:", NSSize)(size);
	}

	void setMaxSize (NSSize size)
	{
		return invokeObjcSelf!(void, "setMaxSize:", NSSize)(size);
	}

	NSSize contentMinSize ()
	{
		return invokeObjcSelf!(NSSize, "contentMinSize");
	}

	NSSize contentMaxSize ()
	{
		return invokeObjcSelf!(NSSize, "contentMaxSize");
	}

	void setContentMinSize (NSSize size)
	{
		return invokeObjcSelf!(void, "setContentMinSize:", NSSize)(size);
	}

	void setContentMaxSize (NSSize size)
	{
		return invokeObjcSelf!(void, "setContentMaxSize:", NSSize)(size);
	}

	NSEvent nextEventMatchingMask (NSUInteger mask)
	{
		return invokeObjcSelf!(NSEvent, "nextEventMatchingMask:", NSUInteger)(mask);
	}

	NSEvent nextEventMatchingMask (NSUInteger mask, NSDate expiration, NSString mode, bool deqFlag)
	{
		return invokeObjcSelf!(NSEvent, "nextEventMatchingMask:untilDate:inMode:dequeue:", NSUInteger, NSDate, NSString, bool)(mask, expiration, mode, deqFlag);
	}

	void discardEventsMatchingMask (NSUInteger mask, NSEvent lastEvent)
	{
		return invokeObjcSelf!(void, "discardEventsMatchingMask:beforeEvent:", NSUInteger, NSEvent)(mask, lastEvent);
	}

	void postEvent (NSEvent event, bool flag)
	{
		return invokeObjcSelf!(void, "postEvent:atStart:", NSEvent, bool)(event, flag);
	}

	NSEvent currentEvent ()
	{
		return invokeObjcSelf!(NSEvent, "currentEvent");
	}

	void setAcceptsMouseMovedEvents (bool flag)
	{
		return invokeObjcSelf!(void, "setAcceptsMouseMovedEvents:", bool)(flag);
	}

	bool acceptsMouseMovedEvents ()
	{
		return invokeObjcSelf!(bool, "acceptsMouseMovedEvents");
	}

	void setIgnoresMouseEvents (bool flag)
	{
		return invokeObjcSelf!(void, "setIgnoresMouseEvents:", bool)(flag);
	}

	bool ignoresMouseEvents ()
	{
		return invokeObjcSelf!(bool, "ignoresMouseEvents");
	}

	NSDictionary deviceDescription ()
	{
		return invokeObjcSelf!(NSDictionary, "deviceDescription");
	}

	void sendEvent (NSEvent theEvent)
	{
		return invokeObjcSelf!(void, "sendEvent:", NSEvent)(theEvent);
	}

	NSPoint mouseLocationOutsideOfEventStream ()
	{
		return invokeObjcSelf!(NSPoint, "mouseLocationOutsideOfEventStream");
	}

	static void menuChanged (NSMenu menu)
	{
		return invokeObjcSelfClass!(void, "menuChanged:", NSMenu)(menu);
	}

	Object windowController ()
	{
		return invokeObjcSelf!(Object, "windowController");
	}

	void setWindowController (NSWindowController windowController)
	{
		return invokeObjcSelf!(void, "setWindowController:", NSWindowController)(windowController);
	}

	bool isSheet ()
	{
		return invokeObjcSelf!(bool, "isSheet");
	}

	NSWindow attachedSheet ()
	{
		id result = invokeObjcSelf!(id, "attachedSheet");
		return result is this.objcObject ? this : (result !is null ? new NSWindow(result) : null);
	}

	static NSButton standardWindowButton (uint b, NSUInteger styleMask)
	{
		return invokeObjcSelfClass!(NSButton, "standardWindowButton:forStyleMask:", uint, NSUInteger)(b, styleMask);
	}

	NSButton standardWindowButton (uint b)
	{
		return invokeObjcSelf!(NSButton, "standardWindowButton:", uint)(b);
	}

	void addChildWindow (NSWindow childWin, int place)
	{
		return invokeObjcSelf!(void, "addChildWindow:ordered:", NSWindow, int)(childWin, place);
	}

	void removeChildWindow (NSWindow childWin)
	{
		return invokeObjcSelf!(void, "removeChildWindow:", NSWindow)(childWin);
	}

	NSArray childWindows ()
	{
		return invokeObjcSelf!(NSArray, "childWindows");
	}

	NSWindow parentWindow ()
	{
		id result = invokeObjcSelf!(id, "parentWindow");
		return result is this.objcObject ? this : (result !is null ? new NSWindow(result) : null);
	}

	void setParentWindow (NSWindow window)
	{
		return invokeObjcSelf!(void, "setParentWindow:", NSWindow)(window);
	}

	NSGraphicsContext graphicsContext ()
	{
		return invokeObjcSelf!(NSGraphicsContext, "graphicsContext");
	}

	CGFloat userSpaceScaleFactor ()
	{
		return invokeObjcSelf!(CGFloat, "userSpaceScaleFactor");
	}
	
	// Drawers
	NSArray drawers ()
	{
		return invokeObjcSelf!(NSArray, "drawers");
	}
	
	// NSScripting
	bool hasCloseBox ()
	{
		return invokeObjcSelf!(bool, "hasCloseBox");
	}

	bool hasTitleBar ()
	{
		return invokeObjcSelf!(bool, "hasTitleBar");
	}

	bool isFloatingPanel ()
	{
		return invokeObjcSelf!(bool, "isFloatingPanel");
	}

	bool isMiniaturizable ()
	{
		return invokeObjcSelf!(bool, "isMiniaturizable");
	}

	bool isModalPanel ()
	{
		return invokeObjcSelf!(bool, "isModalPanel");
	}

	bool isResizable ()
	{
		return invokeObjcSelf!(bool, "isResizable");
	}

	bool isZoomable ()
	{
		return invokeObjcSelf!(bool, "isZoomable");
	}

	NSInteger orderedIndex ()
	{
		return invokeObjcSelf!(NSInteger, "orderedIndex");
	}

	void setIsMiniaturized (bool flag)
	{
		return invokeObjcSelf!(void, "setIsMiniaturized:", bool)(flag);
	}

	void setIsVisible (bool flag)
	{
		return invokeObjcSelf!(void, "setIsVisible:", bool)(flag);
	}

	void setIsZoomed (bool flag)
	{
		return invokeObjcSelf!(void, "setIsZoomed:", bool)(flag);
	}

	void setOrderedIndex (NSInteger index)
	{
		return invokeObjcSelf!(void, "setOrderedIndex:", NSInteger)(index);
	}

	Object handleCloseScriptCommand (NSCloseCommand command)
	{
		return invokeObjcSelf!(Object, "handleCloseScriptCommand:", NSCloseCommand)(command);
	}

	Object handlePrintScriptCommand (NSScriptCommand command)
	{
		return invokeObjcSelf!(Object, "handlePrintScriptCommand:", NSScriptCommand)(command);
	}

	Object handleSaveScriptCommand (NSScriptCommand command)
	{
		return invokeObjcSelf!(Object, "handleSaveScriptCommand:", NSScriptCommand)(command);
	}
	
	// NSCarbonExtensions
	typeof(this) initWithWindowRef (void* windowRef)
	{
		id result = invokeObjcSelf!(id, "initWithWindowRef:", void*)(windowRef);
		return result is this.objcObject ? this : (result !is null ? new typeof(this)(result) : null);
	}

	this (void* windowRef)
	{
		super(typeof(this).alloc.initWithWindowRef(windowRef).objcObject);
	}

	void* windowRef ()
	{
		return invokeObjcSelf!(void*, "windowRef");
	}
	
	// NSToolbarSupport
	void setToolbar (NSToolbar toolbar)
	{
		return invokeObjcSelf!(void, "setToolbar:", NSToolbar)(toolbar);
	}

	NSToolbar toolbar ()
	{
		return invokeObjcSelf!(NSToolbar, "toolbar");
	}

	void toggleToolbarShown (Object sender)
	{
		return invokeObjcSelf!(void, "toggleToolbarShown:", Object)(sender);
	}

	void runToolbarCustomizationPalette (Object sender)
	{
		return invokeObjcSelf!(void, "runToolbarCustomizationPalette:", Object)(sender);
	}

	void setShowsToolbarButton (bool show)
	{
		return invokeObjcSelf!(void, "setShowsToolbarButton:", bool)(show);
	}

	bool showsToolbarButton ()
	{
		return invokeObjcSelf!(bool, "showsToolbarButton");
	}
}