#import "ITTransientStatusWindow.h"
+#import "ITWindowEffect.h"
#import <CoreGraphics/CoreGraphics.h>
#import "ITCoreGraphicsHacks.h"
#import "ITTextField.h"
#import "ITGrayRoundedView.h"
-@class ITTextField;
-@class ITGrayRoundedView;
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark EVIL HACKERY
-/*************************************************************************/
-
-@interface NSApplication (HACKHACKHACKHACK)
-- (CGSConnectionID)contextID;
-@end
+#define EFFECT_FPS 30.0
/*************************************************************************/
exitMode:(ITTransientStatusWindowExitMode)exitMode
backgroundType:(ITTransientStatusWindowBackgroundType)backgroundType;
- (void)rebuildWindow;
-- (void)performEffect;
-- (void)dissolveEffect:(BOOL)entering;
-- (void)slideVerticalEffect:(BOOL)entering;
-- (void)slideHorizontalEffect:(BOOL)entering;
+// - (void)performEffect;
@end
{
NSRect contentRect;
- // If no Content View was provided, use a generic NSView with the app icon.
+ // If no Content View was provided, use a generic view.
if ( ! (contentView) ) {
contentView = [[[NSView alloc] initWithFrame:
NSMakeRect(100.0, 100.0, 200.0, 200.0)] autorelease];
_exitMode = exitMode;
_exitDelay = DEFAULT_EXIT_DELAY;
_backgroundType = backgroundType;
- _verticalPosition = ITTransientStatusWindowPositionBottom;
- _horizontalPosition = ITTransientStatusWindowPositionLeft;
- _entryEffect = ITTransientStatusWindowEffectNone;
- _exitEffect = ITTransientStatusWindowEffectDissolve;
- _effectTime = DEFAULT_EFFECT_TIME;
+ _verticalPosition = ITWindowPositionBottom;
+ _horizontalPosition = ITWindowPositionLeft;
+ _screenPadding = 32.0;
+ _screenNumber = 0;
+ _entryEffect = nil;
+ _exitEffect = nil;
_reallyIgnoresEvents = YES;
- _delayTimer = nil;
- _fadeTimer = nil;
+ _delayTimer = nil;
-// if ( _backgroundType == ITTransientStatusWindowRounded ) {
-// _contentSubView = contentView;
-// } else {
-// [self setContentView:contentView];
-// }
+// if ( _backgroundType == ITTransientStatusWindowRounded ) {
+// _contentSubView = contentView;
+// } else {
+// [self setContentView:contentView];
+// }
[self setIgnoresMouseEvents:YES];
[self setLevel:NSScreenSaverWindowLevel];
#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) ));
-}
-
- (BOOL)ignoresMouseEvents
{
return _reallyIgnoresEvents;
_reallyIgnoresEvents = flag;
}
+/*
+
- (void)orderFront:(id)sender
{
- if ( _exitMode == ITTransientStatusWindowExitAfterDelay ) {
- // set the timer, and orderOut: when it lapses.
- }
-
- if ( _entryEffect == ITTransientStatusWindowEffectNone ) {
+ if ( _entryEffect == nil ) {
[super orderFront:sender];
+ _visibilityState = ITTransientStatusWindowVisibleState;
} else {
[self performEffect];
}
+ if ( _exitMode == ITTransientStatusWindowExitAfterDelay ) {
+ // set the timer, and orderOut: when it lapses.
+ }
}
- (void)makeKeyAndOrderFront:(id)sender
// set the timer, and orderOut: when it lapses.
}
- if ( _entryEffect == ITTransientStatusWindowEffectNone ) {
+ if ( _entryEffect == nil ) {
[super makeKeyAndOrderFront:sender];
+ _visibilityState = ITTransientStatusWindowVisibleState;
} else {
[self performEffect];
[self makeKeyWindow];
- (void)orderOut:(id)sender
{
- if ( _entryEffect == ITTransientStatusWindowEffectNone ) {
+ if ( _entryEffect == nil ) {
[super orderOut:sender];
+ _visibilityState = ITTransientStatusWindowHiddenState;
} else {
[self performEffect];
}
- (NSTimeInterval)animationResizeTime:(NSRect)newFrame
{
- return _effectTime;
+ return _resizeTime;
}
-/*
-
- (id)contentView
{
if ( _backgroundType == ITTransientStatusWindowRounded ) {
*/
+- (void)appear
+{
+ if ( _entryEffect == nil ) {
+ [self orderFront:self];
+ _visibilityState = ITTransientStatusWindowVisibleState;
+ } else {
+ _visibilityState = ITTransientStatusWindowAppearingState;
+ [_entryEffect performAppear];
+ _visibilityState = ITTransientStatusWindowVisibleState;
+ }
+ if ( _exitMode == ITTransientStatusWindowExitAfterDelay ) {
+ // set the timer, and vanish when it lapses.
+ }
+}
+
+- (void)vanish
+{
+ if ( _entryEffect == nil ) {
+ [self orderOut:self];
+ _visibilityState = ITTransientStatusWindowHiddenState;
+ } else {
+ [_exitEffect performVanish];
+ _visibilityState = ITTransientStatusWindowHiddenState;
+ }
+}
+
- (ITTransientStatusWindowVisibilityState)visibilityState
{
return _visibilityState;
_backgroundType = ITTransientStatusWindowRounded;
}
-- (ITTransientStatusWindowPosition)verticalPosition;
+- (ITVerticalWindowPosition)verticalPosition;
{
return _verticalPosition;
}
-- (void)setVerticalPosition:(ITTransientStatusWindowPosition)newPosition;
+- (void)setVerticalPosition:(ITVerticalWindowPosition)newPosition;
{
_verticalPosition = newPosition;
}
-- (ITTransientStatusWindowPosition)horizontalPosition;
+- (ITHorizontalWindowPosition)horizontalPosition;
{
return _horizontalPosition;
}
-- (void)setHorizontalPosition:(ITTransientStatusWindowPosition)newPosition;
+- (void)setHorizontalPosition:(ITHorizontalWindowPosition)newPosition;
{
_horizontalPosition = newPosition;
}
-- (ITTransientStatusWindowEffect)entryEffect
+- (float)screenPadding
+{
+ return _screenPadding;
+}
+
+- (void)setScreenPadding:(float)newPadding
+{
+ _screenPadding = newPadding;
+}
+
+- (int)screenNumber
+{
+ return _screenNumber;
+}
+
+- (void)setScreenNumber:(int)newNumber
+{
+ _screenNumber = newNumber;
+}
+
+- (ITWindowEffect *)entryEffect
{
return _entryEffect;
}
-- (void)setEntryEffect:(ITTransientStatusWindowEffect)newEffect;
+- (void)setEntryEffect:(ITWindowEffect *)newEffect
{
- _entryEffect = newEffect;
+ [_entryEffect autorelease];
+ _entryEffect = [newEffect retain];
}
-- (ITTransientStatusWindowEffect)exitEffect;
+- (ITWindowEffect *)exitEffect
{
return _exitEffect;
}
-- (void)setExitEffect:(ITTransientStatusWindowEffect)newEffect;
+- (void)setExitEffect:(ITWindowEffect *)newEffect
{
- _exitEffect = newEffect;
+ [_exitEffect autorelease];
+ _exitEffect = [newEffect retain];
}
}
}
+/*
+
- (void)performEffect
{
if ( _visibilityState == ITTransientStatusWindowHiddenState ) {
- if ( _entryEffect == ITTransientStatusWindowEffectDissolve ) {
- [self dissolveEffect:YES];
- } else if ( _entryEffect == ITTransientStatusWindowEffectSlideVertically ) {
- [self slideVerticalEffect:YES];
- } else if ( _entryEffect == ITTransientStatusWindowEffectSlideHorizontally ) {
- [self slideHorizontalEffect:YES];
- }
+ _visibilityState = ITTransientStatusWindowEnteringState;
} else if ( _visibilityState == ITTransientStatusWindowVisibleState ) {
- if ( _exitEffect == ITTransientStatusWindowEffectDissolve ) {
- [self dissolveEffect:NO];
- } else if ( _exitEffect == ITTransientStatusWindowEffectSlideVertically ) {
- [self slideVerticalEffect:NO];
- } else if ( _exitEffect == ITTransientStatusWindowEffectSlideHorizontally ) {
- [self slideHorizontalEffect:NO];
- }
- }
-}
-
-- (void)dissolveEffect:(BOOL)entering
-{
- if ( entering ) {
- [super orderFront:self];
+ _visibilityState = ITTransientStatusWindowExitingState;
} else {
- [super orderOut:self];
+ return;
}
-}
-
-- (void)slideVerticalEffect:(BOOL)entering
-{
- if ( entering ) {
- [super orderFront:self];
- } else {
- [super orderOut:self];
+
+ if ( _entryEffect == ITTransientStatusWindowEffectDissolve ) {
+ [self dissolveEffect];
+ } else if ( _entryEffect == ITTransientStatusWindowEffectSlideVertically ) {
+ [self slideVerticalEffect];
+ } else if ( _entryEffect == ITTransientStatusWindowEffectSlideHorizontally ) {
+ [self slideHorizontalEffect];
+ } else if ( _entryEffect == ITTransientStatusWindowEffectPivot ) {
+ [self pivotEffect];
}
}
-- (void)slideHorizontalEffect:(BOOL)entering
-{
- if ( entering ) {
- [super orderFront:self];
- } else {
- [super orderOut:self];
- }
-}
+*/
@end