-
Notifications
You must be signed in to change notification settings - Fork 3
/
AuxPanelController.m
54 lines (50 loc) · 1.38 KB
/
AuxPanelController.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
//
// AuxPanelController.m
// spires
//
// Created by Yuji on 6/29/09.
// Copyright 2009 Y. Tachikawa. All rights reserved.
//
#import "AuxPanelController.h"
@implementation AuxPanelController
-(void)windowDidLoad
{
[self setWindowFrameAutosaveName:[self windowNibName]];
[[self window] setLevel:NSNormalWindowLevel];
[[self window] setIsVisible:[[NSUserDefaults standardUserDefaults] boolForKey:nibIsVisibleKey]];
[[self window] setDelegate:self];
}
-(void)windowWillEnterFullScreen:(NSNotification *)notification
{
[[self window] setLevel:NSFloatingWindowLevel];
}
-(void)windowWillExitFullScreen:(NSNotification *)notification
{
[[self window] setLevel:NSNormalWindowLevel];
}
-(id)initWithWindowNibName:(NSString*)nibName
{
self=[super initWithWindowNibName:nibName];
nibIsVisibleKey=[nibName stringByAppendingString:@"IsVisible"];
if([[NSUserDefaults standardUserDefaults] boolForKey:nibIsVisibleKey]){
[self showWindow:self];
}
return self;
}
-(void)showhide:(id)sender
{
if([[self window] isVisible]){
[[self window] setIsVisible:NO];
}else{
[[self window] makeKeyAndOrderFront:sender];
}
}
-(void)windowDidBecomeKey:(id)sender
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:nibIsVisibleKey];
}
-(void)windowWillClose:(id)sender
{
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:nibIsVisibleKey];
}
@end