diff dwt/internal/cocoa/NSButton.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents 642f460a0908
children 858e9a565d62
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSButton.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSButton.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,20 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 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
+ *    IBM Corporation - initial API and implementation
  *     
  * Port to the D programming language:
- *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *     Jacob Carlborg <doob@me.com>
  *******************************************************************************/
 module dwt.internal.cocoa.NSButton;
 
+import cocoa = dwt.internal.cocoa.id;
 import dwt.internal.cocoa.NSAttributedString;
-import dwt.internal.cocoa.NSButtonCell : NSBezelStyle, NSButtonType;
+import dwt.internal.cocoa.NSButtonCell;
 import dwt.internal.cocoa.NSCell;
 import dwt.internal.cocoa.NSControl;
 import dwt.internal.cocoa.NSEvent;
@@ -25,220 +26,66 @@
 import dwt.internal.cocoa.OS;
 import objc = dwt.internal.objc.runtime;
 
-public class NSButton : NSControl
-{
-
-    public this ()
-    {
-        super();
-    }
+public class NSButton : NSControl {
 
-    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 this() {
+    super();
+}
 
-    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 this(objc.id id) {
+    super(id);
+}
 
-    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 this(cocoa.id id) {
+    super(id);
+}
 
-    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 void setAllowsMixedState(bool flag) {
+    OS.objc_msgSend(this.id, OS.sel_setAllowsMixedState_, flag);
+}
 
-    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 void setAttributedTitle(NSAttributedString aString) {
+    OS.objc_msgSend(this.id, OS.sel_setAttributedTitle_, aString !is null ? aString.id : 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 cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_keyEquivalentModifierMask);
-    }
+public void setBezelStyle(NSBezelStyle bezelStyle) {
+    OS.objc_msgSend(this.id, OS.sel_setBezelStyle_, bezelStyle);
+}
 
-    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 setBordered(bool flag) {
+    OS.objc_msgSend(this.id, OS.sel_setBordered_, flag);
+}
 
-    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 setButtonType(NSButtonType aType) {
+    OS.objc_msgSend(this.id, OS.sel_setButtonType_, aType);
+}
 
-    public void setAttributedTitle (NSAttributedString aString)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setAttributedTitle_1, aString !is null ? aString.id_ : null);
-    }
-
-    public void setBezelStyle (NSBezelStyle 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 setImage(NSImage image) {
+    OS.objc_msgSend(this.id, OS.sel_setImage_, image !is null ? image.id : null);
+}
 
-    public void setButtonType (NSButtonType 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 (NSCellImagePosition aPosition)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setImagePosition_1, aPosition);
-    }
+public void setImagePosition(NSCellImagePosition aPosition) {
+    OS.objc_msgSend(this.id, OS.sel_setImagePosition_, 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 setState(NSInteger value) {
+    OS.objc_msgSend(this.id, OS.sel_setState_, value);
+}
 
-    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 setTitle(NSString aString) {
+    OS.objc_msgSend(this.id, OS.sel_setTitle_, aString !is null ? aString.id : null);
+}
 
-    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 NSInteger state() {
+    return OS.objc_msgSend(this.id, OS.sel_state);
+}
 
-    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 static objc.Class cellClass() {
+    return cast(objc.Class) OS.objc_msgSend(OS.class_NSButton, OS.sel_cellClass);
+}
 
-    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 cast(NSInteger) 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;
-    }
+public static void setCellClass(objc.Class factoryId) {
+    OS.objc_msgSend(OS.class_NSButton, OS.sel_setCellClass_, factoryId);
+}
 
 }