view dstep/appkit/NSCell.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.NSCell;

import dstep.appkit.NSAttributedString;
import dstep.appkit.NSColor;
import dstep.appkit.NSEvent;
import dstep.appkit.NSFont;
import dstep.appkit.NSImage;
import dstep.appkit.NSMenu;
import dstep.appkit.NSParagraphStyle;
import dstep.appkit.NSText;
import dstep.appkit.NSView;
import dstep.applicationservices.coregraphics.CGBase;
import dstep.foundation.NSAttributedString;
import dstep.foundation.NSCoder;
import dstep.foundation.NSFormatter;
import dstep.foundation.NSGeometry;
import dstep.foundation.NSObjCRuntime;
import dstep.foundation.NSObject;
import dstep.foundation.NSString;
import dstep.foundation.NSZone;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

import bindings = dstep.appkit.NSCell_bindings;

alias NSUInteger NSCellType;
alias NSUInteger NSCellAttribute;
alias NSUInteger NSCellImagePosition;
alias NSUInteger NSImageScaling;
alias NSInteger NSCellStateValue;
alias NSUInteger NSControlTint;
alias NSUInteger NSControlSize;
alias NSInteger NSBackgroundStyle;

private
{
	NSString NSControlTintDidChangeNotification_;
}

NSString NSControlTintDidChangeNotification ()
{
	if (NSControlTintDidChangeNotification_)
		return NSControlTintDidChangeNotification_;

	return NSControlTintDidChangeNotification_ = new NSString(bindings.NSControlTintDidChangeNotification);
}

enum
{
	NSAnyType = 0,
	NSIntType = 1,
	NSPositiveIntType = 2,
	NSFloatType = 3,
	NSPositiveFloatType = 4,
	NSDoubleType = 6,
	NSPositiveDoubleType = 7
}

enum
{
	NSNullCellType = 0,
	NSTextCellType = 1,
	NSImageCellType = 2
}

enum
{
	NSCellDisabled = 0,
	NSCellState = 1,
	NSPushInCell = 2,
	NSCellEditable = 3,
	NSChangeGrayCell = 4,
	NSCellHighlighted = 5,
	NSCellLightsByContents = 6,
	NSCellLightsByGray = 7,
	NSChangeBackgroundCell = 8,
	NSCellLightsByBackground = 9,
	NSCellIsBordered = 10,
	NSCellHasOverlappingImage = 11,
	NSCellHasImageHorizontal = 12,
	NSCellHasImageOnLeftOrBottom = 13,
	NSCellChangesContents = 14,
	NSCellIsInsetButton = 15,
	NSCellAllowsMixedState = 16
}

enum
{
	NSNoImage = 0,
	NSImageOnly = 1,
	NSImageLeft = 2,
	NSImageRight = 3,
	NSImageBelow = 4,
	NSImageAbove = 5,
	NSImageOverlaps = 6
}

enum
{
	NSScaleProportionally = 0,
	NSScaleToFit,
	NSScaleNone
}

enum
{
	NSImageScaleProportionallyDown = 0,
	NSImageScaleAxesIndependently,
	NSImageScaleNone,
	NSImageScaleProportionallyUpOrDown
}

enum
{
	NSMixedState = -1,
	NSOffState = 0,
	NSOnState = 1
}

enum
{
	NSNoCellMask = 0,
	NSContentsCellMask = 1,
	NSPushInCellMask = 2,
	NSChangeGrayCellMask = 4,
	NSChangeBackgroundCellMask = 8
}

enum
{
	NSDefaultControlTint = 0,
	NSBlueControlTint = 1,
	NSGraphiteControlTint = 6,
	NSClearControlTint = 7
}

enum
{
	NSRegularControlSize,
	NSSmallControlSize,
	NSMiniControlSize
}

enum
{
	NSCellHitNone = 0,
	NSCellHitContentArea = 1 << 0,
	NSCellHitEditableTextArea = 1 << 1,
	NSCellHitTrackableArea = 1 << 2
}

enum
{
	NSBackgroundStyleLight = 0,
	NSBackgroundStyleDark,
	NSBackgroundStyleRaised,
	NSBackgroundStyleLowered
}

