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

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSComboBox.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSComboBox.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,219 +1,90 @@
 /*******************************************************************************
- * 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.NSComboBox;
 
-import dwt.internal.cocoa.CGFloat;
-import dwt.internal.cocoa.id;
-import dwt.internal.cocoa.NSArray;
-import dwt.internal.cocoa.NSInteger;
-import dwt.internal.cocoa.NSSize;
+import dwt.dwthelper.utils;
+import cocoa = dwt.internal.cocoa.id;
 import dwt.internal.cocoa.NSTextField;
 import dwt.internal.cocoa.OS;
+import dwt.internal.objc.cocoa.Cocoa;
 import objc = dwt.internal.objc.runtime;
 
-public class NSComboBox : NSTextField
-{
-
-    public this ()
-    {
-        super();
-    }
+public class NSComboBox : NSTextField {
 
-    public this (objc.id id)
-    {
-        super(id);
-    }
-
-    public void addItemWithObjectValue (id object)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_addItemWithObjectValue_1, object !is null ? object.id_ : null);
-    }
+public this() {
+    super();
+}
 
-    public void addItemsWithObjectValues (NSArray objects)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_addItemsWithObjectValues_1, objects !is null ? objects.id_ : null);
-    }
-
-    public bool completes ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_completes) !is null;
-    }
+public this(objc.id id) {
+    super(id);
+}
 
-    public id dataSource ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_dataSource);
-        return result !is null ? new id(result) : null;
-    }
-
-    public void deselectItemAtIndex (NSInteger index)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_deselectItemAtIndex_1, index);
-    }
-
-    public bool hasVerticalScroller ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_hasVerticalScroller) !is null;
-    }
+public this(cocoa.id id) {
+    super(id);
+}
 
-    public NSInteger indexOfItemWithObjectValue (id object)
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItemWithObjectValue_1, object !is null ? object.id_ : null);
-    }
-
-    public NSInteger indexOfSelectedItem ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfSelectedItem);
-    }
+public void addItemWithObjectValue(cocoa.id object) {
+    OS.objc_msgSend(this.id, OS.sel_addItemWithObjectValue_, object !is null ? object.id : null);
+}
 
-    public void insertItemWithObjectValue (id object, NSInteger index)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_insertItemWithObjectValue_1atIndex_1, object !is null ? object.id_ : null, index);
-    }
-
-    public NSSize intercellSpacing ()
-    {
-        NSSize result;
-        OS.objc_msgSend_stret(&result, this.id_, OS.sel_intercellSpacing);
-        return result;
-    }
+public void deselectItemAtIndex(NSInteger index) {
+    OS.objc_msgSend(this.id, OS.sel_deselectItemAtIndex_, index);
+}
 
-    public bool isButtonBordered ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_isButtonBordered) !is null;
-    }
-
-    public CGFloat itemHeight ()
-    {
-        return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_itemHeight);
-    }
+public NSInteger indexOfSelectedItem() {
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfSelectedItem);
+}
 
-    public objc.id itemObjectValueAtIndex (NSInteger index)
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemObjectValueAtIndex_1, index);
-        return result !is null ? result : null;
-    }
-
-    public void noteNumberOfItemsChanged ()
-    {
-        OS.objc_msgSend(this.id_, OS.sel_noteNumberOfItemsChanged);
-    }
-
-    public NSInteger numberOfItems ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfItems);
-    }
-
-    public NSInteger numberOfVisibleItems ()
-    {
-        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfVisibleItems);
-    }
+public void insertItemWithObjectValue(cocoa.id object, NSInteger index) {
+    OS.objc_msgSend(this.id, OS.sel_insertItemWithObjectValue_atIndex_, object !is null ? object.id : null, index);
+}
 
-    public id objectValueOfSelectedItem ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_objectValueOfSelectedItem);
-        return result !is null ? new id(result) : null;
-    }
-
-    public NSArray objectValues ()
-    {
-        objc.id result = OS.objc_msgSend(this.id_, OS.sel_objectValues);
-        return result !is null ? new NSArray(result) : null;
-    }
-
-    public void reloadData ()
-    {
-        OS.objc_msgSend(this.id_, OS.sel_reloadData);
-    }
-
-    public void removeAllItems ()
-    {
-        OS.objc_msgSend(this.id_, OS.sel_removeAllItems);
-    }
+public cocoa.id itemObjectValueAtIndex(NSInteger index) {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_itemObjectValueAtIndex_, index);
+    return result !is null ? new cocoa.id(result) : null;
+}
 
-    public void removeItemAtIndex (NSInteger index)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_removeItemAtIndex_1, index);
-    }
-
-    public void removeItemWithObjectValue (id object)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_removeItemWithObjectValue_1, object !is null ? object.id_ : null);
-    }
+public NSInteger numberOfItems() {
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfItems);
+}
 
-    public void scrollItemAtIndexToTop (NSInteger index)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_scrollItemAtIndexToTop_1, index);
-    }
+public NSInteger numberOfVisibleItems() {
+    return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfVisibleItems);
+}
 
-    public void scrollItemAtIndexToVisible (NSInteger index)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_scrollItemAtIndexToVisible_1, index);
-    }
-
-    public void selectItemAtIndex (NSInteger index)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_selectItemAtIndex_1, index);
-    }
+public void removeAllItems() {
+    OS.objc_msgSend(this.id, OS.sel_removeAllItems);
+}
 
-    public void selectItemWithObjectValue (id object)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_selectItemWithObjectValue_1, object !is null ? object.id_ : null);
-    }
-
-    public void setButtonBordered (bool flag)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setButtonBordered_1, flag);
-    }
+public void removeItemAtIndex(NSInteger index) {
+    OS.objc_msgSend(this.id, OS.sel_removeItemAtIndex_, index);
+}
 
-    public void setCompletes (bool completes)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setCompletes_1, completes);
-    }
-
-    public void setDataSource (id aSource)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setDataSource_1, aSource !is null ? aSource.id_ : null);
-    }
-
-    public void setHasVerticalScroller (bool flag)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setHasVerticalScroller_1, flag);
-    }
+public void selectItemAtIndex(NSInteger index) {
+    OS.objc_msgSend(this.id, OS.sel_selectItemAtIndex_, index);
+}
 
-    public void setIntercellSpacing (NSSize aSize)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setIntercellSpacing_1, aSize);
-    }
-
-    public void setItemHeight (CGFloat itemHeight)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setItemHeight_1, itemHeight);
-    }
+public void setNumberOfVisibleItems(NSInteger visibleItems) {
+    OS.objc_msgSend(this.id, OS.sel_setNumberOfVisibleItems_, visibleItems);
+}
 
-    public void setNumberOfVisibleItems (NSInteger visibleItems)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setNumberOfVisibleItems_1, visibleItems);
-    }
+public static objc.Class cellClass() {
+    return cast(objc.Class) OS.objc_msgSend(OS.class_NSComboBox, OS.sel_cellClass);
+}
 
-    public void setUsesDataSource (bool flag)
-    {
-        OS.objc_msgSend(this.id_, OS.sel_setUsesDataSource_1, flag);
-    }
-
-    public bool usesDataSource ()
-    {
-        return OS.objc_msgSend(this.id_, OS.sel_usesDataSource) !is null;
-    }
+public static void setCellClass(objc.Class factoryId) {
+    OS.objc_msgSend(OS.class_NSComboBox, OS.sel_setCellClass_, factoryId);
+}
 
 }