mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 03:51:22 +00:00
addition and deletion of outlets/actions. Made the test application use a .gorm file instead of a hardcoded interface. Corrected a problem with the "set name" functionality and removed the "establishConnection" call in the GormInspectorsManager since this was causing issues when the user added a delegate or a next key view. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@18266 72102866-910b-0410-8b05-ffd578937521
81 lines
2.2 KiB
Objective-C
81 lines
2.2 KiB
Objective-C
/* GormTest.m
|
|
*
|
|
* Copyright (C) 1999 Free Software Foundation, Inc.
|
|
*
|
|
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
|
|
* Date: 1999
|
|
*
|
|
* This file is part of GNUstep.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*/
|
|
|
|
#include <Foundation/Foundation.h>
|
|
#include <AppKit/AppKit.h>
|
|
|
|
@interface Controller: NSObject
|
|
{
|
|
}
|
|
- (id)open: (id) sender;
|
|
@end
|
|
|
|
@implementation Controller
|
|
|
|
- (id) open: (id)sender
|
|
{
|
|
NSArray *fileTypes = [NSArray arrayWithObjects: @"gorm", nil];
|
|
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
|
|
id oldDelegate = [NSApp delegate];
|
|
int result;
|
|
|
|
[oPanel setAllowsMultipleSelection: NO];
|
|
[oPanel setCanChooseFiles: YES];
|
|
[oPanel setCanChooseDirectories: NO];
|
|
result = [oPanel runModalForDirectory: NSHomeDirectory()
|
|
file: nil
|
|
types: fileTypes];
|
|
if (result == NSOKButton)
|
|
{
|
|
[NSBundle loadNibFile: [oPanel filename]
|
|
externalNameTable:
|
|
[NSDictionary dictionaryWithObject: NSApp forKey: @"NSOwner"]
|
|
withZone: NSDefaultMallocZone()];
|
|
if ([NSApp delegate] == oldDelegate)
|
|
{
|
|
NSRunAlertPanel(NULL,
|
|
[NSString stringWithFormat: @"Nib did not set app delegate"],
|
|
@"OK", NULL, NULL);
|
|
return nil;
|
|
}
|
|
if ([[NSApp delegate] isKindOfClass: [NSWindow class]] == NO)
|
|
{
|
|
NSRunAlertPanel(NULL,
|
|
[NSString stringWithFormat:
|
|
@"Nib set app delegate to something other than a window"],
|
|
@"OK", NULL, NULL);
|
|
return nil;
|
|
}
|
|
[[NSApp delegate] makeKeyAndOrderFront: self];
|
|
return self;
|
|
}
|
|
return nil; /* Failed */
|
|
}
|
|
@end
|
|
|
|
int
|
|
main(int argc, const char **argv)
|
|
{
|
|
return NSApplicationMain(argc, argv);
|
|
}
|