Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSTableView.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2007 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 * * Port to the D Programming language: * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.internal.cocoa.NSTableView; import dwt.internal.cocoa.CGFloat; import dwt.internal.cocoa.id; import dwt.internal.cocoa.NSArray; import dwt.internal.cocoa.NSCell; import dwt.internal.cocoa.NSColor; import dwt.internal.cocoa.NSControl; import dwt.internal.cocoa.NSDragOperation; import dwt.internal.cocoa.NSEnumerator; import dwt.internal.cocoa.NSEvent; import dwt.internal.cocoa.NSImage; import dwt.internal.cocoa.NSIndexSet; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSNotification; import dwt.internal.cocoa.NSPoint; import dwt.internal.cocoa.NSRange; import dwt.internal.cocoa.NSRect; import dwt.internal.cocoa.NSSize; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.NSTableColumn; import dwt.internal.cocoa.NSTableHeaderView; import dwt.internal.cocoa.NSText; import dwt.internal.cocoa.NSView; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; enum NSTableViewColumnAutoresizingStyle : NSUInteger { NSTableViewNoColumnAutoresizing = 0, NSTableViewUniformColumnAutoresizingStyle, NSTableViewSequentialColumnAutoresizingStyle, NSTableViewReverseSequentialColumnAutoresizingStyle, NSTableViewLastColumnOnlyAutoresizingStyle, NSTableViewFirstColumnOnlyAutoresizingStyle } alias NSTableViewColumnAutoresizingStyle.NSTableViewNoColumnAutoresizing NSTableViewNoColumnAutoresizing; alias NSTableViewColumnAutoresizingStyle.NSTableViewUniformColumnAutoresizingStyle NSTableViewUniformColumnAutoresizingStyle; alias NSTableViewColumnAutoresizingStyle.NSTableViewSequentialColumnAutoresizingStyle NSTableViewSequentialColumnAutoresizingStyle; alias NSTableViewColumnAutoresizingStyle.NSTableViewReverseSequentialColumnAutoresizingStyle NSTableViewReverseSequentialColumnAutoresizingStyle; alias NSTableViewColumnAutoresizingStyle.NSTableViewLastColumnOnlyAutoresizingStyle NSTableViewLastColumnOnlyAutoresizingStyle; alias NSTableViewColumnAutoresizingStyle.NSTableViewFirstColumnOnlyAutoresizingStyle NSTableViewFirstColumnOnlyAutoresizingStyle; enum NSTableViewSelectionHighlightStyle : NSInteger { NSTableViewSelectionHighlightStyleRegular = 0, NSTableViewSelectionHighlightStyleSourceList = 1, } alias NSTableViewSelectionHighlightStyle.NSTableViewSelectionHighlightStyleRegular NSTableViewSelectionHighlightStyleRegular; alias NSTableViewSelectionHighlightStyle.NSTableViewSelectionHighlightStyleSourceList NSTableViewSelectionHighlightStyleSourceList; enum NSTableViewDropOperation : NSUInteger { NSTableViewDropOn, NSTableViewDropAbove } alias NSTableViewDropOperation.NSTableViewDropOn NSTableViewDropOn; alias NSTableViewDropOperation.NSTableViewDropAbove NSTableViewDropAbove; public class NSTableView : NSControl { public this () { super(); } public this (objc.id id) { super(id); } public void addTableColumn (NSTableColumn column) { OS.objc_msgSend(this.id, OS.sel_addTableColumn_1, column !is null ? column.id : null); } public bool allowsColumnReordering () { return OS.objc_msgSend(this.id, OS.sel_allowsColumnReordering) !is null; } public bool allowsColumnResizing () { return OS.objc_msgSend(this.id, OS.sel_allowsColumnResizing) !is null; } public bool allowsColumnSelection () { return OS.objc_msgSend(this.id, OS.sel_allowsColumnSelection) !is null; } public bool allowsEmptySelection () { return OS.objc_msgSend(this.id, OS.sel_allowsEmptySelection) !is null; } public bool allowsMultipleSelection () { return OS.objc_msgSend(this.id, OS.sel_allowsMultipleSelection) !is null; } public bool allowsTypeSelect () { return OS.objc_msgSend(this.id, OS.sel_allowsTypeSelect) !is null; } public bool autoresizesAllColumnsToFit () { return OS.objc_msgSend(this.id, OS.sel_autoresizesAllColumnsToFit) !is null; } public NSString autosaveName () { objc.id result = OS.objc_msgSend(this.id, OS.sel_autosaveName); return result !is null ? new NSString(result) : null; } public bool autosaveTableColumns () { return OS.objc_msgSend(this.id, OS.sel_autosaveTableColumns) !is null; } public NSColor backgroundColor () { objc.id result = OS.objc_msgSend(this.id, OS.sel_backgroundColor); return result !is null ? new NSColor(result) : null; } public bool canDragRowsWithIndexes (NSIndexSet rowIndexes, NSPoint mouseDownPoint) { return OS.objc_msgSend(this.id, OS.sel_canDragRowsWithIndexes_1atPoint_1, rowIndexes !is null ? rowIndexes.id : null, mouseDownPoint) !is null; } public NSInteger clickedColumn () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_clickedColumn); } public NSInteger clickedRow () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_clickedRow); } public NSTableViewColumnAutoresizingStyle columnAtPoint (NSPoint point) { return cast(NSTableViewColumnAutoresizingStyle) OS.objc_msgSend(this.id, OS.sel_columnAtPoint_1, point); } public NSInteger columnAutoresizingStyle () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_columnAutoresizingStyle); } public NSIndexSet columnIndexesInRect (NSRect rect) { objc.id result = OS.objc_msgSend(this.id, OS.sel_columnIndexesInRect_1, rect); return result !is null ? new NSIndexSet(result) : null; } public NSInteger columnWithIdentifier (id identifier) { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_columnWithIdentifier_1, identifier !is null ? identifier.id : null); } public NSRange columnsInRect (NSRect rect) { NSRange result; OS.objc_msgSend_stret(result, this.id, OS.sel_columnsInRect_1, rect); return result; } public NSView cornerView () { objc.id result = OS.objc_msgSend(this.id, OS.sel_cornerView); return result !is null ? new NSView(result) : null; } public id dataSource () { objc.id result = OS.objc_msgSend(this.id, OS.sel_dataSource); return result !is null ? new id(result) : null; } public id delegatee () { objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); return result !is null ? new id(result) : null; } public void deselectAll (id sender) { OS.objc_msgSend(this.id, OS.sel_deselectAll_1, sender !is null ? sender.id : null); } public void deselectColumn (NSInteger column) { OS.objc_msgSend(this.id, OS.sel_deselectColumn_1, column); } public void deselectRow (NSInteger row) { OS.objc_msgSend(this.id, OS.sel_deselectRow_1, row); } public objc.SEL doubleAction () { return cast(objc.SEL) OS.objc_msgSend(this.id, OS.sel_doubleAction); } public NSImage dragImageForRows (NSArray dragRows, NSEvent dragEvent, NSPointPointer dragImageOffset) { objc.id result = OS.objc_msgSend(this.id, OS.sel_dragImageForRows_1event_1dragImageOffset_1, dragRows !is null ? dragRows.id : null, dragEvent !is null ? dragEvent.id : null, dragImageOffset); return result !is null ? new NSImage(result) : null; } public NSImage dragImageForRowsWithIndexes (NSIndexSet dragRows, NSArray tableColumns, NSEvent dragEvent, NSPointPointer dragImageOffset) { objc.id result = OS.objc_msgSend(this.id, OS.sel_dragImageForRowsWithIndexes_1tableColumns_1event_1offset_1, dragRows !is null ? dragRows.id : null, tableColumns !is null ? tableColumns.id : null, dragEvent !is null ? dragEvent.id : null, dragImageOffset); return result !is null ? new NSImage(result) : null; } public void drawBackgroundInClipRect (NSRect clipRect) { OS.objc_msgSend(this.id, OS.sel_drawBackgroundInClipRect_1, clipRect); } public void drawGridInClipRect (NSRect clipRect) { OS.objc_msgSend(this.id, OS.sel_drawGridInClipRect_1, clipRect); } public void drawRow (NSInteger row, NSRect clipRect) { OS.objc_msgSend(this.id, OS.sel_drawRow_1clipRect_1, row, clipRect); } public bool drawsGrid () { return OS.objc_msgSend(this.id, OS.sel_drawsGrid) !is null; } public void editColumn (NSInteger column, NSInteger row, NSEvent theEvent, bool select) { OS.objc_msgSend(this.id, OS.sel_editColumn_1row_1withEvent_1select_1, column, row, theEvent !is null ? theEvent.id : null, select); } public NSInteger editedColumn () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_editedColumn); } public NSInteger editedRow () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_editedRow); } public NSRect frameOfCellAtColumn (NSInteger column, NSInteger row) { NSRect result; OS.objc_msgSend_stret(result, this.id, OS.sel_frameOfCellAtColumn_1row_1, column, row); return result; } public NSColor gridColor () { objc.id result = OS.objc_msgSend(this.id, OS.sel_gridColor); return result !is null ? new NSColor(result) : null; } public NSUInteger gridStyleMask () { return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_gridStyleMask); } public NSTableHeaderView headerView () { objc.id result = OS.objc_msgSend(this.id, OS.sel_headerView); return result !is null ? new NSTableHeaderView(result) : null; } public void highlightSelectionInClipRect (NSRect clipRect) { OS.objc_msgSend(this.id, OS.sel_highlightSelectionInClipRect_1, clipRect); } public NSTableColumn highlightedTableColumn () { objc.id result = OS.objc_msgSend(this.id, OS.sel_highlightedTableColumn); return result !is null ? new NSTableColumn(result) : null; } public NSImage indicatorImageInTableColumn (NSTableColumn tc) { objc.id result = OS.objc_msgSend(this.id, OS.sel_indicatorImageInTableColumn_1, tc !is null ? tc.id : null); return result !is null ? new NSImage(result) : null; } public NSSize intercellSpacing () { NSSize result; OS.objc_msgSend_stret(result, this.id, OS.sel_intercellSpacing); return result; } public bool isColumnSelected (NSInteger column) { return OS.objc_msgSend(this.id, OS.sel_isColumnSelected_1, column) !is null; } public bool isRowSelected (NSInteger row) { return OS.objc_msgSend(this.id, OS.sel_isRowSelected_1, row) !is null; } public void moveColumn (NSInteger column, NSInteger newIndex) { OS.objc_msgSend(this.id, OS.sel_moveColumn_1toColumn_1, column, newIndex); } public void noteHeightOfRowsWithIndexesChanged (NSIndexSet indexSet) { OS.objc_msgSend(this.id, OS.sel_noteHeightOfRowsWithIndexesChanged_1, indexSet !is null ? indexSet.id : null); } public void noteNumberOfRowsChanged () { OS.objc_msgSend(this.id, OS.sel_noteNumberOfRowsChanged); } public NSInteger numberOfColumns () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfColumns); } public NSInteger numberOfRows () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfRows); } public NSInteger numberOfSelectedColumns () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfSelectedColumns); } public NSInteger numberOfSelectedRows () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfSelectedRows); } public NSCell preparedCellAtColumn (NSInteger column, NSInteger row) { objc.id result = OS.objc_msgSend(this.id, OS.sel_preparedCellAtColumn_1row_1, column, row); return result !is null ? new NSCell(result) : null; } public NSRect rectOfColumn (NSInteger column) { NSRect result; OS.objc_msgSend_stret(result, this.id, OS.sel_rectOfColumn_1, column); return result; } public NSRect rectOfRow (NSInteger row) { NSRect result; OS.objc_msgSend_stret(result, this.id, OS.sel_rectOfRow_1, row); return result; } public void reloadData () { OS.objc_msgSend(this.id, OS.sel_reloadData); } public void removeTableColumn (NSTableColumn column) { OS.objc_msgSend(this.id, OS.sel_removeTableColumn_1, column !is null ? column.id : null); } public NSInteger rowAtPoint (NSPoint point) { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_rowAtPoint_1, point); } public CGFloat rowHeight () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_rowHeight); } public NSRange rowsInRect (NSRect rect) { NSRange result; OS.objc_msgSend_stret(result, this.id, OS.sel_rowsInRect_1, rect); return result; } public void scrollColumnToVisible (NSInteger column) { OS.objc_msgSend(this.id, OS.sel_scrollColumnToVisible_1, column); } public void scrollRowToVisible (NSInteger row) { OS.objc_msgSend(this.id, OS.sel_scrollRowToVisible_1, row); } public void selectAll (id sender) { OS.objc_msgSend(this.id, OS.sel_selectAll_1, sender !is null ? sender.id : null); } public void selectColumn (NSInteger column, bool extend) { OS.objc_msgSend(this.id, OS.sel_selectColumn_1byExtendingSelection_1, column, extend); } public void selectColumnIndexes (NSIndexSet indexes, bool extend) { OS.objc_msgSend(this.id, OS.sel_selectColumnIndexes_1byExtendingSelection_1, indexes !is null ? indexes.id : null, extend); } public void selectRow (NSInteger row, bool extend) { OS.objc_msgSend(this.id, OS.sel_selectRow_1byExtendingSelection_1, row, extend); } public void selectRowIndexes (NSIndexSet indexes, bool extend) { OS.objc_msgSend(this.id, OS.sel_selectRowIndexes_1byExtendingSelection_1, indexes !is null ? indexes.id : null, extend); } public NSInteger selectedColumn () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_selectedColumn); } public NSEnumerator selectedColumnEnumerator () { objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedColumnEnumerator); return result !is null ? new NSEnumerator(result) : null; } public NSIndexSet selectedColumnIndexes () { objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedColumnIndexes); return result !is null ? new NSIndexSet(result) : null; } public NSInteger selectedRow () { return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_selectedRow); } public NSEnumerator selectedRowEnumerator () { objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedRowEnumerator); return result !is null ? new NSEnumerator(result) : null; } public NSIndexSet selectedRowIndexes () { objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedRowIndexes); return result !is null ? new NSIndexSet(result) : null; } public NSTableViewSelectionHighlightStyle selectionHighlightStyle () { return cast(NSTableViewSelectionHighlightStyle) OS.objc_msgSend(this.id, OS.sel_selectionHighlightStyle); } public void setAllowsColumnReordering (bool flag) { OS.objc_msgSend(this.id, OS.sel_setAllowsColumnReordering_1, flag); } public void setAllowsColumnResizing (bool flag) { OS.objc_msgSend(this.id, OS.sel_setAllowsColumnResizing_1, flag); } public void setAllowsColumnSelection (bool flag) { OS.objc_msgSend(this.id, OS.sel_setAllowsColumnSelection_1, flag); } public void setAllowsEmptySelection (bool flag) { OS.objc_msgSend(this.id, OS.sel_setAllowsEmptySelection_1, flag); } public void setAllowsMultipleSelection (bool flag) { OS.objc_msgSend(this.id, OS.sel_setAllowsMultipleSelection_1, flag); } public void setAllowsTypeSelect (bool value) { OS.objc_msgSend(this.id, OS.sel_setAllowsTypeSelect_1, value); } public void setAutoresizesAllColumnsToFit (bool flag) { OS.objc_msgSend(this.id, OS.sel_setAutoresizesAllColumnsToFit_1, flag); } public void setAutosaveName (NSString name) { OS.objc_msgSend(this.id, OS.sel_setAutosaveName_1, name !is null ? name.id : null); } public void setAutosaveTableColumns (bool save) { OS.objc_msgSend(this.id, OS.sel_setAutosaveTableColumns_1, save); } public void setBackgroundColor (NSColor color) { OS.objc_msgSend(this.id, OS.sel_setBackgroundColor_1, color !is null ? color.id : null); } public void setColumnAutoresizingStyle (NSTableViewColumnAutoresizingStyle style) { OS.objc_msgSend(this.id, OS.sel_setColumnAutoresizingStyle_1, style); } public void setCornerView (NSView cornerView) { OS.objc_msgSend(this.id, OS.sel_setCornerView_1, cornerView !is null ? cornerView.id : null); } public void setDataSource (id aSource) { OS.objc_msgSend(this.id, OS.sel_setDataSource_1, aSource !is null ? aSource.id : null); } public void setDelegate (id delegatee) { OS.objc_msgSend(this.id, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id : null); } public void setDoubleAction (objc.SEL aSelector) { OS.objc_msgSend(this.id, OS.sel_setDoubleAction_1, aSelector); } public void setDraggingSourceOperationMask (NSDragOperation mask, bool isLocal) { OS.objc_msgSend(this.id, OS.sel_setDraggingSourceOperationMask_1forLocal_1, mask, isLocal); } public void setDrawsGrid (bool flag) { OS.objc_msgSend(this.id, OS.sel_setDrawsGrid_1, flag); } public void setDropRow (NSInteger row, NSTableViewDropOperation op) { OS.objc_msgSend(this.id, OS.sel_setDropRow_1dropOperation_1, row, op); } public void setGridColor (NSColor color) { OS.objc_msgSend(this.id, OS.sel_setGridColor_1, color !is null ? color.id : null); } public void setGridStyleMask (NSUInteger gridType) { OS.objc_msgSend(this.id, OS.sel_setGridStyleMask_1, gridType); } public void setHeaderView (NSTableHeaderView headerView) { OS.objc_msgSend(this.id, OS.sel_setHeaderView_1, headerView !is null ? headerView.id : null); } public void setHighlightedTableColumn (NSTableColumn tc) { OS.objc_msgSend(this.id, OS.sel_setHighlightedTableColumn_1, tc !is null ? tc.id : null); } public void setIndicatorImage (NSImage anImage, NSTableColumn tc) { OS.objc_msgSend(this.id, OS.sel_setIndicatorImage_1inTableColumn_1, anImage !is null ? anImage.id : null, tc !is null ? tc.id : null); } public void setIntercellSpacing (NSSize aSize) { OS.objc_msgSend(this.id, OS.sel_setIntercellSpacing_1, aSize); } public void setRowHeight (CGFloat rowHeight) { OS.objc_msgSend(this.id, OS.sel_setRowHeight_1, rowHeight); } public void setSelectionHighlightStyle (NSTableViewSelectionHighlightStyle selectionHighlightStyle) { OS.objc_msgSend(this.id, OS.sel_setSelectionHighlightStyle_1, selectionHighlightStyle); } public void setSortDescriptors (NSArray array) { OS.objc_msgSend(this.id, OS.sel_setSortDescriptors_1, array !is null ? array.id : null); } public void setUsesAlternatingRowBackgroundColors (bool useAlternatingRowColors) { OS.objc_msgSend(this.id, OS.sel_setUsesAlternatingRowBackgroundColors_1, useAlternatingRowColors); } public void setVerticalMotionCanBeginDrag (bool flag) { OS.objc_msgSend(this.id, OS.sel_setVerticalMotionCanBeginDrag_1, flag); } public void sizeLastColumnToFit () { OS.objc_msgSend(this.id, OS.sel_sizeLastColumnToFit); } public void sizeToFit () { OS.objc_msgSend(this.id, OS.sel_sizeToFit); } public NSArray sortDescriptors () { objc.id result = OS.objc_msgSend(this.id, OS.sel_sortDescriptors); return result !is null ? new NSArray(result) : null; } public NSTableColumn tableColumnWithIdentifier (id identifier) { objc.id result = OS.objc_msgSend(this.id, OS.sel_tableColumnWithIdentifier_1, identifier !is null ? identifier.id : null); return result !is null ? new NSTableColumn(result) : null; } public NSArray tableColumns () { objc.id result = OS.objc_msgSend(this.id, OS.sel_tableColumns); return result !is null ? new NSArray(result) : null; } public void textDidBeginEditing (NSNotification notification) { OS.objc_msgSend(this.id, OS.sel_textDidBeginEditing_1, notification !is null ? notification.id : null); } public void textDidChange (NSNotification notification) { OS.objc_msgSend(this.id, OS.sel_textDidChange_1, notification !is null ? notification.id : null); } public void textDidEndEditing (NSNotification notification) { OS.objc_msgSend(this.id, OS.sel_textDidEndEditing_1, notification !is null ? notification.id : null); } public bool textShouldBeginEditing (NSText textObject) { return OS.objc_msgSend(this.id, OS.sel_textShouldBeginEditing_1, textObject !is null ? textObject.id : null) !is null; } public bool textShouldEndEditing (NSText textObject) { return OS.objc_msgSend(this.id, OS.sel_textShouldEndEditing_1, textObject !is null ? textObject.id : null) !is null; } public void tile () { OS.objc_msgSend(this.id, OS.sel_tile); } public bool usesAlternatingRowBackgroundColors () { return OS.objc_msgSend(this.id, OS.sel_usesAlternatingRowBackgroundColors) !is null; } public bool verticalMotionCanBeginDrag () { return OS.objc_msgSend(this.id, OS.sel_verticalMotionCanBeginDrag) !is null; } }