1 /* UIxCalDateSelector.m - this file is part of SOGo
3 * Copyright (C) 2006 Inverse groupe conseil
5 * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
7 * This file is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This file is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #import <NGExtensions/NSCalendarDate+misc.h>
25 #import <SOGo/NSCalendarDate+SOGo.h>
27 #import "UIxCalDateSelector.h"
29 @implementation UIxCalDateSelector
31 /* binding accessors */
33 - (void) setSelectedDate: (NSCalendarDate *) _date
35 ASSIGN (selectedDate, _date);
36 [selectedDate setTimeZone: timeZone];
39 - (NSCalendarDate *) selectedDate
42 selectedDate = [super selectedDate];
52 - (NSString *) headerStyle
57 - (NSString *) weekStyle
62 - (void) setTodayWeekStyle: (NSString *) _style
64 ASSIGN (todayWeekStyle, _style);
67 - (NSString *) todayWeekStyle
69 return ((todayWeekStyle)
74 - (NSString *) dayHeaderStyle
76 return dayHeaderStyle;
79 - (void) setSelectedDayExtraStyle: (NSString *) _style
81 ASSIGN(selectedDayExtraStyle, _style);
84 - (NSString *) selectedDayExtraStyle
86 return selectedDayExtraStyle;
91 - (NSCalendarDate *) startDate
93 return [[self selectedDate] firstDayOfMonth];
98 - (NSString *) headerMonthValue
100 NSCalendarDate *date;
102 date = [self startDate];
104 return [NSString stringWithFormat: @"%.2d", [date monthOfYear]];
107 - (NSString *) headerMonthString
109 NSCalendarDate *date;
111 date = [self startDate];
113 return [NSString stringWithFormat:@"%@",
114 [self localizedNameForMonthOfYear: [date monthOfYear]]];
117 - (NSString *) headerYearString
119 NSCalendarDate *date;
121 date = [self startDate];
123 return [NSString stringWithFormat: @"%d", [date yearOfCommonEra]];
126 - (NSString *) localizedDayOfWeekName
128 return [self localizedAbbreviatedNameForDayOfWeek: [self dayOfWeek]];
134 - (NSString *) currentWeekStyle
136 return (([currentWeekStart isDateInSameWeek:[NSCalendarDate date]] &&
137 [currentWeekStart isDateInSameMonth:[self selectedDate]])
138 ? [self todayWeekStyle]
142 - (NSString *) contentStyle
144 return (([currentDay isToday]
145 && [currentDay isDateInSameMonth:[self selectedDate]])
147 : (([currentDay monthOfYear] != [[self startDate] monthOfYear])
152 - (NSString *) extraStyle
154 return (([[self selectedDate] isDateOnSameDay: currentDay])
155 ? [self selectedDayExtraStyle]
161 - (NSDictionary *) currentMonthQueryParameters
163 return [self queryParametersBySettingSelectedDate: [self startDate]];
168 - (NSArray *) fetchCoreInfos