Today's Menu  Portugal
journal and plan nutrition
CalendarView.h
Go to the documentation of this file.
1 //
2 // CalendarView.h
3 // ios_calendar
4 //
5 // Created by Maxim on 10/7/13.
6 // Copyright (c) 2013 Maxim. All rights reserved.
7 //
8 
9 #import <UIKit/UIKit.h>
10 #import <NSString+CalendarView.h>
11 
12 typedef NS_ENUM(NSInteger, CalendarViewType)
13 {
14  CalendarViewTypeDay,
15  CalendarViewTypeMonth,
16  CalendarViewTypeYear,
17 
18  CalendarViewTypeCount
19 };
20 
21 typedef NS_ENUM(NSInteger, CalendarMode)
22 {
23  CalendarModeDefault,
24  CalendarModeMonthsAndYears,
25  CalendarModeYears
26 };
27 
28 typedef NS_ENUM(NSInteger, CalendarEvent)
29 {
30  CalendarEventNone,
31  CalendarEventTap,
32  CalendarEventDoubleTap,
33  CalendarEventSwipeLeft,
34  CalendarEventSwipeRight,
35  CalendarEventPinchIn,
36  CalendarEventPinchOut
37 };
38 
39 @interface CalendarViewRect : NSObject
40 
41 @property NSInteger value;
42 @property NSString *str;
43 @property CGRect frame;
44 @property BOOL isVecation;
45 
46 @end
47 
48 @protocol CalendarViewDelegate <NSObject>
49 
50 @required
51 - (void)didChangeCalendarDate:(NSDate *)date;
52 
53 @optional
54 - (void)didChangeCalendarDate:(NSDate *)date withType:(NSInteger)type withEvent:(NSInteger)event;
55 - (void)didDoubleTapCalendar:(NSDate *)date withType:(NSInteger)type;
56 - (void)didSelectRangeForStartDate:(NSDate *) startDate andEndDate:(NSDate *) endDate;
57 
58 @end
59 
60 @interface CalendarView : UIView
61 
62 - (instancetype)initWithPosition:(CGFloat)x y:(CGFloat)y;
63 - (void)setMode:(NSInteger)m;
64 - (void)refresh;
65 - (void)goToToday;
68 
69 @property (nonatomic, strong) NSMutableArray *dayRects;
70 
71 @property (nonatomic, weak) id<CalendarViewDelegate> calendarDelegate;
72 @property (nonatomic, strong) NSDate *currentDate;
73 
74 // Colors
75 @property (nonatomic, strong) UIColor *fontColor;
76 @property (nonatomic, strong) UIColor *fontHeaderColor;
77 @property (nonatomic, strong) UIColor *fontSelectedColor;
78 @property (nonatomic, strong) UIColor *selectionColor;
79 @property (nonatomic, strong) UIColor *todayColor;
80 @property (nonatomic, strong) UIColor *bgColor;
81 
82 // Cell Size
83 @property (nonatomic) CGFloat dayCellWidth;
84 @property (nonatomic) CGFloat dayCellHeight;
85 @property (nonatomic) CGFloat monthCellWidth;
86 @property (nonatomic) CGFloat monthCellHeight;
87 @property (nonatomic) CGFloat yearCellWidth;
88 @property (nonatomic) CGFloat yearCellHeight;
89 
90 // Font Size
91 @property (nonatomic, strong) NSString *fontName;
92 @property (nonatomic) CGFloat dayFontSize;
93 @property (nonatomic) CGFloat headerFontSize;
94 
95 // Display Options
96 @property (nonatomic, assign) BOOL shouldMarkSelectedDate;
97 @property (nonatomic, assign) BOOL shouldMarkToday;
98 @property (nonatomic, assign) BOOL shouldShowHeaders;
99 
100 @property (nonatomic, strong) NSCalendarIdentifier calendarIdentifier;
101 @property (nonatomic, strong) NSLocale *locale;
102 // Weekday indices start with Sunday = 0
103 // to match the indices provided by the NSDateFormatter method shortWeekdaySymbols
104 @property (nonatomic) NSInteger preferredWeekStartIndex;
105 @property (nonatomic) BOOL useVeryShortWeekdaySymbols;
106 
107 - (NSDictionary *)generateAttributes:(NSString *)fontName withFontSize:(CGFloat)fontSize withColor:(UIColor *)color withAlignment:(NSTextAlignment)textAlignment;
108 - (void)drawCircle:(CGRect)rect toContext:(CGContextRef *)context withColor:(UIColor *)color;
109 @end
typedef NS_ENUM(NSInteger, CalendarViewType)
Definition: CalendarView.h:12
CGFloat monthCellHeight
Definition: CalendarView.h:86
BOOL useVeryShortWeekdaySymbols
Definition: CalendarView.h:105
NSDate * currentDate
Definition: CalendarView.h:72
NSString * str
Definition: CalendarView.h:42
NSMutableArray * dayRects
Definition: CalendarView.h:69
id< CalendarViewDelegate > calendarDelegate
Definition: CalendarView.h:71
CGFloat dayCellHeight
Definition: CalendarView.h:84
UIColor * selectionColor
Definition: CalendarView.h:78
BOOL shouldShowHeaders
Definition: CalendarView.h:98
UIColor * fontSelectedColor
Definition: CalendarView.h:77
UIColor * bgColor
Definition: CalendarView.h:80
NSString * fontName
Definition: CalendarView.h:91
BOOL shouldMarkSelectedDate
Definition: CalendarView.h:96
NSInteger preferredWeekStartIndex
Definition: CalendarView.h:104
UIColor * fontColor
Definition: CalendarView.h:75
void advanceCalendarContents()
Definition: CalendarView.m:893
CGFloat monthCellWidth
Definition: CalendarView.h:85
NSLocale * locale
Definition: CalendarView.h:101
CGFloat dayCellWidth
Definition: CalendarView.h:83
NSInteger value
Definition: CalendarView.h:41
UIColor * todayColor
Definition: CalendarView.h:79
CGFloat yearCellHeight
Definition: CalendarView.h:88
UIColor * fontHeaderColor
Definition: CalendarView.h:76
void rewindCalendarContents()
Definition: CalendarView.m:898
CGFloat dayFontSize
Definition: CalendarView.h:92
CGFloat yearCellWidth
Definition: CalendarView.h:87
BOOL shouldMarkToday
Definition: CalendarView.h:97
CGFloat headerFontSize
Definition: CalendarView.h:93
NSCalendarIdentifier calendarIdentifier
Definition: CalendarView.h:100