struct _CFlags
{
	uint state;
	uint highlighted;
	uint disabled;
	uint editable;
	uint type;
	uint vCentered;
	uint hCentered;
	uint bordered;
	uint bezeled;
	uint selectable;
	uint scrollable;
	uint continuous;
	uint actOnMouseDown;
	uint isLeaf;
	uint invalidObjectValue;
	uint invalidFont;
	uint lineBreakMode;
	uint backgroundStyle;
	uint reserved1;
	uint actOnMouseDragged;
	uint isLoaded;
	uint truncateLastLine;
	uint dontActOnMouseUp;
	uint isWhite;
	uint useUserKeyEquivalent;
	uint showsFirstResponder;
	uint focusRingType;
	uint wasSelectable;
	uint hasInvalidObject;
	uint allowsEditingTextAttributes;
	uint importsGraphics;
	uint alignment;
	uint reserved;
	uint refusesFirstResponder;
	uint needsHighlightedText;
	uint dontAllowsUndo;
	uint currentlyEditing;
	uint allowsMixedState;
	uint inMixedState;
	uint sendsActionOnEndEditing;
	uint inSendAction;
	uint menuWasSet;
	uint controlTint;
	uint controlSize;
	uint branchImageDisabled;
	uint drawingInRevealover;
	uint needsHighlightedTextHint;
}

const TNSCellMixedState = `

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

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

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

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

	//mixin ObjcBindMethod!(setAllowsMixedState, "setAllowsMixedState:");
	//mixin ObjcBindMethod!(allowsMixedState, "allowsMixedState");
	//mixin ObjcBindMethod!(nextState, "nextState");
	//mixin ObjcBindMethod!(setNextState, "setNextState");

`;

const TNSCellBackgroundStyle = `

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

	void setBackgroundStyle (int style)
	{
		return invokeObjcSelf!(void, "setBackgroundStyle:", int)(style);
	}

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

	//mixin ObjcBindMethod!(backgroundStyle, "backgroundStyle");
	//mixin ObjcBindMethod!(setBackgroundStyle, "setBackgroundStyle:");
	//mixin ObjcBindMethod!(interiorBackgroundStyle, "interiorBackgroundStyle");

`;

const TNSCellExpansion = `

	NSRect expansionFrameWithFrame (NSRect cellFrame, NSView view)
	{
		return invokeObjcSelf!(NSRect, "expansionFrameWithFrame:inView:", NSRect, NSView)(cellFrame, view);
	}

	void drawWithExpansionFrame (NSRect cellFrame, NSView view)
	{
		return invokeObjcSelf!(void, "drawWithExpansionFrame:inView:", NSRect, NSView)(cellFrame, view);
	}

	//mixin ObjcBindMethod!(expansionFrameWithFrame, "expansionFrameWithFrame:inView:");
	//mixin ObjcBindMethod!(drawWithExpansionFrame, "drawWithExpansionFrame:inView:");

`;

const TNSCellHitTest = `

	NSUInteger hitTestForEvent (NSEvent event, NSRect cellFrame, NSView controlView)
	{
		return invokeObjcSelf!(NSUInteger, "hitTestForEvent:inRect:ofView:", NSEvent, NSRect, NSView)(event, cellFrame, controlView);
	}

	//mixin ObjcBindMethod!(hitTestForEvent, "hitTestForEvent:inRect:ofView:");

`;

const TNSCellAttributedStringMethods = `

	NSAttributedString attributedStringValue ()
	{
		return invokeObjcSelf!(NSAttributedString, "attributedStringValue");
	}

	void setAttributedStringValue (NSAttributedString obj)
	{
		return invokeObjcSelf!(void, "setAttributedStringValue:", NSAttributedString)(obj);
	}

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

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

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

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

	//mixin ObjcBindMethod!(attributedStringValue, "attributedStringValue");
	//mixin ObjcBindMethod!(setAttributedStringValue, "setAttributedStringValue:");
	//mixin ObjcBindMethod!(allowsEditingTextAttributes, "allowsEditingTextAttributes");
	//mixin ObjcBindMethod!(setAllowsEditingTextAttributes, "setAllowsEditingTextAttributes:");
	//mixin ObjcBindMethod!(importsGraphics, "importsGraphics");
	//mixin ObjcBindMethod!(setImportsGraphics, "setImportsGraphics:");

`;

class NSCell : NSObject, INSCopying, INSCoding
{
	mixin (ObjcWrap);
	
	this (NSCoder aDecoder)
	{
		super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
	}
	
	void encodeWithCoder (NSCoder aCoder)
	{
		return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
	}
	
	typeof(this) initWithCoder (NSCoder aDecoder)
	{
		return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
	}
	
	typeof(this) copyWithZone (NSZone* zone)
	{
		return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
	}

