-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathQSWindowInterfaceController.m
92 lines (63 loc) · 2.35 KB
/
QSWindowInterfaceController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#import "QSWindowInterfaceController.h"
#import <Carbon/Carbon.h>
#import <QSFoundation/NSGeometry_BLTRExtensions.h>
#import <QSEffects/QSWindow.h>
#import <QSInterface/QSSearchObjectView.h>
#import <IOKit/IOCFBundle.h>
#import <ApplicationServices/ApplicationServices.h>
//#import "QSMenuButton.h"
#define EXPAND_HEIGHT 28
//NSRect alignRectInRect(NSRect innerRect,NSRect outerRect,int quadrant);
@implementation QSWindowInterfaceController
- (id)init {
if ((self = [super initWithWindowNibName:@"QSWindowInterface"])){
}
return self;
}
- (NSSize)maxIconSize{
return NSMakeSize(32,32);
}
- (void) windowDidLoad{
[super windowDidLoad];
[[self window] setLevel:NSModalPanelWindowLevel];
[[self window] setFrameAutosaveName:@"WindowInterfaceWindow"];
// Set the window to be visible on all spaces
[[self window] setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces];
[[self window]setFrame:constrainRectToRect([[self window]frame],[[[self window]screen]visibleFrame]) display:NO];
[(QSWindow *)[self window]setHideOffset:NSMakePoint(0,-99)];
[(QSWindow *)[self window]setShowOffset:NSMakePoint(0,99)];
[self contractWindow:self];
}
- (void)updateViewLocations{
[super updateViewLocations];
}
- (void)hideMainWindow:(id)sender{
[[self window] saveFrameUsingName:@"WindowInterfaceWindow"];
[super hideMainWindow:sender];
[self contractWindow:self];
}
- (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet usingRect:(NSRect)rect{
return NSOffsetRect(NSInsetRect(rect,8,0),0,-21);
}
- (void)showIndirectSelector:(id)sender{
if (![iSelector superview] && !expanded)
[iSelector setFrame:NSOffsetRect([aSelector frame],0,-26)];
[super showIndirectSelector:sender];
}
- (void)expandWindow:(id)sender{
NSRect expandedRect=[[self window]frame];
expandedRect.size.height+=EXPAND_HEIGHT;
expandedRect.origin.y-=EXPAND_HEIGHT;
if (!expanded)
[[self window]setFrame:expandedRect display:YES animate:YES];
[super expandWindow:sender];
}
- (void)contractWindow:(id)sender{
NSRect contractedRect=[[self window]frame];
contractedRect.size.height-=EXPAND_HEIGHT;
contractedRect.origin.y+=EXPAND_HEIGHT;
if (expanded)
[[self window]setFrame:contractedRect display:YES animate:YES];
[super contractWindow:sender];
}
@end