//
//   KSTKCalendarMonthView.h
//   KSTK
//
//  Created by Jonathan on 05/05/08.
//  Copyright 2008 Id-Box. All rights reserved.
//
//

#import <Cocoa/Cocoa.h>

//#import " KSTKCalendarPresentationView.h"
//#import " KSTKCalendarEventsListProtocol.h"

@interface  KSTKCalendarMonthView :  NSView {

	// Partie controls
	NSTextField *_labelMonth;
	NSMatrix *_matrixDays;
	
	// Partie présentation
	NSColor *_monthBackgroundColor;
	NSColor *_monthForegroundColor;
	NSColor *_backgroundColor; // Couleur de fond
	NSColor *_selectedBackgroundColor; // Couleur de fond lorsqu'il est séléctionné
	NSColor *_currentBackgroundColor; // Couleur de fond courant
	NSColor *_weekDaysLabelColor; // Couleur des jours de la semaine
	NSColor *_daysLabelColor; // Couleur des jours
	NSColor *_outDaysLabelColor; // Couleur des jours hors mois en cours
	CGFloat _gridWidth;
	NSColor *_gridColor;
	
	// Partie fonctionnalité
	NSMutableArray *_eventViews;
	NSMutableArray *_selectedEventViews;
	NSCalendarDate *_virtualStartDate; // la date de début à laquelle commence l'afficahge (si le mois commence à un autre jour que celui réglé par défaut)
	NSCalendarDate *_virtualEndDate;
	NSCalendarDate *_pointedCalendarDate;
	NSTimer *_dragTimer;
	
	BOOL lastObserveCalendarChange;
}

// Accesseurs
- (NSColor *)monthBackgroundColor;
- (void)setMonthBackgroundColor:(NSColor *)aColor;
- (NSColor *)monthForegroundColor;
- (void)setMonthForegroundColor:(NSColor *)aColor;
- (NSColor *)backgroundColor;
- (void)setBackgroundColor:(NSColor *)aColor;
- (NSColor *)selectedBackgroundColor;
- (void)setSelectedBackgroundColor:(NSColor *)aColor;
- (NSColor *)currentBackgroundColor;
- (void)setCurrentBackgroundColor:(NSColor *)aColor;
- (NSColor *)weekDaysLabelColor;
- (void)setWeekDaysLabelColor:(NSColor *)aColor;
- (NSColor *)daysLabelColor;
- (void)setDaysLabelColor:(NSColor *)aColor;
- (NSColor *)outDaysLabelColor;
- (void)setOutDaysLabelColor:(NSColor *)aColor;
- (CGFloat)gridWidth;
- (void)setGridWidth:(CGFloat)gridWidth;
- (NSColor *)gridColor;
- (void)setGridColor:(NSColor *)gridColor;

- (NSCalendarDate *)pointedCalendarDate;
- (void)setPointedCalendarDate:(NSCalendarDate *)aDate;

- (NSCalendarDate *)_virtualStartDate;
- (void)_setVirtualStartDate:(NSCalendarDate *)virtualStartDate;
- (NSCalendarDate *)_virtualEndDate;
- (void)_setVirtualEndDate:(NSCalendarDate *)virtualEndDate;

// Méthodes d'instance
- (NSUInteger)numberOfDays;
- (NSUInteger)numberOfRows;
- (NSUInteger)numberOfColumns;

- (NSSize)sizeForOneDay;
- (NSRect)rectForColumn:(NSUInteger)column;
- (NSRect)rectForRow:(NSUInteger)row;
- (NSRect)rectForColumn:(NSUInteger)column row:(NSUInteger)row;
- (NSRect)rectForDate:(NSCalendarDate *)aDate;
- (NSInteger)columnForDate:(NSCalendarDate *)aDate;
- (NSInteger)rowForDate:(NSCalendarDate *)aDate;
- (NSInteger)columnAtPoint:(NSPoint)aPoint;
- (NSInteger)rowAtPoint:(NSPoint)aPoint;
- (NSCalendarDate *)dateAtPoint:(NSPoint)aPoint;
- (NSCalendarDate *)dateAtColumn:(NSUInteger)column row:(NSUInteger)row;

- (NSRect)rectEnableAtColumn:(NSUInteger)column row:(NSUInteger)row; // Donne un rectangle dans lequel on peut afficher un événement; cela permet de connaitre la place que l'on a de dispo
- (NSRect)rectEnableAtDate:(NSCalendarDate *)aDate;

//- (NSRect)frameForEvent:(CalEvent *)event;
- (NSRect)frameForStartDate:(NSCalendarDate *)startDate endDate:(NSCalendarDate *)endDate;

- (NSArray *)eventViewsAtColumn:(NSUInteger)column row:(NSUInteger)row;
- (NSArray *)eventViewsAtDate:(NSCalendarDate *)aDate;

//- ( KSTKCalendarEventView *)eventViewAtPoint:(NSPoint)aPoint;

- (NSArray *)selectedEventViews;
//- (void)addSelectedEventView:( KSTKCalendarEventView *)eventView;
//- (void)removeSelectedEventView:( KSTKCalendarEventView *)eventView;
- (void)selectAllEventViews;
- (void)clearSelectedEventViews;

- (NSArray *)selectedCalEvents;
- (void)dragEvent;

//- ( KSTKCalendarEventView *)addEventViewWithEvent:(CalEvent *)anEvent;
//- ( KSTKCalendarEventView *)addEventViewWithStartDate:(NSCalendarDate *)startDate isStartDateView:(BOOL)isStartDateView endDate:(NSCalendarDate *)endDate isEndDateView:(BOOL)isEndDateView event:(CalEvent *)event;
//- (void)removeEventView:( KSTKCalendarEventView *)eventView;
//- (void)updateEventViewsForEventView:( KSTKCalendarEventView *)eventView;
//
//// Méthodes pour la copie
//- (void)writeEventView:( KSTKCalendarEventView *)eventView toPasteboard:(NSPasteboard *)pb;
- (BOOL)readEventViewFromPasteboard:(NSPasteboard *)pb withCalendarDate:(NSCalendarDate *)newDate;
- (IBAction)copy:(id)sender;
- (IBAction)cut:(id)sender;
- (IBAction)paste:(id)sender;

@end
