libui/darwin/datetimepicker.m

43 lines
1.0 KiB
Mathematica
Raw Normal View History

2015-08-14 20:46:35 -05:00
// 14 august 2015
#import "uipriv_darwin.h"
struct uiDateTimePicker {
uiDarwinControl c;
NSDatePicker *dp;
};
uiDarwinControlAllDefaults(uiDateTimePicker, dp)
2015-08-14 20:46:35 -05:00
static uiDateTimePicker *finishNewDateTimePicker(NSDatePickerElementFlags elements)
{
uiDateTimePicker *d;
uiDarwinNewControl(uiDateTimePicker, d);
2015-08-14 20:46:35 -05:00
d->dp = [[NSDatePicker alloc] initWithFrame:NSZeroRect];
[d->dp setBordered:NO];
[d->dp setBezeled:YES];
[d->dp setDrawsBackground:YES];
2015-08-14 20:46:35 -05:00
[d->dp setDatePickerStyle:NSTextFieldAndStepperDatePickerStyle];
[d->dp setDatePickerElements:elements];
[d->dp setDatePickerMode:NSSingleDateMode];
uiDarwinSetControlFont(d->dp, NSRegularControlSize);
2015-08-14 20:46:35 -05:00
return d;
}
uiDateTimePicker *uiNewDateTimePicker(void)
{
return finishNewDateTimePicker(NSYearMonthDayDatePickerElementFlag | NSHourMinuteSecondDatePickerElementFlag);
}
uiDateTimePicker *uiNewDatePicker(void)
{
return finishNewDateTimePicker(NSYearMonthDayDatePickerElementFlag);
}
uiDateTimePicker *uiNewTimePicker(void)
{
return finishNewDateTimePicker(NSHourMinuteSecondDatePickerElementFlag);
}