	static bool prefersTrackingUntilMouseUp ()
	{
		return invokeObjcSelfClass!(bool, "prefersTrackingUntilMouseUp");
	}

	NSCell initTextCell (NSString aString)
	{
		id result = invokeObjcSelf!(id, "initTextCell:", NSString)(aString);
		return result is this.objcObject ? this : (result !is null ? new NSCell(result) : null);
	}

	this (NSString aString)
	{
		super(NSCell.alloc.initTextCell(aString).objcObject);
	}

	NSCell initImageCell (NSImage image)
	{
		id result = invokeObjcSelf!(id, "initImageCell:", NSImage)(image);
		return result is this.objcObject ? this : (result !is null ? new NSCell(result) : null);
	}

	this (NSImage image)
	{
		super(NSCell.alloc.initImageCell(image).objcObject);
	}

	NSView controlView ()
	{
		return invokeObjcSelf!(NSView, "controlView");
	}

	void setControlView (NSView view)
	{
		return invokeObjcSelf!(void, "setControlView:", NSView)(view);
	}

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

	void setType (uint aType)
	{
		return invokeObjcSelf!(void, "setType:", uint)(aType);
	}

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

	void setState (NSInteger value)
	{
		return invokeObjcSelf!(void, "setState:", NSInteger)(value);
	}

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

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

	SEL action ()
	{
		return invokeObjcSelf!(SEL, "action");
	}

	void setAction (SEL aSelector)
	{
		return invokeObjcSelf!(void, "setAction:", SEL)(aSelector);
	}

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

	void setTag (NSInteger anInt)
	{
		return invokeObjcSelf!(void, "setTag:", NSInteger)(anInt);
	}

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

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

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

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

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

	NSInteger sendActionOn (NSInteger mask)
	{
		return invokeObjcSelf!(NSInteger, "sendActionOn:", NSInteger)(mask);
	}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	void setAlignment (uint mode)
	{
		return invokeObjcSelf!(void, "setAlignment:", uint)(mode);
	}

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

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

	NSFont font ()
	{
		return invokeObjcSelf!(NSFont, "font");
	}

	void setFont (NSFont fontObj)
	{
		return invokeObjcSelf!(void, "setFont:", NSFont)(fontObj);
	}

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

	void setEntryType (NSInteger aType)
	{
		return invokeObjcSelf!(void, "setEntryType:", NSInteger)(aType);
	}

	bool isEntryAcceptable (NSString aString)
	{
		return invokeObjcSelf!(bool, "isEntryAcceptable:", NSString)(aString);
	}

	void setFloatingPointFormat (bool autoRange, NSUInteger leftDigits, NSUInteger rightDigits)
	{
		return invokeObjcSelf!(void, "setFloatingPointFormat:left:right:", bool, NSUInteger, NSUInteger)(autoRange, leftDigits, rightDigits);
	}

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

	void setFormatter (NSFormatter newFormatter)
	{
		return invokeObjcSelf!(void, "setFormatter:", NSFormatter)(newFormatter);
	}

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

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

	void setObjectValue (INSCopying obj)
	{
		return invokeObjcSelf!(void, "setObjectValue:", INSCopying)(obj);
	}

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

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

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

	int compare (Object otherCell)
	{
		return invokeObjcSelf!(int, "compare:", Object)(otherCell);
	}

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

	void setIntValue (int anInt)
	{
		return invokeObjcSelf!(void, "setIntValue:", int)(anInt);
	}

	float floatValue ()
	{
		return invokeObjcSelf!(float, "floatValue");
	}

	void setFloatValue (float aFloat)
	{
		return invokeObjcSelf!(void, "setFloatValue:", float)(aFloat);
	}

	double doubleValue ()
	{
		return invokeObjcSelf!(double, "doubleValue");
	}

	void setDoubleValue (double aDouble)
	{
		return invokeObjcSelf!(void, "setDoubleValue:", double)(aDouble);
	}

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

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

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

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

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

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

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

	void setControlTint (uint controlTint)
	{
		return invokeObjcSelf!(void, "setControlTint:", uint)(controlTint);
	}

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

	void setControlSize (uint size)
	{
		return invokeObjcSelf!(void, "setControlSize:", uint)(size);
	}

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

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

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

	NSInteger cellAttribute (uint aParameter)
	{
		return invokeObjcSelf!(NSInteger, "cellAttribute:", uint)(aParameter);
	}

