Adding a BevelView to the kit, for use in AG.
authorMatthew Judy <mjudy@ithinksw.com>
Wed, 23 Apr 2003 12:18:34 +0000 (12:18 +0000)
committerMatthew Judy <mjudy@ithinksw.com>
Wed, 23 Apr 2003 12:18:34 +0000 (12:18 +0000)
ITBevelView.h [new file with mode: 0755]
ITBevelView.m [new file with mode: 0755]
ITKit.h
ITSlideHorizontallyWindowEffect.m
Showcase/Controller.h
Showcase/Controller.m
Showcase/English.lproj/MainMenu.nib/classes.nib
Showcase/English.lproj/MainMenu.nib/info.nib
Showcase/English.lproj/MainMenu.nib/keyedobjects.nib

diff --git a/ITBevelView.h b/ITBevelView.h
new file mode 100755 (executable)
index 0000000..de07fd0
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ *     ITKit
+ *  ITBevelView
+ *    NSView subclass which draws a bevel.
+ *
+ *  Original Author : Matt Judy <mjudy@ithinksw.com>
+ *   Responsibility : Matt Judy <mjudy@ithinksw.com>
+ *
+ *  Copyright (c) 2003 iThink Software.
+ *  All Rights Reserved
+ *
+ */
+
+/*
+ *     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;
+- (void)setBevelDepth:(int)newDepth;
+
+
+@end
diff --git a/ITBevelView.m b/ITBevelView.m
new file mode 100755 (executable)
index 0000000..de94f3b
--- /dev/null
@@ -0,0 +1,112 @@
+#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)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;
+}
+
+- (void)setBevelDepth:(int)newDepth
+{
+    _bevelDepth = newDepth;
+    [self setNeedsDisplay:YES];
+}
+
+
+/*************************************************************************/
+#pragma mark -
+#pragma mark INSTANCE METHODS
+/*************************************************************************/
+
+- (void)drawRect:(NSRect)aRect
+{
+        // Draw special bezel, with a thickness of _bevelDepth.
+    NSRect innerRect = NSMakeRect( (aRect.origin.x + _bevelDepth),
+                                   (aRect.origin.y + _bevelDepth),
+                                   (aRect.size.width  - (_bevelDepth * 2)),
+                                   (aRect.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:aRect.origin];
+    [leftEdge lineToPoint:NSMakePoint(aRect.origin.x, aRect.size.height)];
+    [leftEdge lineToPoint:NSMakePoint( (aRect.origin.x + _bevelDepth), (aRect.size.height - _bevelDepth) )];
+    [leftEdge lineToPoint:NSMakePoint( (aRect.origin.x + _bevelDepth), (aRect.origin.y + _bevelDepth) )];
+
+    [topEdge moveToPoint:NSMakePoint(aRect.origin.x, aRect.size.height)];
+    [topEdge lineToPoint:NSMakePoint(aRect.size.width, aRect.size.height)];
+    [topEdge lineToPoint:NSMakePoint( (aRect.size.width - _bevelDepth), (aRect.size.height - _bevelDepth) )];
+    [topEdge lineToPoint:NSMakePoint( (aRect.origin.x + _bevelDepth), (aRect.size.height - _bevelDepth) )];
+
+    [rightEdge moveToPoint:NSMakePoint(aRect.size.width, aRect.origin.y)];
+    [rightEdge lineToPoint:NSMakePoint(aRect.size.width, aRect.size.height)];
+    [rightEdge lineToPoint:NSMakePoint( (aRect.size.width - _bevelDepth), (aRect.size.height - _bevelDepth) )];
+    [rightEdge lineToPoint:NSMakePoint( (aRect.size.width - _bevelDepth), (_bevelDepth) )];
+
+    [bottomEdge moveToPoint:aRect.origin];
+    [bottomEdge lineToPoint:NSMakePoint(aRect.size.width, aRect.origin.y)];
+    [bottomEdge lineToPoint:NSMakePoint( (aRect.size.width - _bevelDepth), (_bevelDepth) )];
+    [bottomEdge lineToPoint:NSMakePoint( (aRect.origin.x + _bevelDepth), (aRect.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];
+}
+
+
+/*************************************************************************/
+#pragma mark -
+#pragma mark DEALLOCATION METHOD
+/*************************************************************************/
+
+- (void)dealloc
+{
+       [super dealloc];
+}
+
+
+@end
diff --git a/ITKit.h b/ITKit.h
index 95c6aad..ca9c5dc 100755 (executable)
--- a/ITKit.h
+++ b/ITKit.h
@@ -16,6 +16,7 @@
 #import <ITKit/ITStatusItem.h>
 #import <ITKit/ITTableView.h>
 #import <ITKit/ITTabView.h>
+#import <ITKit/ITBevelView.h>
 #import <ITKit/ITTextField.h>
 #import <ITKit/ITTransientStatusWindow.h>
 
index ac302ff..01b3545 100755 (executable)
     [self setSlide:0.0];
     [self setWindowVisibility:ITWindowHiddenState];
 
-    __idle =YES;
+    __idle = YES;
     
     if ( __shouldReleaseWhenIdle ) {
         [self release];
index f8b3b6d..1bd81ea 100755 (executable)
@@ -16,6 +16,9 @@
     // ITTabView Support
     IBOutlet ITTabView *tabView;
 
+    // ITBevelView support
+    IBOutlet ITBevelView *bevelView;
+
     // ITTextField Support
     IBOutlet ITTextField *testTextField;
 
@@ -50,4 +53,7 @@
 - (IBAction)toggleOptionDragging:(id)sender;
 - (IBAction)toggleShiftDragging:(id)sender;
 
+// ITBevelView support
+- (IBAction)changeBevelViewSetting:(id)sender;
+
 @end
index 80fc5f1..71463aa 100755 (executable)
@@ -1,6 +1,7 @@
 #import "Controller.h"
 #import "ITTransientStatusWindow.h"
 #import "ITTextField.h"
+#import "ITBevelView.h"
 #import "ITCutWindowEffect.h"
 #import "ITDissolveWindowEffect.h"
 #import "ITSlideHorizontallyWindowEffect.h"
@@ -28,6 +29,7 @@
     [self createStatusItem];
     [testTextField setCastsShadow:YES];
     [tabView setAllowsDragging:YES];
+    [bevelView setBevelDepth:10];
     statusWindow = [ITTransientStatusWindow sharedWindow];
     [statusWindow setEntryEffect:[[ITCutWindowEffect alloc] initWithWindow:statusWindow]];
     [statusWindow setExitEffect:[[ITDissolveWindowEffect alloc] initWithWindow:statusWindow]];
     }
 
     [statusItem setMenu:statusItemMenu];
+
+    [statusItemMenu addItemWithTitle:[NSString stringWithUTF8String:"★★★★★"]
+                              action:nil
+                       keyEquivalent:@""];
 }
 
 - (void)removeStatusItem
 }
 
 
+/*************************************************************************/
+#pragma mark -
+#pragma mark ITBevelView SUPPORT
+/*************************************************************************/
+
+- (IBAction)changeBevelViewSetting:(id)sender
+{
+    [bevelView setBevelDepth:[sender intValue]];
+}
+
 /*************************************************************************/
 #pragma mark -
 #pragma mark NSWindow DELEGATE METHODS
index cd76fd0..e76b9cf 100755 (executable)
@@ -3,6 +3,7 @@
         {
             ACTIONS = {
                 buildStatusWindow = id; 
+                changeBevelViewSetting = id; 
                 changeWindowSetting = id; 
                 toggleCastsShadow = id; 
                 toggleCommandDragging = id; 
@@ -19,6 +20,7 @@
             CLASS = Controller; 
             LANGUAGE = ObjC; 
             OUTLETS = {
+                bevelView = ITBevelView; 
                 showImageCheckBox = NSButton; 
                 showStatusItemCheckBox = NSButton; 
                 showTitleCheckBox = NSButton; 
@@ -37,6 +39,7 @@
             SUPERCLASS = NSObject; 
         }, 
         {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
+        {CLASS = ITBevelView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, 
         {
             ACTIONS = {start = id; stop = id; }; 
             CLASS = ITChasingArrowsView; 
index a169d02..3e992c5 100755 (executable)
@@ -3,7 +3,7 @@
 <plist version="1.0">
 <dict>
        <key>IBDocumentLocation</key>
-       <string>2 1 356 240 0 0 1056 770 </string>
+       <string>197 65 497 330 0 0 1056 770 </string>
        <key>IBEditorPositions</key>
        <dict>
                <key>197</key>
@@ -15,8 +15,8 @@
        <string>286.0</string>
        <key>IBOpenObjects</key>
        <array>
-               <integer>21</integer>
                <integer>29</integer>
+               <integer>21</integer>
        </array>
        <key>IBSystem Version</key>
        <string>6L28</string>
index dd63502..343c2c0 100755 (executable)
Binary files a/Showcase/English.lproj/MainMenu.nib/keyedobjects.nib and b/Showcase/English.lproj/MainMenu.nib/keyedobjects.nib differ