Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSStatusItem.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/NSStatusItem.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,202 @@ +/******************************************************************************* + * 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; + } + +}