comparison ios/dw.m @ 2587:461006160d11

iOS: Reenable Calendar control, setTranslatesAutoresizingMaskIntoConstraints:NO was causing UIDatePicker to add constraints to our DWBoxes that screwed up the layout. I thought setting it to NO would do that but apparently it was the opposite?
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 24 May 2021 20:32:05 +0000
parents 2acc7ba5dea0
children 8253e17b20ad
comparison
equal deleted inserted replaced
2586:da058319f717 2587:461006160d11
3471 DW_FUNCTION_RESTORE_PARAM2(type, int, pad, int) 3471 DW_FUNCTION_RESTORE_PARAM2(type, int, pad, int)
3472 { 3472 {
3473 DW_FUNCTION_INIT; 3473 DW_FUNCTION_INIT;
3474 DWBox *view = [[[DWBox alloc] init] retain]; 3474 DWBox *view = [[[DWBox alloc] init] retain];
3475 Box *newbox = [view box]; 3475 Box *newbox = [view box];
3476 [view setTranslatesAutoresizingMaskIntoConstraints:NO];
3477 memset(newbox, 0, sizeof(Box)); 3476 memset(newbox, 0, sizeof(Box));
3478 newbox->pad = pad; 3477 newbox->pad = pad;
3479 newbox->type = type; 3478 newbox->type = type;
3480 DW_FUNCTION_RETURN_THIS(view); 3479 DW_FUNCTION_RETURN_THIS(view);
3481 } 3480 }
7313 DW_FUNCTION_DEFINITION(dw_calendar_new, HWND, ULONG cid) 7312 DW_FUNCTION_DEFINITION(dw_calendar_new, HWND, ULONG cid)
7314 DW_FUNCTION_ADD_PARAM1(cid) 7313 DW_FUNCTION_ADD_PARAM1(cid)
7315 DW_FUNCTION_RETURN(dw_calendar_new, HWND) 7314 DW_FUNCTION_RETURN(dw_calendar_new, HWND)
7316 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) 7315 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG)
7317 { 7316 {
7318 DWCalendar *calendar = nil;
7319 #if 0 /* TODO: Figure out why this corrupts DWBoxes in its hierarchy */
7320 DWCalendar *calendar = [[[DWCalendar alloc] init] retain]; 7317 DWCalendar *calendar = [[[DWCalendar alloc] init] retain];
7321 if (@available(iOS 14.0, *)) { 7318 if (@available(iOS 14.0, *)) {
7322 [calendar setPreferredDatePickerStyle:UIDatePickerStyleInline]; 7319 [calendar setPreferredDatePickerStyle:UIDatePickerStyleInline];
7323 } else { 7320 } else {
7324 // We really want the iOS 14 style to match the other platforms... 7321 // We really want the iOS 14 style to match the other platforms...
7325 // but just leave it the default spinner style on 13 and earlier. 7322 // but just leave it the default spinner style on 13 and earlier.
7326 } 7323 }
7327 [calendar setDatePickerMode:UIDatePickerModeDate]; 7324 [calendar setDatePickerMode:UIDatePickerModeDate];
7328 [calendar setDate:[NSDate date]]; 7325 [calendar setDate:[NSDate date]];
7329 [calendar setTag:cid]; 7326 [calendar setTag:cid];
7330 #endif
7331 DW_FUNCTION_RETURN_THIS(calendar); 7327 DW_FUNCTION_RETURN_THIS(calendar);
7332 } 7328 }
7333 7329
7334 /* 7330 /*
7335 * Sets the current date of a calendar. 7331 * Sets the current date of a calendar.