	void setCellAttribute (uint aParameter, NSInteger value)
	{
		return invokeObjcSelf!(void, "setCellAttribute:to:", uint, NSInteger)(aParameter, value);
	}

	NSRect imageRectForBounds (NSRect theRect)
	{
		return invokeObjcSelf!(NSRect, "imageRectForBounds:", NSRect)(theRect);
	}

	NSRect titleRectForBounds (NSRect theRect)
	{
		return invokeObjcSelf!(NSRect, "titleRectForBounds:", NSRect)(theRect);
	}

	NSRect drawingRectForBounds (NSRect theRect)
	{
		return invokeObjcSelf!(NSRect, "drawingRectForBounds:", NSRect)(theRect);
	}

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

	NSSize cellSizeForBounds (NSRect aRect)
	{
		return invokeObjcSelf!(NSSize, "cellSizeForBounds:", NSRect)(aRect);
	}

	NSColor highlightColorWithFrame (NSRect cellFrame, NSView controlView)
	{
		return invokeObjcSelf!(NSColor, "highlightColorWithFrame:inView:", NSRect, NSView)(cellFrame, controlView);
	}

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

	NSText setUpFieldEditorAttributes (NSText textObj)
	{
		return invokeObjcSelf!(NSText, "setUpFieldEditorAttributes:", NSText)(textObj);
	}

	void drawInteriorWithFrame (NSRect cellFrame, NSView controlView)
	{
		return invokeObjcSelf!(void, "drawInteriorWithFrame:inView:", NSRect, NSView)(cellFrame, controlView);
	}

	void drawWithFrame (NSRect cellFrame, NSView controlView)
	{
		return invokeObjcSelf!(void, "drawWithFrame:inView:", NSRect, NSView)(cellFrame, controlView);
	}

	void highlight (bool flag, NSRect cellFrame, NSView controlView)
	{
		return invokeObjcSelf!(void, "highlight:withFrame:inView:", bool, NSRect, NSView)(flag, cellFrame, controlView);
	}

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

	void getPeriodicDelay (float* delay, float* interval)
	{
		return invokeObjcSelf!(void, "getPeriodicDelay:interval:", float*, float*)(delay, interval);
	}

	bool startTrackingAt (NSPoint startPoint, NSView controlView)
	{
		return invokeObjcSelf!(bool, "startTrackingAt:inView:", NSPoint, NSView)(startPoint, controlView);
	}

	bool continueTracking (NSPoint lastPoint, NSPoint currentPoint, NSView controlView)
	{
		return invokeObjcSelf!(bool, "continueTracking:at:inView:", NSPoint, NSPoint, NSView)(lastPoint, currentPoint, controlView);
	}

	void stopTracking (NSPoint lastPoint, NSPoint stopPoint, NSView controlView, bool flag)
	{
		return invokeObjcSelf!(void, "stopTracking:at:inView:mouseIsUp:", NSPoint, NSPoint, NSView, bool)(lastPoint, stopPoint, controlView, flag);
	}

	bool trackMouse (NSEvent theEvent, NSRect cellFrame, NSView controlView, bool flag)
	{
		return invokeObjcSelf!(bool, "trackMouse:inRect:ofView:untilMouseUp:", NSEvent, NSRect, NSView, bool)(theEvent, cellFrame, controlView, flag);
	}

	void editWithFrame (NSRect aRect, NSView controlView, NSText textObj, Object anObject, NSEvent theEvent)
	{
		return invokeObjcSelf!(void, "editWithFrame:inView:editor:delegate:event:", NSRect, NSView, NSText, Object, NSEvent)(aRect, controlView, textObj, anObject, theEvent);
	}

	void selectWithFrame (NSRect aRect, NSView controlView, NSText textObj, Object anObject, NSInteger selStart, NSInteger selLength)
	{
		return invokeObjcSelf!(void, "selectWithFrame:inView:editor:delegate:start:length:", NSRect, NSView, NSText, Object, NSInteger, NSInteger)(aRect, controlView, textObj, anObject, selStart, selLength);
	}

	void endEditing (NSText textObj)
	{
		return invokeObjcSelf!(void, "endEditing:", NSText)(textObj);
	}

	void resetCursorRect (NSRect cellFrame, NSView controlView)
	{
		return invokeObjcSelf!(void, "resetCursorRect:inView:", NSRect, NSView)(cellFrame, controlView);
	}

	void setMenu (NSMenu aMenu)
	{
		return invokeObjcSelf!(void, "setMenu:", NSMenu)(aMenu);
	}

