diff dwt/internal/cocoa/NSControl.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 62202ce0039f
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSControl.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSControl.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,372 +1,122 @@
 /*******************************************************************************
- * 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.NSControl;
 
 import dwt.dwthelper.utils;
-import dwt.internal.cocoa.id;
-import dwt.internal.cocoa.NSAttributedString;
+import cocoa = dwt.internal.cocoa.id;
 import dwt.internal.cocoa.NSCell;
-import dwt.internal.cocoa.NSEvent;
 import dwt.internal.cocoa.NSFont;
 import dwt.internal.cocoa.NSFormatter;
-import dwt.internal.cocoa.NSInteger;
 import dwt.internal.cocoa.NSString;
 import dwt.internal.cocoa.NSText;
 import dwt.internal.cocoa.NSView;
 import dwt.internal.cocoa.OS;
-import obj = dwt.internal.objc.runtime;
-
-public class NSControl : NSView
-{
-
-    public this ()
-    {
-        super();
-    }
+import objc = dwt.internal.objc.runtime;
 
-    public this (objc.id id)
-    {
-        super(id);
-    }
-
-    public bool abortEditing ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_abortEditing) !is null;
-    }
+public class NSControl : NSView {
 
-    public String action ()
-    {
-        return fromStringz(cast(objc.SEL) OS.objc_msgSend(this.id_, OS.sel_action));
-    }
-
-    public objc.id alignment ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_alignment);
-    }
-
-    public NSAttributedString attributedStringValue ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_attributedStringValue);
-        return result !is null ? new NSAttributedString(result) : null;
-    }
-
-    public objc.id baseWritingDirection ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_baseWritingDirection);
-    }
+public this() {
+    super();
+}
 
-    public void calcSize ()
-    {
-        OS.objc_msgSend(this.id_, OS.sel_calcSize);
-    }
-
-    public objc.id cell ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_cell);
-        return result !is null ? result : null;
-    }
-
-    public static objc.Class cellClass ()
-    {
-        return cast(objc.Class) OS.objc_msgSend(OS.class_NSControl, OS.sel_cellClass);
-    }
+public this(objc.id id) {
+    super(id);
+}
 
-    public NSText currentEditor ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_currentEditor);
-        return result !is null ? new NSText(result) : null;
-    }
-
-    public double doubleValue ()
-    {
-        return OS.objc_msgSend_fpret(this.id_, OS.sel_doubleValue);
-    }
+public this(cocoa.id id) {
+    super(id);
+}
 
-    public void drawCell (NSCell aCell)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_drawCell_1, aCell !is null ? aCell.id_ : null);
-    }
-
-    public void drawCellInside (NSCell aCell)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_drawCellInside_1, aCell !is null ? aCell.id_ : null);
-    }
-
-    public float floatValue ()
-    {
-        return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_floatValue);
-    }
+public objc.SEL action() {
+    return cast(objc.SEL) OS.objc_msgSend(this.id, OS.sel_action);
+}
 
-    public NSFont font ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_font);
-        return result !is null ? new NSFont(result) : null;
-    }
-
-    public id formatter ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_formatter);
-        return result !is null ? new id(result) : null;
-    }
-
-    public bool ignoresMultiClick ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_ignoresMultiClick) !is null;
-    }
+public NSCell cell() {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_cell);
+    return result !is null ? new NSCell(result) : null;
+}
 
-    public int intValue ()
-    {
-        return cast(int) OS.objc_msgSend(this.id_, OS.sel_intValue);
-    }
-
-    public NSInteger integerValue ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_integerValue);
-    }
-
-    public bool isContinuous ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_isContinuous) !is null;
-    }
-
-    public bool isEnabled ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_isEnabled) !is null;
-    }
-
-    public void mouseDown (NSEvent theEvent)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_mouseDown_1, theEvent !is null ? theEvent.id_ : null);
-    }
+public static objc.Class cellClass() {
+    return cast(objc.Class) OS.objc_msgSend(OS.class_NSControl, OS.sel_cellClass);
+}
 
-    public id objectValue ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_objectValue);
-        return result !is null ? new id(result) : null;
-    }
+public NSText currentEditor() {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_currentEditor);
+    return result !is null ? new NSText(result) : null;
+}
 
-    public void performClick (id sender)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_performClick_1, sender !is null ? sender.id_ : null);
-    }
-
-    public bool refusesFirstResponder ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_refusesFirstResponder) !is null;
-    }
-
-    public void selectCell (NSCell aCell)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_selectCell_1, aCell !is null ? aCell.id_ : null);
-    }
+public double doubleValue() {
+    return OS.objc_msgSend_fpret(this.id, OS.sel_doubleValue);
+}
 
-    public id selectedCell ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_selectedCell);
-        return result !is null ? new id(result) : null;
-    }
-
-    public NSInteger selectedTag ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_selectedTag);
-    }
+public NSFont font() {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_font);
+    return result !is null ? new NSFont(result) : null;
+}
 
-    public bool sendAction (String theAction, id theTarget)
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_sendAction_1to_1, theAction.ptr, theTarget !is null ? theTarget.id_ : null) !is null;
-    }
-
-    public NSInteger sendActionOn (NSInteger mask)
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_sendActionOn_1, mask);
-    }
-
-    public void setAction (String aSelector)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setAction_1, aSelector.ptr);
-    }
+public bool sendAction(objc.SEL theAction, cocoa.id theTarget) {
+    return OS.objc_msgSend_bool(this.id, OS.sel_sendAction_to_, theAction, theTarget !is null ? theTarget.id : null);
+}
 
-    public void setAlignment (objc.id mode)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setAlignment_1, mode);
-    }
-
-    public void setAttributedStringValue (NSAttributedString obj)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setAttributedStringValue_1, obj !is null ? obj.id_ : null);
-    }
-
-    public void setBaseWritingDirection (objc.id writingDirection)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setBaseWritingDirection_1, writingDirection);
-    }
-
-    public void setCell (NSCell aCell)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setCell_1, aCell !is null ? aCell.id_ : null);
-    }
+public void setAction(objc.SEL aSelector) {
+    OS.objc_msgSend(this.id, OS.sel_setAction_, aSelector);
+}
 
-    public static void setCellClass (objc.Class factoryId)
-    {
-        OS.objc_msgSend(OS.class_NSControl, OS.sel_setCellClass_1, factoryId);
-    }
-
-    public void setContinuous (bool flag)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setContinuous_1, flag);
-    }
+public void setAlignment(NSTextAlignment mode) {
+    OS.objc_msgSend(this.id, OS.sel_setAlignment_, mode);
+}
 
-    public void setDoubleValue (double aDouble)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setDoubleValue_1, aDouble);
-    }
-
-    public void setEnabled (bool flag)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setEnabled_1, flag);
-    }
+public static void setCellClass(objc.Class factoryId) {
+    OS.objc_msgSend(OS.class_NSControl, OS.sel_setCellClass_, factoryId);
+}
 
-    public void setFloatValue (float aFloat)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setFloatValue_1, aFloat);
-    }
-
-    public void setFloatingPointFormat (bool autoRange, NSUInteger leftDigits, NSUInteger rightDigits)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setFloatingPointFormat_1left_1right_1, autoRange, leftDigits, rightDigits);
-    }
-
-    public void setFont (NSFont fontObj)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setFont_1, fontObj !is null ? fontObj.id_ : null);
-    }
-
-    public void setFormatter (NSFormatter newFormatter)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setFormatter_1, newFormatter !is null ? newFormatter.id_ : null);
-    }
+public void setDoubleValue(double aDouble) {
+    OS.objc_msgSend(this.id, OS.sel_setDoubleValue_, aDouble);
+}
 
-    public void setIgnoresMultiClick (bool flag)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setIgnoresMultiClick_1, flag);
-    }
-
-    public void setIntValue (int anInt)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setIntValue_1, anInt);
-    }
+public void setEnabled(bool flag) {
+    OS.objc_msgSend(this.id, OS.sel_setEnabled_, flag);
+}
 
-    public void setIntegerValue (NSInteger anInteger)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setIntegerValue_1, anInteger);
-    }
-
-    public void setNeedsDisplay ()
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setNeedsDisplay);
-    }
-
-    public void setObjectValue (id obj)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setObjectValue_1, obj !is null ? obj.id_ : null);
-    }
+public void setFont(NSFont fontObj) {
+    OS.objc_msgSend(this.id, OS.sel_setFont_, fontObj !is null ? fontObj.id : null);
+}
 
-    public void setRefusesFirstResponder (bool flag)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setRefusesFirstResponder_1, flag);
-    }
-
-    public void setStringValue (NSString aString)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setStringValue_1, aString !is null ? aString.id_ : null);
-    }
-
-    public void setTag (NSInteger anInt)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setTag_1, anInt);
-    }
-
-    public void setTarget (id anObject)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setTarget_1, anObject !is null ? anObject.id_ : null);
-    }
+public void setFormatter(NSFormatter newFormatter) {
+    OS.objc_msgSend(this.id, OS.sel_setFormatter_, newFormatter !is null ? newFormatter.id : null);
+}
 
-    public void sizeToFit ()
-    {
-        OS.objc_msgSend(this.id_, OS.sel_sizeToFit);
-    }
+public void setStringValue(NSString aString) {
+    OS.objc_msgSend(this.id, OS.sel_setStringValue_, aString !is null ? aString.id : null);
+}
 
-    public NSString stringValue ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringValue);
-        return result !is null ? new NSString(result) : null;
-    }
-
-    public NSInteger tag ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_tag);
-    }
-
-    public void takeDoubleValueFrom (id sender)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_takeDoubleValueFrom_1, sender !is null ? sender.id_ : null);
-    }
+public void setTarget(cocoa.id anObject) {
+    OS.objc_msgSend(this.id, OS.sel_setTarget_, anObject !is null ? anObject.id : null);
+}
 
-    public void takeFloatValueFrom (id sender)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_takeFloatValueFrom_1, sender !is null ? sender.id_ : null);
-    }
-
-    public void takeIntValueFrom (id sender)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_takeIntValueFrom_1, sender !is null ? sender.id_ : null);
-    }
-
-    public void takeIntegerValueFrom (id sender)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_takeIntegerValueFrom_1, sender !is null ? sender.id_ : null);
-    }
-
-    public void takeObjectValueFrom (id sender)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_takeObjectValueFrom_1, sender !is null ? sender.id_ : null);
-    }
+public void sizeToFit() {
+    OS.objc_msgSend(this.id, OS.sel_sizeToFit);
+}
 
-    public void takeStringValueFrom (id sender)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_takeStringValueFrom_1, sender !is null ? sender.id_ : 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 stringValue() {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_stringValue);
+    return result !is null ? new NSString(result) : null;
+}
 
-    public void updateCell (NSCell aCell)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_updateCell_1, aCell !is null ? aCell.id_ : null);
-    }
-
-    public void updateCellInside (NSCell aCell)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_updateCellInside_1, aCell !is null ? aCell.id_ : null);
-    }
-
-    public void validateEditing ()
-    {
-        OS.objc_msgSend(this.id_, OS.sel_validateEditing);
-    }
+public cocoa.id target() {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_target);
+    return result !is null ? new id(result) : null;
+}
 
 }