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

import dstep.appkit.AppKitDefines;
import dstep.appkit.NSEvent;
import dstep.appkit.NSFont;
import dstep.appkit.NSMenu;
import dstep.appkit.NSMenuItem;
import dstep.appkit.NSMenuItemCell;
import dstep.appkit.NSScreen;
import dstep.appkit.NSView;
import dstep.applicationservices.coregraphics.CGBase;
import dstep.foundation.NSGeometry;
import dstep.foundation.NSNotification;
import dstep.foundation.NSObjCRuntime;
import dstep.internal.Version;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

static if (!D_LP64):
	
class NSMenuView : NSView
{
	mixin (ObjcWrap);
	
	static CGFloat menuBarHeight ()
	{
		return invokeObjcSelfClass!(CGFloat, "menuBarHeight");
	}
	
	NSMenuView initWithFrame (NSRect frame)
	{
		return invokeObjcSelf!(NSMenuView, "initWithFrame:", NSRect)(frame);
	}
	
	NSMenuView initAsTearOff ()
	{
		return invokeObjcSelf!(NSMenuView, "initAsTearOff");
	}
	
	void setMenu (NSMenu menu)
	{
		return invokeObjcSelf!(NSMenuView, "setMenu:", NSMenu)(menu);
	}
	
	NSMenu menu ()
	{
		return invokeObjcSelf!(NSMenu, "menu");
	}
	
	void itemChanged (NSNotification notification)
	{
		return invokeObjcSelf!(void, "itemChanged:", NSNotification)(notification);
	}
	
	void itemAdded (NSNotification notification)
	{
		return invokeObjcSelf!(void, "itemAdded:", NSNotification)(notification);
	}
	
	void itemRemoved (NSNotification notification)
	{
		return invokeObjcSelf!(void, "itemRemoved:", NSNotification)(notification);
	}
	
	void update ()
	{
		return invokeObjcSelf!(void, "update");
	}
	
	void setHorizontal (bool flag)
	{
		return invokeObjcSelf!(void, "setHorizontal:", bool)(flag);
	}
	
	bool isHorizontal ()
	{
		return invokeObjcSelf!(bool, "isHorizontal");
	}
	
	void setFont (NSFont font)
	{
		return invokeObjcSelf!(void, "setFont:", NSFont)(font);
	}
	
	NSFont font ()
	{
		return invokeObjcSelf!(NSFont, "font");
	}
	
	NSRect innerRect ()
	{
		return invokeObjcSelf!(NSRect, "innerRect");
	}
	
	NSRect rectOfItemAtIndex (NSInteger index)
	{
		return invokeObjcSelf!(NSRect, "rectOfItemAtIndex:", NSInteger)(index);
	}
	
	NSInteger indexOfItemAtPoint (NSPoint point)
	{
		return invokeObjcSelf!(NSInteger, "indexOfItemAtPoint:", NSPoint)(point);
	}
	
	void setNeedsDisplayForItemAtIndex (NSInteger index)
	{
		return invokeObjcSelf!(void, "setNeedsDisplayForItemAtIndex:", NSInteger)(index);
	}
	
	void setHighlightedItemIndex (NSInteger index)
	{
		return invokeObjcSelf!(void, "setHighlightedItemIndex:", NSInteger)(index);
	}
	
	NSInteger highlightedItemIndex ()
	{
		return invokeObjcSelf!(NSInteger, "highlightedItemIndex");
	}
	
	CGFloat stateImageOffset ()
	{
		return invokeObjcSelf!(CGFloat, "stateImageOffset");
	}
	
	CGFloat stateImageWidth ()
	{
		return invokeObjcSelf!(CGFloat, "stateImageWidth");
	}
	
	CGFloat imageAndTitleOffset ()
	{
		return invokeObjcSelf!(CGFloat, "imageAndTitleOffset");
	}
	
	CGFloat imageAndTitleWidth ()
	{
		return invokeObjcSelf!(CGFloat, "imageAndTitleWidth");
	}
	
	CGFloat keyEquivalentOffset ()
	{
		return invokeObjcSelf!(CGFloat, "keyEquivalentOffset");
	}
	
	CGFloat keyEquivalentWidth ()
	{
		return invokeObjcSelf!(CGFloat, "keyEquivalentWidth");
	}
	
	void setMenuItemCell (NSMenuItemCell cell, NSInteger index)
	{
		return invokeObjcSelf!(void, "setMenuItemCell:forItemAtIndex:", NSMenuItemCell, NSInteger)(cell, index);
	}
	
	NSMenuItemCell menuItemCellForItemAtIndex (NSInteger index)
	{
		return invokeObjcSelf!(NSMenuItemCell, "menuItemCellForItemAtIndex:", NSInteger)(index);
	}
	
	NSMenuView attachedMenuView ()
	{
		return invokeObjcSelf!(NSMenuView, "attachedMenuView");
	}
	
	void setNeedsSizing (bool flag)
	{
		return invokeObjcSelf!(void, "setNeedsSizing:", bool)(flag);
	}
	
	bool needsSizing ()
	{
		return invokeObjcSelf!(bool, "needsSizing");
	}
	
	void sizeToFit ()
	{
		return invokeObjcSelf!(void, "sizeToFit");
	}
	
	NSMenu attachedMenu ()
	{
		return invokeObjcSelf!(NSMenu, "attachedMenu");
	}
	
	bool isAttached ()
	{
		return invokeObjcSelf!(bool, "isAttached");
	}
	
	bool isTornOff ()
	{
		return invokeObjcSelf!(bool, "isTornOff");
	}
	
	NSPoint locationForSubmenu (NSMenu aSubmenu)
	{
		return invokeObjcSelf!(NSPoint, "locationForSubmenu:", NSMenu)(aSubmenu);
	}
	
	void setWindowFrameForAttachingToRect (NSRect screenRect, NSScreen screen, NSRectEdge edge, NSInteger selectedItemIndex)
	{
		return invokeObjcSelf!(void, "setWindowFrameForAttachingToRect:onScreen:preferredEdge:popUpSelectedItem:", NSRect, NSScreen, NSRectEdge, NSInteger)(screenRect, screen, edge, selectedItemIndex);
	}
	
	void detachSubmenu ()
	{
		return invokeObjcSelf!(void, "detachSubmenu");
	}
	
	void attachSubmenuForItemAtIndex (NSInteger index)
	{
		return invokeObjcSelf!(void, "attachSubmenuForItemAtIndex:", NSInteger)(index);
	}
	
	void performActionWithHighlightingForItemAtIndex (NSInteger index)
	{
		return invokeObjcSelf!(void, "performActionWithHighlightingForItemAtIndex:", NSInteger)(index);
	}
	
	bool trackWithEvent (NSEvent event)
	{
		return invokeObjcSelf!(bool, "trackWithEvent:", NSEvent)(event);
	}
	
	CGFloat horizontalEdgePadding ()
	{
		return invokeObjcSelf!(CGFloat, "horizontalEdgePadding");
	}
	
	void setHorizontalEdgePadding (CGFloat pad)
	{
		return invokeObjcSelf!(void, "setHorizontalEdgePadding:", CGFloat)(pad);
	}
}