Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSMenuItemCell.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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSMenuItemCell.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,162 @@ +/******************************************************************************* + * 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.NSMenuItemCell; + +import dwt.internal.cocoa.CGFloat; +import dwt.internal.cocoa.NSButtonCell; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSMenuItem; +import dwt.internal.cocoa.NSMenuView; +import dwt.internal.cocoa.NSRect; +import dwt.internal.cocoa.NSView; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +public class NSMenuItemCell : NSButtonCell +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public void calcSize () + { + OS.objc_msgSend(this.id, OS.sel_calcSize); + } + + public void drawBorderAndBackgroundWithFrame (NSRect cellFrame, NSView controlView) + { + OS.objc_msgSend(this.id, OS.sel_drawBorderAndBackgroundWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null); + } + + public void drawImageWithFrame (NSRect cellFrame, NSView controlView) + { + OS.objc_msgSend(this.id, OS.sel_drawImageWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null); + } + + public void drawKeyEquivalentWithFrame (NSRect cellFrame, NSView controlView) + { + OS.objc_msgSend(this.id, OS.sel_drawKeyEquivalentWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null); + } + + public void drawSeparatorItemWithFrame (NSRect cellFrame, NSView controlView) + { + OS.objc_msgSend(this.id, OS.sel_drawSeparatorItemWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null); + } + + public void drawStateImageWithFrame (NSRect cellFrame, NSView controlView) + { + OS.objc_msgSend(this.id, OS.sel_drawStateImageWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null); + } + + public void drawTitleWithFrame (NSRect cellFrame, NSView controlView) + { + OS.objc_msgSend(this.id, OS.sel_drawTitleWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null); + } + + public CGFloat imageWidth () + { + return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_imageWidth); + } + + public NSRect keyEquivalentRectForBounds (NSRect cellFrame) + { + NSRect result; + OS.objc_msgSend_stret(result, this.id, OS.sel_keyEquivalentRectForBounds_1, cellFrame); + return result; + } + + public CGFloat keyEquivalentWidth () + { + return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_keyEquivalentWidth); + } + + public NSMenuItem menuItem () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_menuItem); + return result !is null ? new NSMenuItem(result) : null; + } + + public NSMenuView menuView () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_menuView); + return result !is null ? new NSMenuView(result) : null; + } + + public bool needsDisplay () + { + return OS.objc_msgSend(this.id, OS.sel_needsDisplay) !is null; + } + + public bool needsSizing () + { + return OS.objc_msgSend(this.id, OS.sel_needsSizing) !is null; + } + + public void setMenuItem (NSMenuItem item) + { + OS.objc_msgSend(this.id, OS.sel_setMenuItem_1, item !is null ? item.id : null); + } + + public void setMenuView (NSMenuView menuView) + { + OS.objc_msgSend(this.id, OS.sel_setMenuView_1, menuView !is null ? menuView.id : null); + } + + public void setNeedsDisplay (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setNeedsDisplay_1, flag); + } + + public void setNeedsSizing (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setNeedsSizing_1, flag); + } + + public NSRect stateImageRectForBounds (NSRect cellFrame) + { + NSRect result; + OS.objc_msgSend_stret(result, this.id, OS.sel_stateImageRectForBounds_1, cellFrame); + return result; + } + + public CGFloat stateImageWidth () + { + return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_stateImageWidth); + } + + public NSInteger tag () + { + return OS.objc_msgSend(this.id, OS.sel_tag); + } + + public NSRect titleRectForBounds (NSRect cellFrame) + { + NSRect result; + OS.objc_msgSend_stret(result, this.id, OS.sel_titleRectForBounds_1, cellFrame); + return result; + } + + public CGFloat titleWidth () + { + return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_titleWidth); + } + +}