Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSButton.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/NSButton.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,242 @@ +/******************************************************************************* + * 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.NSButton; + +import dwt.internal.cocoa.NSAttributedString; +import dwt.internal.cocoa.NSControl; +import dwt.internal.cocoa.NSEvent; +import dwt.internal.cocoa.NSImage; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSSound; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +public class NSButton : NSControl +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public bool allowsMixedState () + { + return OS.objc_msgSend(this.id, OS.sel_allowsMixedState) !is null; + } + + public NSImage alternateImage () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_alternateImage); + return result !is null ? new NSImage(result) : null; + } + + public NSString alternateTitle () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_alternateTitle); + return result !is null ? new NSString(result) : null; + } + + public NSAttributedString attributedAlternateTitle () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_attributedAlternateTitle); + return result !is null ? new NSAttributedString(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.id bezelStyle () + { + return OS.objc_msgSend(this.id, OS.sel_bezelStyle); + } + + public void getPeriodicDelay (float* delay, float* interval) + { + OS.objc_msgSend(this.id, OS.sel_getPeriodicDelay_1interval_1, delay, interval); + } + + public void highlight (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_highlight_1, flag); + } + + public NSImage image () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_image); + return result !is null ? new NSImage(result) : null; + } + + public objc.id imagePosition () + { + return OS.objc_msgSend(this.id, OS.sel_imagePosition); + } + + public bool isBordered () + { + return OS.objc_msgSend(this.id, OS.sel_isBordered) !is null; + } + + public bool isTransparent () + { + return OS.objc_msgSend(this.id, OS.sel_isTransparent) !is null; + } + + public NSString keyEquivalent () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_keyEquivalent); + return result !is null ? new NSString(result) : null; + } + + public NSUInteger keyEquivalentModifierMask () + { + return OS.objc_msgSend(this.id, OS.sel_keyEquivalentModifierMask); + } + + public bool performKeyEquivalent (NSEvent key) + { + return OS.objc_msgSend(this.id, OS.sel_performKeyEquivalent_1, key !is null ? key.id : null) !is null; + } + + public void setAllowsMixedState (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setAllowsMixedState_1, flag); + } + + public void setAlternateImage (NSImage image) + { + OS.objc_msgSend(this.id, OS.sel_setAlternateImage_1, image !is null ? image.id : null); + } + + public void setAlternateTitle (NSString aString) + { + OS.objc_msgSend(this.id, OS.sel_setAlternateTitle_1, aString !is null ? aString.id : null); + } + + public void setAttributedAlternateTitle (NSAttributedString obj) + { + OS.objc_msgSend(this.id, OS.sel_setAttributedAlternateTitle_1, obj !is null ? obj.id : null); + } + + public void setAttributedTitle (NSAttributedString aString) + { + OS.objc_msgSend(this.id, OS.sel_setAttributedTitle_1, aString !is null ? aString.id : null); + } + + public void setBezelStyle (objc.id bezelStyle) + { + OS.objc_msgSend(this.id, OS.sel_setBezelStyle_1, bezelStyle); + } + + public void setBordered (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setBordered_1, flag); + } + + public void setButtonType (objc.id aType) + { + OS.objc_msgSend(this.id, OS.sel_setButtonType_1, aType); + } + + public void setImage (NSImage image) + { + OS.objc_msgSend(this.id, OS.sel_setImage_1, image !is null ? image.id : null); + } + + public void setImagePosition (objc.id aPosition) + { + OS.objc_msgSend(this.id, OS.sel_setImagePosition_1, aPosition); + } + + public void setKeyEquivalent (NSString charCode) + { + OS.objc_msgSend(this.id, OS.sel_setKeyEquivalent_1, charCode !is null ? charCode.id : null); + } + + public void setKeyEquivalentModifierMask (NSUInteger mask) + { + OS.objc_msgSend(this.id, OS.sel_setKeyEquivalentModifierMask_1, mask); + } + + public void setNextState () + { + OS.objc_msgSend(this.id, OS.sel_setNextState); + } + + public void setPeriodicDelay (float delay, float interval) + { + OS.objc_msgSend(this.id, OS.sel_setPeriodicDelay_1interval_1, delay, interval); + } + + public void setShowsBorderOnlyWhileMouseInside (bool show) + { + OS.objc_msgSend(this.id, OS.sel_setShowsBorderOnlyWhileMouseInside_1, show); + } + + public void setSound (NSSound aSound) + { + OS.objc_msgSend(this.id, OS.sel_setSound_1, aSound !is null ? aSound.id : null); + } + + public void setState (NSInteger value) + { + OS.objc_msgSend(this.id, OS.sel_setState_1, value); + } + + public void setTitle (NSString aString) + { + OS.objc_msgSend(this.id, OS.sel_setTitle_1, aString !is null ? aString.id : null); + } + + public void setTitleWithMnemonic (NSString StringWithAmpersand) + { + OS.objc_msgSend(this.id, OS.sel_setTitleWithMnemonic_1, StringWithAmpersand !is null ? StringWithAmpersand.id : null); + } + + public void setTransparent (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setTransparent_1, flag); + } + + public bool showsBorderOnlyWhileMouseInside () + { + return OS.objc_msgSend(this.id, OS.sel_showsBorderOnlyWhileMouseInside) !is null; + } + + public NSSound sound () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_sound); + return result !is null ? new NSSound(result) : null; + } + + public NSInteger state () + { + return OS.objc_msgSend(this.id, OS.sel_state); + } + + public NSString title () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_title); + return result !is null ? new NSString(result) : null; + } + +}