first round of debug/release merge: introduce wxDEBUG_LEVEL, for now defined as 1...
[wxWidgets.git] / src / cocoa / NSTableView.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        cocoa/NSTableView.mm
3 // Purpose:     wxCocoaNSTableView / wxCocoaNSTableDataSource
4 // Author:      David Elliott
5 // Modified by:
6 // Created:     2003/08/05
7 // RCS-ID:      $Id$
8 // Copyright:   (c) 2003 David Elliott
9 // Licence:     wxWidgets licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include "wx/wxprec.h"
21 #ifndef WX_PRECOMP
22     #include "wx/log.h"
23 #endif // WX_PRECOMP
24
25 #include "wx/cocoa/NSTableDataSource.h"
26 #include "wx/cocoa/NSTableView.h"
27 #import <AppKit/NSTableView.h>
28
29 // ----------------------------------------------------------------------------
30 // globals
31 // ----------------------------------------------------------------------------
32 WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSTableView)
33
34 // ============================================================================
35 // @class wxCocoaNSTableDataSource
36 // ============================================================================
37 @implementation wxCocoaNSTableDataSource : NSObject
38
39 - (int)numberOfRowsInTableView: (NSTableView *)tableView
40 {
41     wxCocoaNSTableView *wxView = wxCocoaNSTableView::GetFromCocoa(tableView);
42     wxCHECK_MSG(wxView, 0, wxT("No associated wx object"));
43     return wxView->CocoaDataSource_numberOfRows();
44 }
45
46 - (id)tableView:(NSTableView *)tableView
47     objectValueForTableColumn: (NSTableColumn *)tableColumn
48     row: (int)rowIndex
49 {
50     wxCocoaNSTableView *wxView = wxCocoaNSTableView::GetFromCocoa(tableView);
51     wxCHECK_MSG(wxView, nil, wxT("No associated wx object"));
52     return wxView->CocoaDataSource_objectForTableColumn(tableColumn,rowIndex);
53 }
54
55 @end // implementation wxCocoaNSTableDataSource
56 WX_IMPLEMENT_GET_OBJC_CLASS(wxCocoaNSTableDataSource,NSObject)
57