	NSMenu menu ()
	{
		return invokeObjcSelf!(NSMenu, "menu");
	}

	NSMenu menuForEvent (NSEvent event, NSRect cellFrame, NSView view)
	{
		return invokeObjcSelf!(NSMenu, "menuForEvent:inRect:ofView:", NSEvent, NSRect, NSView)(event, cellFrame, view);
	}

	static NSMenu defaultMenu ()
	{
		return invokeObjcSelfClass!(NSMenu, "defaultMenu");
	}

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

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

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

	void setBaseWritingDirection (int writingDirection)
	{
		return invokeObjcSelf!(void, "setBaseWritingDirection:", int)(writingDirection);
	}

	void setLineBreakMode (uint mode)
	{
		return invokeObjcSelf!(void, "setLineBreakMode:", uint)(mode);
	}

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

	void setAllowsUndo (bool allowsUndo)
	{
		return invokeObjcSelf!(void, "setAllowsUndo:", bool)(allowsUndo);
	}

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

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

	void setIntegerValue (NSInteger anInteger)
	{
		return invokeObjcSelf!(void, "setIntegerValue:", NSInteger)(anInteger);
	}

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

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

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

	// NSCellMixedState
	void setAllowsMixedState (bool flag)
	{
		return invokeObjcSelf!(void, "setAllowsMixedState:", bool)(flag);
	}

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

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

	void setNextState ()
	{
		return invokeObjcSelf!(void, "setNextState");
	}
	
	// NSCellBackgroundStyle
	int backgroundStyle ()
	{
		return invokeObjcSelf!(int, "backgroundStyle");
	}

	void setBackgroundStyle (int style)
	{
		return invokeObjcSelf!(void, "setBackgroundStyle:", int)(style);
	}

	int interiorBackgroundStyle ()
	{
		return invokeObjcSelf!(int, "interiorBackgroundStyle");
	}
	
	// NSCellExpansion
	NSRect expansionFrameWithFrame (NSRect cellFrame, NSView view)
	{
		return invokeObjcSelf!(NSRect, "expansionFrameWithFrame:inView:", NSRect, NSView)(cellFrame, view);
	}

	void drawWithExpansionFrame (NSRect cellFrame, NSView view)
	{
		return invokeObjcSelf!(void, "drawWithExpansionFrame:inView:", NSRect, NSView)(cellFrame, view);
	}
	
	// NSCellHitTest
	NSUInteger hitTestForEvent (NSEvent event, NSRect cellFrame, NSView controlView)
	{
		return invokeObjcSelf!(NSUInteger, "hitTestForEvent:inRect:ofView:", NSEvent, NSRect, NSView)(event, cellFrame, controlView);
	}	
	
	// NSCellAttributedStringMethods
	NSAttributedString attributedStringValue ()
	{
		return invokeObjcSelf!(NSAttributedString, "attributedStringValue");
	}

	void setAttributedStringValue (NSAttributedString obj)
	{
		return invokeObjcSelf!(void, "setAttributedStringValue:", NSAttributedString)(obj);
	}

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

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

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

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

void NSDrawThreePartImage (NSRect frame, NSImage startCap, NSImage centerFill, NSImage endCap, bool vertical, uint op, CGFloat alphaFraction, bool flipped)
{
	return Bridge.invokeObjcFunction!(void, bindings.NSDrawThreePartImage, NSRect, NSImage, NSImage, NSImage, bool, uint, CGFloat, bool)(frame, startCap, centerFill, endCap, vertical, op, alphaFraction, flipped);
}

void NSDrawNinePartImage (NSRect frame, NSImage topLeftCorner, NSImage topEdgeFill, NSImage topRightCorner, NSImage leftEdgeFill, NSImage centerFill, NSImage rightEdgeFill, NSImage bottomLeftCorner, NSImage bottomEdgeFill, NSImage bottomRightCorner, uint op, CGFloat alphaFraction, bool flipped)
{
	return Bridge.invokeObjcFunction!(void, bindings.NSDrawNinePartImage, NSRect, NSImage, NSImage, NSImage, NSImage, NSImage, NSImage, NSImage, NSImage, NSImage, uint, CGFloat, bool)(frame, topLeftCorner, topEdgeFill, topRightCorner, leftEdgeFill, centerFill, rightEdgeFill, bottomLeftCorner, bottomEdgeFill, bottomRightCorner, op, alphaFraction, flipped);
}