uiDateTimePicker Fix style consistency

This commit is contained in:
cody271 2018-05-05 21:21:25 -07:00
parent 0b436a8c74
commit edd4127f8e
4 changed files with 13 additions and 15 deletions

View File

@ -11,9 +11,7 @@ struct uiDateTimePicker {
@interface datePickerDelegateClass : NSObject <NSDatePickerCellDelegate> { @interface datePickerDelegateClass : NSObject <NSDatePickerCellDelegate> {
struct mapTable *pickers; struct mapTable *pickers;
} }
- (void)datePickerCell:(NSDatePickerCell *)aDatePickerCell - (void)datePickerCell:(NSDatePickerCell *)aDatePickerCell validateProposedDateValue:(NSDate **)proposedDateValue timeInterval:(NSTimeInterval *)proposedTimeInterval;
validateProposedDateValue:(NSDate **)proposedDateValue
timeInterval:(NSTimeInterval *)proposedTimeInterval;
- (void)doTimer:(NSTimer *)timer; - (void)doTimer:(NSTimer *)timer;
- (void)registerPicker:(uiDateTimePicker *)b; - (void)registerPicker:(uiDateTimePicker *)b;
- (void)unregisterPicker:(uiDateTimePicker *)b; - (void)unregisterPicker:(uiDateTimePicker *)b;
@ -53,7 +51,7 @@ struct uiDateTimePicker {
{ {
uiDateTimePicker *d; uiDateTimePicker *d;
d = (uiDateTimePicker*) [[timer userInfo] pointerValue]; d = (uiDateTimePicker *) [((NSValue *)[timer userInfo]) pointerValue];
(*(d->onChanged))(d, d->onChangedData); (*(d->onChanged))(d, d->onChangedData);
} }

View File

@ -46,8 +46,7 @@ void onClicked(uiButton *b, void *data)
if (now) { if (now) {
uiDateTimePickerSetTime(dtdate, &tmbuf); uiDateTimePickerSetTime(dtdate, &tmbuf);
uiDateTimePickerSetTime(dttime, &tmbuf); uiDateTimePickerSetTime(dttime, &tmbuf);
} } else
else
uiDateTimePickerSetTime(dtboth, &tmbuf); uiDateTimePickerSetTime(dtboth, &tmbuf);
} }

View File

@ -547,7 +547,8 @@ static void dateTimePickerWidget_class_init(dateTimePickerWidgetClass *class)
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE,
0);
} }
struct uiDateTimePicker { struct uiDateTimePicker {

View File

@ -145,7 +145,7 @@ static BOOL onWM_NOTIFY(uiControl *c, HWND hwnd, NMHDR *nmhdr, LRESULT *lResult)
return TRUE; return TRUE;
} }
static void fromSystemTime(LPSYSTEMTIME systime, struct tm *time) static void fromSystemTime(SYSTEMTIME *systime, struct tm *time)
{ {
ZeroMemory(time, sizeof (struct tm)); ZeroMemory(time, sizeof (struct tm));
time->tm_sec = systime->wSecond; time->tm_sec = systime->wSecond;
@ -158,7 +158,7 @@ static void fromSystemTime(LPSYSTEMTIME systime, struct tm *time)
time->tm_isdst = -1; time->tm_isdst = -1;
} }
static void toSystemTime(const struct tm *time, LPSYSTEMTIME systime) static void toSystemTime(const struct tm *time, SYSTEMTIME *systime)
{ {
ZeroMemory(systime, sizeof (SYSTEMTIME)); ZeroMemory(systime, sizeof (SYSTEMTIME));
systime->wYear = time->tm_year + 1900; systime->wYear = time->tm_year + 1900;
@ -179,7 +179,7 @@ void uiDateTimePickerTime(uiDateTimePicker *d, struct tm *time)
{ {
SYSTEMTIME systime; SYSTEMTIME systime;
if (SendMessageW(d->hwnd, DTM_GETSYSTEMTIME, 0, (LPARAM) &systime) != GDT_VALID) if (SendMessageW(d->hwnd, DTM_GETSYSTEMTIME, 0, (LPARAM) (&systime)) != GDT_VALID)
logLastError(L"error getting date and time"); logLastError(L"error getting date and time");
fromSystemTime(&systime, time); fromSystemTime(&systime, time);
} }
@ -189,7 +189,7 @@ void uiDateTimePickerSetTime(uiDateTimePicker *d, const struct tm *time)
SYSTEMTIME systime; SYSTEMTIME systime;
toSystemTime(time, &systime); toSystemTime(time, &systime);
if (!SendMessageW(d->hwnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM) &systime)) if (SendMessageW(d->hwnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM) (&systime)) == 0)
logLastError(L"error setting date and time"); logLastError(L"error setting date and time");
(*(d->onChanged))(d, d->onChangedData); (*(d->onChanged))(d, d->onChangedData);
} }