view dwt/internal/cocoa/NSStatusItem.d @ 1:8b48be5454ce

The internal cocoa classes compile now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Tue, 19 Aug 2008 17:35:17 +0200
parents 380af2bdd8e5
children f565d3a95c0a
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.NSStatusItem;

import dwt.internal.cocoa.CGFloat;
import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSAttributedString;
import dwt.internal.cocoa.NSImage;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSMenu;
import dwt.internal.cocoa.NSObject;
import dwt.internal.cocoa.NSRect;
import dwt.internal.cocoa.NSStatusBar;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSView;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSStatusItem : NSObject
{

    public this ()
    {
        super();
    }

    public this (objc.id id)
    {
        super(id);
    }

    public objc.SEL action ()
    {
        return cast(objc.SEL) OS.objc_msgSend(this.id_, OS.sel_action);
    }

    public NSImage alternateImage ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_alternateImage);
        return result !is null ? new NSImage(result) : null;
    }

    public NSAttributedString attributedTitle ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_attributedTitle);
        return result !is null ? new NSAttributedString(result) : null;
    }

    public objc.SEL doubleAction ()
    {
        return cast(objc.SEL) OS.objc_msgSend(this.id_, OS.sel_doubleAction);
    }

    public void drawStatusBarBackgroundInRect (NSRect rect, bool highlight)
    {
        OS.objc_msgSend(this.id_, OS.sel_drawStatusBarBackgroundInRect_1withHighlight_1, rect, highlight);
    }

    public bool highlightMode ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_highlightMode) !is null;
    }

    public NSImage image ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_image);
        return result !is null ? new NSImage(result) : null;
    }

    public bool isEnabled ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_isEnabled) !is null;
    }

    public CGFloat length ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_length);
    }

    public NSMenu menu ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_menu);
        return result !is null ? new NSMenu(result) : null;
    }

    public void popUpStatusItemMenu (NSMenu menu)
    {
        OS.objc_msgSend(this.id_, OS.sel_popUpStatusItemMenu_1, menu !is null ? menu.id_ : null);
    }

    public NSInteger sendActionOn (NSInteger mask)
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_sendActionOn_1, mask);
    }

    public void setAction (objc.SEL action)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAction_1, action);
    }

    public void setAlternateImage (NSImage image)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAlternateImage_1, image !is null ? image.id_ : null);
    }

    public void setAttributedTitle (NSAttributedString title)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAttributedTitle_1, title !is null ? title.id_ : null);
    }

    public void setDoubleAction (objc.SEL action)
    {
        OS.objc_msgSend(this.id_, OS.sel_setDoubleAction_1, action);
    }

    public void setEnabled (bool enabled)
    {
        OS.objc_msgSend(this.id_, OS.sel_setEnabled_1, enabled);
    }

    public void setHighlightMode (bool highlightMode)
    {
        OS.objc_msgSend(this.id_, OS.sel_setHighlightMode_1, highlightMode);
    }

    public void setImage (NSImage image)
    {
        OS.objc_msgSend(this.id_, OS.sel_setImage_1, image !is null ? image.id_ : null);
    }

    public void setLength (CGFloat length)
    {
        OS.objc_msgSend(this.id_, OS.sel_setLength_1, length);
    }

    public void setMenu (NSMenu menu)
    {
        OS.objc_msgSend(this.id_, OS.sel_setMenu_1, menu !is null ? menu.id_ : null);
    }

    public void setTarget (id target)
    {
        OS.objc_msgSend(this.id_, OS.sel_setTarget_1, target !is null ? target.id_ : null);
    }

    public void setTitle (NSString title)
    {
        OS.objc_msgSend(this.id_, OS.sel_setTitle_1, title !is null ? title.id_ : null);
    }

    public void setToolTip (NSString toolTip)
    {
        OS.objc_msgSend(this.id_, OS.sel_setToolTip_1, toolTip !is null ? toolTip.id_ : null);
    }

    public void setView (NSView view)
    {
        OS.objc_msgSend(this.id_, OS.sel_setView_1, view !is null ? view.id_ : null);
    }

    public NSStatusBar statusBar ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_statusBar);
        return result !is null ? new NSStatusBar(result) : null;
    }

    public id target ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_target);
        return result !is null ? new id(result) : null;
    }

    public NSString title ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_title);
        return result !is null ? new NSString(result) : null;
    }

    public NSString toolTip ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_toolTip);
        return result !is null ? new NSString(result) : null;
    }

    public NSView view ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_view);
        return result !is null ? new NSView(result) : null;
    }

}