diff dwt/internal/cocoa/NSMenuView.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/NSMenuView.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * 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.NSMenuView;
+
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSRect : NSRectEdge;
+import dwt.internal.cocoa.NSView;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSMenuView : NSView
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public void attachSubmenuForItemAtIndex (NSInteger index)
+    {
+        OS.objc_msgSend(this.id, OS.sel_attachSubmenuForItemAtIndex_1, index);
+    }
+
+    public NSMenu attachedMenu ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_attachedMenu);
+        return result !is null ? new NSMenu(result) : null;
+    }
+
+    public NSMenuView attachedMenuView ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_attachedMenuView);
+        return result is this.id ? this : (result !is null ? new NSMenuView(result) : null);
+    }
+
+    public void detachSubmenu ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_detachSubmenu);
+    }
+
+    public NSFont font ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_font);
+        return result !is null ? new NSFont(result) : null;
+    }
+
+    public NSInteger highlightedItemIndex ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_highlightedItemIndex);
+    }
+
+    public CGFloat horizontalEdgePadding ()
+    {
+        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_horizontalEdgePadding);
+    }
+
+    public CGFloat imageAndTitleOffset ()
+    {
+        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_imageAndTitleOffset);
+    }
+
+    public CGFloat imageAndTitleWidth ()
+    {
+        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_imageAndTitleWidth);
+    }
+
+    public NSInteger indexOfItemAtPoint (NSPoint point)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_indexOfItemAtPoint_1, point);
+    }
+
+    public NSMenuView initAsTearOff ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initAsTearOff);
+        return result !is null ? this : null;
+    }
+
+    public NSRect innerRect ()
+    {
+        NSRect result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_innerRect);
+        return result;
+    }
+
+    public bool isAttached ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isAttached) !is null;
+    }
+
+    public bool isHorizontal ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isHorizontal) !is null;
+    }
+
+    public bool isTornOff ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isTornOff) !is null;
+    }
+
+    public void itemAdded (NSNotification notification)
+    {
+        OS.objc_msgSend(this.id, OS.sel_itemAdded_1, notification !is null ? notification.id : null);
+    }
+
+    public void itemChanged (NSNotification notification)
+    {
+        OS.objc_msgSend(this.id, OS.sel_itemChanged_1, notification !is null ? notification.id : null);
+    }
+
+    public void itemRemoved (NSNotification notification)
+    {
+        OS.objc_msgSend(this.id, OS.sel_itemRemoved_1, notification !is null ? notification.id : null);
+    }
+
+    public CGFloat keyEquivalentOffset ()
+    {
+        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_keyEquivalentOffset);
+    }
+
+    public CGFloat keyEquivalentWidth ()
+    {
+        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_keyEquivalentWidth);
+    }
+
+    public NSPoint locationForSubmenu (NSMenu aSubmenu)
+    {
+        NSPoint result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_locationForSubmenu_1, aSubmenu !is null ? aSubmenu.id : null);
+        return result;
+    }
+
+    public NSMenu menu ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_menu);
+        return result !is null ? new NSMenu(result) : null;
+    }
+
+    public static CGFloat menuBarHeight ()
+    {
+        return cast(CGFloat) OS.objc_msgSend_fpret(OS.class_NSMenuView, OS.sel_menuBarHeight);
+    }
+
+    public NSMenuItemCell menuItemCellForItemAtIndex (NSInteger index)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_menuItemCellForItemAtIndex_1, index);
+        return result !is null ? new NSMenuItemCell(result) : null;
+    }
+
+    public bool needsSizing ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_needsSizing) !is null;
+    }
+
+    public void performActionWithHighlightingForItemAtIndex (NSInteger index)
+    {
+        OS.objc_msgSend(this.id, OS.sel_performActionWithHighlightingForItemAtIndex_1, index);
+    }
+
+    public NSRect rectOfItemAtIndex (NSInteger)
+    {
+        NSRect result;
+        OS.objc_msgSend_stret(result, this.id, OS.sel_rectOfItemAtIndex_1, index);
+        return result;
+    }
+
+    public void setFont (NSFont font)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setFont_1, font !is null ? font.id : null);
+    }
+
+    public void setHighlightedItemIndex (NSInteger index)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setHighlightedItemIndex_1, index);
+    }
+
+    public void setHorizontal (bool flag)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setHorizontal_1, flag);
+    }
+
+    public void setHorizontalEdgePadding (CGFloat pad)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setHorizontalEdgePadding_1, pad);
+    }
+
+    public void setMenu (NSMenu menu)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setMenu_1, menu !is null ? menu.id : null);
+    }
+
+    public void setMenuItemCell (NSMenuItemCell cell, NSInteger index)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setMenuItemCell_1forItemAtIndex_1, cell !is null ? cell.id : null, index);
+    }
+
+    public void setNeedsDisplayForItemAtIndex (NSInteger index)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setNeedsDisplayForItemAtIndex_1, index);
+    }
+
+    public void setNeedsSizing (bool flag)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setNeedsSizing_1, flag);
+    }
+
+    public void setWindowFrameForAttachingToRect (NSRect screenRect, NSScreen screen, NSRectEdge edge, NSInteger selectedItemIndex)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setWindowFrameForAttachingToRect_1onScreen_1preferredEdge_1popUpSelectedItem_1, screenRect,
+                screen !is null ? screen.id : null, edge, selectedItemIndex);
+    }
+
+    public void sizeToFit ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_sizeToFit);
+    }
+
+    public CGFloat stateImageOffset ()
+    {
+        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_stateImageOffset);
+    }
+
+    public CGFloat stateImageWidth ()
+    {
+        return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_stateImageWidth);
+    }
+
+    public bool trackWithEvent (NSEvent event)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_trackWithEvent_1, event !is null ? event.id : null) !is null;
+    }
+
+    public void update ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_update);
+    }
+
+}