Mercurial > projects > dstep
diff dstep/appkit/NSStatusItem.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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/appkit/NSStatusItem.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,351 @@ +/** + * 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.NSStatusItem; + +import dstep.appkit.NSAttributedString; +import dstep.appkit.NSImage; +import dstep.appkit.NSMenu; +import dstep.appkit.NSStatusBar; +import dstep.appkit.NSView; +import dstep.appkit.NSWindow; +import dstep.applicationservices.coregraphics.CGBase; +import dstep.foundation.NSAttributedString; +import dstep.foundation.NSGeometry; +import dstep.foundation.NSObjCRuntime; +import dstep.foundation.NSObject; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +const TNSStatusItemView = ` + + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + void setView (NSView view) + { + return invokeObjcSelf!(void, "setView:", NSView)(view); + } + + //mixin ObjcBindMethod!(view, "view"); + //mixin ObjcBindMethod!(setView, "setView:"); + +`; + +const TNSStatusItemCommon = ` + + SEL action () + { + return invokeObjcSelf!(SEL, "action"); + } + + void setAction (SEL action) + { + return invokeObjcSelf!(void, "setAction:", SEL)(action); + } + + SEL doubleAction () + { + return invokeObjcSelf!(SEL, "doubleAction"); + } + + void setDoubleAction (SEL action) + { + return invokeObjcSelf!(void, "setDoubleAction:", SEL)(action); + } + + Object target () + { + return invokeObjcSelf!(Object, "target"); + } + + void setTarget (Object target) + { + return invokeObjcSelf!(void, "setTarget:", Object)(target); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString title) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(title); + } + + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString title) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(title); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setImage (NSImage image) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(image); + } + + NSImage alternateImage () + { + return invokeObjcSelf!(NSImage, "alternateImage"); + } + + void setAlternateImage (NSImage image) + { + return invokeObjcSelf!(void, "setAlternateImage:", NSImage)(image); + } + + NSMenu menu () + { + return invokeObjcSelf!(NSMenu, "menu"); + } + + void setMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setEnabled (bool enabled) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(enabled); + } + + NSString toolTip () + { + return invokeObjcSelf!(NSString, "toolTip"); + } + + void setToolTip (NSString toolTip) + { + return invokeObjcSelf!(void, "setToolTip:", NSString)(toolTip); + } + + void setHighlightMode (bool highlightMode) + { + return invokeObjcSelf!(void, "setHighlightMode:", bool)(highlightMode); + } + + bool highlightMode () + { + return invokeObjcSelf!(bool, "highlightMode"); + } + + NSInteger sendActionOn (NSInteger mask) + { + return invokeObjcSelf!(NSInteger, "sendActionOn:", NSInteger)(mask); + } + + void popUpStatusItemMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "popUpStatusItemMenu:", NSMenu)(menu); + } + + void drawStatusBarBackgroundInRect (NSRect rect, bool highlight) + { + return invokeObjcSelf!(void, "drawStatusBarBackgroundInRect:withHighlight:", NSRect, bool)(rect, highlight); + } + + //mixin ObjcBindMethod!(action, "action"); + //mixin ObjcBindMethod!(setAction, "setAction:"); + //mixin ObjcBindMethod!(doubleAction, "doubleAction"); + //mixin ObjcBindMethod!(setDoubleAction, "setDoubleAction:"); + //mixin ObjcBindMethod!(target, "target"); + //mixin ObjcBindMethod!(setTarget, "setTarget:"); + //mixin ObjcBindMethod!(title, "title"); + //mixin ObjcBindMethod!(setTitle, "setTitle:"); + //mixin ObjcBindMethod!(attributedTitle, "attributedTitle"); + //mixin ObjcBindMethod!(setAttributedTitle, "setAttributedTitle:"); + //mixin ObjcBindMethod!(image, "image"); + //mixin ObjcBindMethod!(setImage, "setImage:"); + //mixin ObjcBindMethod!(alternateImage, "alternateImage"); + //mixin ObjcBindMethod!(setAlternateImage, "setAlternateImage:"); + //mixin ObjcBindMethod!(menu, "menu"); + //mixin ObjcBindMethod!(setMenu, "setMenu:"); + //mixin ObjcBindMethod!(isEnabled, "isEnabled"); + //mixin ObjcBindMethod!(setEnabled, "setEnabled:"); + //mixin ObjcBindMethod!(toolTip, "toolTip"); + //mixin ObjcBindMethod!(setToolTip, "setToolTip:"); + //mixin ObjcBindMethod!(setHighlightMode, "setHighlightMode:"); + //mixin ObjcBindMethod!(highlightMode, "highlightMode"); + //mixin ObjcBindMethod!(sendActionOn, "sendActionOn:"); + //mixin ObjcBindMethod!(popUpStatusItemMenu, "popUpStatusItemMenu:"); + //mixin ObjcBindMethod!(drawStatusBarBackgroundInRect, "drawStatusBarBackgroundInRect:withHighlight:"); + +`; + +class NSStatusItem : NSObject +{ + mixin (ObjcWrap); + + NSStatusBar statusBar () + { + return invokeObjcSelf!(NSStatusBar, "statusBar"); + } + + CGFloat length () + { + return invokeObjcSelf!(CGFloat, "length"); + } + + void setLength (CGFloat length) + { + return invokeObjcSelf!(void, "setLength:", CGFloat)(length); + } + + // NSStatusItemView + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + void setView (NSView view) + { + return invokeObjcSelf!(void, "setView:", NSView)(view); + } + + // NSStatusItemCommon + SEL action () + { + return invokeObjcSelf!(SEL, "action"); + } + + void setAction (SEL action) + { + return invokeObjcSelf!(void, "setAction:", SEL)(action); + } + + SEL doubleAction () + { + return invokeObjcSelf!(SEL, "doubleAction"); + } + + void setDoubleAction (SEL action) + { + return invokeObjcSelf!(void, "setDoubleAction:", SEL)(action); + } + + Object target () + { + return invokeObjcSelf!(Object, "target"); + } + + void setTarget (Object target) + { + return invokeObjcSelf!(void, "setTarget:", Object)(target); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + void setTitle (NSString title) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(title); + } + + NSAttributedString attributedTitle () + { + return invokeObjcSelf!(NSAttributedString, "attributedTitle"); + } + + void setAttributedTitle (NSAttributedString title) + { + return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(title); + } + + NSImage image () + { + return invokeObjcSelf!(NSImage, "image"); + } + + void setImage (NSImage image) + { + return invokeObjcSelf!(void, "setImage:", NSImage)(image); + } + + NSImage alternateImage () + { + return invokeObjcSelf!(NSImage, "alternateImage"); + } + + void setAlternateImage (NSImage image) + { + return invokeObjcSelf!(void, "setAlternateImage:", NSImage)(image); + } + + NSMenu menu () + { + return invokeObjcSelf!(NSMenu, "menu"); + } + + void setMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu); + } + + bool isEnabled () + { + return invokeObjcSelf!(bool, "isEnabled"); + } + + void setEnabled (bool enabled) + { + return invokeObjcSelf!(void, "setEnabled:", bool)(enabled); + } + + NSString toolTip () + { + return invokeObjcSelf!(NSString, "toolTip"); + } + + void setToolTip (NSString toolTip) + { + return invokeObjcSelf!(void, "setToolTip:", NSString)(toolTip); + } + + void setHighlightMode (bool highlightMode) + { + return invokeObjcSelf!(void, "setHighlightMode:", bool)(highlightMode); + } + + bool highlightMode () + { + return invokeObjcSelf!(bool, "highlightMode"); + } + + NSInteger sendActionOn (NSInteger mask) + { + return invokeObjcSelf!(NSInteger, "sendActionOn:", NSInteger)(mask); + } + + void popUpStatusItemMenu (NSMenu menu) + { + return invokeObjcSelf!(void, "popUpStatusItemMenu:", NSMenu)(menu); + } + + void drawStatusBarBackgroundInRect (NSRect rect, bool highlight) + { + return invokeObjcSelf!(void, "drawStatusBarBackgroundInRect:withHighlight:", NSRect, bool)(rect, highlight); + } +} \ No newline at end of file