Skip to content

Instantly share code, notes, and snippets.

@smokyonion
Created August 11, 2010 02:16
Show Gist options
  • Save smokyonion/518375 to your computer and use it in GitHub Desktop.
Save smokyonion/518375 to your computer and use it in GitHub Desktop.
#import "MyPanelController.h"
@implementation MyPanelController
- (MyPanelController *)init
{
return [super initWithWindowNibName:@"MyPanel"];
}
- (void)awakeFromNib
{
// Autosave Window Frame
NSWindow *window = [self window];
// Tell the controller to not cascade its windows.
[[window windowController] setShouldCascadeWindows:NO];
// Specify the autosave name for the window.
[window setFrameAutosaveName:@"com.smokyonion.MyPanelFrameAutosaveName"]);
}
- (void)toggleMyPanel:(id)sender
{
NSWindow *window = [self window];
if([window isVisible])
[window orderOut:sender];
else
[window orderFront:sender];
}
- (IBAction)closeMyPanel:(id)sender
{
[[self window] close];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment