Skip to content

Instantly share code, notes, and snippets.

@toddfreese
Created September 20, 2010 20:19
Show Gist options
  • Select an option

  • Save toddfreese/588580 to your computer and use it in GitHub Desktop.

Select an option

Save toddfreese/588580 to your computer and use it in GitHub Desktop.
//
// MonthHUD.j
// WebSchedule
//
// Created by Todd Freese, The Filmworkers Club
// Copyright 2008-10, The Filmworkers Club, All rights reserved.
//
@import <AppKit/CPPanel.j>
@import <AppKit/CPWindowController.j>
@import <LPKit/LPKit.j>
@import <LPKit/LPCalendarHeaderView.j>
@import <LPKit/LPCalendarMonthView.j>
@implementation MonthHUD : CPWindowController
{
id delegate;
CPWindow theWindow;
LPCalendarView monthView;
}
- (id)loadWindow
{
theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0, 0, 199, 179) styleMask:CPHUDBackgroundWindowMask | CPClosableWindowMask | CPResizableWindowMask];
[theWindow setTitle:@"Select Date"];
var contentView = [theWindow contentView];
// Setup month view
monthView = [[LPCalendarView alloc] initWithFrame:CGRectMake(5, 5, 189, 169)];
[monthView setTheme:LPAristo];
[monthView setMonth:[CPDate date]];
[monthView setDelegate:self];
[monthView setHighlightCurrentPeriod:YES];
[contentView addSubview:monthView];
[monthView setAutoresizingMask: CPViewHeightSizable | CPViewWidthSizable];
[self setWindow:theWindow];
[[self window] center];
}
- (void)showWindow:(id)aSender
{
[super showWindow:aSender];
}
- (void)close
{
// Convenience class to close window.
[theWindow close];
[theWindow setFrame:CGRectMake(CGRectGetMinX([theWindow frame]), CGRectGetMinY([theWindow frame]), CGRectGetWidth([theWindow frame]), 200) display:NO animate:NO];
}
// Accessor Methods
// ----------------
- (id)delegate
{
return delegate;
}
- (void)setDelegate:(id)newDelegate
{
delegate = newDelegate;
}
- (CPPanel)theWindow
{
return theWindow;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment