--- /dev/null
+#import <Cocoa/Cocoa.h>
+
+
+@interface ITButton : NSButton {
+
+}
+
+@end
--- /dev/null
+#import "ITButton.h"
+#import "ITButtonCell.h"
+
+
+@implementation ITButton
+
+
+/*************************************************************************/
+#pragma mark -
+#pragma mark INITIALIZATION METHODS
+/*************************************************************************/
+
++ (void)initialize
+{
+ if ( self == [ITButton class] ) {
+ [self setCellClass:[ITButtonCell class]];
+ }
+}
+
++ (Class)cellClass
+{
+ return [ITButtonCell class];
+}
+
+- (id)initWithCoder:(NSCoder *)coder
+{
+ if ( ( self = [super initWithCoder:coder] ) ) {
+ ITButtonCell *cell = [[ITButtonCell alloc] init];
+ [self setCell:cell];
+ }
+ return self;
+}
+
+- (BOOL)isOpaque
+{
+ return NO;
+}
+
+@end
--- /dev/null
+#import <Cocoa/Cocoa.h>
+
+
+typedef enum _ITBezelStyle {
+ ITGrayRoundedBezelStyle = 1001
+} ITBezelStyle;
+
+
+@interface ITButtonCell : NSButtonCell {
+
+ ITBezelStyle _subStyle;
+
+}
+
+
+@end
--- /dev/null
+#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;
+}
+
+
+
+/*************************************************************************/
+#pragma mark -
+#pragma mark INSTANCE METHODS
+/*************************************************************************/
+
+- (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];
+ [super drawInteriorWithFrame:rect inView:controlView];
+ } 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.35;
+
+ [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.50;
+ }
+
+ [[NSColor colorWithCalibratedWhite:0.0 alpha:alpha] set];
+ [path fill];
+}
+
+
+@end
- (id)init
{
- self = [super init];
-
- if( self )
+ if ( (self = [super init]) )
{
[self setKeyCombo: [ITKeyCombo clearKeyCombo]];
}
- (NSString*)description
{
- return [NSString stringWithFormat: @"<%@: %@>", NSStringFromClass( [self class] ), [self keyCombo]];
+ return [NSString stringWithFormat: @"<%@: %@>",
+ NSStringFromClass( [self class] ),
+ [self keyCombo]];
}
#pragma mark -
#import <ITKit/ITKeyBroadcaster.h>
#import <ITKit/ITKeyCombo.h>
#import <ITKit/ITKeyComboPanel.h>
+#import <ITKit/ITButton.h>
+#import <ITKit/ITButtonCell.h>
#import <ITKit/ITStatusItem.h>
#import <ITKit/ITTableView.h>
#import <ITKit/ITTabView.h>
@interface ITTextField : NSTextField {
- BOOL castsShadow;
-
- float shadowElevation;
- float shadowAzimuth;
- float shadowAmbient;
- float shadowHeight;
- float shadowRadius;
- float shadowSaturation;
-
}
- (BOOL)castsShadow;
#import "ITTextField.h"
+#import "ITTextFieldCell.h"
#import <CoreGraphics/CoreGraphics.h>
#import "ITCoreGraphicsHacks.h"
@implementation ITTextField
+
/*************************************************************************/
#pragma mark -
#pragma mark INITIALIZATION METHODS
/*************************************************************************/
-- (id)initWithFrame:(NSRect)frameRect
++ (void)initialize
{
- if ( ( self = [super initWithFrame:frameRect] ) ) {
- castsShadow = NO;
- shadowElevation = 45.0;
- shadowAzimuth = 90.0;
- shadowAmbient = 0.15;
- shadowHeight = 1.00;
- shadowRadius = 4.00;
- shadowSaturation = 1.0;
+ if ( self == [ITTextField class] ) {
+ [self setCellClass:[ITTextFieldCell class]];
}
-
- return self;
}
-- (id)initWithCoder:(NSCoder *)coder
++ (Class)cellClass
{
- 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;
+ return [ITTextFieldCell class];
}
-/*************************************************************************/
-#pragma mark -
-#pragma mark DRAWING METHODS
-/*************************************************************************/
-
-- (void)drawRect:(NSRect)rect
-{
- 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 drawRect:rect];
-
-
- if ( castsShadow ) {
- // Restore the old context
- [NSGraphicsContext restoreGraphicsState];
- CGStyleRelease(style);
- }
-}
-
-
-
/*************************************************************************/
#pragma mark -
#pragma mark ACCESSOR METHODS
- (BOOL)castsShadow;
{
- return castsShadow;
+ return [[self cell] castsShadow];
}
- (void)setCastsShadow:(BOOL)newSetting;
{
- castsShadow = newSetting;
- [self setNeedsDisplay:YES];
+ [[self cell] setCastsShadow:newSetting];
}
- (float)shadowElevation;
{
- return shadowElevation;
+ return [[self cell] shadowElevation];
}
- (void)setShadowElevation:(float)newElevation;
{
- shadowElevation = newElevation;
- [self setNeedsDisplay:YES];
+ [[self cell] setShadowElevation:newElevation];
}
- (float)shadowAzimuth;
{
- return shadowAzimuth;
+ return [[self cell] shadowAzimuth];
}
- (void)setShadowAzimuth:(float)newAzimuth;
{
- shadowAzimuth = newAzimuth;
- [self setNeedsDisplay:YES];
+ [[self cell] setShadowAzimuth:newAzimuth];
}
- (float)shadowAmbient;
{
- return shadowAmbient;
+ return [[self cell] shadowAmbient];
}
- (void)setShadowAmbient:(float)newAmbient;
{
- shadowAmbient = newAmbient;
- [self setNeedsDisplay:YES];
+ [[self cell] setShadowAmbient:newAmbient];
}
- (float)shadowHeight;
{
- return shadowHeight;
+ return [[self cell] shadowHeight];
}
- (void)setShadowHeight:(float)newHeight;
{
- shadowHeight = newHeight;
- [self setNeedsDisplay:YES];
+ [[self cell] setShadowHeight:newHeight];
}
- (float)shadowRadius;
{
- return shadowRadius;
+ return [[self cell] shadowRadius];
}
- (void)setShadowRadius:(float)newRadius;
{
- shadowRadius = newRadius;
- [self setNeedsDisplay:YES];
+ [[self cell] setShadowRadius:newRadius];
}
- (float)shadowSaturation;
{
- return shadowSaturation;
+ return [[self cell] shadowSaturation];
}
- (void)setShadowSaturation:(float)newSaturation;
{
- shadowSaturation = newSaturation;
- [self setNeedsDisplay:YES];
+ [[self cell] setShadowSaturation:newSaturation];
}
#pragma mark INITIALIZATION METHODS
/*************************************************************************/
-- (id)init
+- (id)initTextCell:(NSString *)string;
{
- if ( ( self = [super init] ) ) {
+ if ( ( self = [super initTextCell:string] ) ) {
castsShadow = NO;
shadowElevation = 45.0;
shadowAzimuth = 90.0;
- (id)initWithCoder:(NSCoder *)coder
{
- if ( ( self = [super initWithCoder:coder] ) ) {
+ if ( ( self = [super initWithCoder:coder] ) ) {
castsShadow = NO;
shadowElevation = 45.0;
shadowAzimuth = 90.0;
#pragma mark DRAWING METHODS
/*************************************************************************/
-- (void)drawInteriorWithFrame:(NSRect)rect inView:(NSView *)controlView
+- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView
{
CGSGenericObj style = nil;
CGShadowStyle shadow;
if ( castsShadow ) {
- // Create the shadow style to use for drawing the string
+// Create the shadow style to use for drawing the string
shadow.version = 0;
shadow.elevation = shadowElevation;
shadow.azimuth = shadowAzimuth;
}
// Draw the string
- [super drawInteriorWithFrame:rect inView:controlView];
+ [super drawWithFrame:rect inView:controlView];
if ( castsShadow ) {
IBOutlet NSButton *useInvertedCheckBox;
IBOutlet NSButton *showTitleCheckBox;
+ // ITButton Support
+ IBOutlet ITButton *button;
+
// ITTabView Support
IBOutlet ITTabView *tabView;
- (void)awakeFromNib
{
[self createStatusItem];
+ [button setBezelStyle:1001];
+ [button setFont:[NSFont fontWithName:@"Lucida Grande Bold" size:14]];
+ [button setTitle:@"Launch Manually"];
+ [button setButtonType:NSMomentaryLight];
+ [button sizeToFit];
+ [button setFrameSize:NSMakeSize([button frame].size.width + 8, 24)];
[testTextField setCastsShadow:YES];
[tabView setAllowsDragging:YES];
[bevelView setBevelDepth:10];
[bevelView setBevelDepth:[sender intValue]];
}
+
+/*************************************************************************/
+#pragma mark -
+#pragma mark ITButton SUPPORT
+/*************************************************************************/
+
+
/*************************************************************************/
#pragma mark -
#pragma mark NSWindow DELEGATE METHODS
LANGUAGE = ObjC;
OUTLETS = {
bevelView = ITBevelView;
+ button = ITButton;
showImageCheckBox = NSButton;
showStatusItemCheckBox = NSButton;
showTitleCheckBox = NSButton;
},
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = ITBevelView; LANGUAGE = ObjC; SUPERCLASS = NSView; },
+ {CLASS = ITButton; LANGUAGE = ObjC; SUPERCLASS = NSButton; },
+ {CLASS = ITButtonCell; LANGUAGE = ObjC; SUPERCLASS = NSButtonCell; },
{CLASS = ITLED; LANGUAGE = ObjC; SUPERCLASS = NSControl; },
{CLASS = ITLEDCell; LANGUAGE = ObjC; SUPERCLASS = NSActionCell; },
{CLASS = ITTabView; LANGUAGE = ObjC; SUPERCLASS = NSTabView; },
- {CLASS = ITTextField; LANGUAGE = ObjC; SUPERCLASS = NSTextField; }
+ {CLASS = ITTextField; LANGUAGE = ObjC; SUPERCLASS = NSTextField; },
+ {CLASS = ITTextFieldCell; LANGUAGE = ObjC; SUPERCLASS = NSTextFieldCell; }
);
IBVersion = 1;
}
\ No newline at end of file
<string>286.0</string>
<key>IBOpenObjects</key>
<array>
- <integer>29</integer>
<integer>21</integer>
</array>
<key>IBSystem Version</key>