FROM : John C. Randolph
DATE : Sun Jan 26 05:46:34 2003
On Saturday, January 25, 2003, at 02:40 AM, j o a r wrote:
> On Saturday, Jan 25, 2003, at 01:54 Europe/Stockholm, Clark Mueller
> wrote:
>
>> I pretty much went into cardiac arrest after I found out how much
>> work NSBrowser involves for so little in return. I've gone about
>> writing all of the stuff I need almost completely from scratch.
>> NSBrowser simply doesn't pull its weight for most of the places in
>> which it might be practically applied. It's annoying.
>
> I beg to differ. Provided that you already have a tree of data - the
> prerequisite for a browser / outline view - the implementation of the
> delegate / data source for a browser is _not_ much more cumbersome or
> even different than the code you have to write for a table view.
[code example snipped]
I'll just mention as well, that when I wrote my Obj-C runtime hierarchy
browser back before I took this job at Apple, my browser delegate
methods came to just:
@implementation RuntimeBrowserDelegate
- (int)browser:(NSBrowser *)sender numberOfRowsInColumn:(int)column;
{
ClassEnumerator
*enumerator = (column == 0 ? [ClassEnumerator rootClassEnumerator]
:
[ClassEnumerator
subclassEnumeratorForClass:NSClassFromString([[sender
selectedCellInColumn:column-1] title])]);
return [enumerator countRemainingObjects];
}
- (void)browser:(NSBrowser *)sender willDisplayCell:(id)cell
atRow:(int)row column:(int)column
{
NSArray
*classNames = (column == 0 ?
[[ClassEnumerator rootClassEnumerator] sortedNames] :
[ClassEnumerator sortedSubclassNamesForClassNamed:[[sender
selectedCellInColumn:column-1] title]]);
[cell setTitle:[classNames objectAtIndex:row]];
[cell setLeaf:!classHasDescendants(NSClassFromString([cell title]))];
}
@end
The bulk of the work was implementing my ClassEnumerator class (which
is still only about 300 lines of code, including a bunch of stuff for
caching lookups already performed, etc.)
-jcr
John C. Randolph <<email_removed>> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Sun Jan 26 05:46:34 2003
On Saturday, January 25, 2003, at 02:40 AM, j o a r wrote:
> On Saturday, Jan 25, 2003, at 01:54 Europe/Stockholm, Clark Mueller
> wrote:
>
>> I pretty much went into cardiac arrest after I found out how much
>> work NSBrowser involves for so little in return. I've gone about
>> writing all of the stuff I need almost completely from scratch.
>> NSBrowser simply doesn't pull its weight for most of the places in
>> which it might be practically applied. It's annoying.
>
> I beg to differ. Provided that you already have a tree of data - the
> prerequisite for a browser / outline view - the implementation of the
> delegate / data source for a browser is _not_ much more cumbersome or
> even different than the code you have to write for a table view.
[code example snipped]
I'll just mention as well, that when I wrote my Obj-C runtime hierarchy
browser back before I took this job at Apple, my browser delegate
methods came to just:
@implementation RuntimeBrowserDelegate
- (int)browser:(NSBrowser *)sender numberOfRowsInColumn:(int)column;
{
ClassEnumerator
*enumerator = (column == 0 ? [ClassEnumerator rootClassEnumerator]
:
[ClassEnumerator
subclassEnumeratorForClass:NSClassFromString([[sender
selectedCellInColumn:column-1] title])]);
return [enumerator countRemainingObjects];
}
- (void)browser:(NSBrowser *)sender willDisplayCell:(id)cell
atRow:(int)row column:(int)column
{
NSArray
*classNames = (column == 0 ?
[[ClassEnumerator rootClassEnumerator] sortedNames] :
[ClassEnumerator sortedSubclassNamesForClassNamed:[[sender
selectedCellInColumn:column-1] title]]);
[cell setTitle:[classNames objectAtIndex:row]];
[cell setLeaf:!classHasDescendants(NSClassFromString([cell title]))];
}
@end
The bulk of the work was implementing my ClassEnumerator class (which
is still only about 300 lines of code, including a bunch of stuff for
caching lookups already performed, etc.)
-jcr
John C. Randolph <<email_removed>> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| The Amazing Llama | Jan 24, 09:04 | |
| Steve Gehrman | Jan 24, 22:43 | |
| John C. Randolph | Jan 25, 01:49 | |
| John C. Randolph | Jan 25, 01:51 | |
| Clark Mueller | Jan 25, 01:54 | |
| Jan Van Tol | Jan 25, 05:33 | |
| Mark Levin | Jan 25, 07:02 | |
| Richard Schreyer | Jan 25, 07:17 | |
| j o a r | Jan 25, 11:40 | |
| Clark Mueller | Jan 25, 19:30 | |
| Andrew Thompson | Jan 25, 20:36 | |
| Sheehan Olver | Jan 25, 21:34 | |
| Clark Mueller | Jan 26, 04:19 | |
| John C. Randolph | Jan 26, 05:46 |






Cocoa mail archive

