comparison ios/dw.m @ 2400:5e454dfab0db

iOS: More thread safety, remove some debug code.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 26 Mar 2021 00:22:26 +0000
parents 1cbc316292c1
children 010ae32a5067
comparison
equal deleted inserted replaced
2399:1cbc316292c1 2400:5e454dfab0db
6695 * Sets the current date of a calendar. 6695 * Sets the current date of a calendar.
6696 * Parameters: 6696 * Parameters:
6697 * handle: The handle to the calendar returned by dw_calendar_new(). 6697 * handle: The handle to the calendar returned by dw_calendar_new().
6698 * year... 6698 * year...
6699 */ 6699 */
6700 void dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day) 6700 DW_FUNCTION_DEFINITION(dw_calendar_set_date, void, HWND handle, unsigned int year, unsigned int month, unsigned int day)
6701 DW_FUNCTION_ADD_PARAM4(handle, year, month, day)
6702 DW_FUNCTION_NO_RETURN(dw_calendar_set_date)
6703 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, year, unsigned int, month, unsigned int, day, unsigned int)
6701 { 6704 {
6702 DWCalendar *calendar = handle; 6705 DWCalendar *calendar = handle;
6703 NSDate *date; 6706 NSDate *date;
6704 char buffer[101]; 6707 char buffer[101];
6705 DW_LOCAL_POOL_IN; 6708 DW_LOCAL_POOL_IN;
6711 6714
6712 date = [dateFormatter dateFromString:[NSString stringWithUTF8String:buffer]]; 6715 date = [dateFormatter dateFromString:[NSString stringWithUTF8String:buffer]];
6713 [calendar setDate:date]; 6716 [calendar setDate:date];
6714 [date release]; 6717 [date release];
6715 DW_LOCAL_POOL_OUT; 6718 DW_LOCAL_POOL_OUT;
6719 DW_FUNCTION_RETURN_NOTHING;
6716 } 6720 }
6717 6721
6718 /* 6722 /*
6719 * Gets the current date of a calendar. 6723 * Gets the current date of a calendar.
6720 * Parameters: 6724 * Parameters:
6721 * handle: The handle to the calendar returned by dw_calendar_new(). 6725 * handle: The handle to the calendar returned by dw_calendar_new().
6722 */ 6726 */
6723 void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day) 6727 DW_FUNCTION_DEFINITION(dw_calendar_get_date, void, HWND handle, unsigned int *year, unsigned int *month, unsigned int *day)
6728 DW_FUNCTION_ADD_PARAM4(handle, year, month, day)
6729 DW_FUNCTION_NO_RETURN(dw_calendar_get_date)
6730 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, year, unsigned int *, month, unsigned int *, day, unsigned int *)
6724 { 6731 {
6725 DWCalendar *calendar = handle; 6732 DWCalendar *calendar = handle;
6726 DW_LOCAL_POOL_IN; 6733 DW_LOCAL_POOL_IN;
6727 NSCalendar *mycalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 6734 NSCalendar *mycalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
6728 NSDate *date = [calendar date]; 6735 NSDate *date = [calendar date];
6730 *day = (unsigned int)[components day]; 6737 *day = (unsigned int)[components day];
6731 *month = (unsigned int)[components month]; 6738 *month = (unsigned int)[components month];
6732 *year = (unsigned int)[components year]; 6739 *year = (unsigned int)[components year];
6733 [mycalendar release]; 6740 [mycalendar release];
6734 DW_LOCAL_POOL_OUT; 6741 DW_LOCAL_POOL_OUT;
6742 DW_FUNCTION_RETURN_NOTHING;
6735 } 6743 }
6736 6744
6737 /* 6745 /*
6738 * Causes the embedded HTML widget to take action. 6746 * Causes the embedded HTML widget to take action.
6739 * Parameters: 6747 * Parameters:
7565 * Parameters: 7573 * Parameters:
7566 * handle: Handle to the dialog item to be focused. 7574 * handle: Handle to the dialog item to be focused.
7567 * Remarks: 7575 * Remarks:
7568 * This is for use after showing the window/dialog. 7576 * This is for use after showing the window/dialog.
7569 */ 7577 */
7570 void API dw_window_set_focus(HWND handle) 7578 DW_FUNCTION_DEFINITION(dw_window_set_focus, void, HWND handle)
7579 DW_FUNCTION_ADD_PARAM1(handle)
7580 DW_FUNCTION_NO_RETURN(dw_window_set_focus)
7581 DW_FUNCTION_RESTORE_PARAM1(handle, HWND)
7571 { 7582 {
7572 id object = handle; 7583 id object = handle;
7573 7584
7574 [object becomeFirstResponder]; 7585 [object becomeFirstResponder];
7586 DW_FUNCTION_RETURN_NOTHING;
7575 } 7587 }
7576 7588
7577 /* 7589 /*
7578 * Sets the default focus item for a window/dialog. 7590 * Sets the default focus item for a window/dialog.
7579 * Parameters: 7591 * Parameters:
7580 * window: Toplevel window or dialog. 7592 * window: Toplevel window or dialog.
7581 * defaultitem: Handle to the dialog item to be default. 7593 * defaultitem: Handle to the dialog item to be default.
7582 * Remarks: 7594 * Remarks:
7583 * This is for use before showing the window/dialog. 7595 * This is for use before showing the window/dialog.
7584 */ 7596 */
7585 void API dw_window_default(HWND handle, HWND defaultitem) 7597 DW_FUNCTION_DEFINITION(dw_window_default, void, HWND handle, HWND defaultitem)
7598 DW_FUNCTION_ADD_PARAM2(handle, defaultitem)
7599 DW_FUNCTION_NO_RETURN(dw_window_default)
7600 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, defaultitem, HWND)
7586 { 7601 {
7587 DWWindow *window = handle; 7602 DWWindow *window = handle;
7588 id object = defaultitem; 7603 id object = defaultitem;
7589 7604
7590 if([window isKindOfClass:[UIWindow class]] && [object isKindOfClass:[UIControl class]]) 7605 if([window isKindOfClass:[UIWindow class]] && [object isKindOfClass:[UIControl class]])
7591 { 7606 {
7592 [object becomeFirstResponder]; 7607 [object becomeFirstResponder];
7593 } 7608 }
7609 DW_FUNCTION_RETURN_NOTHING;
7594 } 7610 }
7595 7611
7596 /* 7612 /*
7597 * Sets window to click the default dialog item when an ENTER is pressed. 7613 * Sets window to click the default dialog item when an ENTER is pressed.
7598 * Parameters: 7614 * Parameters:
9656 } 9672 }
9657 pthread_yield_np(); 9673 pthread_yield_np();
9658 DWApp = [UIApplication sharedApplication]; 9674 DWApp = [UIApplication sharedApplication];
9659 } 9675 }
9660 dw_event_reset(DWMainEvent); 9676 dw_event_reset(DWMainEvent);
9661 dw_debug("SharedApplication is valid!\n");
9662 } 9677 }
9663 9678
9664 /* 9679 /*
9665 * Initializes the Dynamic Windows engine. 9680 * Initializes the Dynamic Windows engine.
9666 * Parameters: 9681 * Parameters: