[Mono-osx] Monomac appkit.cs

James Clancey james.clancey at gmail.com
Thu Apr 22 12:58:35 EDT 2010


Sorry I forgot to include the enums. Here they are. I will start working on
correcting my errors today.

Thanks

public enum NSTableViewColumnAutoresizingStyle {
NSTableViewNoColumnAutoresizing = 0,
NSTableViewUniformColumnAutoresizingStyle,
NSTableViewSequentialColumnAutoresizingStyle,
NSTableViewReverseSequentialColumnAutoresizingStyle,
NSTableViewLastColumnOnlyAutoresizingStyle,
NSTableViewFirstColumnOnlyAutoresizingStyle
}
 public enum NSTableViewSelectionHighlightStyle {
NSTableViewSelectionHighlightStyleNone = -1,
NSTableViewSelectionHighlightStyleRegular = 0,
NSTableViewSelectionHighlightStyleSourceList = 1,
}
 public enum NSTableViewDraggingDestinationFeedbackStyle {
NSTableViewDraggingDestinationFeedbackStyleNone = -1,
NSTableViewDraggingDestinationFeedbackStyleRegular = 0,
NSTableViewDraggingDestinationFeedbackStyleSourceList = 1,
}
 public enum NSTableViewDropOperation {
NSTableViewDropOn,
NSTableViewDropAbove
}

On Thu, Apr 22, 2010 at 5:43 AM, Miguel de Icaza <miguel at novell.com> wrote:

