Upgrading ITKit to Xcode 2.1 and fixing problems with
[ITKit.git] / ITAboutWindowController.m
diff --git a/ITAboutWindowController.m b/ITAboutWindowController.m
new file mode 100644 (file)
index 0000000..cea9a78
--- /dev/null
@@ -0,0 +1,48 @@
+#import "ITAboutWindowController.h"
+
+static ITAboutWindowController *_sharedController;
+
+@implementation ITAboutWindowController
+
++ (ITAboutWindowController *)sharedController
+{
+       if (!_sharedController) {
+               _sharedController = [[ITAboutWindowController alloc] init];
+       }
+       return _sharedController;
+}
+
+- (id)init
+{
+       if ( (self = [super init]) ) {
+               [NSBundle loadNibNamed:@"ITAboutWindow" owner:self];
+       }
+       return self;
+}
+
+- (void)setupAboutWindow
+{
+       [_appIcon setImage:[[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIconFile"]]] autorelease]];
+       
+       [_appName setStringValue:[[NSBundle mainBundle] localizedStringForKey:@"CFBundleShortVersionString" value:@"" table:@"InfoPlist"]];
+       [_companySite setStringValue:@"http://www.ithinksw.com/"];
+       
+       [_copyright setStringValue:[[NSBundle mainBundle] localizedStringForKey:@"NSHumanReadableCopyright" value:@"" table:@"InfoPlist"]];
+}
+
+- (void)showAboutWindow
+{
+       [self setupAboutWindow];
+       
+       [_window center];
+       [NSApp activateIgnoringOtherApps:YES];
+    [_window orderFrontRegardless];
+    [_window makeKeyWindow];
+}
+
+- (BOOL)isVisible
+{
+       return [_window isVisible];
+}
+
+@end
\ No newline at end of file