Hello
So I started writing my first real life Cocoa application after moving from Windows one year back. The interface for the main window of Ecto (a blogging client). Screenshot at: http://ecto.kung-foo.tv/xshots/main.png. Thus the main window will have a NSOutlineView on left and on the right hand side, a NSTableView and NSTextView on right separated by a horizontal NSSplitView. The NSOutlineView is separated by the other two windows by a vertical NSSplitView.
So I create those controls in the MainWindow by dragging the NSOutlineView and other objects in IB and set the datasource of the controls to be the main AppController object. So all the windows datasource is the main AppController.
Instead of doing this, I would like to have my own custom class e.g. FolderView which is derived from NSOutlineView and use that in the mainwindow. So instead of all the datasource messages sent to AppController it will send them to their individual class.
Thus instead of having something like:
I would ideally like to have
How can I do this in XCode 3.0? I would like to separate all the main object controls into separate classes which handles their own job.
So I started writing my first real life Cocoa application after moving from Windows one year back. The interface for the main window of Ecto (a blogging client). Screenshot at: http://ecto.kung-foo.tv/xshots/main.png. Thus the main window will have a NSOutlineView on left and on the right hand side, a NSTableView and NSTextView on right separated by a horizontal NSSplitView. The NSOutlineView is separated by the other two windows by a vertical NSSplitView.
So I create those controls in the MainWindow by dragging the NSOutlineView and other objects in IB and set the datasource of the controls to be the main AppController object. So all the windows datasource is the main AppController.
Instead of doing this, I would like to have my own custom class e.g. FolderView which is derived from NSOutlineView and use that in the mainwindow. So instead of all the datasource messages sent to AppController it will send them to their individual class.
Thus instead of having something like:
Code:
AppController.h
@implementation AppController : NSObject
@interface AppController : NSObject {
IBOutlet NSOutlineView *outlineView;
}
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item;
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item;
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item;
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
I would ideally like to have
Code:
AppController.h
@interface AppController : NSObject {
IBOutlet FolderView *outlineView;
}
@end
FolderView.h
@interface FolderView : NSOutlineView
{
}
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item;
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item;
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item;
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
@end
How can I do this in XCode 3.0? I would like to separate all the main object controls into separate classes which handles their own job.