comparison dwt/widgets/List.d @ 46:cfa563df4fdd

Updated Widget and Display to 3.514
author Jacob Carlborg <doob@me.com>
date Fri, 05 Dec 2008 16:00:41 +0100
parents d8635bb48c7c
children 3607217555f2
comparison
equal deleted inserted replaced
45:d8635bb48c7c 46:cfa563df4fdd
266 if ((style & DWT.V_SCROLL) !is 0) scrollWidget.setHasVerticalScroller(true); 266 if ((style & DWT.V_SCROLL) !is 0) scrollWidget.setHasVerticalScroller(true);
267 scrollWidget.setAutohidesScrollers(true); 267 scrollWidget.setAutohidesScrollers(true);
268 scrollWidget.setBorderType((style & DWT.BORDER) !is 0 ? OS.NSBezelBorder : OS.NSNoBorder); 268 scrollWidget.setBorderType((style & DWT.BORDER) !is 0 ? OS.NSBezelBorder : OS.NSNoBorder);
269 269
270 NSTableView widget = cast(NSTableView)new SWTTableView().alloc(); 270 NSTableView widget = cast(NSTableView)new SWTTableView().alloc();
271 widget.initWithFrame(new NSRect()); 271 widget.initWithFrame(NSRect());
272 widget.setAllowsMultipleSelection((style & DWT.MULTI) !is 0); 272 widget.setAllowsMultipleSelection((style & DWT.MULTI) !is 0);
273 widget.setDataSource(widget); 273 widget.setDataSource(widget);
274 widget.setHeaderView(null); 274 widget.setHeaderView(null);
275 widget.setDelegate(widget); 275 widget.setDelegate(widget);
276 widget.setDoubleAction(OS.sel_sendDoubleSelection); 276 widget.setDoubleAction(OS.sel_sendDoubleSelection);
626 */ 626 */
627 public int getTopIndex () { 627 public int getTopIndex () {
628 checkWidget(); 628 checkWidget();
629 //TODO - partial item at the top 629 //TODO - partial item at the top
630 NSRect rect = scrollView.documentVisibleRect(); 630 NSRect rect = scrollView.documentVisibleRect();
631 NSPoint point = new NSPoint(); 631 NSPoint point = NSPoint();
632 point.x = rect.x; 632 point.x = rect.x;
633 point.y = rect.y; 633 point.y = rect.y;
634 int result = (int)/*64*/(cast(NSTableView)view).rowAtPoint(point); 634 int result = (int)/*64*/(cast(NSTableView)view).rowAtPoint(point);
635 if (result is -1) result = 0; 635 if (result is -1) result = 0;
636 return result; 636 return result;
931 } else { 931 } else {
932 start = Math.max (0, start); 932 start = Math.max (0, start);
933 end = Math.min (end, itemCount - 1); 933 end = Math.min (end, itemCount - 1);
934 int length = end - start + 1; 934 int length = end - start + 1;
935 NSIndexSet indexes = cast(NSIndexSet)new NSIndexSet().alloc(); 935 NSIndexSet indexes = cast(NSIndexSet)new NSIndexSet().alloc();
936 NSRange range = new NSRange(); 936 NSRange range = NSRange();
937 range.location = start; 937 range.location = start;
938 range.length = length; 938 range.length = length;
939 indexes.initWithIndexesInRange(range); 939 indexes.initWithIndexesInRange(range);
940 NSTableView widget = cast(NSTableView)view; 940 NSTableView widget = cast(NSTableView)view;
941 ignoreSelect = true; 941 ignoreSelect = true;