1 /* -*-objc-*-
2    NSDatePickerCell.h
3 
4    The date picker cell class
5 
6    Copyright (C) 2020 Free Software Foundation, Inc.
7 
8    Created by Dr. H. Nikolaus Schaller on Sat Jan 07 2006.
9 
10    Author:	Fabian Spillner
11    Date:	22. October 2007
12 
13    This file is part of the GNUstep GUI Library.
14 
15    This library is free software; you can redistribute it and/or
16    modify it under the terms of the GNU Lesser General Public
17    License as published by the Free Software Foundation; either
18    version 2 of the License, or (at your option) any later version.
19 
20    This library is distributed in the hope that it will be useful,
21    but WITHOUT ANY WARRANTY; without even the implied warranty of
22    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
23    Lesser General Public License for more details.
24 
25    You should have received a copy of the GNU Lesser General Public
26    License along with this library; see the file COPYING.LIB.
27    If not, see <http://www.gnu.org/licenses/> or write to the
28    Free Software Foundation, 51 Franklin Street, Fifth Floor,
29    Boston, MA 02110-1301, USA.
30 */
31 
32 #ifndef _GNUstep_H_NSDatePickerCell
33 #define _GNUstep_H_NSDatePickerCell
34 
35 #import <AppKit/NSActionCell.h>
36 
37 #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
38 
39 enum {
40       NSTextFieldAndStepperDatePickerStyle    = 0,
41       NSClockAndCalendarDatePickerStyle       = 1,
42       NSTextFieldDatePickerStyle              = 2
43 };
44 typedef NSUInteger NSDatePickerStyle;
45 
46 enum {
47       NSSingleDateMode = 0,
48       NSRangeDateMode = 1
49 };
50 typedef NSUInteger NSDatePickerMode;
51 
52 enum {
53       NSHourMinuteDatePickerElementFlag       = 0x000c,
54       NSHourMinuteSecondDatePickerElementFlag = 0x000e,
55       NSTimeZoneDatePickerElementFlag         = 0x0010,
56 
57       NSYearMonthDatePickerElementFlag        = 0x00c0,
58       NSYearMonthDayDatePickerElementFlag     = 0x00e0,
59       NSEraDatePickerElementFlag              = 0x0100,
60 };
61 typedef NSUInteger NSDatePickerElementFlags;
62 
63 @class NSColor, NSDate, NSCalendar, NSLocale, NSTimeZone;
64 
65 @interface NSDatePickerCell : NSActionCell
66 {
67   NSColor *_backgroundColor;
68   NSColor *_textColor;
69   NSDate *_maxDate;
70   NSDate *_minDate;
71   id _delegate;
72   NSTimeInterval _timeInterval;
73   // FIXME: pack into a bitfield?
74   NSDatePickerElementFlags _datePickerElements;
75   NSDatePickerMode _datePickerMode;
76   NSDatePickerStyle _datePickerStyle;
77   BOOL _drawsBackground;
78 }
79 
80 - (NSColor *) backgroundColor;
81 - (NSCalendar *) calendar;
82 - (NSDatePickerElementFlags) datePickerElements;
83 - (NSDatePickerMode) datePickerMode;
84 - (NSDatePickerStyle) datePickerStyle;
85 - (NSDate *) dateValue;
86 - (id) delegate;
87 - (BOOL) drawsBackground;
88 - (NSLocale *) locale;
89 - (NSDate *) maxDate;
90 - (NSDate *) minDate;
91 - (void) setBackgroundColor:(NSColor *) color;
92 - (void) setCalendar:(NSCalendar *) calendar;
93 - (void) setDatePickerElements:(NSDatePickerElementFlags) flags;
94 - (void) setDatePickerMode:(NSDatePickerMode) mode;
95 - (void) setDatePickerStyle:(NSDatePickerStyle) style;
96 - (void) setDateValue:(NSDate *) date;
97 - (void) setDelegate:(id) obj;
98 - (void) setDrawsBackground:(BOOL) flag;
99 - (void) setLocale:(NSLocale *) locale;
100 - (void) setMaxDate:(NSDate *) date;
101 - (void) setMinDate:(NSDate *) date;
102 - (void) setTextColor:(NSColor *) color;
103 - (void) setTimeInterval:(NSTimeInterval) interval;
104 - (void) setTimeZone:(NSTimeZone *) zone;
105 - (NSColor *) textColor;
106 - (NSTimeInterval) timeInterval;
107 - (NSTimeZone *) timeZone;
108 
109 @end
110 
111 @interface NSObject (NSDataPickerCellDelegate)
112 
113 - (void)datePickerCell:(NSDatePickerCell *) aDatePickerCell
114 validateProposedDateValue:(NSDate **) proposedDateValue
115 		  timeInterval:(NSTimeInterval *) proposedTimeInterval;
116 
117 @end
118 
119 #endif
120 #endif /* _GNUstep_H_NSDatePickerCell */
121