Added a new about box class. Added a text field that will eventually be clickable...
authorKent Sutherland <ksuther@ithinksw.com>
Thu, 4 Aug 2005 17:50:52 +0000 (17:50 +0000)
committerKent Sutherland <ksuther@ithinksw.com>
Thu, 4 Aug 2005 17:50:52 +0000 (17:50 +0000)
English.lproj/AboutBox.nib/classes.nib [new file with mode: 0644]
English.lproj/AboutBox.nib/info.nib [new file with mode: 0644]
English.lproj/AboutBox.nib/keyedobjects.nib [new file with mode: 0644]
ITAboutBox.h [new file with mode: 0644]
ITAboutBox.m [new file with mode: 0644]
ITKit.h
ITURLTextField.h [new file with mode: 0644]
ITURLTextField.m [new file with mode: 0644]

diff --git a/English.lproj/AboutBox.nib/classes.nib b/English.lproj/AboutBox.nib/classes.nib
new file mode 100644 (file)
index 0000000..3d7b813
--- /dev/null
@@ -0,0 +1,19 @@
+{
+    IBClasses = (
+        {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
+        {
+            CLASS = ITAboutBox; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {
+                "_appIcon" = NSImageView; 
+                "_appName" = NSTextField; 
+                "_companySite" = NSTextField; 
+                "_copyright" = NSTextField; 
+                "_window" = NSWindow; 
+            }; 
+            SUPERCLASS = NSObject; 
+        }, 
+        {CLASS = ITURLTextField; LANGUAGE = ObjC; SUPERCLASS = NSTextField; }
+    ); 
+    IBVersion = 1; 
+}
\ No newline at end of file
diff --git a/English.lproj/AboutBox.nib/info.nib b/English.lproj/AboutBox.nib/info.nib
new file mode 100644 (file)
index 0000000..d214b83
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>IBDocumentLocation</key>
+       <string>40 60 356 240 0 0 1152 746 </string>
+       <key>IBFramework Version</key>
+       <string>439.0</string>
+       <key>IBOpenObjects</key>
+       <array>
+               <integer>5</integer>
+       </array>
+       <key>IBSystem Version</key>
+       <string>8C46</string>
+</dict>
+</plist>
diff --git a/English.lproj/AboutBox.nib/keyedobjects.nib b/English.lproj/AboutBox.nib/keyedobjects.nib
new file mode 100644 (file)
index 0000000..33020d8
Binary files /dev/null and b/English.lproj/AboutBox.nib/keyedobjects.nib differ
diff --git a/ITAboutBox.h b/ITAboutBox.h
new file mode 100644 (file)
index 0000000..07ca399
--- /dev/null
@@ -0,0 +1,26 @@
+//
+//  ITAboutBox.h
+//  ITKit
+//
+//  Created by Kent Sutherland on 8/4/05.
+//  Copyright 2005 __MyCompanyName__. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@class ITURLTextField;
+
+@interface ITAboutBox : NSObject
+{
+       IBOutlet NSImageView *_appIcon;
+       IBOutlet NSTextField *_appName;
+       IBOutlet ITURLTextField *_companySite;
+       IBOutlet NSTextField *_copyright;
+       IBOutlet NSWindow *_window;
+}
++ (ITAboutBox *)sharedController;
+
+- (void)setupAboutBox;
+- (void)showAboutBox;
+- (BOOL)isVisible;
+@end
diff --git a/ITAboutBox.m b/ITAboutBox.m
new file mode 100644 (file)
index 0000000..276fd7d
--- /dev/null
@@ -0,0 +1,57 @@
+//
+//  ITAboutBox.m
+//  ITKit
+//
+//  Created by Kent Sutherland on 8/4/05.
+//  Copyright 2005 __MyCompanyName__. All rights reserved.
+//
+
+#import "ITAboutBox.h"
+#import "ITURLTextField.h"
+
+static ITAboutBox *_sharedController;
+
+@implementation ITAboutBox
+
++ (ITAboutBox *)sharedController
+{
+       if (!_sharedController) {
+               _sharedController = [[ITAboutBox alloc] init];
+       }
+       return _sharedController;
+}
+
+- (id)init
+{
+       if ( (self = [super init]) ) {
+               [NSBundle loadNibNamed:@"AboutBox" owner:self];
+       }
+       return self;
+}
+
+- (void)setupAboutBox
+{
+       [_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/"];
+       [_companySite setURL:[NSURL URLWithString:@"http://www.ithinksw.com/"]];
+       [_copyright setStringValue:[[NSBundle mainBundle] localizedStringForKey:@"NSHumanReadableCopyright" value:@"" table:@"InfoPlist"]];
+}
+
+- (void)showAboutBox
+{
+       [self setupAboutBox];
+       
+       [_window center];
+       [NSApp activateIgnoringOtherApps:YES];
+    [_window orderFrontRegardless];
+    [_window makeKeyWindow];
+}
+
+- (BOOL)isVisible
+{
+       return [_window isVisible];
+}
+
+@end
diff --git a/ITKit.h b/ITKit.h
index d7ed152..5d34878 100644 (file)
--- a/ITKit.h
+++ b/ITKit.h
@@ -43,5 +43,8 @@
 
 #import <ITKit/ITSplashScreen.h>
 
+#import <ITKit/ITAboutBox.h>
+#import <ITKit/ITURLTextField.h>
+
 #import <ITKit/ITCategory-NSView.h>
 #import <ITKit/ITCategory-NSMenu.h>
\ No newline at end of file
diff --git a/ITURLTextField.h b/ITURLTextField.h
new file mode 100644 (file)
index 0000000..d72791a
--- /dev/null
@@ -0,0 +1,10 @@
+/* ITURLTextField */
+
+#import <Cocoa/Cocoa.h>
+
+@interface ITURLTextField : NSTextField
+{
+       NSURL *_url;
+}
+- (void)setURL:(NSURL *)url;
+@end
diff --git a/ITURLTextField.m b/ITURLTextField.m
new file mode 100644 (file)
index 0000000..03dcdaa
--- /dev/null
@@ -0,0 +1,33 @@
+#import "ITURLTextField.h"
+
+@implementation ITURLTextField
+
+- (void)dealloc
+{
+       [_url release];
+       [super dealloc];
+}
+
+/*- (void)mouseEntered:(NSEvent *)event
+{
+       NSLog(@"grr");
+       [[NSCursor pointingHandCursor] set];
+       [super mouseEntered:event];
+}
+
+- (void)mouseExited:(NSEvent *)event
+{
+       [[NSCursor arrowCursor] set];
+       [super mouseExited:event];
+}*/
+
+- (void)setURL:(NSURL *)url
+{
+       [_url release];
+       _url = [url retain];
+       
+       //Make an attributed string for the main stringValue now
+//     NSAttributedString *string = [[NSAttributedString alloc] initWithString:[self stringValue] attributes:];
+}
+
+@end