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 CGAffineTransform CGAffineTransformMakeRotation(float angle);
+extern CGAffineTransform CGAffineTransformMakeScale(float sx, float sy);
+extern CGAffineTransform CGAffineTransformTranslate(CGAffineTransform t, float tx, float ty);
+extern CGError CGSSetWindowWarp(const CGSConnectionID cid, CGSWindowID wid, int w,int h, float *mesh);
+extern CGError CGSSetWindowTransform(const CGSConnectionID cid, CGSWindowID wid, CGAffineTransform transform);
#import <Cocoa/Cocoa.h>
-@class ITTextField;
-@class ITGrayRoundedView;
+#define DEFAULT_EXIT_DELAY 3.0
+#define DEFAULT_EFFECT_TIME 0.33
-#define DEFAULT_EXIT_DELAY 3.0
+@class ITTextField;
+@class ITGrayRoundedView;
typedef enum {
ITTransientStatusWindowEffectDissolve, // Fades in.
ITTransientStatusWindowEffectSlideVertically, // Slides vertically onto the screen from the nearest edge
ITTransientStatusWindowEffectSlideHorizontally // Slides horizontally onto the screen from the nearest edge
+ ITTransientStatusWindowEffectPivot // Rotate into place from perpendicular edge
} ITTransientStatusWindowEffect;
@interface ITTransientStatusWindow : NSWindow {
- ITTransientStatusWindowVisibilityState _visibilityState;
- ITTransientStatusWindowExitMode _exitMode;
- float _exitDelay;
- ITTransientStatusWindowBackgroundType _backgroundType;
- ITTransientStatusWindowEffect _entryEffect;
- ITTransientStatusWindowEffect _exitEffect;
- ITTransientStatusWindowPosition _verticalPosition;
- ITTransientStatusWindowPosition _horizontalPosition;
+ ITTransientStatusWindowVisibilityState _visibilityState;
+ ITTransientStatusWindowExitMode _exitMode;
+ float _exitDelay;
+ ITTransientStatusWindowBackgroundType _backgroundType;
+ ITTransientStatusWindowEffect _entryEffect;
+ ITTransientStatusWindowEffect _exitEffect;
+ float _effectTime;
+ ITTransientStatusWindowPosition _verticalPosition;
+ ITTransientStatusWindowPosition _horizontalPosition;
+
+ BOOL _reallyIgnoresEvents;
NSTimer *_delayTimer;
NSTimer *_fadeTimer;
- (ITTransientStatusWindowEffect)exitEffect;
- (void)setExitEffect:(ITTransientStatusWindowEffect)newEffect;
+- (void)setRotation:(float)angle;
+
+
@end
{
NSRect contentRect;
- CGSValueObj key;
- CGSValueObj ignore;
-
- // If no Content View was provided, use a generic NSImageView with the app icon.
+ // If no Content View was provided, use a generic NSView with the app icon.
if ( ! (contentView) ) {
contentView = [[[NSView alloc] initWithFrame:
NSMakeRect(100.0, 100.0, 200.0, 200.0)] autorelease];
backing:NSBackingStoreBuffered
defer:NO] ) ) {
- _visibilityState = ITTransientStatusWindowHiddenState;
- _exitMode = exitMode;
- _exitDelay = DEFAULT_EXIT_DELAY;
- _backgroundType = backgroundType;
- _verticalPosition = ITTransientStatusWindowPositionBottom;
- _horizontalPosition = ITTransientStatusWindowPositionLeft;
- _entryEffect = ITTransientStatusWindowEffectNone;
- _exitEffect = ITTransientStatusWindowEffectDissolve;
-
+ _visibilityState = ITTransientStatusWindowHiddenState;
+ _exitMode = exitMode;
+ _exitDelay = DEFAULT_EXIT_DELAY;
+ _backgroundType = backgroundType;
+ _verticalPosition = ITTransientStatusWindowPositionBottom;
+ _horizontalPosition = ITTransientStatusWindowPositionLeft;
+ _entryEffect = ITTransientStatusWindowEffectNone;
+ _exitEffect = ITTransientStatusWindowEffectDissolve;
+ _effectTime = DEFAULT_EFFECT_TIME;
+ _reallyIgnoresEvents = YES;
_delayTimer = nil;
_fadeTimer = nil;
// [self setContentView:contentView];
// }
-// [self setIgnoresMouseEvents:YES];
-
- key = CGSCreateCString("IgnoreForEvents");
- ignore = CGSCreateBoolean(kCGSTrue);
-
- CGSSetWindowProperty([NSApp contextID], (CGSWindowID)[self windowNumber], key, ignore);
-
- CGSReleaseObj(key);
- CGSReleaseObj(ignore);
-
+ [self setIgnoresMouseEvents:YES];
[self setLevel:NSScreenSaverWindowLevel];
[self setContentView:contentView];
[self rebuildWindow];
#pragma mark INSTANCE METHODS
/*************************************************************************/
+- (void)setRotation:(float)angle
+{
+ CGAffineTransform transform = CGAffineTransformMakeRotation(angle);
+ transform.tx = -32.0;
+ transform.ty = [self frame].size.height + 32.0;
+ CGSSetWindowTransform([NSApp contextID],
+ (CGSWindowID)[self windowNumber],
+ CGAffineTransformTranslate(transform,
+ (([self frame].origin.x - 32.0) * -1),
+ (([[self screen] frame].size.height - ([self frame].origin.y) + 32.0) * -1) ));
+ NSLog(@"%f %f", ([self frame].origin.x * -1), ([self frame].origin.y * -1));
+}
+
+- (BOOL)ignoresMouseEvents
+{
+ return _reallyIgnoresEvents;
+}
+
+- (void)setIgnoresMouseEvents:(BOOL)flag
+{
+ CGSValueObj key;
+ CGSValueObj ignore;
+
+ key = CGSCreateCString("IgnoreForEvents");
+ ignore = CGSCreateBoolean( (flag ? kCGSTrue : kCGSFalse) );
+ CGSSetWindowProperty([NSApp contextID], (CGSWindowID)[self windowNumber], key, ignore);
+ CGSReleaseObj(key);
+ CGSReleaseObj(ignore);
+
+ _reallyIgnoresEvents = flag;
+}
+
- (void)orderFront:(id)sender
{
if ( _exitMode == ITTransientStatusWindowExitAfterDelay ) {
}
}
+- (NSTimeInterval)animationResizeTime:(NSRect)newFrame
+{
+ return _effectTime;
+}
+
/*
- (id)contentView
- (IBAction)buildStatusWindow:(id)sender;
- (IBAction)showStatusWindow:(id)sender;
- (IBAction)hideStatusWindow:(id)sender;
+- (IBAction)setRotation:(id)sender;
@end
textWidth,
textHeight);
textField = [[[ITTextField alloc] initWithFrame:textRect] autorelease];
+ [textField setEditable:NO];
+ [textField setSelectable:NO];
[textField setBordered:NO];
[textField setDrawsBackground:NO];
[textField setFont:[NSFont fontWithName:@"Lucida Grande Bold" size:18]];
[[statusWindow contentView] setNeedsDisplay:YES];
}
-/*
-- (IBAction)foo:(id)sender
-{
-
- maxLineHeight = ( ( maxLineHeight > [cdImage size].height ) ? maxLineHeight : [cdImage size].height );
-
- totalWidth = ( ITTSWPADDING + [cdImage size].width + ITTSWSPACING + maxLineWidth + ITTSWPADDING );
- totalHeight = ( ITTSWPADDING + maxLineHeight + ITTSWPADDING );
-
- totalWidth = ( ( totalWidth > ITTSWMINW ) ? totalWidth : ITTSWMINW );
-
-
- [statusWindow setFrame:NSMakeRect(72.0, 72.0, totalWidth, totalHeight)
- display:YES];
-
- textField = [[[ITTextField alloc] initWithFrame:
- NSMakeRect((24.0 + [cdImage size].width + 32.0), 24.0, maxLineWidth, maxLineHeight)] autorelease];
- [[statusWindow contentView] addSubview:textField];
- [textField setBordered:NO];
- [textField setDrawsBackground:NO];
- [textField setFont:[NSFont fontWithName:@"Lucida Grande Bold" size:18]];
- [textField setTextColor:[NSColor whiteColor]];
- [textField setCastsShadow:YES];
- [textField setStringValue:text];
-
-
- [[statusWindow contentView] lockFocus];
- [cdImage compositeToPoint:NSMakePoint(ITTSWPADDING, ( ITTSWPADDING + ((maxLineHeight - [cdImage size].height) / ITTSWPADDING)) )
- operation:NSCompositeSourceOver];
- [[statusWindow contentView] unlockFocus];
-}
-*/
-
- (IBAction)showStatusWindow:(id)sender
{
// [[statusWindow contentView] setNeedsDisplay:YES];
[statusWindow orderOut:self];
}
+- (IBAction)setRotation:(id)sender
+{
+ [statusWindow setRotation:([sender floatValue] * (pi / 180))];
+}
+
+
/*************************************************************************/
#pragma mark -
#pragma mark NSWindow DELEGATE METHODS
ACTIONS = {
buildStatusWindow = id;
hideStatusWindow = id;
+ setRotation = id;
showStatusWindow = id;
toggleCastsShadow = id;
toggleImage = id;