2009-08-05 08:59:46 +00:00
|
|
|
/*
|
2015-01-03 21:30:57 +00:00
|
|
|
Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
2009-08-05 08:59:46 +00:00
|
|
|
|
2015-01-03 21:33:16 +00:00
|
|
|
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
2009-08-05 08:59:46 +00:00
|
|
|
which should be included with this package. The terms are also available at
|
2015-01-03 21:33:16 +00:00
|
|
|
http://www.gnu.org/licenses/gpl-3.0.html
|
2009-08-05 08:59:46 +00:00
|
|
|
*/
|
|
|
|
|
2012-07-29 15:57:46 +00:00
|
|
|
#import "DetailsPanelBase.h"
|
2012-05-28 18:45:13 +00:00
|
|
|
#import "HSPyUtil.h"
|
2009-06-15 12:33:58 +00:00
|
|
|
|
2012-07-29 15:57:46 +00:00
|
|
|
@implementation DetailsPanelBase
|
2012-07-21 14:39:01 +00:00
|
|
|
|
|
|
|
@synthesize detailsTable;
|
|
|
|
|
2012-01-13 20:25:34 +00:00
|
|
|
- (id)initWithPyRef:(PyObject *)aPyRef
|
2009-06-15 12:33:58 +00:00
|
|
|
{
|
2012-07-21 14:39:01 +00:00
|
|
|
self = [super initWithWindow:nil];
|
2012-07-29 15:57:46 +00:00
|
|
|
[self setWindow:[self createWindow]];
|
2012-01-13 20:25:34 +00:00
|
|
|
model = [[PyDetailsPanel alloc] initWithModel:aPyRef];
|
|
|
|
[model bindCallback:createCallback(@"DetailsPanelView", self)];
|
2009-06-15 12:33:58 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2010-02-12 14:39:29 +00:00
|
|
|
- (void)dealloc
|
|
|
|
{
|
2012-01-13 20:25:34 +00:00
|
|
|
[model release];
|
2010-02-12 14:39:29 +00:00
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2012-01-13 20:25:34 +00:00
|
|
|
- (PyDetailsPanel *)model
|
2010-02-05 19:10:54 +00:00
|
|
|
{
|
2012-01-13 20:25:34 +00:00
|
|
|
return (PyDetailsPanel *)model;
|
2010-02-05 19:10:54 +00:00
|
|
|
}
|
|
|
|
|
2012-07-29 15:57:46 +00:00
|
|
|
- (NSWindow *)createWindow
|
|
|
|
{
|
|
|
|
return nil; // Virtual
|
|
|
|
}
|
|
|
|
|
2010-02-05 19:10:54 +00:00
|
|
|
- (void)refreshDetails
|
2009-06-15 12:33:58 +00:00
|
|
|
{
|
|
|
|
[detailsTable reloadData];
|
|
|
|
}
|
2009-06-15 12:53:47 +00:00
|
|
|
|
2011-01-13 12:51:00 +00:00
|
|
|
- (BOOL)isVisible
|
|
|
|
{
|
|
|
|
return [[self window] isVisible];
|
|
|
|
}
|
|
|
|
|
2009-11-02 15:16:34 +00:00
|
|
|
- (void)toggleVisibility
|
|
|
|
{
|
2011-01-13 12:51:00 +00:00
|
|
|
if ([self 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
|
|
|
{
|
2012-01-13 20:25:34 +00:00
|
|
|
return [[self model] numberOfRows];
|
2010-02-05 19:10:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)column row:(NSInteger)row
|
|
|
|
{
|
2012-01-13 20:25:34 +00:00
|
|
|
return [[self model] valueForColumn:[column identifier] row:row];
|
2010-02-05 19:10:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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
|