/*
 Copyright (c) 2007 by Logan Rockmore Design, http://www.loganrockmore.com/
 
 Permission is hereby granted, free of charge, to any person obtaining a
 copy of this software and associated documentation files (the "Software"),
 to deal in the Software without restriction, including without limitation
 the rights to use, copy, modify, merge, publish, distribute, sublicense,
 and/or sell copies of the Software, and to permit persons to whom the
 Software is furnished to do so, subject to the following conditions:
 
 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
 OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
 */

#import <Cocoa/Cocoa.h>


@interface LRCalendarView : NSView {
	
	NSCalendarDate *focusDate;
	NSString *focusDateDescription;
	
	NSMutableDictionary *dataDictionary;
	NSMutableDictionary *calendarCellsDictionary;
	
	// Selected Item
	NSString *selectedTitle;
	NSCalendarDate *selectedDate;
	id selectedObject;
	
	// Hide Weekends
	int _hideWeekends;
	
	// Current View
	int _currentView;
	
	// Header
	NSButton *leftButton;
	NSButton *rightButton;
	NSButton *todayButton;
	NSTextField *currentMonthField;
	
	// Week Days
	NSTextField *sundayField;
	NSTextField *mondayField;
	NSTextField *tuesdayField;
	NSTextField *wednesdayField;
	NSTextField *thursdayField;
	NSTextField *fridayField;
	NSTextField *saturdayField;
	
	id delegate;
	
}

- (void)addObject:(id)object
		withTitle:(NSString *)title
   atCalendarDate:(NSCalendarDate *)date;

#pragma mark -
#pragma mark Selection
- (void)selectObject:(id)object
			withDate:(NSCalendarDate *)date;
- (void)deselectAll;
- (void)deselectAllExceptForDate:(NSCalendarDate *)date;
- (void)removeAllObjects;

#pragma mark -
#pragma mark Setup

- (id)initWithFrame:(NSRect)frame;
- (void)drawRect:(NSRect)rect;
- (void)awakeFromNib;
- (BOOL)acceptsFirstResponder;
- (void)drawCalendar;
- (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize;
- (NSCalendarDate *)dateWithoutTime:(NSCalendarDate *)date;
- (void)colorCells;

#pragma mark -
#pragma mark Event Did Move
- (void)moveSelectedEventToDate:(NSCalendarDate *)date;

#pragma mark -
#pragma mark Selected Event
- (void)setSelectedEventToDate:(NSCalendarDate *)date
					  andIndex:(int)index;
- (NSString *)selectedTitle;
- (NSCalendarDate *)selectedDate;
- (id)selectedObject;

#pragma mark -
#pragma mark Data
- (IBAction)changeDateIncrementally:(id)sender;
- (void)setFocusDate:(NSCalendarDate*)date;
- (NSCalendarDate *)focusDate;
- (NSMutableDictionary *)dataDictionary;

#pragma mark -
#pragma mark Hide Weekends
- (void)setHiddenWeekends:(BOOL)hideWeekends;
- (int)hiddenWeekends;

#pragma mark -
#pragma mark Weekly or Monthly View
- (void)setWeeklyView;
- (BOOL)weeklyView;
- (void)setMonthlyView;
- (BOOL)monthlyView;

#pragma mark -
#pragma mark Delegate Methods
- (void)setDelegate:(id)_delegate;
- (id)delegate;

- (void)tableViewSelectionDidChange;
- (void)eventWillMove;
- (void)eventDidMove;
- (void)didDoubleClick;
- (void)tableView:(NSTableView *)aTableView
  willDisplayCell:(id)aCell
   forTableColumn:(NSTableColumn *)aTableColumn
			  row:(int)rowIndex;

@end
