2015-08-14 20:46:35 -05:00
|
|
|
// 14 august 2015
|
|
|
|
#import "uipriv_darwin.h"
|
|
|
|
|
|
|
|
struct uiDateTimePicker {
|
|
|
|
uiDarwinControl c;
|
|
|
|
NSDatePicker *dp;
|
|
|
|
};
|
|
|
|
|
|
|
|
uiDarwinDefineControl(
|
|
|
|
uiDateTimePicker, // type name
|
2015-08-16 22:44:23 -05:00
|
|
|
uiDateTimePickerType, // type function
|
2015-08-14 20:46:35 -05:00
|
|
|
dp // handle
|
|
|
|
)
|
|
|
|
|
|
|
|
static uiDateTimePicker *finishNewDateTimePicker(NSDatePickerElementFlags elements)
|
|
|
|
{
|
|
|
|
uiDateTimePicker *d;
|
|
|
|
|
|
|
|
d = (uiDateTimePicker *) uiNewControl(uiDateTimePickerType());
|
|
|
|
|
|
|
|
d->dp = [[NSDatePicker alloc] initWithFrame:NSZeroRect];
|
2015-08-22 11:16:27 -05:00
|
|
|
[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];
|
2015-08-22 11:16:27 -05:00
|
|
|
uiDarwinSetControlFont(d->dp, NSRegularControlSize);
|
2015-08-14 20:46:35 -05:00
|
|
|
|
|
|
|
uiDarwinFinishNewControl(d, uiDateTimePicker);
|
|
|
|
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
|
|
|
uiDateTimePicker *uiNewDateTimePicker(void)
|
|
|
|
{
|
|
|
|
return finishNewDateTimePicker(NSYearMonthDayDatePickerElementFlag | NSHourMinuteSecondDatePickerElementFlag);
|
|
|
|
}
|
|
|
|
|
|
|
|
uiDateTimePicker *uiNewDatePicker(void)
|
|
|
|
{
|
|
|
|
return finishNewDateTimePicker(NSYearMonthDayDatePickerElementFlag);
|
|
|
|
}
|
|
|
|
|
|
|
|
uiDateTimePicker *uiNewTimePicker(void)
|
|
|
|
{
|
|
|
|
return finishNewDateTimePicker(NSHourMinuteSecondDatePickerElementFlag);
|
|
|
|
}
|