> Hello James,
>
> Here is a build-able copy of the NSTableview with the associated  classes
>>
>
> Some feedback on the file:
>
> [BaseType (typeof (NSObject))]
>>  interface NSTableColumn {
>>  [Export ("initWithIdentifier:")]
>> IntPtr InitWithIdentifier (NSObject identifier);
>>
>
> All constructors need to become "IntPtr Constructor", the name of the
> constructor is erased, that will become:
>
> public NSTableColumn (NSObject identifier)
>
>  [Export ("headerCell")]
>> NSObject HeaderCell { get; set; }
>>
>
> This should be an NSCell.
>
>
>>  [Export ("dataCell")]
>> NSObject DataCell { get; set; }
>>
>
> So is this.
>
> //[Export ("sortDescriptorPrototype")]
>>  //NSSortDescriptor SortDescriptorPrototype { get; set; }
>>
>
> Could you also send your NSSortDescriptor?
>
>
>>  [Export ("resizingMask")]
>> uint ResizingMask { get; set; }
>>
>
> We tend not to expose uint or ints for masks.   In this case, notice that
> the docs point to the possible values:
>
>
> http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSTableColumn_Class/Reference/Reference.html#//apple_ref/doc/constant_group/Resizing_Modes
>
> You need to edit AppKit/Enums.cs to add the following:
>
> [Flags]
> public enum NSTableResizingMask {
>    // The actual values.
> }
>
> Then replace the int or uint value with this enum.
>
> [Export ("tableColumns")]
>>  NSArray TableColumns ();
>>
>
> You need to lookup the actual type  of tableColumns in the documentation,
> and make this strongly typed.  I looked this up and the array contains
> NSTableColumn elements, so you have to change that to:
>
> NSTableColumn [] TableColumns
>
> [Export ("numberOfColumns")]
>>  int NumberOfColumns ();
>>
>
> Per the framework design guidelines, rename this to  ColumnCount and make
> it a property:
>
> int ColumnCount { get; }
>
> [Export ("numberOfRows")]
>>  int NumberOfRows ();
>>
>
> same here:
>
>     int RowCount { get;  }
>
>  [Export ("addTableColumn:")]
>> void AddTableColumn (NSTableColumn tableColumn);
>>
>> [Export ("removeTableColumn:")]
>> void RemoveTableColumn (NSTableColumn tableColumn);
>>
>> [Export ("moveColumn:toColumn:")]
>> void MoveColumntoColumn (int oldIndex, int newIndex);
>>
>
> The identifier is a bad choice from the FDG perspective, use instead:
>
> void MoveColumn
>
>
>>  [Export ("columnWithIdentifier:")]
>> int ColumnWithIdentifier (NSObject identifier);
>>
>
> Since C# supports method overloads there is no need to distinguish
> functionality based on the method name, so we need to group this and the
> next one into the same method, I suggest FindColumn.
>
>
>> [Export ("tableColumnWithIdentifier:")]
>> NSTableColumn TableColumnWithIdentifier (NSObject identifier);
>>
>
> Per above, rename FindColumn.
>
> [Export ("reloadDataForRowIndexes:columnIndexes:")]
>>  void ReloadDataForRowIndexescolumnIndexes (NSIndexSet rowIndexes,
>> NSIndexSet columnIndexes );
>>
>
> Notice that the name generated by the parser here is terrible.   The name
> contains the second part of the selector, but C# has no need for it.
>
> So this method should be renamed "ReloadData", it is just an overload that
> is more specific than the general one.
>
>
>>
>> [Export ("editedColumn")]
>>  int EditedColumn ();
>>
>> [Export ("editedRow")]
>> int EditedRow ();
>>
>> [Export ("clickedColumn")]
>> int ClickedColumn ();
>>
>
>> [Export ("clickedRow")]
>> int ClickedRow ();
>>
>
> All those four need to become read-only properties.
>
>
>>  [Export ("setIndicatorImage:inTableColumn:")]
>> void SetIndicatorImageinTableColumn (NSImage anImage, NSTableColumn
>> tableColumn);
>>
>
> Again: ugly identifier caused by the selector.   It shoudl become:
>
> SetIndicatorImage (NSImage anImage, NSTableColumn inTableColumn)
>
>
>>  [Export ("indicatorImageInTableColumn:")]
>> NSImage IndicatorImageInTableColumn (NSTableColumn tableColumn);
>>
>
> This should become GetIndicatorImage (...)
>
>
>> [Export ("canDragRowsWithIndexes:atPoint:")]
>>  bool CanDragRowsWithIndexesatPoint (NSIndexSet rowIndexes, PointF
>> mouseDownPoint );
>>
>
> Same, should become CanDragRows, the indexes: and atPoint: are not relevant
> to the method name.
>
> [Export ("setDraggingSourceOperationMask:forLocal:")]
>>  void SetDraggingSourceOperationMaskforLocal (NSDragOperation mask, bool
>> isLocal );
>>
>
> Same, should become SetDraggingSourceOperationMask
>
>
>> [Export ("setDropRow:dropOperation:")]
>>  void SetDropRowdropOperation (int row, NSTableViewDropOperation
>> dropOperation);
>>
>
> Same, should become SetDropRowDropOperation
>
>  [Export ("selectAll:")]
>> void SelectAll (NSObject sender);
>>
>> [Export ("deselectAll:")]
>> void DeselectAll (NSObject sender);
>>
>> [Export ("selectColumnIndexes:byExtendingSelection:")]
>> void SelectColumnIndexesbyExtendingSelection (NSIndexSet indexes, bool
>> extend );
>>
>
> Same, should become SelectColumns (NSIndexSet columnIndexes, bool
> extendSelection)
>
> Notice that we can make our parameter names more meaningful in the cases
> where we drop parts of the method name.
>
> C# 4.0 will take allow developers to take advantage of this, like this:
>
> SelectColumns (columnIndexes = x, extendSelection  = true)
>
>
>
>>  [Export ("selectRowIndexes:byExtendingSelection:")]
>> void SelectRowIndexesbyExtendingSelection (NSIndexSet indexes, bool extend
>> );
>>
>
> Same, now: SelectRows
>
> [Export ("selectedColumnIndexes")]
>>  NSIndexSet SelectedColumnIndexes ();
>>
>
> Should become a read-only property.
>
>
>>  [Export ("selectedRowIndexes")]
>> NSIndexSet SelectedRowIndexes ();
>>
>
> Should become a read-only property.
>
>
>> [Export ("selectedColumn")]
>> int SelectedColumn ();
>>
>> [Export ("selectedRow")]
>> int SelectedRow ();
>>
>
> Should become read-only properties.
>
>
>> [Export ("numberOfSelectedColumns")]
>>  int NumberOfSelectedColumns ();
>>
>
> -> SelectedColumnCount
>
>
>>  [Export ("numberOfSelectedRows")]
>> int NumberOfSelectedRows ();
>>
>
> -> SelectedRowCount
>
>
>> [Export ("rectOfColumn:")]
>> RectangleF RectOfColumn (int column);
>>
>
> -> RectForColumn
>
>
>> [Export ("rectOfRow:")]
>>  RectangleF RectOfRow (int row);
>>
>
> -> RectOfRow.
>
>  [Export ("columnIndexesInRect:")]
>> NSIndexSet ColumnIndexesInRect (RectangleF rect);
>>
>
> -> GetColumnIndexesInRect
>
> [Export ("columnAtPoint:")]
>>
> int ColumnAtPoint (PointF point);
>>
>
> -> GetColumn (PointF atPoint)
>
> [Export ("rowAtPoint:")]
>>  int RowAtPoint (PointF point);
>>
>
> -> GetRow (PointF atPoint)
>
>
>>  [Export ("frameOfCellAtColumn:row:")]
>> RectangleF FrameOfCellAtColumnrow (int column, int row);
>>
>
> ->GetCellFrame (int column, int row)
>
>
>> [Export ("preparedCellAtColumn:row:")]
>>  NSCell PreparedCellAtColumnrow (int column, int row );
>>
>
> ->GetCell (int column, int row)
>
>  [Export ("shouldFocusCell:atColumn:row:")]
>> bool ShouldFocusCellatColumnrow (NSCell cell, int column, int row );
>>
>
> -> ShouldFocusCell
>
>
>> [Export ("performClickOnCellAtColumn:row:")]
>>  void PerformClickOnCellAtColumnrow (int column, int row );
>>
>
> -> PerformClick
>
>
>>  [Export ("editColumn:row:withEvent:select:")]
>> void EditColumnrowwithEventselect (int column, int row, NSEvent theEvent,
>> bool select);
>>
>
> -> EditColumn
>
>
>> [Export ("drawRow:clipRect:")]
>>  void DrawRowclipRect (int row, RectangleF clipRect);
>>
>
> -> DrawRow
>
>
>>  [Export ("highlightSelectionInClipRect:")]
>> void HighlightSelectionInClipRect (RectangleF clipRect);
>>
>
> -> HighlightSelection (RectangleF inCliprect)
>
>
>> [Export ("drawGridInClipRect:")]
>>  void DrawGridInClipRect (RectangleF clipRect);
>>
>
> -> DrawGrid
>
>
>>  [Export ("drawBackgroundInClipRect:")]
>> void DrawBackgroundInClipRect (RectangleF clipRect );
>>
>
> -> DrawBackground
>
>
>> //Detected properties
>>  [Export ("dataSource")][NullAllowed]
>>  NSTableViewDataSource DataSource { get; set; }
>>
>> [Export ("delegate")][NullAllowed]
>>  NSTableViewDelegate Delegate { get; set; }
>>
>
> Apply the standard delegate transformation, make the above weakly typed
> (replace return value with NSObject) rename it to "WeakDelegate"
> and add a new:
>
> [Wrap ("WeakDelegate")]
> NSTableViewDelegate Delegate { get; set; }
>
> This is necessary to allow developers to set delegates in the Objective-C
> style, when they out out of the strongly typed version that we offer.
>
> At this point, you will want to read how to turn the Objective-C delegate
> into C# events, you will need to decorate the interface with the
> Events/Delegates property for this.
>
>  [Export ("gridStyleMask")]
>>  uint GridStyleMask { get; set; }
>>
>
> Needs to become strongly typed, with an enum.
>
>  [Export ("sortDescriptors")]
>>  NSArray SortDescriptors { get; set; }
>>
>
> The NSArray needs to become strongly typed, what are the elements of this?
>
> The NSTableViewDelegate will need plenty of updates by sprinkling the
> proper EventArgs on each method:
>
>  [BaseType (typeof (NSObject))]
>> [Model]
>>  interface NSTableViewDelegate {
>> [Export ("tableView:willDispayCell:forTableColumn:row:")]
>>  void TableViewwillDisplayCellforTableColumnrow (NSTableView tableView,
>> NSObject cell, NSTableColumn tableColumn, int
>>
>
> In delegates, the first parameter is usually the sender, so the first part
> of the selector name is useless, so we need to extract the actual meaning of
> this method, which is "WillDisplayCell"
>
> So that needs to become "WillDisplayCell"
>
> The following return values, so in addition to the EventArgs that you need
> to sprinkle, you need to look in the docs what is the default return value
> if these methods are not implemented, and then do:
>
> [DefaultValue (...)]
>
> When no docs are available, we need to make an educated guess:
>
>  [Export ("tableView:shouldEditTableColumn:row:")]
>>  bool TableViewshouldEditTableColumnrow (NSTableView tableView,
>> NSTableColumn tableColumn, int row);
>>
>
> -> ShouldEditTableColumn
>
> In this case, the docs say nothing about what happens if the user does not
> implement the method, so we are going to assume that the default should be
> "no", so we do: DefaultValoue (false)
>
>
>> [Export ("selectionShouldChangeInTableView:")]
>>  bool SelectionShouldChangeInTableView (NSTableView tableView);
>>
>
> -> ShouldSelectionChange
>
>  [Export ("tableView:shouldSelectRow:")]
>>  bool TableViewshouldSelectRow (NSTableView tableView, int row);
>>
>
> -> ShouldSelectRow
>
>
>>  [Export ("tableView:selectionIndexesForProposedSelection:")]
>>  NSIndexSet TableViewselectionIndexesForProposedSelection (NSTableView
>> tableView, NSIndexSet proposedSelectionIndexes);
>>
>
> -> GetSelectionIndexes
>
>
>>
>> [Export ("tableView:shouldSelectTableColumn:")]
>>  bool TableViewshouldSelectTableColumn (NSTableView tableView,
>> NSTableColumn tableColumn);
>>
>
> -> ShouldSelectTableColumn
>
>
>> [Export ("tableView:mouseDownInHeaderOfTableColumn:")]
>>  void TableViewmouseDownInHeaderOfTableColumn (NSTableView tableView,
>> NSTableColumn tableColumn);
>>
>
> -> MouseDown
>
>  [Export ("tableView:didClickTableColumn:")]
>>  void TableViewdidClickTableColumn (NSTableView tableView, NSTableColumn
>> tableColumn);
>>
>
> -> DidClickTableColumn
>
>  [Export ("tableView:didDragTableColumn:")]
>>  void TableViewdidDragTableColumn (NSTableView tableView, NSTableColumn
>> tableColumn);
>>
>
> DidDragTabelColumn
>
>
>>  [Export ("tableView:heightOfRow:")]
>> float TableViewheightOfRow (NSTableView tableView, int row );
>>
>
> -> GetRowHeight
>
>
>> [Export ("tableView:typeSelectStringForTableColumn:row:")]
>>  string TableViewtypeSelectStringForTableColumnrow (NSTableView
>> tableView, NSTableColumn tableColumn, int row );
>>
>
> -> GetSelectString
>
>
>> [Export ("tableView:nextTypeSelectMatchFromRow:toRow:forString:")]
>>  int TableViewnextTypeSelectMatchFromRowtoRowforString (NSTableView
>> tableView, int startRow, int endRow, string
>>
>
> -> GetNextTypeSelectMatch
>
> [Export ("tableView:shouldTypeSelectForEvent:withCurrentSearchString:")]
>>  bool TableViewshouldTypeSelectForEventwithCurrentSearchString
>> (NSTableView tableView, NSEvent theEvent, string searchString );
>>
>
> -> ShouldTypeSelect
>
>
>> [Export ("tableView:shouldShowCellExpansionForTableColumn:row:")]
>>  bool TableViewshouldShowCellExpansionForTableColumnrow (NSTableView
>> tableView, NSTableColumn tableColumn, int row );
>>
>
> -> ShouldShowCellExpansion
>
>
>> [Export ("tableView:shouldTrackCell:forTableColumn:row:")]
>>  bool TableViewshouldTrackCellforTableColumnrow (NSTableView tableView,
>> NSCell cell, NSTableColumn tableColumn, int row
>>
>
> -> ShouldTrackCell
>
> [Export ("tableView:dataCellForTableColumn:row:")]
>>  NSCell TableViewdataCellForTableColumnrow (NSTableView tableView,
>> NSTableColumn tableColumn, int row );
>>
>
> -> GetCell
>
>
>>
>> [Export ("tableView:isGroupRow:")]
>> bool TableViewisGroupRow (NSTableView tableView, int row );
>>
>
> -> IsGroupRow
>
>
>> [Export ("tableView:sizeToFitWidthOfColumn:")]
>>  float TableViewsizeToFitWidthOfColumn (NSTableView tableView, int column
>> );
>>
>
> -> GetSizeToFitColumnWidth
>
>
>>  [Export ("tableView:shouldReorderColumn:toColumn:")]
>> bool TableViewshouldReorderColumntoColumn (NSTableView tableView, int
>> columnIndex, int newColumnIndex );
>>
>
> -> ShouldReorder
>
>
>> [Export ("tableViewSelectionDidChange:")]
>>  void TableViewSelectionDidChange (NSNotification notification);
>>
>
> -> SelectionDidChange
>
>
>>  [Export ("tableViewColumnDidMove:")]
>> void TableViewColumnDidMove (NSNotification notification);
>>
>
> -> ColumnDidMove
>
>
>> [Export ("tableViewColumnDidResize:")]
>>  void TableViewColumnDidResize (NSNotification notification);
>>
>
> -> ColumnDidResize
>
>  [Export ("tableViewSelectionIsChanging:")]
>> void TableViewSelectionIsChanging (NSNotification notification);
>>
>
> -> SelectionIsChanging
>
>
>> [BaseType (typeof (NSObject))]
>>  [Model]
>>  interface NSTableViewDataSource {
>> [Export ("numberOfRowsInTableView:")]
>>  int NumberOfRowsInTableView (NSTableView tableView);
>>
>
> -> GetRowCount
>
>
>>  [Export ("tableView:objectValueForTableColumn:row:")]
>>  NSObject TableViewobjectValueForTableColumnrow (NSTableView tableView,
>> NSTableColumn tableColumn, int row);
>>
>
> -> GetObjectValue
>
>
>>
>> [Export ("tableView:setObjectValue:forTableColumn:row:")]
>>  void TableViewsetObjectValueforTableColumnrow (NSTableView tableView,
>> NSObject theObject, NSTableColumn tableColumn,
>>
>
> -> SetObjectValue
>
> [Export ("tableView:sortDescriptorsDidChange:")]
>>  void TableViewsortDescriptorsDidChange (NSTableView tableView, NSArray
>> oldDescriptors );
>>
>
> -> SortDescriptorChanged
>
>
>> [Export ("tableView:writeRowsWithIndexes:toPasteboard:")]
>>  bool TableViewwriteRowsWithIndexestoPasteboard (NSTableView tableView,
>> NSIndexSet rowIndexes, NSPasteboard pboard );
>>
>
> -> WriteRows
>
> [Export ("tableView:validateDrop:proposedRow:proposedDropOperation:")]
>>  NSDragOperation TableViewvalidateDropproposedRowproposedDropOperation
>> (NSTableView tableView, NSDraggingInfo info, int row,
>> NSTableViewDropOperation dropOperation);
>>
>
> -> ValidateDrop
>
> [Export ("tableView:acceptDrop:row:dropOperation:")]
>>  bool TableViewacceptDroprowdropOperation (NSTableView tableView,
>> NSDraggingInfo info, int row, NSTableViewDropOperation dropOperation);
>>
>
> -> AcceptDrop
>
>
>> [Export
>> ("tableView:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:")]
>>  NSArray
>> TableViewnamesOfPromisedFilesDroppedAtDestinationforDraggedRowsWithIndexes
>> (NSTableView tableView, NSUrl dropDestination, NSIndexSet indexSet );
>>
>
> -> FilesDropped
>
> [BaseType (typeof (NSTextFieldCell))]
>>  interface NSTableHeaderCell {
>>  [Export ("drawSortIndicatorWithFrame:inView:ascending:priority:")]
>> void DrawSortIndicatorWithFrameinViewascendingpriority (RectangleF
>> cellFrame, NSView controlView, bool ascending, int priority );
>>
>
> -> DrawSortIndicator
>
>
>> [Export ("sortIndicatorRectForBounds:")]
>>  RectangleF SortIndicatorRectForBounds (RectangleF theRect );
>>
>
> GetSortIndicatorRect
>
>  [BaseType (typeof (NSView))]
>> interface NSTableHeaderView {
>> [Export ("draggedColumn")]
>>  int DraggedColumn ();
>>
>> [Export ("draggedDistance")]
>>  float DraggedDistance ();
>>
>> [Export ("resizedColumn")]
>>  int ResizedColumn ();
>>
>
> Those three need to become read-only properties
>
>
>>  [Export ("headerRectOfColumn:")]
>>  RectangleF HeaderRectOfColumn (int column);
>>
>
> -> GetHeaderRect
>
>
>>
>> [Export ("columnAtPoint:")]
>>  int ColumnAtPoint (PointF point);
>>
>
> -> GetColumn
>
> Miguel.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20100422/29afe719/attachment-0001.html 


More information about the Mono-osx mailing list