Mercurial > projects > dwt-mac
diff dwt/widgets/List.d @ 90:c7f7f4d7091a
All widgets are ported
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 30 Dec 2008 18:54:31 +0100 |
parents | 8e3c85e1733d |
children | 63a09873578e |
line wrap: on
line diff
--- a/dwt/widgets/List.d Tue Dec 30 17:01:10 2008 +0100 +++ b/dwt/widgets/List.d Tue Dec 30 18:54:31 2008 +0100 @@ -44,7 +44,7 @@ import dwt.internal.cocoa.SWTTableView; import cocoa = dwt.internal.cocoa.id; -import dwt.internal.c.Carbon; +import Carbon = dwt.internal.c.Carbon; import dwt.internal.objc.cocoa.Cocoa; import objc = dwt.internal.objc.runtime; import dwt.widgets.Composite; @@ -542,7 +542,7 @@ NSIndexSet selection = widget.selectedRowIndexes(); NSUInteger count = selection.count(); NSUInteger [] indexBuffer = new NSUInteger [count]; - selection.getIndexes(indexBuffer.ptr, count, 0); + selection.getIndexes(indexBuffer.ptr, count, null); String [] result = new String [count]; for (NSUInteger i=0; i<count; i++) { result [i] = items [indexBuffer [i]]; @@ -584,9 +584,9 @@ } NSIndexSet selection = widget.selectedRowIndexes(); NSUInteger count = selection.count(); - NSUInteger [] result = NSUInteger [count]; - selection.getIndexes(result.ptr, count, 0); - return cast(int) NSUInteger [0]; + NSUInteger [] result = new NSUInteger [count]; + selection.getIndexes(result.ptr, count, null); + return cast(int) result [0]; } /** @@ -614,7 +614,7 @@ NSIndexSet selection = widget.selectedRowIndexes(); NSUInteger count = selection.count(); NSUInteger [] indices = new NSUInteger [count]; - selection.getIndexes(indices, count, 0); + selection.getIndexes(indices.ptr, count, null); NSUInteger [] result = new NSUInteger [count]; for (NSUInteger i = 0; i < result.length; i++) { result [i] = indices [i]; @@ -1045,7 +1045,7 @@ return result; } -void setBackground (CGFloat [] color) { +void setBackground (Carbon.CGFloat [] color) { super.setBackground (color); NSColor nsColor; if (color is null) { @@ -1058,8 +1058,8 @@ void setFont (NSFont font) { super.setFont (font); - CGFloat ascent = font.ascender (); - CGFloat descent = -font.descender () + font.leading (); + Carbon.CGFloat ascent = font.ascender (); + Carbon.CGFloat descent = -font.descender () + font.leading (); (cast(NSTableView)view).setRowHeight (cast(int)Math.ceil (ascent + descent) + 1); } @@ -1204,12 +1204,12 @@ checkWidget (); if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); deselectAll (); - int length = indices.length; - if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return; - int [] ids = new int [length]; + int length_ = indices.length; + if (length_ is 0 || ((style & DWT.SINGLE) !is 0 && length_ > 1)) return; + int [] ids = new int [length_]; int count = 0; - for (int i=0; i<length; i++) { - int index = indices [length - i - 1]; + for (int i=0; i<length_; i++) { + int index = indices [length_ - i - 1]; if (index >= 0 && index < itemCount) { ids [count++] = index + 1; } @@ -1246,12 +1246,12 @@ checkWidget (); if (items is null) error (DWT.ERROR_NULL_ARGUMENT); deselectAll (); - int length = items.length; - if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return; + int length_ = items.length; + if (length_ is 0 || ((style & DWT.SINGLE) !is 0 && length_ > 1)) return; int count = 0; - int [] ids = new int [length]; - for (int i=0; i<length; i++) { - String string = items [length - i - 1]; + int [] ids = new int [length_]; + for (int i=0; i<length_; i++) { + String string = items [length_ - i - 1]; if ((style & DWT.SINGLE) !is 0) { int index = indexOf (string, 0); if (index !is -1) { @@ -1338,9 +1338,9 @@ String text = items[cast(size_t)rowIndex]; int length_ = text.length(); char[] chars = new char[length_]; - text.getChars(0, length, chars, 0); - NSString str = NSString.stringWithCharacters(chars, length); - NSAttributedString attribStr = (cast(NSAttributedString)(new NSAttributedString()).alloc()).initWithString_(str, dict); + text.getChars(0, length_, chars, 0); + NSString str = NSString.stringWithCharacters(chars.toString16().ptr, length_); + NSAttributedString attribStr = (cast(NSAttributedString)(new NSAttributedString()).alloc()).initWithString(str, dict); return attribStr.id; }