diff options
Diffstat (limited to 'src/libui_sdl/libui/darwin/datetimepicker.m')
-rw-r--r-- | src/libui_sdl/libui/darwin/datetimepicker.m | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/libui_sdl/libui/darwin/datetimepicker.m b/src/libui_sdl/libui/darwin/datetimepicker.m new file mode 100644 index 0000000..44364d9 --- /dev/null +++ b/src/libui_sdl/libui/darwin/datetimepicker.m @@ -0,0 +1,42 @@ +// 14 august 2015 +#import "uipriv_darwin.h" + +struct uiDateTimePicker { + uiDarwinControl c; + NSDatePicker *dp; +}; + +uiDarwinControlAllDefaults(uiDateTimePicker, dp) + +static uiDateTimePicker *finishNewDateTimePicker(NSDatePickerElementFlags elements) +{ + uiDateTimePicker *d; + + uiDarwinNewControl(uiDateTimePicker, d); + + d->dp = [[NSDatePicker alloc] initWithFrame:NSZeroRect]; + [d->dp setBordered:NO]; + [d->dp setBezeled:YES]; + [d->dp setDrawsBackground:YES]; + [d->dp setDatePickerStyle:NSTextFieldAndStepperDatePickerStyle]; + [d->dp setDatePickerElements:elements]; + [d->dp setDatePickerMode:NSSingleDateMode]; + uiDarwinSetControlFont(d->dp, NSRegularControlSize); + + return d; +} + +uiDateTimePicker *uiNewDateTimePicker(void) +{ + return finishNewDateTimePicker(NSYearMonthDayDatePickerElementFlag | NSHourMinuteSecondDatePickerElementFlag); +} + +uiDateTimePicker *uiNewDatePicker(void) +{ + return finishNewDateTimePicker(NSYearMonthDayDatePickerElementFlag); +} + +uiDateTimePicker *uiNewTimePicker(void) +{ + return finishNewDateTimePicker(NSHourMinuteSecondDatePickerElementFlag); +} |