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

View File

@ -5,7 +5,7 @@
uiDateTimePicker *dtboth, *dtdate, *dttime;
const char * timeFormat(uiDateTimePicker *d)
const char *timeFormat(uiDateTimePicker *d)
{
const char *fmt;
@ -27,7 +27,7 @@ void onChanged(uiDateTimePicker *d, void *data)
char buf[64];
uiDateTimePickerTime(d, &time);
strftime(buf, sizeof(buf), timeFormat(d), &time);
strftime(buf, sizeof (buf), timeFormat(d), &time);
uiLabelSetText(uiLabel(data), buf);
}
@ -46,8 +46,7 @@ void onClicked(uiButton *b, void *data)
if (now) {
uiDateTimePickerSetTime(dtdate, &tmbuf);
uiDateTimePickerSetTime(dttime, &tmbuf);
}
else
} else
uiDateTimePickerSetTime(dtboth, &tmbuf);
}

View File

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

View File

@ -145,9 +145,9 @@ static BOOL onWM_NOTIFY(uiControl *c, HWND hwnd, NMHDR *nmhdr, LRESULT *lResult)
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_min = systime->wMinute;
time->tm_hour = systime->wHour;
@ -158,9 +158,9 @@ static void fromSystemTime(LPSYSTEMTIME systime, struct tm *time)
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->wMonth = time->tm_mon + 1;
systime->wDayOfWeek = time->tm_wday;
@ -179,7 +179,7 @@ void uiDateTimePickerTime(uiDateTimePicker *d, struct tm *time)
{
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");
fromSystemTime(&systime, time);
}
@ -189,7 +189,7 @@ void uiDateTimePickerSetTime(uiDateTimePicker *d, const struct tm *time)
SYSTEMTIME 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");
(*(d->onChanged))(d, d->onChangedData);
}