mirror of
https://github.com/arsenetar/dupeguru.git
synced 2024-11-19 13:29:03 +00:00
1fe42f673f
--HG-- branch : xibless rename : cocoa/base/DetailsPanel.h => cocoa/base/DetailsPanelBase.h rename : cocoa/base/DetailsPanel.m => cocoa/base/DetailsPanelBase.m rename : cocoa/pe/DetailsPanelPE.h => cocoa/pe/DetailsPanel.h rename : cocoa/pe/DetailsPanelPE.m => cocoa/pe/DetailsPanel.m
81 lines
1.6 KiB
Objective-C
81 lines
1.6 KiB
Objective-C
/*
|
|
Copyright 2012 Hardcoded Software (http://www.hardcoded.net)
|
|
|
|
This software is licensed under the "BSD" 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/bsd_license
|
|
*/
|
|
|
|
#import "DetailsPanelBase.h"
|
|
#import "HSPyUtil.h"
|
|
|
|
@implementation DetailsPanelBase
|
|
|
|
@synthesize detailsTable;
|
|
|
|
- (id)initWithPyRef:(PyObject *)aPyRef
|
|
{
|
|
self = [super initWithWindow:nil];
|
|
[self setWindow:[self createWindow]];
|
|
model = [[PyDetailsPanel alloc] initWithModel:aPyRef];
|
|
[model bindCallback:createCallback(@"DetailsPanelView", self)];
|
|
return self;
|
|
}
|
|
|
|
- (void)dealloc
|
|
{
|
|
[model release];
|
|
[super dealloc];
|
|
}
|
|
|
|
- (PyDetailsPanel *)model
|
|
{
|
|
return (PyDetailsPanel *)model;
|
|
}
|
|
|
|
- (NSWindow *)createWindow
|
|
{
|
|
return nil; // Virtual
|
|
}
|
|
|
|
- (void)refreshDetails
|
|
{
|
|
[detailsTable reloadData];
|
|
}
|
|
|
|
- (BOOL)isVisible
|
|
{
|
|
return [[self window] isVisible];
|
|
}
|
|
|
|
- (void)toggleVisibility
|
|
{
|
|
if ([self isVisible]) {
|
|
[[self window] close];
|
|
}
|
|
else {
|
|
[self refreshDetails]; // selection might have changed since last time
|
|
[[self window] orderFront:nil];
|
|
}
|
|
}
|
|
|
|
/* NSTableView Delegate */
|
|
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
|
|
{
|
|
return [[self model] numberOfRows];
|
|
}
|
|
|
|
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)column row:(NSInteger)row
|
|
{
|
|
return [[self model] valueForColumn:[column identifier] row:row];
|
|
}
|
|
|
|
/* Python --> Cocoa */
|
|
- (void)refresh
|
|
{
|
|
if ([[self window] isVisible]) {
|
|
[self refreshDetails];
|
|
}
|
|
}
|
|
@end
|