changeset 79:0dc55b17c290

Ported dwt.widgets.TabItem
author Jacob Carlborg <doob@me.com>
date Wed, 24 Dec 2008 13:18:04 +0100
parents d226cd03f84a
children b24476d6dedf
files dwt/dwthelper/utils.d dwt/widgets/TabItem.d
diffstat 2 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/dwthelper/utils.d	Wed Dec 24 13:12:21 2008 +0100
+++ b/dwt/dwthelper/utils.d	Wed Dec 24 13:18:04 2008 +0100
@@ -413,8 +413,8 @@
     return res.length;
 }
 
-public alias tango.text.convert.Utf.toString16 toString16;
-public alias tango.text.convert.Utf.toString toString;
+alias tango.text.convert.Utf.toString16 toString16;
+alias tango.text.convert.Utf.toString toString;
 
 int getRelativeCodePointOffset( String str, int startIndex, int searchRelCp ){
     int ignore;
--- a/dwt/widgets/TabItem.d	Wed Dec 24 13:12:21 2008 +0100
+++ b/dwt/widgets/TabItem.d	Wed Dec 24 13:18:04 2008 +0100
@@ -7,6 +7,9 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     
+ * Port to the D programming language:
+ *     Jacob Carlborg <doob@me.com>
  *******************************************************************************/
 module dwt.widgets.TabItem;
 
@@ -27,6 +30,10 @@
 import dwt.internal.cocoa.NSWindow;
 import dwt.internal.cocoa.OS;
 
+import dwt.widgets.Control;
+import dwt.widgets.Item;
+import dwt.widgets.TabFolder;
+
 /**
  * Instances of this class represent a selectable user interface object
  * corresponding to a tab for a page in a tab folder.
@@ -149,8 +156,8 @@
     checkWidget();
     Rectangle result = new Rectangle (0, 0, 0, 0);
     if (nsItem.respondsToSelector (OS.sel_accessibilityAttributeValue_)) {
-        int /*long*/ posValue = OS.objc_msgSend (nsItem.id, OS.sel_accessibilityAttributeValue_, OS.NSAccessibilityPositionAttribute ());
-        int /*long*/ sizeValue = OS.objc_msgSend (nsItem.id, OS.sel_accessibilityAttributeValue_, OS.NSAccessibilitySizeAttribute ());      
+        objc.id posValue = OS.objc_msgSend (nsItem.id, OS.sel_accessibilityAttributeValue_, OS.NSAccessibilityPositionAttribute_);
+        objc.id sizeValue = OS.objc_msgSend (nsItem.id, OS.sel_accessibilityAttributeValue_, OS.NSAccessibilitySizeAttribute_);      
         NSValue val = new NSValue (posValue);
         NSPoint pt = val.pointValue ();
         NSWindow window = parent.view.window ();
@@ -274,7 +281,7 @@
     if (newControl !is null) {
         view = newControl.topView();
     } else {
-        view = (NSView)new NSView().alloc();
+        view = cast(NSView)(new NSView()).alloc();
         view.initWithFrame (NSRect());
         view.autorelease();
     }
@@ -323,7 +330,7 @@
     char [] chars = new char [string.length ()];
     string.getChars (0, chars.length, chars, 0);
     int length = fixMnemonic (chars);
-    NSString str = NSString.stringWithCharacters (chars, length);
+    NSString str = NSString.stringWithCharacters (chars.toString16().ptr, length);
     nsItem.setLabel (str);
 }