Mercurial > projects > dstep
view dstep/appkit/NSButton.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 source
/** * 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.NSButton; import dstep.appkit.NSButtonCell; import dstep.appkit.NSControl; import dstep.appkit.NSEvent; import dstep.appkit.NSImage; import dstep.appkit.NSSound; import dstep.appkit.NSUserInterfaceValidation; import dstep.foundation.NSAttributedString; import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSString; import dstep.objc.bridge.Bridge; import dstep.objc.objc; const TNSButtonMixedState = ` void setAllowsMixedState (bool flag) { return invokeObjcSelf!(void, "setAllowsMixedState:", bool)(flag); } bool allowsMixedState () { return invokeObjcSelf!(bool, "allowsMixedState"); } void setNextState () { return invokeObjcSelf!(void, "setNextState"); } //mixin ObjcBindMethod!(setAllowsMixedState, "setAllowsMixedState:"); //mixin ObjcBindMethod!(allowsMixedState, "allowsMixedState"); //mixin ObjcBindMethod!(setNextState, "setNextState"); `; const TNSButtonAttributedStringMethods = ` NSAttributedString attributedTitle () { return invokeObjcSelf!(NSAttributedString, "attributedTitle"); } void setAttributedTitle (NSAttributedString aString) { return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(aString); } NSAttributedString attributedAlternateTitle () { return invokeObjcSelf!(NSAttributedString, "attributedAlternateTitle"); } void setAttributedAlternateTitle (NSAttributedString obj) { return invokeObjcSelf!(void, "setAttributedAlternateTitle:", NSAttributedString)(obj); } //mixin ObjcBindMethod!(attributedTitle, "attributedTitle"); //mixin ObjcBindMethod!(setAttributedTitle, "setAttributedTitle:"); //mixin ObjcBindMethod!(attributedAlternateTitle, "attributedAlternateTitle"); //mixin ObjcBindMethod!(setAttributedAlternateTitle, "setAttributedAlternateTitle:"); `; const TNSButtonSoundExtensions = ` void setSound (NSSound aSound) { return invokeObjcSelf!(void, "setSound:", NSSound)(aSound); } NSSound sound () { return invokeObjcSelf!(NSSound, "sound"); } //mixin ObjcBindMethod!(setSound, "setSound:"); //mixin ObjcBindMethod!(sound, "sound"); `; const TNSButtonBezelStyles = ` void setBezelStyle (uint bezelStyle) { return invokeObjcSelf!(void, "setBezelStyle:", uint)(bezelStyle); } uint bezelStyle () { return invokeObjcSelf!(uint, "bezelStyle"); } //mixin ObjcBindMethod!(setBezelStyle, "setBezelStyle:"); //mixin ObjcBindMethod!(bezelStyle, "bezelStyle"); `; const TNSButtonBorder = ` void setShowsBorderOnlyWhileMouseInside (bool show) { return invokeObjcSelf!(void, "setShowsBorderOnlyWhileMouseInside:", bool)(show); } bool showsBorderOnlyWhileMouseInside () { return invokeObjcSelf!(bool, "showsBorderOnlyWhileMouseInside"); } //mixin ObjcBindMethod!(setShowsBorderOnlyWhileMouseInside, "setShowsBorderOnlyWhileMouseInside:"); //mixin ObjcBindMethod!(showsBorderOnlyWhileMouseInside, "showsBorderOnlyWhileMouseInside"); `; class NSButton : NSControl, INSUserInterfaceValidations { mixin (ObjcWrap); NSString title () { return invokeObjcSelf!(NSString, "title"); } void setTitle (NSString aString) { return invokeObjcSelf!(void, "setTitle:", NSString)(aString); } NSString alternateTitle () { return invokeObjcSelf!(NSString, "alternateTitle"); } void setAlternateTitle (NSString aString) { return invokeObjcSelf!(void, "setAlternateTitle:", NSString)(aString); } 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); } uint imagePosition () { return invokeObjcSelf!(uint, "imagePosition"); } void setImagePosition (uint aPosition) { return invokeObjcSelf!(void, "setImagePosition:", uint)(aPosition); } void setButtonType (uint aType) { return invokeObjcSelf!(void, "setButtonType:", uint)(aType); } NSInteger state () { return invokeObjcSelf!(NSInteger, "state"); } void setState (NSInteger value) { return invokeObjcSelf!(void, "setState:", NSInteger)(value); } bool isBordered () { return invokeObjcSelf!(bool, "isBordered"); } void setBordered (bool flag) { return invokeObjcSelf!(void, "setBordered:", bool)(flag); } bool isTransparent () { return invokeObjcSelf!(bool, "isTransparent"); } void setTransparent (bool flag) { return invokeObjcSelf!(void, "setTransparent:", bool)(flag); } void setPeriodicDelay (float delay, float interval) { return invokeObjcSelf!(void, "setPeriodicDelay:interval:", float, float)(delay, interval); } void getPeriodicDelay (float* delay, float* interval) { return invokeObjcSelf!(void, "getPeriodicDelay:interval:", float*, float*)(delay, interval); } NSString keyEquivalent () { return invokeObjcSelf!(NSString, "keyEquivalent"); } void setKeyEquivalent (NSString charCode) { return invokeObjcSelf!(void, "setKeyEquivalent:", NSString)(charCode); } NSUInteger keyEquivalentModifierMask () { return invokeObjcSelf!(NSUInteger, "keyEquivalentModifierMask"); } void setKeyEquivalentModifierMask (NSUInteger mask) { return invokeObjcSelf!(void, "setKeyEquivalentModifierMask:", NSUInteger)(mask); } void highlight (bool flag) { return invokeObjcSelf!(void, "highlight:", bool)(flag); } bool performKeyEquivalent (NSEvent key) { return invokeObjcSelf!(bool, "performKeyEquivalent:", NSEvent)(key); } bool validateUserInterfaceItem (INSValidatedUserInterfaceItem anItem) { return invokeObjcSelf!(bool, "validateUserInterfaceItem:", INSValidatedUserInterfaceItem)(anItem); } // NSButtonMixedState void setAllowsMixedState (bool flag) { return invokeObjcSelf!(void, "setAllowsMixedState:", bool)(flag); } bool allowsMixedState () { return invokeObjcSelf!(bool, "allowsMixedState"); } void setNextState () { return invokeObjcSelf!(void, "setNextState"); } // NSButtonAttributedStringMethods NSAttributedString attributedTitle () { return invokeObjcSelf!(NSAttributedString, "attributedTitle"); } void setAttributedTitle (NSAttributedString aString) { return invokeObjcSelf!(void, "setAttributedTitle:", NSAttributedString)(aString); } NSAttributedString attributedAlternateTitle () { return invokeObjcSelf!(NSAttributedString, "attributedAlternateTitle"); } void setAttributedAlternateTitle (NSAttributedString obj) { return invokeObjcSelf!(void, "setAttributedAlternateTitle:", NSAttributedString)(obj); } // NSButtonSoundExtensions void setSound (NSSound aSound) { return invokeObjcSelf!(void, "setSound:", NSSound)(aSound); } NSSound sound () { return invokeObjcSelf!(NSSound, "sound"); } // NSButtonBezelStyles void setBezelStyle (uint bezelStyle) { return invokeObjcSelf!(void, "setBezelStyle:", uint)(bezelStyle); } uint bezelStyle () { return invokeObjcSelf!(uint, "bezelStyle"); } // NSButtonBorder void setShowsBorderOnlyWhileMouseInside (bool show) { return invokeObjcSelf!(void, "setShowsBorderOnlyWhileMouseInside:", bool)(show); } bool showsBorderOnlyWhileMouseInside () { return invokeObjcSelf!(bool, "showsBorderOnlyWhileMouseInside"); } }