2009-08-05 08:59:46 +00:00
|
|
|
/*
|
2010-01-01 20:11:34 +00:00
|
|
|
Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
|
2009-08-05 08:59:46 +00:00
|
|
|
|
|
|
|
This software is licensed under the "HS" License as described in the "LICENSE" file,
|
|
|
|
which should be included with this package. The terms are also available at
|
|
|
|
http://www.hardcoded.net/licenses/hs_license
|
|
|
|
*/
|
|
|
|
|
2009-06-15 12:33:58 +00:00
|
|
|
#import "DetailsPanel.h"
|
2010-02-05 19:10:54 +00:00
|
|
|
#import "Utils.h"
|
2009-06-15 12:33:58 +00:00
|
|
|
|
2010-02-05 16:15:45 +00:00
|
|
|
@implementation DetailsPanel
|
2009-06-15 12:33:58 +00:00
|
|
|
- (id)initWithPy:(PyApp *)aPy
|
|
|
|
{
|
2009-10-25 10:42:00 +00:00
|
|
|
self = [super initWithWindowNibName:@"DetailsPanel"];
|
2009-06-15 12:33:58 +00:00
|
|
|
[self window]; //So the detailsTable is initialized.
|
2010-02-05 19:10:54 +00:00
|
|
|
Class pyClass = [Utils classNamed:@"PyDetailsPanel"];
|
|
|
|
py = [[pyClass alloc] initWithCocoa:self pyParent:aPy];
|
2009-06-15 12:33:58 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2010-02-05 19:10:54 +00:00
|
|
|
- (void)dealloc
|
|
|
|
{
|
|
|
|
[py release];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)refreshDetails
|
2009-06-15 12:33:58 +00:00
|
|
|
{
|
|
|
|
[detailsTable reloadData];
|
|
|
|
}
|
2009-06-15 12:53:47 +00:00
|
|
|
|
2009-11-02 15:16:34 +00:00
|
|
|
- (void)toggleVisibility
|
|
|
|
{
|
2010-02-05 19:10:54 +00:00
|
|
|
if ([[self window] isVisible]) {
|
2009-11-02 15:16:34 +00:00
|
|
|
[[self window] close];
|
2010-02-05 19:10:54 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
[self refreshDetails]; // selection might have changed since last time
|
2009-11-02 15:16:34 +00:00
|
|
|
[[self window] orderFront:nil];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-05 19:10:54 +00:00
|
|
|
/* NSTableView Delegate */
|
|
|
|
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
|
2009-06-15 12:53:47 +00:00
|
|
|
{
|
2010-02-05 19:10:54 +00:00
|
|
|
return [py numberOfRows];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)column row:(NSInteger)row
|
|
|
|
{
|
|
|
|
return [py valueForColumn:[column identifier] row:row];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Python --> Cocoa */
|
|
|
|
- (void)refresh
|
|
|
|
{
|
|
|
|
if ([[self window] isVisible]) {
|
|
|
|
[self refreshDetails];
|
|
|
|
}
|
2009-06-15 12:53:47 +00:00
|
|
|
}
|
2009-06-15 12:33:58 +00:00
|
|
|
@end
|