source: trunk/Cocoa/Pester/Source/OACalendarView.h@ 536

Last change on this file since 536 was 102, checked in by Nicholas Riley, 22 years ago

Pester 1.1b3

File size: 3.5 KB
Line 
1// Copyright 2001-2002 Omni Development, Inc. All rights reserved.
2//
3// This software may only be used and reproduced according to the
4// terms in the file OmniSourceLicense.html, which should be
5// distributed with this project and can also be found at
6// http://www.omnigroup.com/DeveloperResources/OmniSourceLicense.html.
7//
8// $Header: /Network/Source/CVS/OmniGroup/Frameworks/OmniAppKit/Widgets.subproj/OACalendarView.h,v 1.16 2002/12/07 00:23:40 andrew Exp $
9
10#import <AppKit/NSControl.h>
11
12@class NSCalendarDate, NSMutableArray;
13@class NSTableHeaderCell, NSTextFieldCell;
14@class OACalendarView;
15
16#import <AppKit/NSNibDeclarations.h>
17
18@interface NSObject (OACalendarViewDelegate)
19- (int)calendarView:(OACalendarView *)aCalendarView highlightMaskForVisibleMonth:(NSCalendarDate *)visibleMonth;
20- (void)calendarView:(OACalendarView *)aCalendarView willDisplayCell:(id)aCell forDate:(NSCalendarDate *)aDate; // implement this on the target if you want to be able to set up the date cell. The cell is only used for drawing (and is reused for every date), so you can not, for instance, enable/disable dates by enabling or disabling the cell.
21- (BOOL)calendarView:(OACalendarView *)aCalendarView shouldSelectDate:(NSCalendarDate *)aDate; // implement this on the target if you need to prevent certain dates from being selected. The target is responsible for taking into account the selection type
22- (void)calendarView:(OACalendarView *)aCalendarView didChangeVisibleMonth:(NSCalendarDate *)aDate; // implement this on the target if you want to know when the visible month changes
23- (void)calendarViewShouldDismiss:(OACalendarView *)aCalendarView; // implement this on the target if you want to know when someone double-clicks on a day
24@end
25
26
27typedef enum _OACalendarViewSelectionType {
28 OACalendarViewSelectByDay = 0, // one day
29 OACalendarViewSelectByWeek = 1, // one week (from Sunday to Saturday)
30 OACalendarViewSelectByWeekday = 2, // all of one weekday (e.g. Monday) for a whole month
31} OACalendarViewSelectionType;
32
33@interface OACalendarView : NSControl
34{
35 NSCalendarDate *visibleMonth;
36 NSCalendarDate *selectedDay;
37 NSMutableString *typed;
38 NSDate *typeSelectResetTime;
39
40 NSView *monthAndYearView;
41 NSTextFieldCell *monthAndYearTextFieldCell;
42 NSTableHeaderCell *dayOfWeekCell[7];
43 NSTextFieldCell *dayOfMonthCell;
44 NSMutableArray *buttons;
45
46 int dayHighlightMask;
47 OACalendarViewSelectionType selectionType;
48
49 float columnWidth;
50 float rowHeight;
51 NSRect monthAndYearRect;
52 NSRect gridHeaderAndBodyRect;
53 NSRect gridHeaderRect;
54 NSRect gridBodyRect;
55
56 struct {
57 unsigned int showsDaysForOtherMonths:1;
58 unsigned int targetProvidesHighlightMask:1;
59 unsigned int targetWatchesCellDisplay:1;
60 unsigned int targetWatchesVisibleMonth:1;
61 unsigned int targetApprovesDateSelection:1;
62 unsigned int targetReceivesDismiss:1;
63 } flags;
64}
65
66- (NSCalendarDate *)visibleMonth;
67- (void)setVisibleMonth:(NSCalendarDate *)aDate;
68
69- (NSCalendarDate *)selectedDay;
70- (void)setSelectedDay:(NSCalendarDate *)newSelectedDay;
71
72- (int)dayHighlightMask;
73- (void)setDayHighlightMask:(int)newMask;
74- (void)updateHighlightMask;
75
76- (BOOL)showsDaysForOtherMonths;
77- (void)setShowsDaysForOtherMonths:(BOOL)value;
78
79- (OACalendarViewSelectionType)selectionType;
80- (void)setSelectionType:(OACalendarViewSelectionType)value;
81
82- (NSArray *)selectedDays;
83
84// Actions
85- (IBAction)previousMonth:(id)sender;
86- (IBAction)nextMonth:(id)sender;
87- (IBAction)previousYear:(id)sender;
88- (IBAction)nextYear:(id)sender;
89
90@end
Note: See TracBrowser for help on using the repository browser.