+++ /dev/null
-/*
- * ITKit
- * ITChasingArrowsView
- * Animating Asynchronous Arrows Widget
- * *** DEPRECATED: NSProgressIndicator now offers an async mode. MLJ - 01/14/2003
- *
- * Original Author : Doug Brown <...>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
- *
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
- *
- */
-
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface ITChasingArrowsView : NSView
-{
- BOOL running, inForeground;
- int curIndex;
- NSTimer *timer;
- NSArray *images;
-}
-
-- (IBAction)stop:(id)sender;
-- (IBAction)start:(id)sender;
-
-
-@end
+++ /dev/null
-#import "ITChasingArrowsView.h"
-
-
-@implementation ITChasingArrowsView
-
-- (id)initWithCoder:(NSCoder *)decoder
-{
- self = [super initWithCoder:decoder];
-
- running = NO;
-
- images = [[decoder decodeObject] retain];
-
- curIndex = 0;
- timer = nil;
-
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder
-{
- [super encodeWithCoder:coder];
-
- [coder encodeObject:images];
-}
-
-- (id)initWithFrame:(NSRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- NSBundle *bund = [NSBundle bundleForClass:[self class]];
- running = NO;
- images = [[NSArray alloc] initWithObjects:
- [[[NSImage alloc] initWithContentsOfFile:[bund pathForImageResource:@"ITChasingArrow1.tiff"]] autorelease],
- [[[NSImage alloc] initWithContentsOfFile:[bund pathForImageResource:@"ITChasingArrow2.tiff"]] autorelease],
- [[[NSImage alloc] initWithContentsOfFile:[bund pathForImageResource:@"ITChasingArrow3.tiff"]] autorelease],
- [[[NSImage alloc] initWithContentsOfFile:[bund pathForImageResource:@"ITChasingArrow4.tiff"]] autorelease],
- [[[NSImage alloc] initWithContentsOfFile:[bund pathForImageResource:@"ITChasingArrow5.tiff"]] autorelease],
- [[[NSImage alloc] initWithContentsOfFile:[bund pathForImageResource:@"ITChasingArrow6.tiff"]] autorelease],
- [[[NSImage alloc] initWithContentsOfFile:[bund pathForImageResource:@"ITChasingArrow7.tiff"]] autorelease],
- [[[NSImage alloc] initWithContentsOfFile:[bund pathForImageResource:@"ITChasingArrow8.tiff"]] autorelease],
- [[[NSImage alloc] initWithContentsOfFile:[bund pathForImageResource:@"ITChasingArrow9.tiff"]] autorelease],
- [[[NSImage alloc] initWithContentsOfFile:[bund pathForImageResource:@"ITChasingArrow10.tiff"]] autorelease],
- nil];
-
- curIndex = 0;
- timer = nil;
- }
- return self;
-}
-
-- (void)dealloc
-{
- if (timer)
- {
- [timer invalidate];
- [timer release];
- timer = nil;
- }
- [images release];
-
- [super dealloc];
-}
-- (void)drawRect:(NSRect)rect {
-
- if (running)
- {
- NSImage *curImage = [images objectAtIndex:curIndex];
- float amt;
- if (inForeground)
- {
- amt = 1.0;
- }
- else
- {
- amt = 0.5;
- }
- [curImage compositeToPoint:NSMakePoint(0,0) operation:NSCompositeSourceOver fraction:amt];
- }
- else
- {
- // draw nothing.
- }
-}
-
-- (IBAction)stop:(id)sender
-{
- running = NO;
-
- if (timer)
- {
- NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
- [nc removeObserver:self];
- [timer invalidate];
- [timer release];
- timer = nil;
- }
-
- [self setNeedsDisplay:YES];
-}
-
-- (IBAction)start:(id)sender
-{
- if (!timer)
- {
- NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
- [nc addObserver:self selector:@selector(appWentToBackground:) name:NSApplicationWillResignActiveNotification object:nil];
- [nc addObserver:self selector:@selector(appWentToForeground:) name:NSApplicationWillBecomeActiveNotification object:nil];
- [nc addObserver:self selector:@selector(windowWentToBackground:) name:NSWindowDidResignMainNotification object:nil];
- [nc addObserver:self selector:@selector(windowWentToForeground:) name:NSWindowDidBecomeMainNotification object:nil];
- inForeground = ([NSApp isActive] && [[self window] isMainWindow]);
- curIndex = 0;
- running = YES;
- timer = [[NSTimer scheduledTimerWithTimeInterval:0.05
- target:self
- selector:@selector(showNewImage:)
- userInfo:nil
- repeats:YES] retain];
- [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];
- }
-}
-
-- (void)showNewImage:(NSTimer *)t
-{
- [self setNeedsDisplay:YES];
-
- if (curIndex == 9)
- {
- curIndex = 0;
- }
- else
- {
- curIndex++;
- }
-}
-
-- (void)appWentToBackground:(NSNotification *)note
-{
- inForeground = NO;
-}
-
-- (void)appWentToForeground:(NSNotification *)note
-{
- inForeground = YES;
-}
-
-- (void)windowWentToBackground:(NSNotification *)note
-{
- NSWindow *window = [note object];
- if (window == [self window])
- {
- inForeground = NO;
- }
-}
-
-- (void)windowWentToForeground:(NSNotification *)note
-{
- NSWindow *window = [note object];
- if (window == [self window])
- {
- inForeground = YES;
- }
-}
-
-
-@end
/*
* ITKit
- * ITBevelView
- * NSView subclass which draws a bevel.
+ * ITBevelView.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * NSView subclass which draws a bevel of specified thickness, and resizes its
+ * first subview to fill the remaining space.
*
- * Copyright (c) 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-/*
- * Draws a bevel of specified thickness, and resizes
- * its first subview to fill the remaining space.
- */
-
-
#import <Cocoa/Cocoa.h>
-
@interface ITBevelView : NSView {
- int _bevelDepth;
+ int _bevelDepth;
}
- (int)bevelDepth;
- (void)setBevelDepth:(int)newDepth;
-
-@end
+@end
\ No newline at end of file
#import "ITBevelView.h"
-
@implementation ITBevelView
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark INITIALIZATION METHODS
-/*************************************************************************/
-
-- (id)initWithFrame:(NSRect)frameRect
-{
- if ( (self = [super initWithFrame:frameRect]) ) {
- _bevelDepth = 5;
- [self setAutoresizesSubviews:NO];
- }
-
- return self;
+- (id)initWithFrame:(NSRect)frameRect {
+ if ((self = [super initWithFrame:frameRect])) {
+ _bevelDepth = 5;
+ [self setAutoresizesSubviews:NO];
+ }
+ return self;
}
-- (id)initWithCoder:(NSCoder *)coder
-{
- if ( ( self = [super initWithCoder:coder] ) ) {
- _bevelDepth = 5;
- [self setAutoresizesSubviews:NO];
- }
-
- return self;
+- (id)initWithCoder:(NSCoder *)coder {
+ if ((self = [super initWithCoder:coder])) {
+ _bevelDepth = 5;
+ [self setAutoresizesSubviews:NO];
+ }
+ return self;
}
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark ACCESSOR METHODS
-/*************************************************************************/
-
-- (int)bevelDepth
-{
- return _bevelDepth;
+- (int)bevelDepth {
+ return _bevelDepth;
}
-- (void)setBevelDepth:(int)newDepth
-{
- _bevelDepth = newDepth;
- [self setNeedsDisplay:YES];
+- (void)setBevelDepth:(int)newDepth {
+ _bevelDepth = newDepth;
+ [self setNeedsDisplay:YES];
}
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark INSTANCE METHODS
-/*************************************************************************/
-
-- (void)drawRect:(NSRect)aRect
-{
- NSRect frameRect = [self convertRect:[self frame] fromView:[self superview]];
- NSRect innerRect = NSMakeRect( (frameRect.origin.x + _bevelDepth),
- (frameRect.origin.y + _bevelDepth),
- (frameRect.size.width - (_bevelDepth * 2)),
- (frameRect.size.height - (_bevelDepth * 2)) );
-
- NSBezierPath *leftEdge = [NSBezierPath bezierPath];
- NSBezierPath *topEdge = [NSBezierPath bezierPath];
- NSBezierPath *rightEdge = [NSBezierPath bezierPath];
- NSBezierPath *bottomEdge = [NSBezierPath bezierPath];
-
- [[[self subviews] objectAtIndex:0] setFrame:innerRect];
-
- [leftEdge moveToPoint:frameRect.origin];
- [leftEdge lineToPoint:NSMakePoint(frameRect.origin.x, frameRect.size.height)];
- [leftEdge lineToPoint:NSMakePoint( (frameRect.origin.x + _bevelDepth), (frameRect.size.height - _bevelDepth) )];
- [leftEdge lineToPoint:NSMakePoint( (frameRect.origin.x + _bevelDepth), (frameRect.origin.y + _bevelDepth) )];
-
- [topEdge moveToPoint:NSMakePoint(frameRect.origin.x, frameRect.size.height)];
- [topEdge lineToPoint:NSMakePoint(frameRect.size.width, frameRect.size.height)];
- [topEdge lineToPoint:NSMakePoint( (frameRect.size.width - _bevelDepth), (frameRect.size.height - _bevelDepth) )];
- [topEdge lineToPoint:NSMakePoint( (frameRect.origin.x + _bevelDepth), (frameRect.size.height - _bevelDepth) )];
-
- [rightEdge moveToPoint:NSMakePoint(frameRect.size.width, frameRect.origin.y)];
- [rightEdge lineToPoint:NSMakePoint(frameRect.size.width, frameRect.size.height)];
- [rightEdge lineToPoint:NSMakePoint( (frameRect.size.width - _bevelDepth), (frameRect.size.height - _bevelDepth) )];
- [rightEdge lineToPoint:NSMakePoint( (frameRect.size.width - _bevelDepth), (_bevelDepth) )];
-
- [bottomEdge moveToPoint:frameRect.origin];
- [bottomEdge lineToPoint:NSMakePoint(frameRect.size.width, frameRect.origin.y)];
- [bottomEdge lineToPoint:NSMakePoint( (frameRect.size.width - _bevelDepth), (_bevelDepth) )];
- [bottomEdge lineToPoint:NSMakePoint( (frameRect.origin.x + _bevelDepth), (frameRect.origin.y + _bevelDepth) )];
-
- [[NSColor colorWithCalibratedWhite:0.5 alpha:0.5] set];
- [leftEdge fill];
- [[NSColor colorWithCalibratedWhite:0.0 alpha:0.5] set];
- [topEdge fill];
- [[NSColor colorWithCalibratedWhite:0.5 alpha:0.5] set];
- [rightEdge fill];
- [[NSColor colorWithCalibratedWhite:1.0 alpha:0.6] set];
- [bottomEdge fill];
-
- [[[self subviews] objectAtIndex:0] setNeedsDisplay:YES];
+- (void)drawRect:(NSRect)aRect {
+ NSRect frameRect = [self convertRect:[self frame] fromView:[self superview]];
+ NSRect innerRect = NSMakeRect((frameRect.origin.x + _bevelDepth), (frameRect.origin.y + _bevelDepth), (frameRect.size.width - (_bevelDepth * 2)), (frameRect.size.height - (_bevelDepth * 2)));
+
+ NSBezierPath *leftEdge = [NSBezierPath bezierPath];
+ NSBezierPath *topEdge = [NSBezierPath bezierPath];
+ NSBezierPath *rightEdge = [NSBezierPath bezierPath];
+ NSBezierPath *bottomEdge = [NSBezierPath bezierPath];
+
+ [[[self subviews] objectAtIndex:0] setFrame:innerRect];
+
+ [leftEdge moveToPoint:frameRect.origin];
+ [leftEdge lineToPoint:NSMakePoint(frameRect.origin.x, frameRect.size.height)];
+ [leftEdge lineToPoint:NSMakePoint((frameRect.origin.x + _bevelDepth), (frameRect.size.height - _bevelDepth))];
+ [leftEdge lineToPoint:NSMakePoint((frameRect.origin.x + _bevelDepth), (frameRect.origin.y + _bevelDepth))];
+
+ [topEdge moveToPoint:NSMakePoint(frameRect.origin.x, frameRect.size.height)];
+ [topEdge lineToPoint:NSMakePoint(frameRect.size.width, frameRect.size.height)];
+ [topEdge lineToPoint:NSMakePoint((frameRect.size.width - _bevelDepth), (frameRect.size.height - _bevelDepth))];
+ [topEdge lineToPoint:NSMakePoint((frameRect.origin.x + _bevelDepth), (frameRect.size.height - _bevelDepth))];
+
+ [rightEdge moveToPoint:NSMakePoint(frameRect.size.width, frameRect.origin.y)];
+ [rightEdge lineToPoint:NSMakePoint(frameRect.size.width, frameRect.size.height)];
+ [rightEdge lineToPoint:NSMakePoint((frameRect.size.width - _bevelDepth), (frameRect.size.height - _bevelDepth))];
+ [rightEdge lineToPoint:NSMakePoint((frameRect.size.width - _bevelDepth), _bevelDepth)];
+
+ [bottomEdge moveToPoint:frameRect.origin];
+ [bottomEdge lineToPoint:NSMakePoint(frameRect.size.width, frameRect.origin.y)];
+ [bottomEdge lineToPoint:NSMakePoint((frameRect.size.width - _bevelDepth), _bevelDepth)];
+ [bottomEdge lineToPoint:NSMakePoint((frameRect.origin.x + _bevelDepth), (frameRect.origin.y + _bevelDepth))];
+
+ [[NSColor colorWithCalibratedWhite:0.5 alpha:0.5] set];
+ [leftEdge fill];
+ [[NSColor colorWithCalibratedWhite:0.0 alpha:0.5] set];
+ [topEdge fill];
+ [[NSColor colorWithCalibratedWhite:0.5 alpha:0.5] set];
+ [rightEdge fill];
+ [[NSColor colorWithCalibratedWhite:1.0 alpha:0.6] set];
+ [bottomEdge fill];
+
+ [[[self subviews] objectAtIndex:0] setNeedsDisplay:YES];
}
-- (BOOL)mouseDownCanMoveWindow
-{
- return NO;
+- (BOOL)mouseDownCanMoveWindow {
+ return NO;
}
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark DEALLOCATION METHOD
-/*************************************************************************/
-
-- (void)dealloc
-{
+- (void)dealloc {
[super dealloc];
}
-
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITButton
- * Stylized button for use in Status Windows.
+ * ITButton.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * Custom NSButton subclass that uses ITButtonCell.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
-
@interface ITButton : NSButton {
}
-@end
+@end
\ No newline at end of file
#import "ITButton.h"
#import "ITButtonCell.h"
-
@implementation ITButton
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark INITIALIZATION METHODS
-/*************************************************************************/
-
-+ (void)initialize
-{
- if ( self == [ITButton class] ) {
- [self setCellClass:[ITButtonCell class]];
- }
++ (void)initialize {
+ if (self == [ITButton class]) {
+ [self setCellClass:[ITButtonCell class]];
+ }
}
-+ (Class)cellClass
-{
- return [ITButtonCell class];
++ (Class)cellClass {
+ return [ITButtonCell class];
}
- (void)displayIfNeeded {
- [super displayIfNeededIgnoringOpacity];
+ [super displayIfNeededIgnoringOpacity];
}
- (void)displayIfNeededInRect:(NSRect)aRect {
- [super displayIfNeededInRectIgnoringOpacity:aRect];
+ [super displayIfNeededInRectIgnoringOpacity:aRect];
}
- (void)displayRect:(NSRect)aRect {
- [super displayRectIgnoringOpacity:aRect];
+ [super displayRectIgnoringOpacity:aRect];
}
-- (id)initWithCoder:(NSCoder *)coder
-{
- if ( ( self = [super initWithCoder:coder] ) ) {
- ITButtonCell *cell = [[ITButtonCell alloc] init];
- [self setCell:cell];
- }
- return self;
+- (id)initWithCoder:(NSCoder *)coder {
+ if ((self = [super initWithCoder:coder])) {
+ ITButtonCell *cell = [[ITButtonCell alloc] init];
+ [self setCell:cell];
+ }
+ return self;
}
-- (BOOL)isOpaque
-{
- return NO;
+- (BOOL)isOpaque {
+ return NO;
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITButtonCell
- * Cell used by the ITButton control.
+ * ITButtonCell.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * Custom NSButtonCell subclass that provides a stylized bezel style for use
+ * with ITStatusWindows.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
-
typedef enum _ITBezelStyle {
- ITGrayRoundedBezelStyle = 1001
+ ITGrayRoundedBezelStyle = 1001
} ITBezelStyle;
-
@interface ITButtonCell : NSButtonCell {
-
- ITBezelStyle _subStyle;
-
+ ITBezelStyle _subStyle;
}
-
-@end
+@end
\ No newline at end of file
#import "ITButtonCell.h"
-#import "ITTextFieldCell.h"
-
#define GRAY_EXTRA_PAD_H 60.0
-
@interface ITButtonCell (Private)
- (void)drawGrayRoundedBezelWithFrame:(NSRect)rect inView:(NSView *)controlView;
@end
-
@implementation ITButtonCell
-- (id)init
-{
- if ( ( self = [super init] ) ) {
- _subStyle = 0;
- }
-
- return self;
+- (id)init {
+ if ((self = [super init])) {
+ _subStyle = 0;
+ }
+ return self;
}
-
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark INSTANCE METHODS
-/*************************************************************************/
-
-- (void)setBezelStyle:(NSBezelStyle)bezelStyle
-{
- if ( bezelStyle == ITGrayRoundedBezelStyle ) {
- _subStyle = bezelStyle;
- bezelStyle = NSRegularSquareBezelStyle;
- } else {
- _subStyle = 0;
- }
-
- [super setBezelStyle:bezelStyle];
+- (void)setBezelStyle:(NSBezelStyle)bezelStyle {
+ if (bezelStyle == ITGrayRoundedBezelStyle) {
+ _subStyle = bezelStyle;
+ bezelStyle = NSRegularSquareBezelStyle;
+ } else {
+ _subStyle = 0;
+ }
+ [super setBezelStyle:bezelStyle];
}
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark DRAWING METHODS
-/*************************************************************************/
-
-- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView
-{
- if ( _subStyle == ITGrayRoundedBezelStyle ) {
- [self drawGrayRoundedBezelWithFrame:rect inView:controlView];
- if ( [self attributedTitle] ) {
- NSPoint stringOrigin;
- NSSize stringSize;
- stringSize = [[self attributedTitle] size];
- stringOrigin.x = rect.origin.x + (rect.size.width - stringSize.width)/2;
- stringOrigin.y = (rect.origin.y + (rect.size.height - stringSize.height)/2) - 2;
- [controlView lockFocus];
- [[self attributedTitle] drawAtPoint:stringOrigin];
- [controlView unlockFocus];
- } else {
- [super drawInteriorWithFrame:rect inView:controlView];
- }
- [[controlView superview] setNeedsDisplay:YES];
- } else {
- [super drawWithFrame:rect inView:controlView];
- }
+- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView {
+ if (_subStyle == ITGrayRoundedBezelStyle) {
+ [self drawGrayRoundedBezelWithFrame:rect inView:controlView];
+ if ([self attributedTitle]) {
+ NSPoint stringOrigin;
+ NSSize stringSize;
+ stringSize = [[self attributedTitle] size];
+ stringOrigin.x = rect.origin.x + (rect.size.width - stringSize.width) / 2;
+ stringOrigin.y = (rect.origin.y + (rect.size.height - stringSize.height) / 2) - 2;
+ [controlView lockFocus];
+ [[self attributedTitle] drawAtPoint:stringOrigin];
+ [controlView unlockFocus];
+ } else {
+ [super drawInteriorWithFrame:rect inView:controlView];
+ }
+ [[controlView superview] setNeedsDisplay:YES];
+ } else {
+ [super drawWithFrame:rect inView:controlView];
+ }
}
-- (void)drawGrayRoundedBezelWithFrame:(NSRect)rect inView:(NSView *)controlView
-{
- NSBezierPath *path = [NSBezierPath bezierPath];
- float ch = rect.size.height;
- float cw = rect.size.width;
- float radius = ( ch / 2 );
- NSPoint pointA = NSMakePoint( (ch / 2) , 0.0 );
- NSPoint pointB = NSMakePoint( (cw - (ch / 2)) , 0.0 );
-// NSPoint pointC = NSMakePoint( (cw - (ch / 2)) , ch );
- NSPoint pointD = NSMakePoint( (ch / 2) , ch );
- NSPoint lCtr = NSMakePoint( (ch / 2) , (ch / 2) );
- NSPoint rCtr = NSMakePoint( (cw - (ch / 2)) , (ch / 2) );
- float alpha = 0.45;
-
- [path moveToPoint:pointA];
- [path lineToPoint:pointB];
- [path appendBezierPathWithArcWithCenter:rCtr
- radius:radius
- startAngle:270.0
- endAngle:90.0];
- [path lineToPoint:pointD];
- [path appendBezierPathWithArcWithCenter:lCtr
- radius:radius
- startAngle:90.0
- endAngle:270.0];
-
- if ( [self isHighlighted] ) {
- alpha = 0.60;
- }
-
- [[NSColor colorWithCalibratedWhite:0.15 alpha:alpha] set];
- [path fill];
+- (void)drawGrayRoundedBezelWithFrame:(NSRect)rect inView:(NSView *)controlView {
+ NSBezierPath *path = [NSBezierPath bezierPath];
+ float ch = rect.size.height;
+ float cw = rect.size.width;
+ float radius = (ch / 2);
+ NSPoint pointA = NSMakePoint((ch / 2), 0.0);
+ NSPoint pointB = NSMakePoint((cw - (ch / 2)), 0.0);
+// NSPoint pointC = NSMakePoint((cw - (ch / 2)), ch);
+ NSPoint pointD = NSMakePoint((ch / 2), ch);
+ NSPoint lCtr = NSMakePoint((ch / 2), (ch / 2));
+ NSPoint rCtr = NSMakePoint((cw - (ch / 2)), (ch / 2));
+ float alpha = 0.45;
+
+ [path moveToPoint:pointA];
+ [path lineToPoint:pointB];
+ [path appendBezierPathWithArcWithCenter:rCtr radius:radius startAngle:270.0 endAngle:90.0];
+ [path lineToPoint:pointD];
+ [path appendBezierPathWithArcWithCenter:lCtr radius:radius startAngle:90.0 endAngle:270.0];
+
+ if ([self isHighlighted]) {
+ alpha = 0.60;
+ }
+
+ [[NSColor colorWithCalibratedWhite:0.15 alpha:alpha] set];
+ [path fill];
}
-- (BOOL)isOpaque
-{
- return NO;
+- (BOOL)isOpaque {
+ return NO;
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITCategory-NSMenu.h
- * Category which extends NSMenu
+ * ITCategory-NSMenu.h
*
- * Original Author : Joseph Spiros <joseph.spiros@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
*
- * Copyright (c) 2002 - 2004 iThink Software.
- * All Rights Reserved
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
-@interface NSMenu (ITCategory)
+@interface NSMenu (ITKitCategory)
- (void)indentItem:(id <NSMenuItem>)item;
- (void)indentItemAtIndex:(int)index;
- (MenuRef)menuRef;
- (void)removeAllItems;
-@end
+@end
\ No newline at end of file
#import "ITCategory-NSMenu.h"
-@interface NSMenu (HACKHACKHACKHACK)
+extern void _NSGetMenuItemForCommandKeyEvent(NSMenu *menu, void *chicken, void *taco, void *food);
+extern MenuRef _NSGetCarbonMenu(NSMenu *menu);
+
+@interface NSMenu (ITKitCategoryHacks)
- (id)_menuImpl;
@end
-extern void _NSGetMenuItemForCommandKeyEvent (NSMenu *menu, void *chicken, void *taco, void *food);
-extern MenuRef _NSGetCarbonMenu( NSMenu *menu);
+@protocol _ITKitCategoryNSMenuItemPantherCompatability <NSMenuItem>
+- (int)indentationLevel;
+- (void)setIndentationLevel:(int)indentationLevel;
+@end
-@implementation NSMenu (ITCategory)
+@implementation NSMenu (ITKitCategory)
- (void)indentItem:(id <NSMenuItem>)item {
[self indentItem:item toLevel:1];
}
- (void)indentItemAtIndex:(int)index toLevel:(int)indentLevel {
- if ([[self itemAtIndex:index] respondsToSelector:@selector(setIndentationLevel:)]) {
- (void)[[self itemAtIndex:index] setIndentationLevel:indentLevel];
+ id <NSMenuItem> theItem = [self itemAtIndex:index];
+ if ([theItem respondsToSelector:@selector(setIndentationLevel:)]) {
+ [(id <_ITKitCategoryNSMenuItemPantherCompatability>)theItem setIndentationLevel:indentLevel];
} else {
MenuRef carbonMenu = [self menuRef];
if (carbonMenu) {
MenuRef carbonMenu;
int w00t, m00f;
- if( [self respondsToSelector:@selector(_menuImpl)] ) {
+ if ([self respondsToSelector:@selector(_menuImpl)]) {
(void)[self _menuImpl];
} else {
return nil;
}
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITCategory-NSView.h
- * Category which extends NSView
+ * ITCategory-NSView.h
*
- * Original Author : Joseph Spiros <joseph.spiros@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
*
- * Copyright (c) 2002 - 2004 iThink Software.
- * All Rights Reserved
+ * $Id$
*
*/
-
-
-#import <AppKit/AppKit.h>
+#import <Cocoa/Cocoa.h>
-@interface NSView (ITCategory)
+@interface NSView (ITKitCategory)
- (void)removeAllSubviews;
- (void)removeSubview:(NSView *)subview;
-@end
+@end
\ No newline at end of file
#import "ITCategory-NSView.h"
-
-@implementation NSView (ITCategory)
+@implementation NSView (ITKitCategory)
- (void)removeAllSubviews {
[[self subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
}
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITCoreGraphicsHacks
- * Header to import to work with private CoreGraphics API
+ * ITCoreGraphicsHacks.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Header to import to work with private CoreGraphics API.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark CoreGraphics HACK HACK HACK
-/*************************************************************************/
-
typedef void * CGSGenericObj;
typedef CGSGenericObj CGSValueObj;
typedef void * CGSConnectionID;
typedef void * CGSWindowID;
typedef struct CGStyle *CGStyleRef;
typedef struct CGShadowStyle {
- unsigned int version;
- float elevation;
- float azimuth;
- float ambient;
- float height;
- float radius;
- float saturation;
+ unsigned int version;
+ float elevation;
+ float azimuth;
+ float ambient;
+ float height;
+ float radius;
+ float saturation;
} CGShadowStyle;
typedef unsigned char CGSBoolean;
enum {
- kCGSFalse = 0,
- kCGSTrue = 1
+ kCGSFalse = 0,
+ kCGSTrue = 1
};
-extern void CGStyleRelease(CGStyleRef style);
-extern void CGSReleaseObj(void *obj);
-extern void CGContextSetStyle(CGContextRef c, CGStyleRef style);
-extern void CGStyleRelease(CGStyleRef style);
-extern CGStyleRef CGStyleCreateShadow(const CGShadowStyle *shadow);
+extern void CGStyleRelease(CGStyleRef style);
+extern void CGSReleaseObj(void *obj);
+extern void CGContextSetStyle(CGContextRef c, CGStyleRef style);
+extern void CGStyleRelease(CGStyleRef style);
+extern CGStyleRef CGStyleCreateShadow(const CGShadowStyle *shadow);
extern CGSValueObj CGSCreateCString(const char *string);
extern CGSValueObj CGSCreateBoolean(CGSBoolean boolean);
-extern CGError CGSSetWindowProperty(const CGSConnectionID cid, CGSWindowID wid, const CGSValueObj key, const CGSValueObj value);
-
+extern CGError CGSSetWindowProperty(const CGSConnectionID cid, CGSWindowID wid, const CGSValueObj key, const CGSValueObj value);
+
extern CGError CGSSetWindowWarp(const CGSConnectionID cid, CGSWindowID wid, int w,int h, float *mesh);
extern CGError CGSSetWindowTransform(const CGSConnectionID cid, CGSWindowID wid, CGAffineTransform transform);
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark NSApplication HACK HACK HACK
-/*************************************************************************/
-
-@interface NSApplication (HACKHACKHACKHACK)
+@interface NSApplication (ITCoreGraphicsHacks)
- (CGSConnectionID)contextID;
-@end
-
-
+@end
\ No newline at end of file
/*
* ITKit
- * ITCutWindowEffect
- * Effect subclass which performs a simple cut in or out, with no transition.
+ * ITCutWindowEffect.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Effect subclass which performs a simple cut in or out, with no transition.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
#import "ITWindowEffect.h"
-
-@interface ITCutWindowEffect : ITWindowEffect <ITWindowEffect> {
+@interface ITCutWindowEffect : ITWindowEffect {
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITDissolveWindowEffect
- * Effect subclass which performs a dissolve fade effect on a window.
+ * ITDissolveWindowEffect.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Effect subclass which performs a dissolve fade effect on a window.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
#import "ITWindowEffect.h"
-
-@interface ITDissolveWindowEffect : ITWindowEffect <ITWindowEffect> {
+@interface ITDissolveWindowEffect : ITWindowEffect {
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITHotKey
+ * ITHotKey.h
*
- * Original Author : Quentin Carnicelli <...>
- * Responsibility : Kent Sutherland <kent.sutherland@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * $Id$
*
*/
+#import <Cocoa/Cocoa.h>
-#import <Foundation/Foundation.h>
-#import "ITKeyCombo.h"
+@class ITKeyCombo;
-
-@interface ITHotKey : NSObject
-{
- NSString* mName;
- ITKeyCombo* mKeyCombo;
- id mTarget;
- SEL mAction;
+@interface ITHotKey : NSObject {
+ NSString *mName;
+ ITKeyCombo *mKeyCombo;
+ id mTarget;
+ SEL mAction;
}
- (id)init;
-- (void)setName: (NSString*)name;
-- (NSString*)name;
+- (void)setName:(NSString *)name;
+- (NSString *)name;
-- (void)setKeyCombo: (ITKeyCombo*)combo;
-- (ITKeyCombo*)keyCombo;
+- (void)setKeyCombo:(ITKeyCombo *)combo;
+- (ITKeyCombo *)keyCombo;
-- (void)setTarget: (id)target;
+- (void)setTarget:(id)target;
- (id)target;
-- (void)setAction: (SEL)action;
+- (void)setAction:(SEL)action;
- (SEL)action;
- (void)invoke;
-@end
+@end
\ No newline at end of file
-//
-// ITHotKey.m
-//
-// Created by Quentin Carnicelli on Sat Aug 02 2003.
-// Copyright (c) 2003 iThink Software. All rights reserved.
-//
-
#import "ITHotKey.h"
-
-#import "ITHotKeyCenter.h"
#import "ITKeyCombo.h"
@implementation ITHotKey
-- (id)init
-{
- if ( (self = [super init]) )
- {
- [self setKeyCombo: [ITKeyCombo clearKeyCombo]];
+- (id)init {
+ if ((self = [super init])) {
+ [self setKeyCombo:[ITKeyCombo clearKeyCombo]];
}
-
return self;
}
-- (void)dealloc
-{
+- (void)dealloc {
[mName release];
[mKeyCombo release];
-
[super dealloc];
}
-- (NSString*)description
-{
- return [NSString stringWithFormat: @"<%@: %@>",
- NSStringFromClass( [self class] ),
- [self keyCombo]];
+- (NSString *)description {
+ return [NSString stringWithFormat:@"<%@: %@>", NSStringFromClass([self class]), [self keyCombo]];
}
-#pragma mark -
-
-- (void)setKeyCombo: (ITKeyCombo*)combo
-{
- [combo retain];
- [mKeyCombo release];
- mKeyCombo = combo;
+- (void)setKeyCombo:(ITKeyCombo *)combo {
+ [mKeyCombo autorelease];
+ mKeyCombo = [combo retain];
}
-- (ITKeyCombo*)keyCombo
-{
+- (ITKeyCombo *)keyCombo {
return mKeyCombo;
}
-- (void)setName: (NSString*)name
-{
- [name retain];
- [mName release];
- mName = name;
+- (void)setName:(NSString *)name {
+ [mName autorelease];
+ mName = [name retain];
}
-- (NSString*)name
-{
+- (NSString *)name {
return mName;
}
-- (void)setTarget: (id)target
-{
+- (void)setTarget:(id)target {
mTarget = target;
}
-- (id)target
-{
+- (id)target {
return mTarget;
}
-- (void)setAction: (SEL)action
-{
+- (void)setAction:(SEL)action {
mAction = action;
}
-- (SEL)action
-{
+- (SEL)action {
return mAction;
}
-- (void)invoke
-{
- [mTarget performSelector: mAction withObject: self];
+- (void)invoke {
+ [mTarget performSelector:mAction withObject:self];
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITHotKeyCenter
+ * ITHotKeyCenter.h
*
- * Original Author : Quentin Carnicelli <...>
- * Responsibility : Kent Sutherland <kent.sutherland@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * $Id$
*
*/
-
-#import <AppKit/AppKit.h>
-
+#import <Cocoa/Cocoa.h>
@class ITHotKey;
-
-@interface ITHotKeyCenter : NSObject
-{
- NSMutableDictionary* mHotKeys; //Keys are NSValue of EventHotKeyRef
- BOOL mEventHandlerInstalled;
- BOOL _enabled;
+@interface ITHotKeyCenter : NSObject {
+ NSMutableDictionary *mHotKeys; //Keys are NSValue of EventHotKeyRef
+ BOOL mEventHandlerInstalled;
+ BOOL _enabled;
}
+ (id)sharedCenter;
- (BOOL)isEnabled;
- (void)setEnabled:(BOOL)flag;
-- (BOOL)registerHotKey: (ITHotKey*)hotKey;
-- (void)unregisterHotKey: (ITHotKey*)hotKey;
-
-- (NSArray*)allHotKeys;
+- (BOOL)registerHotKey:(ITHotKey *)hotKey;
+- (void)unregisterHotKey:(ITHotKey *)hotKey;
-- (void)sendEvent: (NSEvent*)event;
+- (NSArray *)allHotKeys;
+- (void)sendEvent:(NSEvent *)event;
-@end
+@end
\ No newline at end of file
-//
-// ITHotKeyCenter.m
-//
-// Created by Quentin Carnicelli on Sat Aug 02 2003.
-// Copyright (c) 2003 iThink Software. All rights reserved.
-//
-
#import "ITHotKeyCenter.h"
#import "ITHotKey.h"
#import "ITKeyCombo.h"
#import <Carbon/Carbon.h>
-#if __PROTEIN__
-#import "NSObjectAdditions.h"
-#endif
-
@interface ITHotKeyCenter (Private)
- (BOOL)_hasCarbonEventSupport;
-- (ITHotKey*)_hotKeyForCarbonHotKey: (EventHotKeyRef)carbonHotKey;
-- (EventHotKeyRef)_carbonHotKeyForHotKey: (ITHotKey*)hotKey;
+- (ITHotKey *)_hotKeyForCarbonHotKey:(EventHotKeyRef)carbonHotKey;
+- (EventHotKeyRef)_carbonHotKeyForHotKey:(ITHotKey *)hotKey;
- (void)_updateEventHandler;
-- (void)_hotKeyDown: (ITHotKey*)hotKey;
-- (void)_hotKeyUp: (ITHotKey*)hotKey;
-static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void* refCon );
+- (void)_hotKeyDown:(ITHotKey *)hotKey;
+- (void)_hotKeyUp:(ITHotKey *)hotKey;
+
+static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void *refCon);
@end
@implementation ITHotKeyCenter
-static id _sharedHotKeyCenter = nil;
+static ITHotKeyCenter *_sharedHotKeyCenter = nil;
-+ (id)sharedCenter
-{
- if( _sharedHotKeyCenter == nil )
- {
++ (id)sharedCenter {
+ if (!_sharedHotKeyCenter) {
_sharedHotKeyCenter = [[self alloc] init];
- #if __PROTEIN__
- [_sharedHotKeyCenter releaseOnTerminate];
- #endif
}
-
return _sharedHotKeyCenter;
}
-- (id)init
-{
- self = [super init];
-
- if( self )
- {
+- (id)init {
+ if ((self = [super init])) {
mHotKeys = [[NSMutableDictionary alloc] init];
_enabled = YES;
}
-
return self;
}
-- (void)dealloc
-{
+- (void)dealloc {
[mHotKeys release];
[super dealloc];
}
-#pragma mark -
-
-- (BOOL)isEnabled
-{
+- (BOOL)isEnabled {
return _enabled;
}
-- (void)setEnabled:(BOOL)flag
-{
+- (void)setEnabled:(BOOL)flag {
_enabled = flag;
}
-- (BOOL)registerHotKey: (ITHotKey*)hotKey
-{
- OSStatus err;
+- (BOOL)registerHotKey:(ITHotKey *)hotKey {
EventHotKeyID hotKeyID;
EventHotKeyRef carbonHotKey;
- NSValue* key;
-
- if( [[self allHotKeys] containsObject: hotKey] == YES )
- [self unregisterHotKey: hotKey];
+ NSValue *key;
+
+ if ([[self allHotKeys] containsObject:hotKey]) {
+ [self unregisterHotKey:hotKey];
+ }
- if( [[hotKey keyCombo] isValidHotKeyCombo] == NO )
+ if (![[hotKey keyCombo] isValidHotKeyCombo]) {
return YES;
+ }
hotKeyID.signature = 'PTHk';
hotKeyID.id = (long)hotKey;
- err = RegisterEventHotKey( [[hotKey keyCombo] keyCode],
- [[hotKey keyCombo] modifiers],
- hotKeyID,
- GetEventDispatcherTarget(),
- nil,
- &carbonHotKey );
-
- if( err )
+ if (RegisterEventHotKey([[hotKey keyCombo] keyCode], [[hotKey keyCombo] modifiers], hotKeyID, GetEventDispatcherTarget(), nil, &carbonHotKey)) {
return NO;
-
- key = [NSValue valueWithPointer: carbonHotKey];
- [mHotKeys setObject: hotKey forKey: key];
-
+ }
+
+ key = [NSValue valueWithPointer:carbonHotKey];
+ [mHotKeys setObject:hotKey forKey:key];
+
[self _updateEventHandler];
return YES;
}
-- (void)unregisterHotKey: (ITHotKey*)hotKey
-{
+- (void)unregisterHotKey:(ITHotKey *)hotKey {
OSStatus err;
EventHotKeyRef carbonHotKey;
- NSValue* key;
-
- if( [[self allHotKeys] containsObject: hotKey] == NO )
+ NSValue *key;
+
+ if (![[self allHotKeys] containsObject:hotKey]) {
return;
+ }
- carbonHotKey = [self _carbonHotKeyForHotKey: hotKey];
- NSAssert( carbonHotKey != nil, @"" );
-
- err = UnregisterEventHotKey( carbonHotKey );
- //Watch as we ignore 'err':
-
- key = [NSValue valueWithPointer: carbonHotKey];
- [mHotKeys removeObjectForKey: key];
+ carbonHotKey = [self _carbonHotKeyForHotKey:hotKey];
+ NSAssert(carbonHotKey, @"");
+
+ err = UnregisterEventHotKey(carbonHotKey);
+
+ key = [NSValue valueWithPointer:carbonHotKey];
+ [mHotKeys removeObjectForKey:key];
[self _updateEventHandler];
-
- //See that? Completely ignored
}
-- (NSArray*)allHotKeys
-{
+- (NSArray *)allHotKeys {
return [mHotKeys allValues];
}
-#pragma mark -
-
-- (BOOL)_hasCarbonEventSupport
-{
- return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_1;
+- (BOOL)_hasCarbonEventSupport {
+ return (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_1);
}
-- (ITHotKey*)_hotKeyForCarbonHotKey: (EventHotKeyRef)carbonHotKey
-{
- NSValue* key = [NSValue valueWithPointer: carbonHotKey];
- return [mHotKeys objectForKey: key];
+- (ITHotKey *)_hotKeyForCarbonHotKey:(EventHotKeyRef)carbonHotKey {
+ NSValue *key = [NSValue valueWithPointer:carbonHotKey];
+ return [mHotKeys objectForKey:key];
}
-- (EventHotKeyRef)_carbonHotKeyForHotKey: (ITHotKey*)hotKey
-{
- NSArray* values;
- NSValue* value;
+- (EventHotKeyRef)_carbonHotKeyForHotKey:(ITHotKey *)hotKey {
+ NSArray *values;
+ NSValue *value;
- values = [mHotKeys allKeysForObject: hotKey];
- NSAssert( [values count] == 1, @"Failed to find Carbon Hotkey for ITHotKey" );
+ values = [mHotKeys allKeysForObject:hotKey];
+ NSAssert(([values count] == 1), @"Failed to find Carbon Hotkey for ITHotKey");
value = [values lastObject];
return (EventHotKeyRef)[value pointerValue];
}
-- (void)_updateEventHandler
-{
- if( [self _hasCarbonEventSupport] == NO ) //Don't use event handler on these systems
+- (void)_updateEventHandler {
+ if (![self _hasCarbonEventSupport]) {
return;
-
- if( [mHotKeys count] && mEventHandlerInstalled == NO )
- {
+ }
+
+ if ([mHotKeys count] && !mEventHandlerInstalled) {
EventTypeSpec eventSpec[2] = {
{ kEventClassKeyboard, kEventHotKeyPressed },
{ kEventClassKeyboard, kEventHotKeyReleased }
- };
-
- InstallEventHandler( GetEventDispatcherTarget(),
- (EventHandlerProcPtr)hotKeyEventHandler,
- 2, eventSpec, nil, nil);
-
+ };
+
+ InstallEventHandler(GetEventDispatcherTarget(), (EventHandlerProcPtr)hotKeyEventHandler, 2, eventSpec, nil, nil);
+
mEventHandlerInstalled = YES;
}
}
-- (void)_hotKeyDown: (ITHotKey*)hotKey
-{
+- (void)_hotKeyDown:(ITHotKey *)hotKey {
[hotKey invoke];
}
-- (void)_hotKeyUp: (ITHotKey*)hotKey
-{
+- (void)_hotKeyUp:(ITHotKey *)hotKey {
}
-- (void)sendEvent: (NSEvent*)event
-{
+- (void)sendEvent:(NSEvent *)event {
long subType;
EventHotKeyRef carbonHotKey;
}
//We only have to intercept sendEvent to do hot keys on old system versions
- if( [self _hasCarbonEventSupport] )
+ if ([self _hasCarbonEventSupport]) {
return;
+ }
- if( [event type] == NSSystemDefined )
- {
+ if ([event type] == NSSystemDefined) {
subType = [event subtype];
- if( subType == 6 ) //6 is hot key down
- {
- carbonHotKey= (EventHotKeyRef)[event data1]; //data1 is our hot key ref
- if( carbonHotKey != nil )
- {
- ITHotKey* hotKey = [self _hotKeyForCarbonHotKey: carbonHotKey];
- [self _hotKeyDown: hotKey];
+ if (subType == 6) { //6 is hot key down
+ carbonHotKey = (EventHotKeyRef)[event data1]; //data1 is our hot key ref
+ if (carbonHotKey) {
+ ITHotKey *hotKey = [self _hotKeyForCarbonHotKey:carbonHotKey];
+ [self _hotKeyDown:hotKey];
}
- }
- else if( subType == 9 ) //9 is hot key up
- {
- carbonHotKey= (EventHotKeyRef)[event data1];
- if( carbonHotKey != nil )
- {
- ITHotKey* hotKey = [self _hotKeyForCarbonHotKey: carbonHotKey];
- [self _hotKeyUp: hotKey];
+ } else if (subType == 9) { //9 is hot key up
+ carbonHotKey = (EventHotKeyRef)[event data1];
+ if (carbonHotKey) {
+ ITHotKey *hotKey = [self _hotKeyForCarbonHotKey:carbonHotKey];
+ [self _hotKeyUp:hotKey];
}
}
}
}
-- (OSStatus)sendCarbonEvent: (EventRef)event
-{
+- (OSStatus)sendCarbonEvent:(EventRef)event {
OSStatus err;
EventHotKeyID hotKeyID;
- ITHotKey* hotKey;
+ ITHotKey *hotKey;
if (!_enabled) {
return -1;
}
- NSAssert( [self _hasCarbonEventSupport], @"" );
- NSAssert( GetEventClass( event ) == kEventClassKeyboard, @"Unknown event class" );
+ NSAssert([self _hasCarbonEventSupport], @"");
+ NSAssert((GetEventClass(event) == kEventClassKeyboard), @"Unknown event class");
- err = GetEventParameter( event,
- kEventParamDirectObject,
- typeEventHotKeyID,
- nil,
- sizeof(EventHotKeyID),
- nil,
- &hotKeyID );
- if( err )
+ if ((err = GetEventParameter(event, kEventParamDirectObject, typeEventHotKeyID, nil, sizeof(EventHotKeyID), nil, &hotKeyID))) {
return err;
+ }
+ NSAssert((hotKeyID.signature == 'PTHk'), @"Invalid hot key id");
+ NSAssert((hotKeyID.id != nil), @"Invalid hot key id");
- NSAssert( hotKeyID.signature == 'PTHk', @"Invalid hot key id" );
- NSAssert( hotKeyID.id != nil, @"Invalid hot key id" );
-
- hotKey = (ITHotKey*)hotKeyID.id;
-
- switch( GetEventKind( event ) )
- {
+ hotKey = (ITHotKey *)hotKeyID.id;
+
+ switch (GetEventKind(event)) {
case kEventHotKeyPressed:
- [self _hotKeyDown: hotKey];
- break;
-
+ [self _hotKeyDown:hotKey];
+ break;
case kEventHotKeyReleased:
- [self _hotKeyUp: hotKey];
- break;
-
+ [self _hotKeyUp:hotKey];
+ break;
default:
- NSAssert( 0, @"Unknown event kind" );
- break;
+ NSAssert(NO, @"Unknown event kind");
+ break;
}
return noErr;
}
-static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void* refCon )
-{
- return [[ITHotKeyCenter sharedCenter] sendCarbonEvent: inEvent];
+static OSStatus hotKeyEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void *refCon) {
+ return [[ITHotKeyCenter sharedCenter] sendCarbonEvent:inEvent];
}
@end
/*
* ITKit
- * ITIconAndTextStatusWindow
- * ITTransientStatusWindow subclass to show an icon and text.
+ * ITIconAndTextStatusWindow.h
*
- * Original Author : Kent Sutherland <ksutherland@ithinksw.com>
- * Responsibility : Kent Sutherland <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * ITTransientStatusWindow subclass to show an icon and text.
*
- * Copyright (c) 2002 - 2004 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
#import "ITTransientStatusWindow.h"
@interface ITIconAndTextStatusWindow : ITTransientStatusWindow {
- NSImage *_image;
+ NSImage *_image;
}
- (void)setImage:(NSImage *)newImage;
- (void)buildTextWindowWithString:(NSString *)text;
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITImageCell
- * Cell used by the ITImageView control.
+ * ITImageCell.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Custom NSImageCell subclass that casts a shadow using CoreGraphics,
+ * providing support for versions of Cocoa that don't have the NSShadow
+ * class which was introduced in Mac OS X 10.3 (Panther), and also
+ * provides smooth scaling.
*
- * Copyright (c) 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
-
-#import <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
@interface ITImageCell : NSImageCell {
-
- BOOL _scalesSmoothly;
-
- BOOL castsShadow;
-
- float shadowElevation;
- float shadowAzimuth;
- float shadowAmbient;
- float shadowHeight;
- float shadowRadius;
- float shadowSaturation;
+ BOOL _scalesSmoothly;
+ BOOL castsShadow;
+ float shadowElevation;
+ float shadowAzimuth;
+ float shadowAmbient;
+ float shadowHeight;
+ float shadowRadius;
+ float shadowSaturation;
}
- (BOOL)scalesSmoothly;
- (BOOL)castsShadow;
- (void)setCastsShadow:(BOOL)newSetting;
-- (float)shadowElevation; /* Light source elevation in degrees. Defaults to 45.0 */
+- (float)shadowElevation; /* Light source elevation in degrees. Defaults to 45.0 */
- (void)setShadowElevation:(float)newElevation;
-- (float)shadowAzimuth; /* Light source azimuth in degrees. Defaults to 90.0 */
+- (float)shadowAzimuth; /* Light source azimuth in degrees. Defaults to 90.0 */
- (void)setShadowAzimuth:(float)newAzimuth;
-- (float)shadowAmbient; /* Amount of ambient light. Defaults to 0.15 */
+- (float)shadowAmbient; /* Amount of ambient light. Defaults to 0.15 */
- (void)setShadowAmbient:(float)newAmbient;
-- (float)shadowHeight; /* Height above the canvas. Defaults to 1.0 */
+- (float)shadowHeight; /* Height above the canvas. Defaults to 1.0 */
- (void)setShadowHeight:(float)newHeight;
-- (float)shadowRadius; /* Blur radius. Defaults to 4.0 */
+- (float)shadowRadius; /* Blur radius. Defaults to 4.0 */
- (void)setShadowRadius:(float)newRadius;
-- (float)shadowSaturation; /* Maximum saturation. Defaults to 1.0 */
+- (float)shadowSaturation; /* Maximum saturation. Defaults to 1.0 */
- (void)setShadowSaturation:(float)newSaturation;
-@end
+@end
\ No newline at end of file
#import "ITImageCell.h"
-#import <ApplicationServices/ApplicationServices.h>
#import "ITCoreGraphicsHacks.h"
-
+#import <ApplicationServices/ApplicationServices.h>
@implementation ITImageCell
+- (id)initImageCell:(NSImage *)image {
+ if ((self = [super initImageCell:image])) {
+ _scalesSmoothly = YES;
+ castsShadow = NO;
+ shadowElevation = 45.0;
+ shadowAzimuth = 90.0;
+ shadowAmbient = 0.15;
+ shadowHeight = 1.00;
+ shadowRadius = 4.00;
+ shadowSaturation = 1.0;
+ }
+ return self;
+}
-- (id)initImageCell:(NSImage *)image
-{
- if ( (self = [super initImageCell:image]) ) {
- _scalesSmoothly = YES;
- castsShadow = NO;
- shadowElevation = 45.0;
- shadowAzimuth = 90.0;
- shadowAmbient = 0.15;
- shadowHeight = 1.00;
- shadowRadius = 4.00;
- shadowSaturation = 1.0;
- }
- NSLog(@"foo");
- return self;
-}
-
-- (id)init
-{
- if ( (self = [super init]) ) {
- _scalesSmoothly = YES;
- castsShadow = NO;
- shadowElevation = 45.0;
- shadowAzimuth = 90.0;
- shadowAmbient = 0.15;
- shadowHeight = 1.00;
- shadowRadius = 4.00;
- shadowSaturation = 1.0;
- }
- return self;
-}
-
-- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView
-{
- CGSGenericObj style = nil;
- CGShadowStyle shadow;
-
- if ( _scalesSmoothly || castsShadow ) {
- [NSGraphicsContext saveGraphicsState];
- }
-
- if ( _scalesSmoothly ) {
- // CGContextSetInterpolationQuality([[NSGraphicsContext currentContext] graphicsPort], kCGInterpolationHigh);
- [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
- [[NSGraphicsContext currentContext] setShouldAntialias:YES];
- }
-
- if ( castsShadow ) {
- // Create the shadow style to use for drawing the string
- shadow.version = 0;
- shadow.elevation = shadowElevation;
- shadow.azimuth = shadowAzimuth;
- shadow.ambient = shadowAmbient;
- shadow.height = shadowHeight;
- shadow.radius = shadowRadius;
- shadow.saturation = shadowSaturation;
- style = CGStyleCreateShadow(&shadow);
- CGContextSetStyle([[NSGraphicsContext currentContext] graphicsPort], style);
- }
-
- [super drawWithFrame:rect inView:controlView];
-
- if ( _scalesSmoothly || castsShadow ) {
- [NSGraphicsContext restoreGraphicsState];
- }
-
- if ( castsShadow ) {
- CGStyleRelease(style);
- }
+- (id)init {
+ if ((self = [super init])) {
+ _scalesSmoothly = YES;
+ castsShadow = NO;
+ shadowElevation = 45.0;
+ shadowAzimuth = 90.0;
+ shadowAmbient = 0.15;
+ shadowHeight = 1.00;
+ shadowRadius = 4.00;
+ shadowSaturation = 1.0;
+ }
+ return self;
}
-- (BOOL)scalesSmoothly
-{
- return _scalesSmoothly;
+- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView {
+ CGSGenericObj style = nil;
+ CGShadowStyle shadow;
+
+ if (_scalesSmoothly || castsShadow) {
+ [NSGraphicsContext saveGraphicsState];
+ }
+
+ if (_scalesSmoothly) {
+ // CGContextSetInterpolationQuality([[NSGraphicsContext currentContext] graphicsPort], kCGInterpolationHigh);
+ [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
+ [[NSGraphicsContext currentContext] setShouldAntialias:YES];
+ }
+
+ if (castsShadow) {
+ // Create the shadow style to use for drawing the string
+ shadow.version = 0;
+ shadow.elevation = shadowElevation;
+ shadow.azimuth = shadowAzimuth;
+ shadow.ambient = shadowAmbient;
+ shadow.height = shadowHeight;
+ shadow.radius = shadowRadius;
+ shadow.saturation = shadowSaturation;
+ style = CGStyleCreateShadow(&shadow);
+ CGContextSetStyle([[NSGraphicsContext currentContext] graphicsPort], style);
+ }
+
+ [super drawWithFrame:rect inView:controlView];
+
+ if (castsShadow) {
+ CGStyleRelease(style);
+ }
+
+ if (_scalesSmoothly || castsShadow) {
+ [NSGraphicsContext restoreGraphicsState];
+ }
}
-- (void)setScalesSmoothly:(BOOL)flag
-{
- _scalesSmoothly = flag;
- [[self controlView] setNeedsDisplay:YES];
+- (BOOL)scalesSmoothly {
+ return _scalesSmoothly;
}
-- (BOOL)castsShadow;
-{
- return castsShadow;
+- (void)setScalesSmoothly:(BOOL)flag {
+ _scalesSmoothly = flag;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (void)setCastsShadow:(BOOL)newSetting;
-{
- castsShadow = newSetting;
- [[self controlView] setNeedsDisplay:YES];
+- (BOOL)castsShadow {
+ return castsShadow;
}
-- (float)shadowElevation;
-{
- return shadowElevation;
+- (void)setCastsShadow:(BOOL)newSetting {
+ castsShadow = newSetting;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (void)setShadowElevation:(float)newElevation;
-{
- shadowElevation = newElevation;
- [[self controlView] setNeedsDisplay:YES];
+- (float)shadowElevation {
+ return shadowElevation;
}
-- (float)shadowAzimuth;
-{
- return shadowAzimuth;
+- (void)setShadowElevation:(float)newElevation {
+ shadowElevation = newElevation;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (void)setShadowAzimuth:(float)newAzimuth;
-{
- shadowAzimuth = newAzimuth;
- [[self controlView] setNeedsDisplay:YES];
+- (float)shadowAzimuth {
+ return shadowAzimuth;
}
-- (float)shadowAmbient;
-{
- return shadowAmbient;
+- (void)setShadowAzimuth:(float)newAzimuth {
+ shadowAzimuth = newAzimuth;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (void)setShadowAmbient:(float)newAmbient;
-{
- shadowAmbient = newAmbient;
- [[self controlView] setNeedsDisplay:YES];
+- (float)shadowAmbient {
+ return shadowAmbient;
}
-- (float)shadowHeight;
-{
- return shadowHeight;
+- (void)setShadowAmbient:(float)newAmbient {
+ shadowAmbient = newAmbient;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (void)setShadowHeight:(float)newHeight;
-{
- shadowHeight = newHeight;
- [[self controlView] setNeedsDisplay:YES];
+- (float)shadowHeight {
+ return shadowHeight;
}
-- (float)shadowRadius;
-{
- return shadowRadius;
+- (void)setShadowHeight:(float)newHeight {
+ shadowHeight = newHeight;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (void)setShadowRadius:(float)newRadius;
-{
- shadowRadius = newRadius;
- [[self controlView] setNeedsDisplay:YES];
+- (float)shadowRadius {
+ return shadowRadius;
}
-- (float)shadowSaturation;
-{
- return shadowSaturation;
+- (void)setShadowRadius:(float)newRadius {
+ shadowRadius = newRadius;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (void)setShadowSaturation:(float)newSaturation;
-{
- shadowSaturation = newSaturation;
- [[self controlView] setNeedsDisplay:YES];
+- (float)shadowSaturation {
+ return shadowSaturation;
}
+- (void)setShadowSaturation:(float)newSaturation {
+ shadowSaturation = newSaturation;
+ [[self controlView] setNeedsDisplay:YES];
+}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITImageView
- * NSImageView subclass which adds new features, such as smooth scaling.
+ * ITImageView.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Custom NSImageView subclass that uses ITImageCell.
*
- * Copyright (c) 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
-
@interface ITImageView : NSImageView {
}
- (BOOL)castsShadow;
- (void)setCastsShadow:(BOOL)newSetting;
-- (float)shadowElevation; /* Light source elevation in degrees. Defaults to 45.0 */
+- (float)shadowElevation; /* Light source elevation in degrees. Defaults to 45.0 */
- (void)setShadowElevation:(float)newElevation;
-- (float)shadowAzimuth; /* Light source azimuth in degrees. Defaults to 90.0 */
+- (float)shadowAzimuth; /* Light source azimuth in degrees. Defaults to 90.0 */
- (void)setShadowAzimuth:(float)newAzimuth;
-- (float)shadowAmbient; /* Amount of ambient light. Defaults to 0.15 */
+- (float)shadowAmbient; /* Amount of ambient light. Defaults to 0.15 */
- (void)setShadowAmbient:(float)newAmbient;
-- (float)shadowHeight; /* Height above the canvas. Defaults to 1.0 */
+- (float)shadowHeight; /* Height above the canvas. Defaults to 1.0 */
- (void)setShadowHeight:(float)newHeight;
-- (float)shadowRadius; /* Blur radius. Defaults to 4.0 */
+- (float)shadowRadius; /* Blur radius. Defaults to 4.0 */
- (void)setShadowRadius:(float)newRadius;
-- (float)shadowSaturation; /* Maximum saturation. Defaults to 1.0 */
+- (float)shadowSaturation; /* Maximum saturation. Defaults to 1.0 */
- (void)setShadowSaturation:(float)newSaturation;
-
-@end
+@end
\ No newline at end of file
#import "ITImageView.h"
#import "ITImageCell.h"
-
@implementation ITImageView
-
-+ (void)initialize
-{
- if ( self == [ITImageView class] ) {
- [self setCellClass:[ITImageCell class]];
- }
++ (void)initialize {
+ if (self == [ITImageView class]) {
+ [self setCellClass:[ITImageCell class]];
+ }
}
-+ (Class)cellClass
-{
- return [ITImageCell class];
++ (Class)cellClass {
+ return [ITImageCell class];
}
-- (id)initWithFrame:(NSRect)rect
-{
- if ( (self = [super initWithFrame:rect]) ) {
- [self setScalesSmoothly:YES];
- }
-
- return self;
+- (id)initWithFrame:(NSRect)rect {
+ if ((self = [super initWithFrame:rect])) {
+ [self setScalesSmoothly:YES];
+ }
+ return self;
}
-- (BOOL)scalesSmoothly
-{
- return [[self cell] scalesSmoothly];
+- (BOOL)scalesSmoothly {
+ return [[self cell] scalesSmoothly];
}
-- (void)setScalesSmoothly:(BOOL)flag
-{
- [[self cell] setScalesSmoothly:flag];
+- (void)setScalesSmoothly:(BOOL)flag {
+ [[self cell] setScalesSmoothly:flag];
}
-- (BOOL)castsShadow;
-{
- return [[self cell] castsShadow];
+- (BOOL)castsShadow {
+ return [[self cell] castsShadow];
}
-- (void)setCastsShadow:(BOOL)newSetting;
-{
- [[self cell] setCastsShadow:newSetting];
+- (void)setCastsShadow:(BOOL)newSetting {
+ [[self cell] setCastsShadow:newSetting];
}
-- (float)shadowElevation;
-{
- return [[self cell] shadowElevation];
+- (float)shadowElevation {
+ return [[self cell] shadowElevation];
}
-- (void)setShadowElevation:(float)newElevation;
-{
- [[self cell] setShadowElevation:newElevation];
+- (void)setShadowElevation:(float)newElevation {
+ [[self cell] setShadowElevation:newElevation];
}
-- (float)shadowAzimuth;
-{
- return [[self cell] shadowAzimuth];
+- (float)shadowAzimuth {
+ return [[self cell] shadowAzimuth];
}
-- (void)setShadowAzimuth:(float)newAzimuth;
-{
- [[self cell] setShadowAzimuth:newAzimuth];
+- (void)setShadowAzimuth:(float)newAzimuth {
+ [[self cell] setShadowAzimuth:newAzimuth];
}
-- (float)shadowAmbient;
-{
- return [[self cell] shadowAmbient];
+- (float)shadowAmbient {
+ return [[self cell] shadowAmbient];
}
-- (void)setShadowAmbient:(float)newAmbient;
-{
- [[self cell] setShadowAmbient:newAmbient];
+- (void)setShadowAmbient:(float)newAmbient {
+ [[self cell] setShadowAmbient:newAmbient];
}
-- (float)shadowHeight;
-{
- return [[self cell] shadowHeight];
+- (float)shadowHeight {
+ return [[self cell] shadowHeight];
}
-- (void)setShadowHeight:(float)newHeight;
-{
- [[self cell] setShadowHeight:newHeight];
+- (void)setShadowHeight:(float)newHeight {
+ [[self cell] setShadowHeight:newHeight];
}
-- (float)shadowRadius;
-{
- return [[self cell] shadowRadius];
+- (float)shadowRadius {
+ return [[self cell] shadowRadius];
}
-- (void)setShadowRadius:(float)newRadius;
-{
- [[self cell] setShadowRadius:newRadius];
+- (void)setShadowRadius:(float)newRadius {
+ [[self cell] setShadowRadius:newRadius];
}
-- (float)shadowSaturation;
-{
- return [[self cell] shadowSaturation];
+- (float)shadowSaturation {
+ return [[self cell] shadowSaturation];
}
-- (void)setShadowSaturation:(float)newSaturation;
-{
- [[self cell] setShadowSaturation:newSaturation];
+- (void)setShadowSaturation:(float)newSaturation {
+ [[self cell] setShadowSaturation:newSaturation];
}
-
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITHotKeyBroadcaster
+ * ITKeyBroadcaster.h
*
- * Original Author : Quentin Carnicelli <...>
- * Responsibility : Kent Sutherland <kent.sutherland@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * $Id$
*
*/
+#import <Cocoa/Cocoa.h>
-#import <AppKit/AppKit.h>
+__private_extern__ NSString *ITKeyBroadcasterKeyEvent; //keys: keyCombo as ITKeyCombo
+@interface ITKeyBroadcaster : NSButton {
-@interface ITKeyBroadcaster : NSButton
-{
}
-+ (long)cocoaModifiersAsCarbonModifiers: (long)cocoaModifiers;
++ (long)cocoaModifiersAsCarbonModifiers:(long)cocoaModifiers;
-
-@end
-
-
-__private_extern__ NSString* ITKeyBroadcasterKeyEvent; //keys: keyCombo as ITKeyCombo
\ No newline at end of file
+@end
\ No newline at end of file
-//
-// ITKeyBroadcaster.m
-//
-// Created by Quentin Carnicelli on Sun Aug 03 2003.
-// Copyright (c) 2003 iThink Software. All rights reserved.
-//
-
#import "ITKeyBroadcaster.h"
#import "ITKeyCombo.h"
#import <Carbon/Carbon.h>
-NSString* ITKeyBroadcasterKeyEvent = @"ITKeyBroadcasterKeyEvent";
+NSString *ITKeyBroadcasterKeyEvent = @"ITKeyBroadcasterKeyEvent";
@implementation ITKeyBroadcaster
-- (void)_bcastKeyCode: (short)keyCode modifiers: (long)modifiers
-{
- ITKeyCombo* keyCombo = [ITKeyCombo keyComboWithKeyCode: keyCode modifiers: modifiers];
- NSDictionary* userInfo = [NSDictionary dictionaryWithObject: keyCombo forKey:@"keyCombo"];
-
- [[NSNotificationCenter defaultCenter]
- postNotificationName: ITKeyBroadcasterKeyEvent
- object: self
- userInfo: userInfo];
+- (void)_bcastKeyCode:(short)keyCode modifiers:(long)modifiers {
+ ITKeyCombo *keyCombo = [ITKeyCombo keyComboWithKeyCode:keyCode modifiers:modifiers];
+ NSDictionary *userInfo = [NSDictionary dictionaryWithObject:keyCombo forKey:@"keyCombo"];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:ITKeyBroadcasterKeyEvent object:self userInfo:userInfo];
}
-- (void)_bcastEvent: (NSEvent*)event
-{
+- (void)_bcastEvent:(NSEvent *)event {
short keyCode;
long modifiers;
keyCode = [event keyCode];
modifiers = [event modifierFlags];
- modifiers = [[self class] cocoaModifiersAsCarbonModifiers: modifiers];
-
- [self _bcastKeyCode: keyCode modifiers: modifiers];
+ modifiers = [[self class] cocoaModifiersAsCarbonModifiers:modifiers];
+
+ [self _bcastKeyCode:keyCode modifiers:modifiers];
}
-- (void)keyDown: (NSEvent*)event
-{
- [self _bcastEvent: event];
+- (void)keyDown:(NSEvent *)event {
+ [self _bcastEvent:event];
}
-- (BOOL)performKeyEquivalent: (NSEvent*)event
-{
- [self _bcastEvent: event];
+- (BOOL)performKeyEquivalent:(NSEvent *)event {
+ [self _bcastEvent:event];
return YES;
}
-+ (long)cocoaModifiersAsCarbonModifiers: (long)cocoaModifiers
-{
- static long cocoaToCarbon[6][2] =
- {
- { NSCommandKeyMask, cmdKey},
- { NSAlternateKeyMask, optionKey},
- { NSControlKeyMask, controlKey},
- { NSShiftKeyMask, shiftKey},
- { NSFunctionKeyMask, rightControlKey},
++ (long)cocoaModifiersAsCarbonModifiers:(long)cocoaModifiers {
+ static long cocoaToCarbon[6][2] = {
+ { NSCommandKeyMask, cmdKey },
+ { NSAlternateKeyMask, optionKey },
+ { NSControlKeyMask, controlKey },
+ { NSShiftKeyMask, shiftKey },
+ { NSFunctionKeyMask, rightControlKey },
//{ NSAlphaShiftKeyMask, alphaLock }, //Ignore this?
};
-
+
long carbonModifiers = 0;
int i;
- for( i = 0 ; i < 6; i++ )
- if( cocoaModifiers & cocoaToCarbon[i][0] )
+ for (i = 0;i < 6;i++) {
+ if (cocoaModifiers & cocoaToCarbon[i][0]) {
carbonModifiers += cocoaToCarbon[i][1];
+ }
+ }
return carbonModifiers;
}
-
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITKeyCombo
+ * ITKeyCombo.h
*
- * Original Author : Quentin Carnicelli <...>
- * Responsibility : Kent Sutherland <kent.sutherland@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * $Id$
*
*/
+#import <Cocoa/Cocoa.h>
-#import <Foundation/Foundation.h>
-
-
-@interface ITKeyCombo : NSObject <NSCopying>
-{
- int mKeyCode;
- int mModifiers;
+@interface ITKeyCombo : NSObject <NSCopying> {
+ int mKeyCode;
+ int mModifiers;
}
+ (id)clearKeyCombo;
-+ (id)keyComboWithKeyCode: (int)keyCode modifiers: (int)modifiers;
-+ (id)keyComboWithPlistRepresentation: (id)plist;
-- (id)initWithKeyCode: (int)keyCode modifiers: (int)modifiers;
++ (id)keyComboWithKeyCode:(int)keyCode modifiers:(int)modifiers;
++ (id)keyComboWithPlistRepresentation:(id)plist;
+- (id)initWithKeyCode:(int)keyCode modifiers:(int)modifiers;
-- (id)initWithPlistRepresentation: (id)plist;
+- (id)initWithPlistRepresentation:(id)plist;
- (id)plistRepresentation;
-- (BOOL)isEqual: (ITKeyCombo*)combo;
+- (BOOL)isEqual:(ITKeyCombo *)combo;
- (int)keyCode;
- (int)modifiers;
- (BOOL)isClearCombo;
- (BOOL)isValidHotKeyCombo;
-
@end
-
@interface ITKeyCombo (UserDisplayAdditions)
-- (NSString*)description;
+- (NSString *)description;
@end
\ No newline at end of file
-//
-// ITKeyCombo.m
-//
-// Created by Quentin Carnicelli on Sat Aug 02 2003.
-// Copyright (c) 2003 iThink Software. All rights reserved.
-//
-
#import "ITKeyCombo.h"
-
#import <Carbon/Carbon.h>
@implementation ITKeyCombo
-+ (id)clearKeyCombo
-{
- return [self keyComboWithKeyCode: -1 modifiers: -1];
++ (id)clearKeyCombo {
+ return [self keyComboWithKeyCode:-1 modifiers:-1];
}
-+ (id)keyComboWithKeyCode: (int)keyCode modifiers: (int)modifiers
-{
- return [[[self alloc] initWithKeyCode: keyCode modifiers: modifiers] autorelease];
++ (id)keyComboWithKeyCode:(int)keyCode modifiers:(int)modifiers {
+ return [[[self alloc] initWithKeyCode:keyCode modifiers:modifiers] autorelease];
}
-+ (id)keyComboWithPlistRepresentation: (id)plist
-{
- return [[[self alloc] initWithPlistRepresentation: plist] autorelease];
++ (id)keyComboWithPlistRepresentation:(id)plist {
+ return [[[self alloc] initWithPlistRepresentation:plist] autorelease];
}
-- (id)initWithKeyCode: (int)keyCode modifiers: (int)modifiers
-{
- self = [super init];
-
- if( self )
- {
+- (id)initWithKeyCode:(int)keyCode modifiers:(int)modifiers {
+ if ((self = [super init])) {
mKeyCode = keyCode;
mModifiers = modifiers;
}
-
return self;
}
-- (id)initWithPlistRepresentation: (id)plist
-{
+- (id)initWithPlistRepresentation:(id)plist {
int keyCode, modifiers;
-
- keyCode = [[plist objectForKey: @"keyCode"] intValue];
- if( keyCode <= 0 ) keyCode = -1;
-
- modifiers = [[plist objectForKey: @"modifiers"] intValue];
- if( modifiers <= 0 ) modifiers = -1;
-
- return [self initWithKeyCode: keyCode modifiers: modifiers];
+
+ keyCode = [[plist objectForKey:@"keyCode"] intValue];
+ if (keyCode <= 0) {
+ keyCode = -1;
+ }
+
+ modifiers = [[plist objectForKey:@"modifiers"] intValue];
+ if (modifiers <= 0) {
+ modifiers = -1;
+ }
+
+ return [self initWithKeyCode:keyCode modifiers:modifiers];
}
-- (id)plistRepresentation
-{
- return [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt: [self keyCode]], @"keyCode",
- [NSNumber numberWithInt: [self modifiers]], @"modifiers",
- nil];
+- (id)plistRepresentation {
+ return [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:[self keyCode]], @"keyCode", [NSNumber numberWithInt:[self modifiers]], @"modifiers", nil];
}
-- (id)copyWithZone:(NSZone*)zone;
-{
+- (id)copyWithZone:(NSZone *)zone {
return [self retain];
}
-- (BOOL)isEqual: (ITKeyCombo*)combo
-{
- return [self keyCode] == [combo keyCode] &&
- [self modifiers] == [combo modifiers];
+- (BOOL)isEqual:(ITKeyCombo *)combo {
+ return (([self keyCode] == [combo keyCode]) && ([self modifiers] == [combo modifiers]));
}
-#pragma mark -
-
-- (int)keyCode
-{
+- (int)keyCode {
return mKeyCode;
}
-- (int)modifiers
-{
+- (int)modifiers {
return mModifiers;
}
-- (BOOL)isValidHotKeyCombo
-{
- return mKeyCode >= 0 && mModifiers > 0;
+- (BOOL)isValidHotKeyCombo {
+ return ((mKeyCode >= 0) && (mModifiers > 0));
}
-- (BOOL)isClearCombo
-{
- return mKeyCode == -1 && mModifiers == -1;
+- (BOOL)isClearCombo {
+ return ((mKeyCode == -1) && (mModifiers == -1));
}
@end
-#pragma mark -
-
@implementation ITKeyCombo (UserDisplayAdditions)
-+ (NSDictionary*)_keyCodesDictionary
-{
- static NSDictionary* keyCodes = nil;
++ (NSDictionary *)_keyCodesDictionary {
+ static NSDictionary *keyCodes = nil;
- if( keyCodes == nil )
- {
- NSString* path;
- NSString* contents;
+ if (!keyCodes) {
+ NSString *path;
+ NSString *contents;
- path = [[NSBundle bundleForClass: self] pathForResource: @"ITKeyCodes" ofType: @"plist"];
- contents = [NSString stringWithContentsOfFile: path];
+ path = [[NSBundle bundleForClass:self] pathForResource:@"ITKeyCodes" ofType:@"plist"];
+ contents = [NSString stringWithContentsOfFile:path];
keyCodes = [[contents propertyList] retain];
}
return keyCodes;
}
-+ (NSString*)_stringForModifiers: (long)modifiers
-{
- static long modToChar[4][2] =
- {
- { cmdKey, 0x23180000 },
- { optionKey, 0x23250000 },
- { controlKey, 0x005E0000 },
- { shiftKey, 0x21e70000 }
++ (NSString *)_stringForModifiers:(long)modifiers {
+ static long modToChar[4][2] = {
+ { cmdKey, 0x23180000 },
+ { optionKey, 0x23250000 },
+ { controlKey, 0x005E0000 },
+ { shiftKey, 0x21e70000 }
};
-
- NSString* str = nil;
- NSString* charStr;
+
+ NSString *str = @"";
+ NSString *charStr;
long i;
-
- str = [NSString string];
-
- for( i = 0; i < 4; i++ )
- {
- if( modifiers & modToChar[i][0] )
- {
- charStr = [NSString stringWithCharacters: (const unichar*)&modToChar[i][1] length: 1];
- str = [str stringByAppendingString: charStr];
+
+ for (i = 0;i < 4;i++) {
+ if (modifiers & modToChar[i][0]) {
+ charStr = [NSString stringWithCharacters:(const unichar *)&modToChar[i][1] length:1];
+ str = [str stringByAppendingString:charStr];
}
}
- if( !str )
- str = @"";
-
return str;
}
-+ (NSString*)_stringForKeyCode: (short)keyCode
-{
- NSDictionary* dict;
- id key;
- NSString* str;
-
- dict = [self _keyCodesDictionary];
- key = [NSString stringWithFormat: @"%d", keyCode];
- str = [dict objectForKey: key];
++ (NSString *)_stringForKeyCode:(short)keyCode {
+ NSDictionary *dict = [self _keyCodesDictionary];
+ NSString *key = [NSString stringWithFormat:@"%d", keyCode];
+ NSString *str = [dict objectForKey:key];
- if( !str )
- str = [NSString stringWithFormat: @"%X", keyCode];
+ if (!str) {
+ str = [NSString stringWithFormat:@"%X", keyCode];
+ }
return str;
}
-- (NSString*)description
-{
- NSString* desc;
-
- if( [self isValidHotKeyCombo] ) //This might have to change
- {
- desc = [NSString stringWithFormat: @"%@%@",
- [[self class] _stringForModifiers: [self modifiers]],
- [[self class] _stringForKeyCode: [self keyCode]]];
+- (NSString *)description {
+ if ([self isValidHotKeyCombo]) { //This might have to change
+ return [NSString stringWithFormat:@"%@%@", [[self class] _stringForModifiers:[self modifiers]], [[self class] _stringForKeyCode:[self keyCode]]];
}
- else
- desc = NSLocalizedString( @"(None)", @"Hot Keys: Key Combo text for 'empty' combo" );
-
- return desc;
+
+ return NSLocalizedString(@"(None)", @"Hot Keys: Key Combo text for 'empty' combo");
}
@end
\ No newline at end of file
/*
* ITKit
- * ITKeyComboPanel
+ * ITKeyComboPanel.h
*
- * Original Author : Quentin Carnicelli <...>
- * Responsibility : Kent Sutherland <kent.sutherland@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * $Id$
*
*/
-
-#import <AppKit/AppKit.h>
-
+#import <Cocoa/Cocoa.h>
@class ITKeyBroadcaster;
@class ITKeyCombo;
@class ITHotKey;
-
-@interface ITKeyComboPanel : NSWindowController
-{
- IBOutlet NSTextField* mTitleField;
- IBOutlet NSTextField* mComboField;
- IBOutlet ITKeyBroadcaster* mKeyBcaster;
-
- NSString* mKeyName;
- ITKeyCombo* mKeyCombo;
+@interface ITKeyComboPanel : NSWindowController {
+ IBOutlet NSTextField *mTitleField;
+ IBOutlet NSTextField *mComboField;
+ IBOutlet ITKeyBroadcaster *mKeyBcaster;
+ NSString *mKeyName;
+ ITKeyCombo *mKeyCombo;
}
+ (id)sharedPanel;
- (int)runModal;
-- (void)runModalForHotKey: (ITHotKey*)hotKey;
-
-- (void)setKeyCombo: (ITKeyCombo*)combo;
-- (ITKeyCombo*)keyCombo;
+- (void)runModalForHotKey:(ITHotKey *)hotKey;
-- (void)setKeyBindingName: (NSString*)name;
-- (NSString*)keyBindingName;
+- (void)setKeyCombo:(ITKeyCombo *)combo;
+- (ITKeyCombo *)keyCombo;
-- (IBAction)ok: (id)sender;
-- (IBAction)cancel: (id)sender;
-- (IBAction)clear: (id)sender;
+- (void)setKeyBindingName:(NSString *)name;
+- (NSString *)keyBindingName;
+- (IBAction)ok:(id)sender;
+- (IBAction)cancel:(id)sender;
+- (IBAction)clear:(id)sender;
-@end
+@end
\ No newline at end of file
-//
-// ITKeyComboPanel.m
-//
-// Created by Quentin Carnicelli on Sun Aug 03 2003.
-// Copyright (c) 2003 iThink Software. All rights reserved.
-//
-
#import "ITKeyComboPanel.h"
-
#import "ITHotKey.h"
#import "ITKeyCombo.h"
#import "ITKeyBroadcaster.h"
#import "ITHotKeyCenter.h"
-#if __PROTEIN__
-#import "NSObjectAdditions.h"
-#endif
-
@implementation ITKeyComboPanel
static id _sharedKeyComboPanel = nil;
-+ (id)sharedPanel
-{
- if( _sharedKeyComboPanel == nil )
- {
++ (id)sharedPanel {
+ if (!_sharedKeyComboPanel) {
_sharedKeyComboPanel = [[self alloc] init];
-
- #if __PROTEIN__
- [_sharedKeyComboPanel releaseOnTerminate];
- #endif
}
-
return _sharedKeyComboPanel;
}
-- (id)init
-{
- return [self initWithWindowNibName: @"ITKeyComboPanel"];
+- (id)init {
+ return [self initWithWindowNibName:@"ITKeyComboPanel"];
}
-- (void)dealloc
-{
- [[NSNotificationCenter defaultCenter] removeObserver: self];
+- (void)dealloc {
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
[mKeyName release];
-
[super dealloc];
}
-- (void)windowDidLoad
-{
- [[NSNotificationCenter defaultCenter]
- addObserver: self
- selector: @selector( noteKeyBroadcast: )
- name: ITKeyBroadcasterKeyEvent
- object: mKeyBcaster];
+- (void)windowDidLoad {
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(noteKeyBroadcast:) name:ITKeyBroadcasterKeyEvent object:mKeyBcaster];
}
-- (void)_refreshContents
-{
- if( mComboField )
- [mComboField setStringValue: [mKeyCombo description]];
-
- if( mTitleField )
+- (void)_refreshContents {
+ if (mComboField) {
+ [mComboField setStringValue:[mKeyCombo description]];
+ }
+ if (mTitleField) {
[mTitleField setStringValue:mKeyName];
+ }
}
-- (int)runModal
-{
+- (int)runModal {
int resultCode;
-
+
[self window]; //Force us to load
-
+
[self _refreshContents];
[[self window] center];
- [self showWindow: self];
- resultCode = [[NSApplication sharedApplication] runModalForWindow: [self window]];
+ [self showWindow:self];
+ resultCode = [[NSApplication sharedApplication] runModalForWindow:[self window]];
[self close];
-
+
return resultCode;
}
-- (void)runModalForHotKey: (ITHotKey*)hotKey
-{
+- (void)runModalForHotKey:(ITHotKey *)hotKey {
int resultCode;
- [self setKeyBindingName: [hotKey name]];
- [self setKeyCombo: [hotKey keyCombo]];
+ [self setKeyBindingName:[hotKey name]];
+ [self setKeyCombo:[hotKey keyCombo]];
resultCode = [self runModal];
- if( resultCode == NSOKButton )
- {
- [hotKey setKeyCombo: [self keyCombo]];
- [[ITHotKeyCenter sharedCenter] registerHotKey: hotKey];
+ if (resultCode == NSOKButton) {
+ [hotKey setKeyCombo:[self keyCombo]];
+ [[ITHotKeyCenter sharedCenter] registerHotKey:hotKey];
}
}
-#pragma mark -
-
-- (void)setKeyCombo: (ITKeyCombo*)combo
-{
- [combo retain];
- [mKeyCombo release];
- mKeyCombo = combo;
+- (void)setKeyCombo:(ITKeyCombo *)combo {
+ [mKeyCombo autorelease];
+ mKeyCombo = [combo retain];
[self _refreshContents];
}
-- (ITKeyCombo*)keyCombo
-{
+- (ITKeyCombo *)keyCombo {
return mKeyCombo;
}
-- (void)setKeyBindingName: (NSString*)name
-{
- [name retain];
- [mKeyName release];
- mKeyName = name;
+- (void)setKeyBindingName:(NSString *)name {
+ [mKeyName autorelease];
+ mKeyName = [name retain];
[self _refreshContents];
}
-- (NSString*)keyBindingName
-{
+- (NSString *)keyBindingName {
return mKeyName;
}
-#pragma mark -
-
-- (IBAction)ok: (id)sender
-{
- [[NSApplication sharedApplication] stopModalWithCode: NSOKButton];
+- (IBAction)ok:(id)sender {
+ [[NSApplication sharedApplication] stopModalWithCode:NSOKButton];
}
-- (IBAction)cancel: (id)sender
-{
- [[NSApplication sharedApplication] stopModalWithCode: NSCancelButton];
+- (IBAction)cancel:(id)sender {
+ [[NSApplication sharedApplication] stopModalWithCode:NSCancelButton];
}
-- (IBAction)clear: (id)sender
-{
- [self setKeyCombo: [ITKeyCombo clearKeyCombo]];
- [[NSApplication sharedApplication] stopModalWithCode: NSOKButton];
+- (IBAction)clear:(id)sender {
+ [self setKeyCombo:[ITKeyCombo clearKeyCombo]];
+ [[NSApplication sharedApplication] stopModalWithCode:NSOKButton];
}
-- (void)noteKeyBroadcast: (NSNotification*)note
-{
- ITKeyCombo* keyCombo;
-
- keyCombo = [[note userInfo] objectForKey: @"keyCombo"];
-
- [self setKeyCombo: keyCombo];
+- (void)noteKeyBroadcast:(NSNotification *)note {
+ ITKeyCombo *keyCombo = [[note userInfo] objectForKey:@"keyCombo"];
+ [self setKeyCombo:keyCombo];
}
@end
/*
* ITKit
- * iThink Software's custom extensions to Apple's AppKit framework
+ * ITKit.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * iThink Software's custom extensions to Apple's Cocoa framework.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
#import <ITKit/ITIconAndTextStatusWindow.h>
#import <ITKit/ITCategory-NSView.h>
-#import <ITKit/ITCategory-NSMenu.h>
+#import <ITKit/ITCategory-NSMenu.h>
\ No newline at end of file
7C992F8B054F539B000B93EA,
08FB77AEFE84172EC02AAC07,
7C992F90054F53D9000B93EA,
- 7C992FA1054F54C3000B93EA,
32C88DFF0371C24200C91783,
089C1665FE841158C02AAC07,
7C99307F054F6982000B93EA,
};
08FB77AEFE84172EC02AAC07 = {
children = (
- 7C01A1B7059B4A86003A4662,
7C992F93054F53F2000B93EA,
7C992F96054F53F7000B93EA,
7C992F9B054F547C000B93EA,
//7C2
//7C3
//7C4
- 7C01A1B7059B4A86003A4662 = {
- children = (
- 7C01A1BA059B4A8B003A4662,
- );
- isa = PBXGroup;
- name = Carbon;
- refType = 4;
- sourceTree = "<group>";
- };
- 7C01A1BA059B4A8B003A4662 = {
- children = (
- 7C01A1BF059B4AA1003A4662,
- 7C01A1C0059B4AA1003A4662,
- 7C01A1C5059B4AAC003A4662,
- 7C01A1C6059B4AAC003A4662,
- 7C23B320059BA4C000E08741,
- );
- isa = PBXGroup;
- name = Resources;
- refType = 4;
- sourceTree = "<group>";
- };
- 7C01A1BF059B4AA1003A4662 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.h;
- path = ITMacResourceFile.h;
- refType = 4;
- sourceTree = "<group>";
- };
- 7C01A1C0059B4AA1003A4662 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.objc;
- path = ITMacResourceFile.m;
- refType = 4;
- sourceTree = "<group>";
- };
- 7C01A1C5059B4AAC003A4662 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.h;
- path = ITMacResource.h;
- refType = 4;
- sourceTree = "<group>";
- };
- 7C01A1C6059B4AAC003A4662 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.objc;
- path = ITMacResource.m;
- refType = 4;
- sourceTree = "<group>";
- };
- 7C23B316059BA4AA00E08741 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.h;
- path = ITStringMacResource.h;
- refType = 4;
- sourceTree = "<group>";
- };
- 7C23B317059BA4AA00E08741 = {
- fileEncoding = 4;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.objc;
- path = ITStringMacResource.m;
- refType = 4;
- sourceTree = "<group>";
- };
- 7C23B320059BA4C000E08741 = {
- children = (
- 7C23B316059BA4AA00E08741,
- 7C23B317059BA4AA00E08741,
- );
- isa = PBXGroup;
- name = "Custom Types";
- refType = 4;
- sourceTree = "<group>";
- };
7C4BBADA05F98C9900734027 = {
fileEncoding = 4;
isa = PBXFileReference;
7C992E3E054F5246000B93EA = {
children = (
7C992E3F054F5246000B93EA,
- 7C992E43054F5246000B93EA,
);
isa = PBXGroup;
path = Graphics;
refType = 4;
sourceTree = "<group>";
};
- 7C992E43054F5246000B93EA = {
- isa = PBXFileReference;
- lastKnownFileType = image.tiff;
- path = URLTextViewHand.tiff;
- refType = 4;
- sourceTree = "<group>";
- };
7C992E44054F5246000B93EA = {
fileRef = 7C992E3F054F5246000B93EA;
isa = PBXBuildFile;
settings = {
};
};
- 7C992E48054F5246000B93EA = {
- fileRef = 7C992E43054F5246000B93EA;
- isa = PBXBuildFile;
- settings = {
- };
- };
7C992E78054F5285000B93EA = {
fileEncoding = 4;
isa = PBXFileReference;
refType = 4;
sourceTree = "<group>";
};
- 7C992FA1054F54C3000B93EA = {
- children = (
- 7C993015054F54F0000B93EA,
- 7C993016054F54F0000B93EA,
- 7C99301F054F5509000B93EA,
- );
- isa = PBXGroup;
- name = Deprecated;
- path = "";
- refType = 4;
- sourceTree = "<group>";
- };
- 7C993015054F54F0000B93EA = {
- fileEncoding = 4;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.h;
- name = ITChasingArrowsView.h;
- path = Deprecated/ITChasingArrowsView.h;
- refType = 4;
- sourceTree = "<group>";
- };
- 7C993016054F54F0000B93EA = {
- fileEncoding = 4;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.objc;
- name = ITChasingArrowsView.m;
- path = Deprecated/ITChasingArrowsView.m;
- refType = 4;
- sourceTree = "<group>";
- };
- 7C99301F054F5509000B93EA = {
- children = (
- 7C993035054F6524000B93EA,
- 7C993036054F6524000B93EA,
- 7C993037054F6524000B93EA,
- 7C993038054F6524000B93EA,
- 7C993039054F6524000B93EA,
- 7C99303A054F6524000B93EA,
- 7C99303B054F6524000B93EA,
- 7C99303C054F6524000B93EA,
- 7C99303D054F6524000B93EA,
- 7C99303E054F6524000B93EA,
- );
- isa = PBXGroup;
- path = Graphics;
- refType = 4;
- sourceTree = "<group>";
- };
- 7C993035054F6524000B93EA = {
- isa = PBXFileReference;
- lastKnownFileType = image.tiff;
- name = ITChasingArrow1.tiff;
- path = Deprecated/ITChasingArrow1.tiff;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
- 7C993036054F6524000B93EA = {
- isa = PBXFileReference;
- lastKnownFileType = image.tiff;
- name = ITChasingArrow2.tiff;
- path = Deprecated/ITChasingArrow2.tiff;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
- 7C993037054F6524000B93EA = {
- isa = PBXFileReference;
- lastKnownFileType = image.tiff;
- name = ITChasingArrow3.tiff;
- path = Deprecated/ITChasingArrow3.tiff;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
- 7C993038054F6524000B93EA = {
- isa = PBXFileReference;
- lastKnownFileType = image.tiff;
- name = ITChasingArrow4.tiff;
- path = Deprecated/ITChasingArrow4.tiff;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
- 7C993039054F6524000B93EA = {
- isa = PBXFileReference;
- lastKnownFileType = image.tiff;
- name = ITChasingArrow5.tiff;
- path = Deprecated/ITChasingArrow5.tiff;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
- 7C99303A054F6524000B93EA = {
- isa = PBXFileReference;
- lastKnownFileType = image.tiff;
- name = ITChasingArrow6.tiff;
- path = Deprecated/ITChasingArrow6.tiff;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
- 7C99303B054F6524000B93EA = {
- isa = PBXFileReference;
- lastKnownFileType = image.tiff;
- name = ITChasingArrow7.tiff;
- path = Deprecated/ITChasingArrow7.tiff;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
- 7C99303C054F6524000B93EA = {
- isa = PBXFileReference;
- lastKnownFileType = image.tiff;
- name = ITChasingArrow8.tiff;
- path = Deprecated/ITChasingArrow8.tiff;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
- 7C99303D054F6524000B93EA = {
- isa = PBXFileReference;
- lastKnownFileType = image.tiff;
- name = ITChasingArrow9.tiff;
- path = Deprecated/ITChasingArrow9.tiff;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
- 7C99303E054F6524000B93EA = {
- isa = PBXFileReference;
- lastKnownFileType = image.tiff;
- name = ITChasingArrow10.tiff;
- path = Deprecated/ITChasingArrow10.tiff;
- refType = 2;
- sourceTree = SOURCE_ROOT;
- };
7C993057054F6832000B93EA = {
children = (
7C992DF9054F5179000B93EA,
files = (
8DC2EF530486A6940098B216,
7C992E44054F5246000B93EA,
- 7C992E48054F5246000B93EA,
2A30D88F056B3AD90087AE54,
2A30D8A3056B3BE30087AE54,
2A30D8BE056B3C5D0087AE54,
+++ /dev/null
-//
-// ITMacResource.h
-// ITKit
-//
-// Created by Joseph Spiros on Thu Dec 25 2003.
-// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <Carbon/Carbon.h>
-
-typedef ResType ITMacResourceType;
-
-@interface ITMacResource : NSObject {
- @protected
- Handle _handle;
-}
-+ (void)_registerClass:(Class)class forType:(ITMacResourceType)type;
-+ (Class)_classForType:(ITMacResourceType)type;
-
-+ (id)_resourceWithHandle:(Handle)handle;
-- (id)_initWithHandle:(Handle)handle;
-
-- (Handle)_handle;
-
-- (NSData *)data;
-- (ITMacResourceType)type;
-- (NSNumber *)id;
-- (NSString *)name;
-
-- (Class)nativeRepresentationClass;
-- (id)nativeRepresentation;
-@end
+++ /dev/null
-//
-// ITMacResource.m
-// ITKit
-//
-// Created by Joseph Spiros on Thu Dec 25 2003.
-// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
-//
-
-#import "ITMacResource.h"
-
-
-@implementation ITMacResource
-
-static NSMutableDictionary *_resourceTypeClasses = nil;
-
-+ (void)_registerClass:(Class)class forType:(ITMacResourceType)type {
- if (!_resourceTypeClasses) {
- _resourceTypeClasses = [[NSMutableDictionary dictionary] retain];
- }
- [_resourceTypeClasses setObject:class forKey:[NSString stringWithCString:(char *)type]];
-}
-
-+ (Class)_classForType:(ITMacResourceType)type {
- Class _class = [_resourceTypeClasses objectForKey:[NSString stringWithCString:(char *)type]];
- return ((_class == nil) ? [ITMacResource class] : _class);
-}
-
-+ (id)_resourceWithHandle:(Handle)handle { // THIS *WILL* RETURN A MORE SPECIFIC INSTANCE USING THE REGISTRATION DATABASE IF SUCH A CLASS EXISTS
- return [[[self alloc] _initWithHandle:handle] autorelease];
-}
-
-- (id)_initWithHandle:(Handle)handle {
- if (self = [super init]) {
- _handle = handle;
- }
- return self;
-}
-
-- (Handle)_handle {
- return _handle;
-}
-
-- (NSData *)data {
- NSData *_data;
- HLock(_handle);
- _data = [NSData dataWithBytes:(*_handle) length:GetHandleSize(_handle)];
- HUnlock(_handle);
- return _data;
-}
-
-- (ITMacResourceType)type {
- short _id;
- ResType _type;
- Str255 _name;
- GetResInfo(_handle, &_id, &_type, _name);
- return (ITMacResourceType)_type;
-}
-
-- (NSNumber *)id {
- short _id;
- ResType _type;
- Str255 _name;
- GetResInfo(_handle, &_id, &_type, _name);
- return [NSNumber numberWithShort:_id];
-}
-
-- (NSString *)name {
- short _id;
- ResType _type;
- Str255 _name;
- GetResInfo(_handle, &_id, &_type, _name);
- return [(NSString*)CFStringCreateWithPascalString(NULL,
-_name, kCFStringEncodingMacRomanLatin1) autorelease];
-}
-
-- (Class)nativeRepresentationClass {
- return nil;
-}
-
-- (id)nativeRepresentation {
- return nil;
-}
-
-- (void)dealloc {
- ReleaseResource(_handle);
- [super dealloc];
-}
-
-@end
+++ /dev/null
-//
-// ITMacResourceFile.h
-// ITKit
-//
-// Created by Joseph Spiros on Thu Dec 25 2003.
-// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <Carbon/Carbon.h>
-#import "ITMacResource.h"
-
-@interface ITMacResourceFile : NSObject {
- FSRef _fileReference;
- SInt16 _referenceNumber;
-}
-- (id)initWithContentsOfFile:(NSString *)path;
-- (id)initWithContentsOfFile:(NSString *)path fork:(HFSUniStr255)namedFork;
-
-- (ITMacResource *)resourceOfType:(ITMacResourceType)type withID:(NSNumber *)idNum;
-- (ITMacResource *)resourceOfType:(ITMacResourceType)type withName:(NSString *)name;
-@end
+++ /dev/null
-//
-// ITMacResourceFile.m
-// ITKit
-//
-// Created by Joseph Spiros on Thu Dec 25 2003.
-// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
-//
-
-#import "ITMacResourceFile.h"
-
-
-@implementation ITMacResourceFile
-
-- (id)initWithContentsOfFile:(NSString *)path {
- HFSUniStr255 dataForkName;
- FSGetDataForkName(&dataForkName);
- return [self initWithContentsOfFile:path fork:dataForkName];
-}
-
-- (id)initWithContentsOfFile:(NSString *)path fork:(HFSUniStr255)namedFork {
- if (self = [super init]) {
- if (FSPathMakeRef([path fileSystemRepresentation],&_fileReference,NULL) == noErr) {
- FSOpenResourceFile(&_fileReference, namedFork.length, namedFork.unicode, fsRdPerm, &_referenceNumber);
- } else {
- // Raise Exception!
- }
- }
- return self;
-}
-
-- (ITMacResource *)resourceOfType:(ITMacResourceType)type withID:(NSNumber *)idNum {
- return [[ITMacResource _classForType:type] _resourceWithHandle:GetResource((ResType)type,[idNum shortValue])];
-}
-
-- (ITMacResource *)resourceOfType:(ITMacResourceType)type withName:(NSString *)name {
- Str255 _buffer;
- StringPtr _ptr = CFStringGetPascalStringPtr((CFStringRef)name, kCFStringEncodingMacRomanLatin1);
- if (_ptr == NULL) {
- if (CFStringGetPascalString((CFStringRef)name, _buffer, 256, kCFStringEncodingMacRomanLatin1)) {
- _ptr = _buffer;
- } else {
- // Raise exception!
- }
- }
- return [[ITMacResource _classForType:type] _resourceWithHandle:GetNamedResource((ResType)type,_ptr)];
-}
-
-- (void)dealloc {
- CloseResFile(_referenceNumber);
- [super dealloc];
-}
-
-@end
-//
-// ITMultilineTextFieldCell.h
-// ITKit
-//
-// Created by Joseph Spiros on Fri Mar 05 2004.
-// Copyright (c) 2004 __MyCompanyName__. All rights reserved.
-//
+/*
+ * ITKit
+ * ITMultilineTextFieldCell.h
+ *
+ * Custom NSCell subclass that draws multiple lines of text using standard
+ * UI guidelines for such a presentation.
+ *
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
+ *
+ */
#import <Cocoa/Cocoa.h>
-
@interface ITMultilineTextFieldCell : NSCell {
+
}
-@end
+@end
\ No newline at end of file
-//
-// ITMultilineTextFieldCell.m
-// ITKit
-//
-// Created by Joseph Spiros on Fri Mar 05 2004.
-// Copyright (c) 2004 __MyCompanyName__. All rights reserved.
-//
-
#import "ITMultilineTextFieldCell.h"
-
@implementation ITMultilineTextFieldCell
-- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
-{
- if ([[self objectValue] isKindOfClass:[NSArray class]]) {
-
- /*
- Okay, here's the different possibilities for the objectValue of this cell, and how they're displayed:
-
- NSArray of NSStrings - Draw first line with System Font, following lines with Small System Font
- NSArray of NSAttributedStrings - Draw as given
- NSArray of both - Draw each line as above!
-
- The number of lines is determined by the contents of the array...
- */
-
- NSColor *defaultColor;
- NSMutableParagraphStyle *paragraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
- [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
- NSPoint cellPoint = cellFrame.origin;
- NSSize cellSize = cellFrame.size;
-
- NSRect secondaryLineRect;
-
- if ([self isHighlighted] && ([self highlightColorWithFrame:cellFrame inView:controlView]!=[NSColor secondarySelectedControlColor])) {
- defaultColor = [NSColor whiteColor];
- } else {
- defaultColor = [NSColor blackColor];
- }
-
- // Process the first line...
- {
- NSDictionary *firstLineAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont boldSystemFontOfSize:[NSFont systemFontSize]], NSFontAttributeName, defaultColor, NSForegroundColorAttributeName, paragraphStyle, NSParagraphStyleAttributeName, nil];
-
- NSRect firstLineRect = NSMakeRect(cellPoint.x+5, cellPoint.y+1, cellSize.width-5, cellSize.height);
-
- id firstString = [[self objectValue] objectAtIndex:0];
- NSMutableAttributedString *firstAttrString;
-
- if ([firstString isKindOfClass:[NSAttributedString class]]) {
- firstAttrString = [[[NSMutableAttributedString alloc] initWithAttributedString:firstString] autorelease];
- [firstAttrString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0,[firstAttrString length])];
- if ([defaultColor isEqual:[NSColor whiteColor]]) {
- [firstAttrString addAttribute:NSForegroundColorAttributeName value:defaultColor range:NSMakeRange(0,[firstAttrString length])];
- }
- } else if ([firstString isKindOfClass:[NSString class]]) {
- firstAttrString = [[[NSMutableAttributedString alloc] initWithString:firstString attributes:firstLineAttributes] autorelease];
- } else {
- firstAttrString = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"Object (%@) is not a string", firstString] attributes:firstLineAttributes] autorelease];
- }
-
- [controlView lockFocus];
-
- [firstAttrString drawInRect:firstLineRect];
-
- [controlView unlockFocus];
-
- secondaryLineRect = NSMakeRect(cellPoint.x+5, (cellPoint.y+1+[firstAttrString size].height), cellSize.width-5, cellSize.height);
- }
-
- // Process the secondary lines
- {
- NSDictionary *secondaryLineAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]], NSFontAttributeName, defaultColor, NSForegroundColorAttributeName, paragraphStyle, NSParagraphStyleAttributeName, nil];
-
- NSMutableArray *tMArray = [NSMutableArray arrayWithArray:[self objectValue]];
- [tMArray removeObjectAtIndex:0]; // Remove the first line string... already handled that above!
-
- NSEnumerator *enumerator = [tMArray objectEnumerator];
- id secondaryString;
-
- while (secondaryString = [enumerator nextObject]) {
-
- NSMutableAttributedString *secondaryAttrString;
-
- if ([secondaryString isKindOfClass:[NSAttributedString class]]) {
- secondaryAttrString = [[[NSMutableAttributedString alloc] initWithAttributedString:secondaryString] autorelease];
- [secondaryAttrString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0,[secondaryAttrString length])];
- if ([defaultColor isEqual:[NSColor whiteColor]]) {
- [secondaryAttrString addAttribute:NSForegroundColorAttributeName value:defaultColor range:NSMakeRange(0,[secondaryAttrString length])];
- }
- } else if ([secondaryString isKindOfClass:[NSString class]]) {
- secondaryAttrString = [[[NSMutableAttributedString alloc] initWithString:secondaryString attributes:secondaryLineAttributes] autorelease];
- } else {
- secondaryAttrString = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"Object (%@) is not a string", secondaryString] attributes:secondaryLineAttributes] autorelease];
- }
-
- [controlView lockFocus];
-
- [secondaryAttrString drawInRect:secondaryLineRect];
-
- [controlView unlockFocus];
-
- secondaryLineRect.origin.y = secondaryLineRect.origin.y+[secondaryAttrString size].height; // modify the rect for the next loop, based on the size and location of the most recently processed line.
-
- }
- }
- } else {
- [super drawInteriorWithFrame:cellFrame inView:controlView];
- }
+- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
+ if ([(id)[self objectValue] isKindOfClass:[NSArray class]]) {
+
+ /*
+ Okay, here's the different possibilities for the objectValue of this cell, and how they're displayed:
+
+ NSArray of NSStrings - Draw first line with System Font, following lines with Small System Font
+ NSArray of NSAttributedStrings - Draw as given
+ NSArray of both - Draw each line as above!
+
+ The number of lines is determined by the contents of the array...
+ */
+
+ NSColor *defaultColor;
+ NSMutableParagraphStyle *paragraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
+ [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
+ NSPoint cellPoint = cellFrame.origin;
+ NSSize cellSize = cellFrame.size;
+
+ NSRect secondaryLineRect;
+
+ if ([self isHighlighted] && ([self highlightColorWithFrame:cellFrame inView:controlView]!=[NSColor secondarySelectedControlColor])) {
+ defaultColor = [NSColor whiteColor];
+ } else {
+ defaultColor = [NSColor blackColor];
+ }
+
+ // Process the first line...
+ {
+ NSDictionary *firstLineAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont boldSystemFontOfSize:[NSFont systemFontSize]], NSFontAttributeName, defaultColor, NSForegroundColorAttributeName, paragraphStyle, NSParagraphStyleAttributeName, nil];
+
+ NSRect firstLineRect = NSMakeRect(cellPoint.x+5, cellPoint.y+1, cellSize.width-5, cellSize.height);
+
+ id firstString = [(NSArray *)[self objectValue] objectAtIndex:0];
+ NSMutableAttributedString *firstAttrString;
+
+ if ([firstString isKindOfClass:[NSAttributedString class]]) {
+ firstAttrString = [[[NSMutableAttributedString alloc] initWithAttributedString:firstString] autorelease];
+ [firstAttrString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0,[firstAttrString length])];
+ if ([defaultColor isEqual:[NSColor whiteColor]]) {
+ [firstAttrString addAttribute:NSForegroundColorAttributeName value:defaultColor range:NSMakeRange(0,[firstAttrString length])];
+ }
+ } else if ([firstString isKindOfClass:[NSString class]]) {
+ firstAttrString = [[[NSMutableAttributedString alloc] initWithString:firstString attributes:firstLineAttributes] autorelease];
+ } else {
+ firstAttrString = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"Object (%@) is not a string", firstString] attributes:firstLineAttributes] autorelease];
+ }
+
+ [controlView lockFocus];
+
+ [firstAttrString drawInRect:firstLineRect];
+
+ [controlView unlockFocus];
+
+ secondaryLineRect = NSMakeRect(cellPoint.x+5, (cellPoint.y+1+[firstAttrString size].height), cellSize.width-5, cellSize.height);
+ }
+
+ // Process the secondary lines
+ {
+ NSDictionary *secondaryLineAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]], NSFontAttributeName, defaultColor, NSForegroundColorAttributeName, paragraphStyle, NSParagraphStyleAttributeName, nil];
+
+ NSMutableArray *tMArray = [NSMutableArray arrayWithArray:(NSArray *)[self objectValue]];
+ [tMArray removeObjectAtIndex:0]; // Remove the first line string... already handled that above!
+
+ NSEnumerator *enumerator = [tMArray objectEnumerator];
+ id secondaryString;
+
+ while ((secondaryString = [enumerator nextObject])) {
+
+ NSMutableAttributedString *secondaryAttrString;
+
+ if ([secondaryString isKindOfClass:[NSAttributedString class]]) {
+ secondaryAttrString = [[[NSMutableAttributedString alloc] initWithAttributedString:secondaryString] autorelease];
+ [secondaryAttrString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0,[secondaryAttrString length])];
+ if ([defaultColor isEqual:[NSColor whiteColor]]) {
+ [secondaryAttrString addAttribute:NSForegroundColorAttributeName value:defaultColor range:NSMakeRange(0,[secondaryAttrString length])];
+ }
+ } else if ([secondaryString isKindOfClass:[NSString class]]) {
+ secondaryAttrString = [[[NSMutableAttributedString alloc] initWithString:secondaryString attributes:secondaryLineAttributes] autorelease];
+ } else {
+ secondaryAttrString = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"Object (%@) is not a string", secondaryString] attributes:secondaryLineAttributes] autorelease];
+ }
+
+ [controlView lockFocus];
+
+ [secondaryAttrString drawInRect:secondaryLineRect];
+
+ [controlView unlockFocus];
+
+ secondaryLineRect.origin.y = secondaryLineRect.origin.y+[secondaryAttrString size].height; // modify the rect for the next loop, based on the size and location of the most recently processed line.
+
+ }
+ }
+ } else {
+ [super drawInteriorWithFrame:cellFrame inView:controlView];
+ }
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITPivotWindowEffect
- * Effect subclass which pivots (rotates) a window into position on the screen.
+ * ITPivotWindowEffect.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Effect subclass which pivots (rotates) a window into position on the screen.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
#import "ITWindowEffect.h"
-
-@interface ITPivotWindowEffect : ITWindowEffect <ITWindowEffect> {
+@interface ITPivotWindowEffect : ITWindowEffect {
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITSlideHorizontallyWindowEffect
- * Effect subclass which slides a window in from the right or left side of the screen.
+ * ITSlideHorizontallyWindowEffect.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Effect subclass which slides a window in from the right or left side of the screen.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
#import "ITWindowEffect.h"
-
-@interface ITSlideHorizontallyWindowEffect : ITWindowEffect <ITWindowEffect> {
+@interface ITSlideHorizontallyWindowEffect : ITWindowEffect {
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITSlideVerticallyWindowEffect
- * Effect subclass which slides a window in from the top or bottom of the screen.
+ * ITSlideVerticallyWindowEffect.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Effect subclass which slides a window in from the top or bottom of the screen.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
#import "ITWindowEffect.h"
-
-@interface ITSlideVerticallyWindowEffect : ITWindowEffect <ITWindowEffect> {
+@interface ITSlideVerticallyWindowEffect : ITWindowEffect {
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITSpinAndZoomWindowEffect
- * Effect subclass which Spins (expands/shrinks) a window into position on the screen.
+ * ITSpinAndZoomWindowEffect.h
*
- * Original Author : Kent Sutherland <ksutherland@ithinksw.com>
- * Responsibility : Kent Sutherland <ksutherland@ithinksw.com>
+ * Effect subclass which spins and zooms a window into position on the screen.
*
- * Copyright (c) 2002 - 2004 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
#import "ITWindowEffect.h"
-
-@interface ITSpinAndZoomWindowEffect : ITWindowEffect <ITWindowEffect> {
+@interface ITSpinAndZoomWindowEffect : ITWindowEffect {
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITSpinWindowEffect
- * Effect subclass which Spins (expands/shrinks) a window into position on the screen.
+ * ITSpinWindowEffect.h
*
- * Original Author : Kent Sutherland <ksutherland@ithinksw.com>
- * Responsibility : Kent Sutherland <ksutherland@ithinksw.com>
+ * Effect subclass which spins a window into position on the screen.
*
- * Copyright (c) 2002 - 2004 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
#import "ITWindowEffect.h"
-
-@interface ITSpinWindowEffect : ITWindowEffect <ITWindowEffect> {
+@interface ITSpinWindowEffect : ITWindowEffect {
}
-@end
+@end
\ No newline at end of file
-/* ITSplashScreen */
+/*
+ * ITKit
+ * ITSplashScreen.h
+ *
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
+ *
+ */
#import <Cocoa/Cocoa.h>
@class ITSplashWindow, ITSplashView;
-@interface ITSplashScreen : NSObject
-{
+@interface ITSplashScreen : NSObject {
NSTimer *_fadeTimer;
ITSplashWindow *_window;
ITSplashView *_view;
}
+
+ (ITSplashScreen *)sharedController;
- (double)progressValue;
- (void)showSplashWindow;
- (void)closeSplashWindow;
-@end
+
+@end
\ No newline at end of file
#import "ITSplashWindow.h"
#import "ITSplashView.h"
-static ITSplashScreen *_sharedController;
+static ITSplashScreen *_sharedScreen;
@implementation ITSplashScreen
-+ (ITSplashScreen *)sharedController
-{
- if (!_sharedController) {
- _sharedController = [[ITSplashScreen alloc] init];
++ (ITSplashScreen *)sharedController {
+ if (!_sharedScreen) {
+ _sharedScreen = [[ITSplashScreen alloc] init];
}
- return _sharedController;
+ return _sharedScreen;
}
-- (id)init
-{
- if ( (self = [super init]) ) {
+- (id)init {
+ if ((self = [super init])) {
_window = [[ITSplashWindow alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
_view = [[ITSplashView alloc] initWithFrame:NSMakeRect(0, 0, 200, 200)];
[_window setLevel:NSStatusWindowLevel];
return self;
}
-- (void)dealloc
-{
+- (void)dealloc {
[_window release];
[super dealloc];
}
-- (double)progressValue
-{
+- (double)progressValue {
return ([[_view progressIndicator] doubleValue] / 100.0);
}
-- (void)setProgressValue:(double)progress
-{
+- (void)setProgressValue:(double)progress {
if (progress >= 1.0) {
[[_view progressIndicator] setIndeterminate:YES];
} else {
}
}
-- (NSImage *)image
-{
+- (NSImage *)image {
return [_view image];
}
-- (void)setImage:(NSImage *)image
-{
+- (void)setImage:(NSImage *)image {
NSRect rect = NSZeroRect, newRect = [_window frame];
rect.size = [image size];
newRect.size = rect.size;
[_window center];
}
-- (NSString *)string
-{
+- (NSString *)string {
return [_view string];
}
-- (void)setString:(NSString *)string
-{
+- (void)setString:(NSString *)string {
[_view setString:string];
}
-- (void)setSettingsPath:(NSString *)path
-{
+- (void)setSettingsPath:(NSString *)path {
[_view loadControlsFromPath:path];
}
-- (void)showSplashWindow
-{
+- (void)showSplashWindow {
//[_window setAlphaValue:0.0];
[_window makeKeyAndOrderFront:nil];
//_fadeTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / 30.0) target:self selector:@selector(showStep:) userInfo:nil repeats:YES];
}
-- (void)showStep:(NSTimer *)timer
-{
- [_window setAlphaValue:[_window alphaValue] + 0.05];
+- (void)showStep:(NSTimer *)timer {
+ [_window setAlphaValue:([_window alphaValue] + 0.05)];
if ([_window alphaValue] >= 1.0) {
[timer invalidate];
_fadeTimer = nil;
}
}
-- (void)closeSplashWindow
-{
+- (void)closeSplashWindow {
if (_fadeTimer) {
[_fadeTimer invalidate];
}
_fadeTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / 30.0) target:self selector:@selector(closeStep:) userInfo:nil repeats:YES];
}
-- (void)closeStep:(NSTimer *)timer
-{
- [_window setAlphaValue:[_window alphaValue] - 0.05];
+- (void)closeStep:(NSTimer *)timer {
+ [_window setAlphaValue:([_window alphaValue] - 0.05)];
if ([_window alphaValue] <= 0.0) {
[timer invalidate];
_fadeTimer = nil;
-//
-// ITSplashView.h
-// SplashScreen
-//
-// Created by Kent Sutherland on 11/22/04.
-// Copyright 2004 __MyCompanyName__. All rights reserved.
-//
+/*
+ * ITKit
+ * ITSplashView.h
+ *
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
+ *
+ */
#import <Cocoa/Cocoa.h>
-@interface ITSplashView : NSView
-{
+@interface ITSplashView : NSView {
NSImage *_image;
NSProgressIndicator *_progress;
NSTextField *_text;
}
+
- (void)stopAnimation;
- (NSProgressIndicator *)progressIndicator;
- (NSImage *)image;
- (void)setImage:(NSImage *)image;
- (void)setString:(NSString *)text;
- (void)loadControlsFromPath:(NSString *)path;
-@end
+
+@end
\ No newline at end of file
-//
-// ITSplashView.m
-// SplashScreen
-//
-// Created by Kent Sutherland on 11/22/04.
-// Copyright 2004 __MyCompanyName__. All rights reserved.
-//
-
#import "ITSplashView.h"
@implementation ITSplashView
-- (id)initWithFrame:(NSRect)frame
-{
- if ( (self = [super initWithFrame:frame]) ) {
- }
- return self;
-}
-
-- (void)dealloc
-{
+- (void)dealloc {
[_image release];
[_progress release];
[_text release];
[super dealloc];
}
-- (void)drawRect:(NSRect)rect
-{
+- (void)drawRect:(NSRect)rect {
[_image compositeToPoint:NSZeroPoint operation:NSCompositeSourceOver];
}
-- (BOOL)isOpaque
-{
+- (BOOL)isOpaque {
return NO;
}
-- (void)stopAnimation
-{
+- (void)stopAnimation {
[_progress stopAnimation:nil];
}
-- (NSProgressIndicator *)progressIndicator
-{
+- (NSProgressIndicator *)progressIndicator {
return _progress;
}
-- (NSImage *)image
-{
+- (NSImage *)image {
return _image;
}
-- (NSString *)string
-{
+- (NSString *)string {
return [_text stringValue];
}
-- (void)setImage:(NSImage *)image
-{
+- (void)setImage:(NSImage *)image {
[_image autorelease];
_image = [image retain];
}
-- (void)setString:(NSString *)text
-{
+- (void)setString:(NSString *)text {
[_text setStringValue:text];
}
-- (void)loadControlsFromPath:(NSString *)path
-{
+- (void)loadControlsFromPath:(NSString *)path {
[_progress removeFromSuperview];
[_progress release];
[_text removeFromSuperview];
switch (height) {
/*case NSProgressIndicatorPreferredSmallThickness:
size = NSMiniControlSize;
- break;*/
+ break;*/
case NSProgressIndicatorPreferredAquaThickness:
size = NSSmallControlSize;
- break;
+ break;
case NSProgressIndicatorPreferredThickness:
default:
size = NSRegularControlSize;
- break;
+ break;
}
if ([[settings objectForKey:@"ProgressIndicator.style"] intValue] == 0) {
//We have a normal bar
[settings release];
}
-@end
+@end
\ No newline at end of file
-/* ITSplashWindow */
+/*
+ * ITKit
+ * ITSplashWindow.h
+ *
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
+ *
+ */
#import <Cocoa/Cocoa.h>
-@interface ITSplashWindow : NSWindow
-{
+@interface ITSplashWindow : NSWindow {
+
}
-@end
+
+@end
\ No newline at end of file
@implementation ITSplashWindow
-- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag
-{
- if ( (self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]) ) {
+- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag {
+ if ((self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO])) {
[self setOpaque:NO];
[self setBackgroundColor:[NSColor clearColor]];
[self setHasShadow:YES];
return self;
}
-- (BOOL)canBecomeKeyWindow
-{
+- (BOOL)canBecomeKeyWindow {
return YES;
}
-- (BOOL)isKeyWindow
-{
+- (BOOL)isKeyWindow {
return YES;
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITStatusItem
- * NSStatusItem subclass which reduces suckage
+ * ITStatusItem.h
*
- * Original Author : Joseph Spiros <joseph.spiros@ithinksw.com>
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * NSStatusItem subclass which attempts to approximate NSMenuExtra's
+ * appearance and functionality.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
*
- */
-
-/*
- * This subclass does 4 things to approximate NSMenuExtra's functionality:
- *
- * 1. Makes the status item smarter about highlighting.
- * 2. Allows you to set an alternate (inverted) image.
- * 3. Eliminates the pre-Jaguar shadow behind a normal status item.
- * 4. If you use an image AND title, the text will be made slightly smaller
- * to resemble the visual interface of an NSMenuExtra.
- *
- * Note: In order to have the shadow not overlap the bottom of the
- * menubar, Apple moves the image up one pixel. Since that shadow is
- * no longer drawn, please adjust your images DOWN one pixel to compensate.
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
+@interface ITStatusItem : NSStatusItem {
-@interface ITStatusItem : NSStatusItem
-{
}
-// Use this to create a new retained status item.
-// It will appear in the system status bar, and
-// default to YES for its highlightMode.
-- (id)initWithStatusBar:(NSStatusBar*)statusBar withLength:(float)length;
-
-// These allow you to use an alternate (selected) image for your status item.
-- (NSImage*) alternateImage;
-- (void) setAlternateImage:(NSImage*)image;
+- (id)initWithStatusBar:(NSStatusBar *)statusBar withLength:(float)length;
+- (NSImage *)alternateImage;
+- (void)setAlternateImage:(NSImage *)image;
-@end
+@end
\ No newline at end of file
#import "ITStatusItem.h"
-/*************************************************************************/
-#pragma mark -
-#pragma mark EVIL HACKERY
-/*************************************************************************/
+@class NSStatusBarButton;
-// This stuff is actually implemented by the AppKit.
-// We declare it here to cancel out warnings.
-
-@interface NSStatusBarButton : NSButton
+@interface NSStatusItem (ITStatusItemHacks)
+- (id)_initInStatusBar:(NSStatusBar *)statusBar withLength:(float)length withPriority:(int)priority;
+- (NSStatusBarButton *)_button;
@end
-@interface NSStatusItem (HACKHACKHACKHACK)
-- (id)_initInStatusBar:(NSStatusBar*)statusBar
- withLength:(float)length
- withPriority:(int)priority;
-- (NSStatusBarButton*)_button;
+@protocol _ITStatusItemNSStatusItemPantherCompatability
+- (void)setAlternateImage:(NSImage *)image;
+- (NSImage *)alternateImage;
@end
+@implementation ITStatusItem
-/*************************************************************************/
-#pragma mark -
-#pragma mark PRIVATE METHOD DECLARATIONS
-/*************************************************************************/
-
-@interface ITStatusItem (Private)
-- (void)setImage:(NSImage*)image;
-- (NSString*) title;
-- (void)setTitle:(NSString*)title;
-- (void)setSmallTitle:(NSString*)title;
-@end
-
+static BOOL _ITStatusItemShouldKillShadow = NO;
-@implementation ITStatusItem
++ (void)initialize {
+ if ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_1) && (floor(NSAppKitVersionNumber) <= 663.6)) {
+ _ITStatusItemShouldKillShadow = YES;
+ }
+}
-/*************************************************************************/
-#pragma mark -
-#pragma mark INITIALIZATION METHODS
-/*************************************************************************/
+- (id)initWithStatusBar:(NSStatusBar *)statusBar withLength:(float)length {
+ return [self _initInStatusBar:statusBar withLength:length withPriority:1000];
+}
-- (id)initWithStatusBar:(NSStatusBar*)statusBar withLength:(float)length
-{
- if ( ( self = [super _initInStatusBar:statusBar
- withLength:length
- withPriority:1000] ) ) {
-
- //Eliminate the fucking shadow...
- [[[self _button] cell] setType:NSNullCellType];
-
- //Be something other than a dumbshit about highlighting...
+- (id)_initInStatusBar:(NSStatusBar *)statusBar withLength:(float)length withPriority:(int)priority {
+ if ((self = [super _initInStatusBar:statusBar withLength:length withPriority:priority])) {
+ if (_ITStatusItemShouldKillShadow) {
+ [[(NSButton *)[self _button] cell] setType:NSNullCellType];
+ }
[self setHighlightMode:YES];
}
return self;
}
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark ACCESSOR METHODS
-/*************************************************************************/
-
-- (NSImage*)alternateImage {
- return [[self _button] alternateImage];
+- (NSImage *)alternateImage {
+ if ([super respondsToSelector:@selector(alternateImage)]) {
+ return [(id <_ITStatusItemNSStatusItemPantherCompatability>)super alternateImage];
+ }
+ return [(NSButton *)[self _button] alternateImage];
}
- (void)setAlternateImage:(NSImage*)image {
- [[self _button] setAlternateImage:image];
+ if ([super respondsToSelector:@selector(setAlternateImage:)]) {
+ [(id <_ITStatusItemNSStatusItemPantherCompatability>)super setAlternateImage:image];
+ return;
+ }
+ [(NSButton *)[self _button] setAlternateImage:image];
}
-- (void)setImage:(NSImage*)image {
- [super setImage:image];
- if ( [self title] ) {
- [self setTitle:[self title]];
- }
-}
-
-- (void)setTitle:(NSString*)title {
- if ( [self image] && (title != nil) ) {
- [self setSmallTitle:title];
- } else {
- [super setTitle:title];
- }
-}
-
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark PRIVATE METHODS
-/*************************************************************************/
-
-- (void)setSmallTitle:(NSString*)title {
- NSAttributedString *attrTitle = [[[NSAttributedString alloc] initWithString:title attributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"LucidaGrande" size:12.0] forKey:NSFontAttributeName]] autorelease];
- [self setAttributedTitle:attrTitle];
-}
-
-
-@end
+@end
\ No newline at end of file
+++ /dev/null
-//
-// ITStringMacResource.h
-// ITKit
-//
-// Created by Joseph Spiros on Thu Dec 25 2003.
-// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import "ITMacResource.h"
-
-@interface ITStringMacResource : ITMacResource {
-
-}
-
-@end
+++ /dev/null
-//
-// ITStringMacResource.m
-// ITKit
-//
-// Created by Joseph Spiros on Thu Dec 25 2003.
-// Copyright (c) 2003 __MyCompanyName__. All rights reserved.
-//
-
-#import "ITStringMacResource.h"
-
-
-@implementation ITStringMacResource
-
-+ (void)load {
- [ITMacResource _registerClass:self forType:'STR '];
-}
-
-- (Class)nativeRepresentationClass {
- return [NSString class];
-}
-
-- (id)nativeRepresentation {
- return @"Not Implemented Yet";
-}
-
-@end
/*
* ITKit
- * ITTSWBackgroundView
- * NSView subclass which draws a translucent background with rounded corners.
+ * ITTSWBackgroundView.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * NSView subclass which draws a translucent background with rounded corners.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
#import <Cocoa/Cocoa.h>
-
typedef enum _ITTSWBackgroundMode {
ITTSWBackgroundApple,
ITTSWBackgroundReadable,
ITTSWBackgroundColored
} ITTSWBackgroundMode;
-
@interface ITTSWBackgroundView : NSView {
- NSBezierPath *_path;
- NSColor *_color;
- ITTSWBackgroundMode _mode;
+ NSBezierPath *_path;
+ NSColor *_color;
+ ITTSWBackgroundMode _mode;
}
- (ITTSWBackgroundMode)backgroundMode;
- (NSColor *)backgroundColor;
- (void)setBackgroundColor:(NSColor *)newColor;
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITTabView
- * NSTabView subclass which includes convenience features
+ * ITTabView.h
*
- * Original Author : Kent Sutherland <kent.sutherland@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Kent Sutherland <kent.sutherland@ithinksw.com>
+ * NSTabView subclass which allows dragging (reordering) of tab view items.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-/*
- * This subclass enables drag-and-drop for tab view items.
- */
-
-
#import <Cocoa/Cocoa.h>
-
-@interface ITTabView : NSTabView
-{
- NSTabViewItem *_draggedTab;
- bool _allowsDragging;
- unsigned int _requiredModifiers;
+@interface ITTabView : NSTabView {
+ NSTabViewItem *_draggedTab;
+ BOOL _allowsDragging;
+ unsigned int _requiredModifiers;
}
-- (void)setAllowsDragging:(bool)flag;
-- (bool)allowsDragging;
+- (void)setAllowsDragging:(BOOL)flag;
+- (BOOL)allowsDragging;
- (void)setRequiredModifiers:(unsigned int)modifiers;
- (unsigned int)requiredModifiers;
- (void)moveTab:(NSTabViewItem *)tab toIndex:(int)index;
-
-@end
+@end
\ No newline at end of file
#import "ITTabView.h"
-/*************************************************************************/
-#pragma mark -
-#pragma mark EVIL HACKERY
-/*************************************************************************/
-
-@interface NSTabViewItem (HACKHACKHACKHACK)
+@interface NSTabViewItem (ITTabViewHacks)
- (NSRect)_tabRect;
@end
-
@implementation ITTabView
-- (id)initWithFrame:(NSRect)frame
-{
- if ( (self = [super initWithFrame:frame]) ) {
- _draggedTab = nil;
- _allowsDragging = NO;
- _requiredModifiers = NSCommandKeyMask;
- }
- return self;
+- (id)initWithFrame:(NSRect)frame {
+ if ((self = [super initWithFrame:frame])) {
+ _draggedTab = nil;
+ _allowsDragging = NO;
+ _requiredModifiers = NSCommandKeyMask;
+ }
+ return self;
}
-- (void)setAllowsDragging:(bool)flag
-{
- _allowsDragging = flag;
- _requiredModifiers = NSCommandKeyMask;
+- (void)setAllowsDragging:(BOOL)flag {
+ _allowsDragging = flag;
}
-- (bool)allowsDragging
-{
- return _allowsDragging;
+- (BOOL)allowsDragging {
+ return _allowsDragging;
}
-- (void)setRequiredModifiers:(unsigned int)modifiers
-{
- _requiredModifiers = modifiers;
+- (void)setRequiredModifiers:(unsigned int)modifiers {
+ _requiredModifiers = modifiers;
}
-- (unsigned int)requiredModifiers
-{
- return _requiredModifiers;
+- (unsigned int)requiredModifiers {
+ return _requiredModifiers;
}
-- (void)moveTab:(NSTabViewItem *)tab toIndex:(int)index
-{
- if ([self indexOfTabViewItem:tab] != index)
- {
- [tab retain];
- [self removeTabViewItem:tab];
- [self insertTabViewItem:tab atIndex:index];
- [self selectTabViewItem:tab];
- }
+- (void)moveTab:(NSTabViewItem *)tab toIndex:(int)index {
+ int oldIndex = [self indexOfTabViewItem:tab];
+ if ((oldIndex != NSNotFound) && (oldIndex != index)) {
+ [tab retain];
+ [self removeTabViewItem:tab];
+ [self insertTabViewItem:tab atIndex:index];
+ [self selectTabViewItem:tab];
+ [tab release];
+ }
}
-- (void)mouseDown:(NSEvent *)event
-{
- if ((_requiredModifiers == 0 || ([[NSApp currentEvent] modifierFlags] & _requiredModifiers)) && [self allowsDragging]) {
- NSPoint clickedPoint;
- clickedPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
- NSTabViewItem *clickedTab = [self tabViewItemAtPoint:clickedPoint];
- _draggedTab = clickedTab;
- }
- [super mouseDown:event];
+- (void)mouseDown:(NSEvent *)event {
+ if ((_requiredModifiers == 0 || ([[NSApp currentEvent] modifierFlags] & _requiredModifiers)) && [self allowsDragging]) {
+ NSPoint clickedPoint;
+ clickedPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
+ NSTabViewItem *clickedTab = [self tabViewItemAtPoint:clickedPoint];
+ _draggedTab = clickedTab;
+ }
+ [super mouseDown:event];
}
-- (void)mouseUp:(NSEvent *)event
-{
- if (_draggedTab && [self allowsDragging]) {
- NSPoint releasedPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
- NSTabViewItem *releasedTab = [self tabViewItemAtPoint:releasedPoint];
- if (releasedTab && ![releasedTab isEqualTo:_draggedTab]) {
- [self moveTab:_draggedTab toIndex:[self indexOfTabViewItem:releasedTab]];
- }
- _draggedTab = nil;
- }
- [super mouseUp:event];
+- (void)mouseUp:(NSEvent *)event {
+ if (_draggedTab && [self allowsDragging]) {
+ NSPoint releasedPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
+ NSTabViewItem *releasedTab = [self tabViewItemAtPoint:releasedPoint];
+ if (releasedTab && ![releasedTab isEqualTo:_draggedTab]) {
+ [self moveTab:_draggedTab toIndex:[self indexOfTabViewItem:releasedTab]];
+ }
+ _draggedTab = nil;
+ }
+ [super mouseUp:event];
}
-- (void)mouseDragged:(NSEvent *)event
-{
- if (_draggedTab && [self allowsDragging]) {
- NSPoint currentPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
- NSTabViewItem *curTab = [self tabViewItemAtPoint:currentPoint];
- if (curTab && ![curTab isEqualTo:_draggedTab]) {
- [self moveTab:_draggedTab toIndex:[self indexOfTabViewItem:curTab]];
- [self selectTabViewItem:_draggedTab];
- }
- }
- [super mouseDragged:event];
+- (void)mouseDragged:(NSEvent *)event {
+ if (_draggedTab && [self allowsDragging]) {
+ NSPoint currentPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
+ NSTabViewItem *curTab = [self tabViewItemAtPoint:currentPoint];
+ if (curTab && ![curTab isEqualTo:_draggedTab]) {
+ [self moveTab:_draggedTab toIndex:[self indexOfTabViewItem:curTab]];
+ [self selectTabViewItem:_draggedTab];
+ }
+ }
+ [super mouseDragged:event];
}
-
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITTableCornerView
- * NSPopUpButton subclass for corner views in a table view.
+ * ITTableCornerView.h
*
- * Original Author : Joseph Spiros <joseph.spiros@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * NSPopUpButton subclass for use as a cornerView in NSTableView instances.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
@interface ITTableCornerView : NSPopUpButton {
- NSTableHeaderCell *headerCell;
+ NSImage *image;
+ NSTableHeaderCell *headerCell;
}
-@end
+@end
\ No newline at end of file
#import "ITTableCornerView.h"
+@interface ITTableCornerView (Private)
+
+- (id)initWithFrame:(NSRect)frame cellClass:(Class)cellClass;
+
+@end
+
@implementation ITTableCornerView
- (id)initWithFrame:(NSRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- headerCell = [[NSTableHeaderCell alloc] init];
- }
- return self;
+ return [self initWithFrame:frame cellClass:[NSTableHeaderCell class]];
+}
+
+- (id)initWithFrame:(NSRect)frame cellClass:(Class)cellClass {
+ if ((self = [super initWithFrame:frame])) {
+ headerCell = [[cellClass alloc] init];
+ [self setPullsDown:YES];
+ }
+ return self;
}
- (void)drawRect:(NSRect)rect {
- rect.origin.y = 0;
- rect.size.height = 17;
- rect.size.width += 1;
-
- [headerCell setState: ([[self cell] isHighlighted]) ? NSOnState : NSOffState];
- [headerCell drawWithFrame:rect inView:nil];
-
- if ([self image]) {
- [[self image] drawAtPoint:rect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
- }
+ NSImage *drawImage;
+
+ rect.origin.y = 0;
+ rect.size.height = 17;
+ rect.size.width += 1;
+
+ [headerCell setState:([[self cell] isHighlighted] ? NSOnState : NSOffState)];
+ [headerCell drawWithFrame:rect inView:nil];
+
+ if ((drawImage = [self image])) {
+ BOOL oldFlipped = [drawImage isFlipped];
+ [drawImage setFlipped:YES];
+ [drawImage drawAtPoint:rect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
+ [drawImage setFlipped:oldFlipped];
+ }
+}
+
+- (void)setImage:(NSImage *)anImage {
+ [super setImage:anImage];
+ [image autorelease];
+ image = [anImage copy];
+}
+
+- (NSImage *)image {
+ return (image ? image : [super image]);
}
- (void)dealloc {
- [headerCell release];
- [super dealloc];
+ [image release];
+ [headerCell release];
+ [super dealloc];
}
@end
\ No newline at end of file
/*
* ITKit
- * ITTableView
- * NSTableView subclass with easy to use accessors for adding a menu
- * (with optional image) to the corner view of the TableView.
+ * ITTableCornerView.h
*
- * Original Author : Joseph Spiros <joseph.spiros@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * NSTableView subclass that uses an ITTableCornerView as its default
+ * cornerView and provides easy to use accessors to the features
+ * provided by ITTableCornerView when it is being used.
*
- * Copyright (c) 2002-2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
#import <Cocoa/Cocoa.h>
-@class ITTableCornerView;
-
@interface ITTableView : NSTableView {
- ITTableCornerView *corner;
+
}
- (void)setCornerImage:(NSImage*)image;
- (void)setCornerMenu:(NSMenu*)menu;
- (NSMenu*)cornerMenu;
-@end
+@end
\ No newline at end of file
#import "ITTableView.h"
#import "ITTableCornerView.h"
-
@implementation ITTableView
- (id)initWithFrame:(NSRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- corner = [[ITTableCornerView alloc] initWithFrame:[[self cornerView] frame]];
- [corner setPullsDown:YES];
- [self setCornerView:corner];
- }
- return self;
+ if ((self = [super initWithFrame:frame])) {
+ [self setCornerView:[[ITTableCornerView alloc] initWithFrame:[[self cornerView] frame]]];
+ }
+ return self;
}
-- (id)initWithCoder:(NSCoder*)coder {
- self = [super initWithCoder:coder];
- if (self) {
- corner = [[ITTableCornerView alloc] initWithFrame:[[self cornerView] frame]];
- [corner setPullsDown:YES];
- [self setCornerView:corner];
- }
- return self;
+- (id)initWithCoder:(NSCoder *)coder {
+ if ((self = [super initWithCoder:coder])) {
+ [self setCornerView:[[ITTableCornerView alloc] initWithFrame:[[self cornerView] frame]]];
+ }
+ return self;
}
-- (void)encodeWithCoder:(NSCoder*)coder {
- [super encodeWithCoder:coder];
+- (void)encodeWithCoder:(NSCoder *)coder {
+ [super encodeWithCoder:coder];
}
-- (void)setCornerImage:(NSImage*)image {
- [corner setImage:image];
+- (void)setCornerImage:(NSImage *)image {
+ if ([_cornerView isKindOfClass:[ITTableCornerView class]]) {
+ [(ITTableCornerView *)_cornerView setImage:image];
+ }
}
-- (NSImage*)cornerImage {
- return [corner image];
+- (NSImage *)cornerImage {
+ if ([_cornerView isKindOfClass:[ITTableCornerView class]]) {
+ return [(ITTableCornerView *)_cornerView image];
+ }
+ return nil;
}
-- (void)setCornerMenu:(NSMenu*)menu {
- [corner setMenu:menu];
+- (void)setCornerMenu:(NSMenu *)menu {
+ if ([_cornerView isKindOfClass:[ITTableCornerView class]]) {
+ [(ITTableCornerView *)_cornerView setMenu:menu];
+ }
}
-- (NSMenu*)cornerMenu {
- return [corner menu];
+- (NSMenu *)cornerMenu {
+ if ([_cornerView isKindOfClass:[ITTableCornerView class]]) {
+ return [(ITTableCornerView *)_cornerView menu];
+ }
+ return nil;
}
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITTextField
- * Allows shadows to be drawn under text.
+ * ITTextField.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * Custom NSTextField subclass that uses ITTextFieldCell.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
-
@interface ITTextField : NSTextField {
}
- (BOOL)castsShadow;
- (void)setCastsShadow:(BOOL)newSetting;
-- (float)shadowElevation; /* Light source elevation in degrees. Defaults to 45.0 */
+- (float)shadowElevation; /* Light source elevation in degrees. Defaults to 45.0 */
- (void)setShadowElevation:(float)newElevation;
-- (float)shadowAzimuth; /* Light source azimuth in degrees. Defaults to 90.0 */
+- (float)shadowAzimuth; /* Light source azimuth in degrees. Defaults to 90.0 */
- (void)setShadowAzimuth:(float)newAzimuth;
-- (float)shadowAmbient; /* Amount of ambient light. Defaults to 0.15 */
+- (float)shadowAmbient; /* Amount of ambient light. Defaults to 0.15 */
- (void)setShadowAmbient:(float)newAmbient;
-- (float)shadowHeight; /* Height above the canvas. Defaults to 1.0 */
+- (float)shadowHeight; /* Height above the canvas. Defaults to 1.0 */
- (void)setShadowHeight:(float)newHeight;
-- (float)shadowRadius; /* Blur radius. Defaults to 4.0 */
+- (float)shadowRadius; /* Blur radius. Defaults to 4.0 */
- (void)setShadowRadius:(float)newRadius;
-- (float)shadowSaturation; /* Maximum saturation. Defaults to 1.0 */
+- (float)shadowSaturation; /* Maximum saturation. Defaults to 1.0 */
- (void)setShadowSaturation:(float)newSaturation;
-
-@end
+@end
\ No newline at end of file
#import "ITTextField.h"
#import "ITTextFieldCell.h"
-#import <ApplicationServices/ApplicationServices.h>
-#import "ITCoreGraphicsHacks.h"
-
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark IMPLEMENTATION
-/*************************************************************************/
@implementation ITTextField
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark INITIALIZATION METHODS
-/*************************************************************************/
-
-+ (void)initialize
-{
- if ( self == [ITTextField class] ) {
- [self setCellClass:[ITTextFieldCell class]];
- }
++ (void)initialize {
+ if (self == [ITTextField class]) {
+ [self setCellClass:[ITTextFieldCell class]];
+ }
}
-+ (Class)cellClass
-{
- return [ITTextFieldCell class];
++ (Class)cellClass {
+ return [ITTextFieldCell class];
}
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark ACCESSOR METHODS
-/*************************************************************************/
-
-- (BOOL)castsShadow;
-{
- return [[self cell] castsShadow];
+- (BOOL)castsShadow {
+ return [[self cell] castsShadow];
}
-- (void)setCastsShadow:(BOOL)newSetting;
-{
- [[self cell] setCastsShadow:newSetting];
+- (void)setCastsShadow:(BOOL)newSetting {
+ [[self cell] setCastsShadow:newSetting];
}
-- (float)shadowElevation;
-{
- return [[self cell] shadowElevation];
+- (float)shadowElevation {
+ return [[self cell] shadowElevation];
}
-- (void)setShadowElevation:(float)newElevation;
-{
- [[self cell] setShadowElevation:newElevation];
+- (void)setShadowElevation:(float)newElevation {
+ [[self cell] setShadowElevation:newElevation];
}
-- (float)shadowAzimuth;
-{
- return [[self cell] shadowAzimuth];
+- (float)shadowAzimuth {
+ return [[self cell] shadowAzimuth];
}
-- (void)setShadowAzimuth:(float)newAzimuth;
-{
- [[self cell] setShadowAzimuth:newAzimuth];
+- (void)setShadowAzimuth:(float)newAzimuth {
+ [[self cell] setShadowAzimuth:newAzimuth];
}
-- (float)shadowAmbient;
-{
- return [[self cell] shadowAmbient];
+- (float)shadowAmbient {
+ return [[self cell] shadowAmbient];
}
-- (void)setShadowAmbient:(float)newAmbient;
-{
- [[self cell] setShadowAmbient:newAmbient];
+- (void)setShadowAmbient:(float)newAmbient {
+ [[self cell] setShadowAmbient:newAmbient];
}
-- (float)shadowHeight;
-{
- return [[self cell] shadowHeight];
+- (float)shadowHeight {
+ return [[self cell] shadowHeight];
}
-- (void)setShadowHeight:(float)newHeight;
-{
- [[self cell] setShadowHeight:newHeight];
+- (void)setShadowHeight:(float)newHeight {
+ [[self cell] setShadowHeight:newHeight];
}
-- (float)shadowRadius;
-{
- return [[self cell] shadowRadius];
+- (float)shadowRadius {
+ return [[self cell] shadowRadius];
}
-- (void)setShadowRadius:(float)newRadius;
-{
- [[self cell] setShadowRadius:newRadius];
+- (void)setShadowRadius:(float)newRadius {
+ [[self cell] setShadowRadius:newRadius];
}
-- (float)shadowSaturation;
-{
- return [[self cell] shadowSaturation];
+- (float)shadowSaturation {
+ return [[self cell] shadowSaturation];
}
-- (void)setShadowSaturation:(float)newSaturation;
-{
- [[self cell] setShadowSaturation:newSaturation];
+- (void)setShadowSaturation:(float)newSaturation {
+ [[self cell] setShadowSaturation:newSaturation];
}
-
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITTextFieldCell
- * Cell used by the ITTextField control.
+ * ITTextFieldCell.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * Custom NSTextFieldCell subclass that casts a shadow using CoreGraphics,
+ * providing support for versions of Cocoa that don't have the NSShadow
+ * class which was introduced in Mac OS X 10.3 (Panther).
*
- * Copyright (c) 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
-
@interface ITTextFieldCell : NSTextFieldCell {
-
- BOOL castsShadow;
-
- float shadowElevation;
- float shadowAzimuth;
- float shadowAmbient;
- float shadowHeight;
- float shadowRadius;
- float shadowSaturation;
-
+ BOOL castsShadow;
+ float shadowElevation;
+ float shadowAzimuth;
+ float shadowAmbient;
+ float shadowHeight;
+ float shadowRadius;
+ float shadowSaturation;
}
- (BOOL)castsShadow;
- (void)setCastsShadow:(BOOL)newSetting;
-- (float)shadowElevation; /* Light source elevation in degrees. Defaults to 45.0 */
+- (float)shadowElevation; /* Light source elevation in degrees. Defaults to 45.0 */
- (void)setShadowElevation:(float)newElevation;
-- (float)shadowAzimuth; /* Light source azimuth in degrees. Defaults to 90.0 */
+- (float)shadowAzimuth; /* Light source azimuth in degrees. Defaults to 90.0 */
- (void)setShadowAzimuth:(float)newAzimuth;
-- (float)shadowAmbient; /* Amount of ambient light. Defaults to 0.15 */
+- (float)shadowAmbient; /* Amount of ambient light. Defaults to 0.15 */
- (void)setShadowAmbient:(float)newAmbient;
-- (float)shadowHeight; /* Height above the canvas. Defaults to 1.0 */
+- (float)shadowHeight; /* Height above the canvas. Defaults to 1.0 */
- (void)setShadowHeight:(float)newHeight;
-- (float)shadowRadius; /* Blur radius. Defaults to 4.0 */
+- (float)shadowRadius; /* Blur radius. Defaults to 4.0 */
- (void)setShadowRadius:(float)newRadius;
-- (float)shadowSaturation; /* Maximum saturation. Defaults to 1.0 */
+- (float)shadowSaturation; /* Maximum saturation. Defaults to 1.0 */
- (void)setShadowSaturation:(float)newSaturation;
-
-@end
+@end
\ No newline at end of file
#import "ITTextFieldCell.h"
-#import <ApplicationServices/ApplicationServices.h>
#import "ITCoreGraphicsHacks.h"
-
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark IMPLEMENTATION
-/*************************************************************************/
+#import <ApplicationServices/ApplicationServices.h>
@implementation ITTextFieldCell
-/*************************************************************************/
-#pragma mark -
-#pragma mark INITIALIZATION METHODS
-/*************************************************************************/
-
-- (id)initTextCell:(NSString *)string
-{
- if ( ( self = [super initTextCell:string] ) ) {
- castsShadow = NO;
- shadowElevation = 45.0;
- shadowAzimuth = 90.0;
- shadowAmbient = 0.15;
- shadowHeight = 1.00;
- shadowRadius = 4.00;
- shadowSaturation = 1.0;
- }
-
- return self;
+- (id)initTextCell:(NSString *)string {
+ if ((self = [super initTextCell:string])) {
+ castsShadow = NO;
+ shadowElevation = 45.0;
+ shadowAzimuth = 90.0;
+ shadowAmbient = 0.15;
+ shadowHeight = 1.00;
+ shadowRadius = 4.00;
+ shadowSaturation = 1.0;
+ }
+ return self;
}
-- (id)initWithCoder:(NSCoder *)coder
-{
- if ( ( self = [super initWithCoder:coder] ) ) {
- castsShadow = NO;
- shadowElevation = 45.0;
- shadowAzimuth = 90.0;
- shadowAmbient = 0.15;
- shadowHeight = 1.00;
- shadowRadius = 4.00;
- shadowSaturation = 1.0;
- }
-
- return self;
+- (id)initWithCoder:(NSCoder *)coder {
+ if ((self = [super initWithCoder:coder])) {
+ castsShadow = NO;
+ shadowElevation = 45.0;
+ shadowAzimuth = 90.0;
+ shadowAmbient = 0.15;
+ shadowHeight = 1.00;
+ shadowRadius = 4.00;
+ shadowSaturation = 1.0;
+ }
+ return self;
}
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark DRAWING METHODS
-/*************************************************************************/
-
-- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView
-{
- CGSGenericObj style = nil;
- CGShadowStyle shadow;
-
- if ( castsShadow ) {
-// Create the shadow style to use for drawing the string
- shadow.version = 0;
- shadow.elevation = shadowElevation;
- shadow.azimuth = shadowAzimuth;
- shadow.ambient = shadowAmbient;
- shadow.height = shadowHeight;
- shadow.radius = shadowRadius;
- shadow.saturation = shadowSaturation;
- style = CGStyleCreateShadow(&shadow);
-
- // Set the context for drawing the string
- [NSGraphicsContext saveGraphicsState];
- CGContextSetStyle([[NSGraphicsContext currentContext] graphicsPort], style);
- }
-
- // Draw the string
- [super drawWithFrame:rect inView:controlView];
-
-
- if ( castsShadow ) {
- // Restore the old context
- [NSGraphicsContext restoreGraphicsState];
- CGStyleRelease(style);
- }
+- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView {
+ CGSGenericObj style = nil;
+ CGShadowStyle shadow;
+
+ if ( castsShadow ) {
+ // Create the shadow style to use for drawing the string
+ shadow.version = 0;
+ shadow.elevation = shadowElevation;
+ shadow.azimuth = shadowAzimuth;
+ shadow.ambient = shadowAmbient;
+ shadow.height = shadowHeight;
+ shadow.radius = shadowRadius;
+ shadow.saturation = shadowSaturation;
+ style = CGStyleCreateShadow(&shadow);
+
+ // Set the context for drawing the string
+ [NSGraphicsContext saveGraphicsState];
+ CGContextSetStyle([[NSGraphicsContext currentContext] graphicsPort], style);
+ }
+
+ // Draw the string
+ [super drawWithFrame:rect inView:controlView];
+
+ if (castsShadow) {
+ // Restore the old context
+ [NSGraphicsContext restoreGraphicsState];
+ CGStyleRelease(style);
+ }
}
-
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark ACCESSOR METHODS
-/*************************************************************************/
-
-- (BOOL)castsShadow;
-{
- return castsShadow;
+- (BOOL)castsShadow {
+ return castsShadow;
}
-- (void)setCastsShadow:(BOOL)newSetting;
-{
- castsShadow = newSetting;
- [[self controlView] setNeedsDisplay:YES];
+- (void)setCastsShadow:(BOOL)newSetting {
+ castsShadow = newSetting;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (float)shadowElevation;
-{
- return shadowElevation;
+- (float)shadowElevation {
+ return shadowElevation;
}
-- (void)setShadowElevation:(float)newElevation;
-{
- shadowElevation = newElevation;
- [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowElevation:(float)newElevation {
+ shadowElevation = newElevation;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (float)shadowAzimuth;
-{
- return shadowAzimuth;
+- (float)shadowAzimuth {
+ return shadowAzimuth;
}
-- (void)setShadowAzimuth:(float)newAzimuth;
-{
- shadowAzimuth = newAzimuth;
- [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowAzimuth:(float)newAzimuth {
+ shadowAzimuth = newAzimuth;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (float)shadowAmbient;
-{
- return shadowAmbient;
+- (float)shadowAmbient {
+ return shadowAmbient;
}
-- (void)setShadowAmbient:(float)newAmbient;
-{
- shadowAmbient = newAmbient;
- [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowAmbient:(float)newAmbient {
+ shadowAmbient = newAmbient;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (float)shadowHeight;
-{
- return shadowHeight;
+- (float)shadowHeight {
+ return shadowHeight;
}
-- (void)setShadowHeight:(float)newHeight;
-{
- shadowHeight = newHeight;
- [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowHeight:(float)newHeight {
+ shadowHeight = newHeight;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (float)shadowRadius;
-{
- return shadowRadius;
+- (float)shadowRadius {
+ return shadowRadius;
}
-- (void)setShadowRadius:(float)newRadius;
-{
- shadowRadius = newRadius;
- [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowRadius:(float)newRadius {
+ shadowRadius = newRadius;
+ [[self controlView] setNeedsDisplay:YES];
}
-- (float)shadowSaturation;
-{
- return shadowSaturation;
+- (float)shadowSaturation {
+ return shadowSaturation;
}
-- (void)setShadowSaturation:(float)newSaturation;
-{
- shadowSaturation = newSaturation;
- [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowSaturation:(float)newSaturation {
+ shadowSaturation = newSaturation;
+ [[self controlView] setNeedsDisplay:YES];
}
-
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITTransientStatusWindow
- * NSWindow subclass for quick display of status information.
- * Similar to volume/brightness/eject bezel key windows.
+ * ITTransientStatusWindow.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
- * Contributor : Kent Sutherland <kent.sutherland@ithinksw.com>
+ * NSWindow subclass for quick display of status information, similar to
+ * volume/brightness/eject bezel key windows.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
#import "ITWindowPositioning.h"
#import "ITWindowEffect.h"
-#define DEFAULT_EXIT_DELAY 3.0
-
+#define DEFAULT_EXIT_DELAY 3.0
@class ITTextField;
@class ITGrayRoundedView;
-@class ITWindowEffect;
-
typedef enum {
ITTransientStatusWindowExitOnCommand,
- ITTransientStatusWindowExitAfterDelay,
+ ITTransientStatusWindowExitAfterDelay
} ITTransientStatusWindowExitMode;
-
typedef enum {
ITTransientStatusWindowNoBackground,
ITTransientStatusWindowRounded,
ITTransientStatusWindowMini
} ITTransientStatusWindowSizing;
-@interface ITTransientStatusWindow : NSWindow <ITWindowPositioning , ITWindowMotility> {
-
- ITWindowVisibilityState _visibilityState;
- ITTransientStatusWindowExitMode _exitMode;
- float _exitDelay;
- ITTransientStatusWindowBackgroundType _backgroundType;
- ITWindowEffect *_entryEffect;
- ITWindowEffect *_exitEffect;
- double _effectProgress;
- ITVerticalWindowPosition _verticalPosition;
- ITHorizontalWindowPosition _horizontalPosition;
- ITTransientStatusWindowSizing _sizing;
- float _screenPadding;
-// int _screenNumber;
+@interface ITTransientStatusWindow : NSWindow <ITWindowPositioning, ITWindowMotility> {
+ ITWindowVisibilityState _visibilityState;
+ ITTransientStatusWindowExitMode _exitMode;
+ float _exitDelay;
+ ITTransientStatusWindowBackgroundType _backgroundType;
+ ITWindowEffect *_entryEffect;
+ ITWindowEffect *_exitEffect;
+ double _effectProgress;
+ ITVerticalWindowPosition _verticalPosition;
+ ITHorizontalWindowPosition _horizontalPosition;
+ ITTransientStatusWindowSizing _sizing;
+ float _screenPadding;
NSScreen *_screen;
-
- BOOL _reallyIgnoresEvents;
-
- NSTimer *_exitTimer;
-
- NSView *_contentSubView;
+ BOOL _reallyIgnoresEvents;
+ NSTimer *_exitTimer;
+ NSView *_contentSubView;
}
+ (id)sharedWindow;
-- (id)initWithContentView:(NSView *)contentView
- exitMode:(ITTransientStatusWindowExitMode)exitMode
- backgroundType:(ITTransientStatusWindowBackgroundType)backgroundType;
+- (id)initWithContentView:(NSView *)contentView exitMode:(ITTransientStatusWindowExitMode)exitMode backgroundType:(ITTransientStatusWindowBackgroundType)backgroundType;
- (void)appear:(id)sender;
- (void)vanish:(id)sender;
-- (void)setScreen:(NSScreen *)newScreen;
-
- (void)setSizing:(ITTransientStatusWindowSizing)newSizing;
- (ITTransientStatusWindowSizing)sizing;
- (ITTransientStatusWindowBackgroundType)backgroundType;
- (void)setBackgroundType:(ITTransientStatusWindowBackgroundType)newType;
-- (ITVerticalWindowPosition)verticalPosition;
-- (void)setVerticalPosition:(ITVerticalWindowPosition)newPosition;
-
-- (ITHorizontalWindowPosition)horizontalPosition;
-- (void)setHorizontalPosition:(ITHorizontalWindowPosition)newPosition;
-
- (float)effectProgress;
- (void)setEffectProgress:(float)newProgress;
- (ITWindowEffect *)exitEffect;
- (void)setExitEffect:(ITWindowEffect *)newEffect;
-
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITWindowEffect
- * Protocal and abstract superclass for performing effects on windows.
+ * ITWindowEffect.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
+ * Protocol and abstract superclass for performing effects on windows.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
#import "ITWindowPositioning.h"
#define EFFECT_FPS 30.0
#define DEFAULT_EFFECT_TIME 0.75
-
typedef enum {
ITWindowHiddenState,
ITWindowAppearingState,
ITWindowVanishingState
} ITWindowVisibilityState;
-
@protocol ITWindowEffect
+
+ (NSString *)effectName;
+ (NSDictionary *)supportedPositions;
+ (unsigned int)listOrder;
- (void)performVanish;
- (void)cancelAppear;
- (void)cancelVanish;
-@end
+@end
@protocol ITWindowMotility
+
- (ITWindowVisibilityState)visibilityState;
- (void)setVisibilityState:(ITWindowVisibilityState)newState;
- (float)effectProgress;
- (void)setEffectProgress:(float)newProgress;
-@end
+@end
-@interface ITWindowEffect : NSObject <ITWindowEffect>
-{
- ITTransientStatusWindow *_window;
- float _effectTime;
- float _effectSpeed;
- ITVerticalWindowPosition _verticalPosition;
- ITHorizontalWindowPosition _horizontalPosition;
- NSTimer *_effectTimer;
- BOOL __idle;
- BOOL __shouldReleaseWhenIdle;
+@interface ITWindowEffect : NSObject <ITWindowEffect> {
+ NSWindow <ITWindowPositioning, ITWindowMotility> *_window;
+ float _effectTime;
+ float _effectSpeed;
+ ITVerticalWindowPosition _verticalPosition;
+ ITHorizontalWindowPosition _horizontalPosition;
+ NSTimer *_effectTimer;
+ BOOL __idle;
+ BOOL __shouldReleaseWhenIdle;
}
+ (NSArray *)effectClasses;
- (void)releaseWhenIdle;
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITWindowPositioning
- * Protocol which defines methods for window positioning presets.
+ * ITWindowPositioning.h
*
- * Original Author : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Matthew Judy <mjudy@ithinksw.com>
- * Responsibility : Joseph Spiros <joseph.spiros@ithinksw.com>
+ * Protocol which defines methods for window positioning presets.
*
- * Copyright (c) 2002 - 2003 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
typedef enum {
- ITWindowPositionLeft = 0,
+ ITWindowPositionLeft = 0,
ITWindowPositionCenter = 1,
- ITWindowPositionRight = 2,
+ ITWindowPositionRight = 2
} ITHorizontalWindowPosition;
typedef enum {
- ITWindowPositionTop = 0,
+ ITWindowPositionTop = 0,
ITWindowPositionMiddle = 1,
- ITWindowPositionBottom = 2,
+ ITWindowPositionBottom = 2
} ITVerticalWindowPosition;
-
@protocol ITWindowPositioning
+- (NSScreen *)screen;
+- (void)setScreen:(NSScreen *)newScreen;
- (ITVerticalWindowPosition)verticalPosition;
- (void)setVerticalPosition:(ITVerticalWindowPosition)newPosition;
- (ITHorizontalWindowPosition)horizontalPosition;
- (void)setHorizontalPosition:(ITHorizontalWindowPosition)newPosition;
- (float)screenPadding;
- (void)setScreenPadding:(float)newPadding;
-/*- (int)screenNumber;
-- (void)setScreenNumber:(int)newNumber;*/
-@end
+@end
\ No newline at end of file
/*
* ITKit
- * ITZoomWindowEffect
- * Effect subclass which zooms (expands/shrinks) a window into position on the screen.
+ * ITZoomWindowEffect.h
*
- * Original Author : Kent Sutherland <ksutherland@ithinksw.com>
- * Responsibility : Kent Sutherland <ksutherland@ithinksw.com>
+ * Effect subclass which zooms a window into position on the screen.
*
- * Copyright (c) 2002 - 2004 iThink Software.
- * All Rights Reserved
+ * Copyright (c) 2005 by iThink Software.
+ * All Rights Reserved.
+ *
+ * $Id$
*
*/
-
#import <Cocoa/Cocoa.h>
#import "ITWindowEffect.h"
-
-@interface ITZoomWindowEffect : ITWindowEffect <ITWindowEffect> {
+@interface ITZoomWindowEffect : ITWindowEffect {
}
-@end
+@end
\ No newline at end of file