API  0.9.10
CPDatePicker.j
Go to the documentation of this file.
1 /* CPDatePicker.j
2 * AppKit
3 *
4 * Created by Alexandre Wilhelm
5 * Copyright 2012 <[email protected]>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library 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 GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21 
22 
23 
24 
27 
29 
32 
36 
43 
48 @implementation CPDatePicker : CPControl
49 {
50  BOOL _isBordered;
51  BOOL _isBezeled;
52  BOOL _drawsBackground;
53  CPDate _dateValue;
54  CPDate _minDate;
55  CPDate _maxDate;
56  CPFont _textFont;
57  CPLocale _locale;
58  //CPCalendar _calendar;
59  CPTimeZone _timeZone;
60  id _delegate;
61  CPInteger _datePickerElements;
62  CPInteger _datePickerMode;
63  CPInteger _datePickerStyle;
64  CPInteger _timeInterval;
65 
66  BOOL _invokedByUserEvent;
67  _CPDatePickerTextField _datePickerTextfield;
68  _CPDatePickerCalendar _datePickerCalendar;
69  unsigned _implementedCDatePickerDelegateMethods;
70 }
71 
72 
73 #pragma mark -
74 #pragma mark Theme methods
75 
77 {
78  return @"datePicker";
79 }
80 
82 {
83  return @{
84  @"bezel-color": [CPColor clearColor],
85  @"border-width" : 1.0,
86  @"border-color": [CPColor clearColor],
87  @"content-inset": CGInsetMakeZero(),
88  @"bezel-inset": CGInsetMakeZero(),
89  @"datepicker-textfield-bezel-color": [CPColor clearColor],
90  @"min-size-datepicker-textfield": CGSizeMakeZero(),
91  @"content-inset-datepicker-textfield": CGInsetMakeZero(),
92  @"content-inset-datepicker-textfield-separator": CGInsetMakeZero(),
93  @"separator-content-inset": CGInsetMakeZero(),
94  @"date-hour-margin": 5.0,
95  @"stepper-margin": 5.0,
96  @"bezel-color-calendar": [CPColor clearColor],
97  @"title-text-color": [CPColor blackColor],
98  @"title-text-shadow-color": [CPColor clearColor],
99  @"title-text-shadow-offset": CGSizeMakeZero(),
100  @"title-font": [CPNull null],
101  @"weekday-text-color": [CPColor blackColor],
102  @"weekday-text-shadow-color": [CPColor clearColor],
103  @"weekday-text-shadow-offset": CGSizeMakeZero(),
104  @"weekday-font": [CPNull null],
105  @"arrow-image-left": [CPNull null],
106  @"arrow-image-right": [CPNull null],
107  @"arrow-image-left-highlighted": [CPNull null],
108  @"arrow-image-right-highlighted": [CPNull null],
109  @"arrow-inset": CGInsetMakeZero(),
110  @"circle-image": [CPNull null],
111  @"circle-image-highlighted": [CPNull null],
112  @"tile-text-color": [CPColor blackColor],
113  @"tile-text-shadow-color": [CPColor clearColor],
114  @"tile-text-shadow-offset": CGSizeMakeZero(),
115  @"tile-font": [CPNull null],
116  @"size-tile": CGSizeMakeZero(),
117  @"size-calendar": CGSizeMakeZero(),
118  @"size-header": CGSizeMakeZero(),
119  @"min-size-calendar": CGSizeMakeZero(),
120  @"max-size-calendar": CGSizeMakeZero(),
121  @"bezel-color-clock": [CPColor clearColor],
122  @"clock-text-color": [CPColor blackColor],
123  @"clock-text-shadow-color": [CPColor clearColor],
124  @"clock-text-shadow-offset": CGSizeMakeZero(),
125  @"clock-font": [CPNull null],
126  @"second-hand-image": [CPNull null],
127  @"hour-hand-image": [CPNull null],
128  @"middle-hand-image": [CPNull null],
129  @"minute-hand-image": [CPNull null],
130  @"size-clock": CGSizeMakeZero(),
131  @"second-hand-size": CGSizeMakeZero(),
132  @"hour-hand-size": CGSizeMakeZero(),
133  @"middle-hand-size": CGSizeMakeZero(),
134  @"minute-hand-size": CGSizeMakeZero(),
135  };
136 }
137 
138 
139 #pragma mark -
140 #pragma mark Binding methods
141 
142 + (Class)_binderClassForBinding:(CPString)theBinding
143 {
144  if (theBinding == CPValueBinding || theBinding == CPMinValueBinding || theBinding == CPMaxValueBinding)
145  return [_CPDatePickerValueBinder class];
146 
147  return [super _binderClassForBinding:theBinding];
148 }
149 
150 - (CPString)_replacementKeyPathForBinding:(CPString)aBinding
151 {
152  if (aBinding == CPValueBinding)
153  return @"dateValue";
154 
155  if (aBinding == CPMinValueBinding)
156  return @"minDate";
157 
158  if (aBinding == CPMaxValueBinding)
159  return @"maxDate";
160 
161  return [super _replacementKeyPathForBinding:aBinding];
162 }
163 
164 
165 #pragma mark -
166 #pragma mark Init methods
167 
168 - (id)initWithFrame:(CGRect)aFrame
169 {
170  if (self = [super initWithFrame:aFrame])
171  {
172  _drawsBackground = YES;
173  _datePickerStyle = CPTextFieldAndStepperDatePickerStyle;
174  _datePickerMode = CPSingleDateMode;
176  _timeInterval = 0;
177  _implementedCDatePickerDelegateMethods = 0;
178 
179  [self setObjectValue:[CPDate date]];
180  _minDate = [CPDate distantPast];
181  _maxDate = [CPDate distantFuture];
182 
183  [self setBezeled:YES];
184  [self setBordered:YES];
185 
186  [self _init];
187  }
188 
189  return self
190 }
191 
192 - (void)_init
193 {
194  if (!_locale)
195  _locale = [CPLocale currentLocale];
196 
197  _datePickerTextfield = [[_CPDatePickerTextField alloc] initWithFrame:[self bounds] withDatePicker:self];
198  [_datePickerTextfield setDateValue:_dateValue];
199 
200  _datePickerCalendar = [[_CPDatePickerCalendar alloc] initWithFrame:[self bounds] withDatePicker:self];
201  [_datePickerCalendar setDateValue:_dateValue];
202 
203  // We might have been unarchived in a disabled state.
204  [_datePickerTextfield setEnabled:[self isEnabled]];
205 
206  [self setNeedsDisplay:YES];
207  [self setNeedsLayout];
208 }
209 
210 
211 #pragma mark -
212 #pragma mark Control Size
213 
214 - (void)setControlSize:(CPControlSize)aControlSize
215 {
216  [super setControlSize:aControlSize];
217 
219  [self _sizeToControlSize];
220 }
221 
222 
223 #pragma mark -
224 #pragma mark Delegate methods
225 
229 - (void)setDelegate:(id)aDelegate
230 {
231  _delegate = aDelegate;
232  _implementedCDatePickerDelegateMethods = 0;
233 
234  // Look if the delegate implements or not the delegate methods
235  if ([_delegate respondsToSelector:@selector(datePicker:validateProposedDateValue:timeInterval:)])
236  _implementedCDatePickerDelegateMethods |= CPDatePicker_validateProposedDateValue_timeInterval;
237 }
238 
239 
240 #pragma mark -
241 #pragma mark Layout method
242 
246 {
247  [super layoutSubviews];
248 
249  if (_datePickerStyle == CPTextFieldAndStepperDatePickerStyle || _datePickerStyle == CPTextFieldDatePickerStyle)
250  {
251  if (![_datePickerTextfield superview])
252  [self addSubview:_datePickerTextfield];
253 
254  if ([_datePickerCalendar superview])
255  [_datePickerCalendar removeFromSuperview];
256 
257  [_datePickerTextfield setControlSize:[self controlSize]];
258  [_datePickerTextfield setNeedsLayout];
259  [_datePickerTextfield setNeedsDisplay:YES];
260  }
261  else
262  {
263  if (![_datePickerCalendar superview])
264  [self addSubview:_datePickerCalendar];
265 
266  if ([_datePickerTextfield superview])
267  [_datePickerTextfield removeFromSuperview];
268 
269  [_datePickerCalendar setNeedsLayout];
270  [_datePickerCalendar setNeedsDisplay:YES];
271  }
272 }
273 
274 #pragma mark -
275 #pragma mark Setter
276 
280 {
281  // TODO : add timeZone effect. How to do it because js ???
282  return _dateValue
283 }
284 
288 - (void)setObjectValue:(CPDate)aValue
289 {
290  if (![aValue isKindOfClass:[CPDate class]])
291  return;
292 
293  [self setDateValue:aValue];
294 }
295 
296 /* Set the dateValue of the datePicker
297  @param aDateValue the dateValue
298 */
299 - (void)setDateValue:(CPDate)aDateValue
300 {
301  if (aDateValue == nil)
302  return;
303 
304  _invokedByUserEvent = NO;
305  [self _setDateValue:aDateValue timeInterval:_timeInterval];
306 }
307 
312 - (void)_setDateValue:(CPDate)aDateValue timeInterval:(CPTimeInterval)aTimeInterval
313 {
314  // Make sure to have a valid date and avoid NaN values
315  if (!isFinite(aDateValue))
316  {
317  [CPException raise:CPInvalidArgumentException
318  reason:@"aDateValue is not valid"];
319  return;
320  }
321 
322  if (_minDate)
323  aDateValue = new Date (MAX(aDateValue, _minDate));
324 
325  if (_maxDate)
326  aDateValue = new Date (MIN(aDateValue, _maxDate));
327 
328  aTimeInterval = MAX(MIN(aTimeInterval, [_maxDate timeIntervalSinceDate:aDateValue]), [_minDate timeIntervalSinceDate:aDateValue]);
329 
330  if ([aDateValue isEqualToDate:_dateValue] && aTimeInterval == _timeInterval)
331  {
332  if (_datePickerStyle == CPTextFieldAndStepperDatePickerStyle || _datePickerStyle == CPTextFieldDatePickerStyle)
333  [_datePickerTextfield setDateValue:_dateValue];
334  else
335  [_datePickerCalendar setDateValue:_dateValue];
336 
337  return;
338  }
339 
340  if (_implementedCDatePickerDelegateMethods & CPDatePicker_validateProposedDateValue_timeInterval)
341  {
342  // constrain timeInterval also
343  var aStartDateRef = function(x){if (typeof x == 'undefined') return aDateValue; aDateValue = x;}
344  var aTimeIntervalRef = function(x){if (typeof x == 'undefined') return aTimeInterval; aTimeInterval = x;}
345 
346  [_delegate datePicker:self validateProposedDateValue:aStartDateRef timeInterval:aTimeIntervalRef];
347  }
348 
349  [self willChangeValueForKey:@"objectValue"];
350  [self willChangeValueForKey:@"dateValue"];
351  _dateValue = aDateValue;
352  [super setObjectValue:_dateValue];
353  [self didChangeValueForKey:@"objectValue"];
354  [self didChangeValueForKey:@"dateValue"];
355 
356  [self willChangeValueForKey:@"timeInterval"];
357  _timeInterval = (_datePickerMode == CPSingleDateMode)? 0 : aTimeInterval;
358  [self didChangeValueForKey:@"timeInterval"];
359 
360  if (_invokedByUserEvent)
361  [self sendAction:[self action] to:[self target]];
362 
363  if (_datePickerStyle == CPTextFieldAndStepperDatePickerStyle || _datePickerStyle == CPTextFieldDatePickerStyle)
364  [_datePickerTextfield setDateValue:_dateValue];
365  else
366  [_datePickerCalendar setDateValue:_dateValue];
367 }
368 
372 - (void)setMinDate:(CPDate)aMinDate
373 {
374  [self willChangeValueForKey:@"minDate"];
375  _minDate = aMinDate;
376  [self didChangeValueForKey:@"minDate"];
377 
378  [self _setDateValue:_dateValue timeInterval:_timeInterval];
379 }
380 
384 - (void)setMaxDate:(CPDate)aMaxDate
385 {
386  [self willChangeValueForKey:@"maxDate"];
387  _maxDate = aMaxDate;
388  [self didChangeValueForKey:@"maxDate"];
389 
390  [self _setDateValue:_dateValue timeInterval:_timeInterval];
391 }
392 
396 - (void)setDatePickerStyle:(CPInteger)aDatePickerStyle
397 {
398  _datePickerStyle = aDatePickerStyle;
399 
400  [self setControlSize:[self controlSize]];
401 
402  [self setNeedsDisplay:YES];
403  [self setNeedsLayout];
404 }
405 
409 - (void)setDatePickerElements:(CPInteger)aDatePickerElements
410 {
411  _datePickerElements = aDatePickerElements;
412 
413  [self setNeedsDisplay:YES];
414  [self setNeedsLayout];
415 }
416 
420 - (void)setDatePickerMode:(CPInteger)aDatePickerMode
421 {
422  _datePickerMode = aDatePickerMode;
423 
424  if (_datePickerMode == CPSingleDateMode)
425  [self _setDateValue:[self dateValue] timeInterval:0];
426 
427  [self setNeedsDisplay:YES];
428  [self setNeedsLayout];
429 }
430 
434 - (void)setTimeInterval:(CPInteger)aTimeInterval
435 {
436  if (_datePickerMode == CPSingleDateMode)
437  return;
438 
439  [self _setDateValue:[self dateValue] timeInterval:aTimeInterval];
440 }
441 
445 - (void)setLocale:(CPLocale)aLocale
446 {
447  _locale = aLocale;
448 
449  if (_formatter)
450  {
451  [self willChangeValueForKey:@"locale"];
452  [_formatter setLocale:_locale];
453  [self didChangeValueForKey:@"locale"];
454  }
455 
456  // This will update the textFields (usefull when changing with a date with pm and am)
457  [_datePickerTextfield setDateValue:_dateValue];
458  [self setNeedsDisplay:YES];
459  [self setNeedsLayout];
460 }
461 
466 - (void)setBezeled:(BOOL)shouldBeBezeled
467 {
468  _isBezeled = shouldBeBezeled;
469 
470  if (shouldBeBezeled)
471  [self setThemeState:CPThemeStateBezeled];
472  else
473  [self unsetThemeState:CPThemeStateBezeled];
474 }
475 
480 - (void)setBordered:(BOOL)shouldBeBordered
481 {
482  _isBordered = shouldBeBordered;
483 
484  if (shouldBeBordered)
485  [self setThemeState:CPThemeStateBordered];
486  else
487  [self unsetThemeState:CPThemeStateBordered];
488 }
489 
494 - (void)setTextFont:(CPFont)aFont
495 {
496  [self setFont:aFont];
497 }
498 
502 - (void)setEnabled:(BOOL)aBoolean
503 {
504  [super setEnabled:aBoolean];
505 
506  [_datePickerTextfield setEnabled:aBoolean];
507  [_datePickerCalendar setEnabled:aBoolean];
508 }
509 
513 - (void)setBackgroundColor:(CPColor)aColor
514 {
515  _backgroundColor = aColor;
516  [self setNeedsLayout];
517 }
518 
522 - (void)setDrawsBackground:(BOOL)aBoolean
523 {
524  [self willChangeValueForKey:@"drawsBackground"];
525  _drawsBackground = aBoolean;
526  [self didChangeValueForKey:@"drawsBackground"];
527 
528  [self setNeedsLayout];
529 }
530 
534 - (void)setTimeZone:(CPTimeZone)aTimeZone
535 {
536  [self willChangeValueForKey:@"timeZone"];
537  _timeZone = aTimeZone;
538  [self didChangeValueForKey:@"timeZone"];
539 
540  [self setNeedsLayout];
541 
542  if (_datePickerStyle == CPTextFieldAndStepperDatePickerStyle || _datePickerStyle == CPTextFieldDatePickerStyle)
543  [_datePickerTextfield setDateValue:_dateValue];
544  else
545  [_datePickerCalendar setDateValue:_dateValue];
546 }
547 
548 
549 #pragma mark -
550 #pragma mark First responder methods
551 
555 {
556  if (_datePickerStyle == CPTextFieldAndStepperDatePickerStyle || _datePickerStyle == CPTextFieldDatePickerStyle)
557  {
558  if (![super becomeFirstResponder])
559  return NO;
560 
561  [_datePickerTextfield _selectTextFieldWithFlags:[[CPApp currentEvent] modifierFlags]];
562 
563  return YES;
564  }
565 
566  return NO;
567 }
568 
572 {
573  return YES;
574 }
575 
579 {
580  if (_datePickerStyle == CPTextFieldAndStepperDatePickerStyle || _datePickerStyle == CPTextFieldDatePickerStyle)
581  [_datePickerTextfield resignFirstResponder];
582 
583  return YES;
584 }
585 
586 
587 #pragma mark -
588 #pragma mark getter
589 
593 - (BOOL)isBezeled
594 {
595  return [self hasThemeState:CPThemeStateBezeled];
596 }
597 
601 - (BOOL)isBordered
602 {
603  return [self hasThemeState:CPThemeStateBordered];
604 }
605 
610 {
611  return [self font];
612 }
613 
616 - (BOOL)_isAmericanFormat
617 {
618  return [[_locale objectForKey:CPLocaleCountryCode] isEqualToString:@"US"];
619 }
620 
621 #pragma mark -
622 #pragma mark Key event
623 
627 - (void)keyDown:(CPEvent)anEvent
628 {
629  if (_datePickerStyle == CPTextFieldAndStepperDatePickerStyle || _datePickerStyle == CPTextFieldDatePickerStyle)
630  [_datePickerTextfield keyDown:anEvent];
631 }
632 
633 @end
634 
635 var CPDatePickerModeKey = @"CPDatePickerModeKey",
636  CPIntervalKey = @"CPIntervalKey",
637  CPMinDateKey = @"CPMinDateKey",
638  CPMaxDateKey = @"CPMaxDateKey",
639  CPBackgroundColorKey = @"CPBackgroundColorKey",
640  CPDrawsBackgroundKey = @"CPDrawsBackgroundKey",
641  CPTextFontKey = @"CPTextFontKey",
642  CPDatePickerElementsKey = @"CPDatePickerElementsKey",
643  CPDatePickerStyleKey = @"CPDatePickerStyleKey",
644  CPLocaleKey = @"CPLocaleKey",
645  CPBorderedKey = @"CPBorderedKey",
646  CPDateValueKey = @"CPDateValueKey";
647 
648 @implementation CPDatePicker (CPCoding)
649 
650 - (id)initWithCoder:(CPCoder)aCoder
651 {
652  self = [super initWithCoder:aCoder];
653 
654  if (self)
655  {
656  _textFont = [aCoder decodeObjectForKey:CPTextFontKey];
657  _minDate = [aCoder decodeObjectForKey:CPMinDateKey] || [CPDate distantPast];
658  _maxDate = [aCoder decodeObjectForKey:CPMaxDateKey] || [CPDate distantFuture];
659  _timeInterval = [aCoder decodeDoubleForKey:CPIntervalKey];
660  _datePickerMode = [aCoder decodeIntForKey:CPDatePickerModeKey];
661  _datePickerElements = [aCoder decodeIntForKey:CPDatePickerElementsKey];
662  [self setDatePickerStyle:[aCoder decodeIntForKey:CPDatePickerStyleKey]];
663  _locale = [aCoder decodeObjectForKey:CPLocaleKey];
664  _dateValue = [aCoder decodeObjectForKey:CPDateValueKey];
665  _backgroundColor = [aCoder decodeObjectForKey:CPBackgroundColorKey];
666  _drawsBackground = [aCoder decodeBoolForKey:CPDrawsBackgroundKey];
667  _isBordered = [aCoder decodeBoolForKey:CPBorderedKey];
668 
669  [self _init];
670  }
671 
672  return self
673 }
674 
675 - (void)encodeWithCoder:(CPCoder)aCoder
676 {
677  // FIXME Do we need to encode _datePickerTextfield and _datePickerCalendar? As subviews they'll be encoded, but when we decode we recreate them anyhow.
678  [super encodeWithCoder:aCoder];
679 
680  [aCoder encodeDouble:_timeInterval forKey:CPIntervalKey];
681  [aCoder encodeInt:_datePickerMode forKey:CPDatePickerModeKey];
682  [aCoder encodeInt:_datePickerStyle forKey:CPDatePickerStyleKey];
683  [aCoder encodeInt:_datePickerElements forKey:CPDatePickerElementsKey];
684  [aCoder encodeObject:_minDate forKey:CPMinDateKey];
685  [aCoder encodeObject:_maxDate forKey:CPMaxDateKey]
686  [aCoder encodeObject:_dateValue forKey:CPDateValueKey];;
687  [aCoder encodeObject:_textFont forKey:CPTextFontKey];
688  [aCoder encodeObject:_locale forKey:CPLocaleKey];
689  [aCoder encodeObject:_backgroundColor forKey:CPBackgroundColorKey];
690  [aCoder encodeObject:_drawsBackground forKey:CPDrawsBackgroundKey];
691  [aCoder encodeObject:_isBordered forKey:CPBorderedKey];
692 
693 }
694 
695 @end
696 @implementation _CPDatePickerValueBinder : CPBinder
697 {
698  id __doxygen__;
699 }
700 
701 @end
702 
704 
705 - (int)_daysInMonth
706 {
707  return 32 - new Date(self.getFullYear(), self.getMonth(), 32).getDate();
708 }
709 
710 - (void)_resetToMidnight
711 {
712  self.setHours(0);
713  self.setMinutes(0);
714  self.setSeconds(0);
715  self.setMilliseconds(0);
716 }
717 
718 - (void)_resetToLastSeconds
719 {
720  self.setHours(23);
721  self.setMinutes(59);
722  self.setSeconds(59);
723  self.setMilliseconds(99);
724 }
725 
726 @end
727 
729 
733 - (BOOL)isBordered
734 {
735  return _isBordered;
736 }
737 
741 - (void)setBordered:(BOOL)aValue
742 {
743  _isBordered = aValue;
744 }
745 
749 - (BOOL)isBezeled
750 {
751  return _isBezeled;
752 }
753 
757 - (void)setBezeled:(BOOL)aValue
758 {
759  _isBezeled = aValue;
760 }
761 
766 {
767  return _drawsBackground;
768 }
769 
773 - (void)setDrawsBackground:(BOOL)aValue
774 {
775  _drawsBackground = aValue;
776 }
777 
782 {
783  return _dateValue;
784 }
785 
789 - (void)setDateValue:(CPDate)aValue
790 {
791  _dateValue = aValue;
792 }
793 
798 {
799  return _minDate;
800 }
801 
805 - (void)setMinDate:(CPDate)aValue
806 {
807  _minDate = aValue;
808 }
809 
814 {
815  return _maxDate;
816 }
817 
821 - (void)setMaxDate:(CPDate)aValue
822 {
823  _maxDate = aValue;
824 }
825 
830 {
831  return _textFont;
832 }
833 
837 - (void)setTextFont:(CPFont)aValue
838 {
839  _textFont = aValue;
840 }
841 
846 {
847  return _locale;
848 }
849 
853 - (void)setLocale:(CPLocale)aValue
854 {
855  _locale = aValue;
856 }
857 
861 - (CPCalendar)calendar
862 {
863  return _calendar;
864 }
865 
869 - (void)setCalendar:(CPCalendar)aValue
870 {
871  _calendar = aValue;
872 }
873 
878 {
879  return _timeZone;
880 }
881 
885 - (void)setTimeZone:(CPTimeZone)aValue
886 {
887  _timeZone = aValue;
888 }
889 
893 - (id)delegate
894 {
895  return _delegate;
896 }
897 
901 - (void)setDelegate:(id)aValue
902 {
903  _delegate = aValue;
904 }
905 
909 - (CPInteger)datePickerElements
910 {
911  return _datePickerElements;
912 }
913 
917 - (void)setDatePickerElements:(CPInteger)aValue
918 {
919  _datePickerElements = aValue;
920 }
921 
925 - (CPInteger)datePickerMode
926 {
927  return _datePickerMode;
928 }
929 
933 - (void)setDatePickerMode:(CPInteger)aValue
934 {
935  _datePickerMode = aValue;
936 }
937 
941 - (CPInteger)datePickerStyle
942 {
943  return _datePickerStyle;
944 }
945 
949 - (void)setDatePickerStyle:(CPInteger)aValue
950 {
951  _datePickerStyle = aValue;
952 }
953 
957 - (CPInteger)timeInterval
958 {
959  return _timeInterval;
960 }
961 
965 - (void)setTimeInterval:(CPInteger)aValue
966 {
967  _timeInterval = aValue;
968 }
969 
970 @end
Used to implement exception handling (creating & raising).
Definition: CPException.h:2
CPRangeDateMode
Definition: CPDatePicker.j:31
Definition: CPFont.h:2
void setFont:(CPFont aFont)
Definition: CPControl.j:891
var CPBorderedKey
Definition: CPDatePicker.j:645
var CPDrawsBackgroundKey
Definition: CPDatePicker.j:640
CPControlSize controlSize()
Definition: CPControl.j:202
void addSubview:(CPView aSubview)
Definition: CPView.j:512
void layoutSubviews()
Definition: CPDatePicker.j:245
id currentLocale()
Definition: CPLocale.j:86
void layoutSubviews()
Definition: CPView.j:2765
BOOL isEnabled()
Definition: CPControl.j:970
BOOL setThemeState:(ThemeState aState)
Definition: CPView.j:3214
CPFont textFont()
Definition: CPDatePicker.j:609
CPHourMinuteDatePickerElementFlag
Definition: CPDatePicker.j:37
A representation of a single point in time.
Definition: CPDate.h:2
An object representation of nil.
Definition: CPNull.h:2
CPColor clearColor()
Definition: CPColor.j:450
CPMinValueBinding
CPDictionary themeAttributes()
Definition: CPDatePicker.j:81
void setDateValue:(CPDate aDateValue)
Definition: CPDatePicker.j:299
CPFont font()
Definition: CPControl.j:899
var CPMinDateKey
Definition: CPDatePicker.j:637
CPTextFieldAndStepperDatePickerStyle
Definition: CPDatePicker.j:33
CGRect bounds()
Definition: CPView.j:1302
void raise:reason:(CPString aName, [reason] CPString aReason)
Definition: CPException.j:66
void setControlSize:(CPControlSize aControlSize)
Definition: CPControl.j:211
void setEnabled:(BOOL isEnabled)
Definition: CPControl.j:959
var CPDateValueKey
Definition: CPDatePicker.j:646
id distantFuture()
Definition: CPDate.j:67
CPEraDatePickerElementFlag
Definition: CPDatePicker.j:42
A mutable key-value pair collection.
Definition: CPDictionary.h:2
CPLocaleLanguageCode
Definition: CPLocale.j:25
void setBordered:(BOOL shouldBeBordered)
Definition: CPDatePicker.j:480
var CPDatePickerModeKey
Definition: CPDatePicker.j:635
var CPMaxDateKey
Definition: CPDatePicker.j:638
CPTimeZoneDatePickerElementFlag
Definition: CPDatePicker.j:39
CPColor blackColor()
Definition: CPColor.j:283
void setControlSize:(CPControlSize aControlSize)
Definition: CPDatePicker.j:214
CPString defaultThemeClass()
Definition: CPDatePicker.j:76
CPDateFormatterShortStyle
An immutable string (collection of characters).
Definition: CPString.h:2
CPNull null()
Definition: CPNull.j:51
id distantPast()
Definition: CPDate.j:62
CPHourMinuteSecondDatePickerElementFlag
Definition: CPDatePicker.j:38
BOOL sendAction:to:(SEL anAction, [to] id anObject)
Definition: CPControl.j:319
SEL action()
Definition: CPControl.j:290
id initWithCoder:(CPCoder aCoder)
Definition: CPControl.j:1085
void setBezeled:(BOOL shouldBeBezeled)
Definition: CPDatePicker.j:466
void setNeedsDisplay:(BOOL aFlag)
Definition: CPView.j:2556
void setObjectValue:(id anObject)
Definition: CPControl.j:534
CPMaxValueBinding
CPTimeZone is a class to define the behvior of time zone object (like CPDatePicker) ...
Definition: CPTimeZone.h:2
var CPLocaleKey
Definition: CPDatePicker.j:644
void setNeedsLayout()
Definition: CPView.j:2707
id target()
Definition: CPControl.j:308
global CPLocaleLanguageCode global CPDateFormatterShortStyle var CPDatePicker_validateProposedDateValue_timeInterval
Definition: CPDatePicker.j:28
var CPDatePickerElementsKey
Definition: CPDatePicker.j:642
var CPDatePickerStyleKey
Definition: CPDatePicker.j:643
Defines methods for use when archiving & restoring (enc/decoding).
Definition: CPCoder.h:2
CPClockAndCalendarDatePickerStyle
Definition: CPDatePicker.j:34
CPTextFieldDatePickerStyle
Definition: CPDatePicker.j:35
BOOL becomeFirstResponder()
Definition: CPDatePicker.j:554
BOOL unsetThemeState:(ThemeState aState)
Definition: CPView.j:3227
BOOL acceptsFirstResponder()
Definition: CPDatePicker.j:571
id date()
Definition: CPDate.j:42
void setDatePickerStyle:(CPInteger aDatePickerStyle)
Definition: CPDatePicker.j:396
Definition: CPEvent.h:2
var CPTextFontKey
Definition: CPDatePicker.j:641
CPView superview()
Definition: CPView.j:486
void setObjectValue:(CPDate aValue)
Definition: CPDatePicker.j:288
CPYearMonthDatePickerElementFlag
Definition: CPDatePicker.j:40
var CPIntervalKey
Definition: CPDatePicker.j:636
CPValueBinding
BOOL resignFirstResponder()
Definition: CPDatePicker.j:578
CPSingleDateMode
Definition: CPDatePicker.j:30
void encodeWithCoder:(CPCoder aCoder)
Definition: CPControl.j:1114
CPDate dateValue()
Definition: CPDatePicker.j:781
CPYearMonthDayDatePickerElementFlag
Definition: CPDatePicker.j:41
var CPBackgroundColorKey
Definition: CPDatePicker.j:639