view dwt/internal/cocoa/NSMenuItemCell.d @ 13:f565d3a95c0a

Ported dwt.internal
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Fri, 22 Aug 2008 16:46:34 +0200
parents 8b48be5454ce
children
line wrap: on
line source

/*******************************************************************************
 * 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 cast(NSInteger) 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);
    }

}