From: Kent Sutherland Date: Thu, 4 Aug 2005 17:50:52 +0000 (+0000) Subject: Added a new about box class. Added a text field that will eventually be clickable... X-Git-Tag: MenuTunes-1.6~5 X-Git-Url: http://git.ithinksw.org/ITKit.git/commitdiff_plain/d4f63699c141b36ccd7daff2d910e836af76dcfa Added a new about box class. Added a text field that will eventually be clickable to go to a URL. Added the about box nib. --- diff --git a/English.lproj/AboutBox.nib/classes.nib b/English.lproj/AboutBox.nib/classes.nib new file mode 100644 index 0000000..3d7b813 --- /dev/null +++ b/English.lproj/AboutBox.nib/classes.nib @@ -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 index 0000000..d214b83 --- /dev/null +++ b/English.lproj/AboutBox.nib/info.nib @@ -0,0 +1,16 @@ + + + + + IBDocumentLocation + 40 60 356 240 0 0 1152 746 + IBFramework Version + 439.0 + IBOpenObjects + + 5 + + IBSystem Version + 8C46 + + diff --git a/English.lproj/AboutBox.nib/keyedobjects.nib b/English.lproj/AboutBox.nib/keyedobjects.nib new file mode 100644 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 index 0000000..07ca399 --- /dev/null +++ b/ITAboutBox.h @@ -0,0 +1,26 @@ +// +// ITAboutBox.h +// ITKit +// +// Created by Kent Sutherland on 8/4/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import + +@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 index 0000000..276fd7d --- /dev/null +++ b/ITAboutBox.m @@ -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 --- a/ITKit.h +++ b/ITKit.h @@ -43,5 +43,8 @@ #import +#import +#import + #import #import \ No newline at end of file diff --git a/ITURLTextField.h b/ITURLTextField.h new file mode 100644 index 0000000..d72791a --- /dev/null +++ b/ITURLTextField.h @@ -0,0 +1,10 @@ +/* ITURLTextField */ + +#import + +@interface ITURLTextField : NSTextField +{ + NSURL *_url; +} +- (void)setURL:(NSURL *)url; +@end diff --git a/ITURLTextField.m b/ITURLTextField.m new file mode 100644 index 0000000..03dcdaa --- /dev/null +++ b/ITURLTextField.m @@ -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