comparison mac/dw.m @ 2012:75c6eb796e91

Mac: Implement dw_html_javascript_run() so things build again.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 07 Nov 2019 05:26:04 +0000
parents ebbdb2120659
children 7303b35a9f4d
comparison
equal deleted inserted replaced
2011:2dfce1ced00f 2012:75c6eb796e91
8606 [calendar setDateValue:[NSDate date]]; 8606 [calendar setDateValue:[NSDate date]];
8607 return calendar; 8607 return calendar;
8608 } 8608 }
8609 8609
8610 /* 8610 /*
8611 * Sets the current date of a calendar 8611 * Sets the current date of a calendar.
8612 * Parameters: 8612 * Parameters:
8613 * handle: The handle to the calendar returned by dw_calendar_new(). 8613 * handle: The handle to the calendar returned by dw_calendar_new().
8614 * year... 8614 * year...
8615 */ 8615 */
8616 void dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day) 8616 void dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day)
8630 [date release]; 8630 [date release];
8631 DW_LOCAL_POOL_OUT; 8631 DW_LOCAL_POOL_OUT;
8632 } 8632 }
8633 8633
8634 /* 8634 /*
8635 * Gets the position of a splitbar (pecentage). 8635 * Gets the current date of a calendar.
8636 * Parameters: 8636 * Parameters:
8637 * handle: The handle to the splitbar returned by dw_splitbar_new(). 8637 * handle: The handle to the calendar returned by dw_calendar_new().
8638 */ 8638 */
8639 void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day) 8639 void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day)
8640 { 8640 {
8641 DWCalendar *calendar = handle; 8641 DWCalendar *calendar = handle;
8642 DW_LOCAL_POOL_IN; 8642 DW_LOCAL_POOL_IN;
8643 NSCalendar *mycalendar = [[NSCalendar alloc] initWithCalendarIdentifier:DWCalendarIdentifierGregorian]; 8643 NSCalendar *mycalendar = [[NSCalendar alloc] initWithCalendarIdentifier:DWCalendarIdentifierGregorian];
8644 NSDate *date = [calendar dateValue]; 8644 NSDate *date = [calendar dateValue];
8645 NSDateComponents* components = [mycalendar components:DWCalendarUnitDay|DWCalendarUnitMonth|DWCalendarUnitYear fromDate:date]; 8645 NSDateComponents* components = [mycalendar components:DWCalendarUnitDay|DWCalendarUnitMonth|DWCalendarUnitYear fromDate:date];
8646 *day = [components day]; 8646 *day = (unsigned int)[components day];
8647 *month = [components month]; 8647 *month = (unsigned int)[components month];
8648 *year = [components year]; 8648 *year = (unsigned int)[components year];
8649 [mycalendar release]; 8649 [mycalendar release];
8650 DW_LOCAL_POOL_OUT; 8650 DW_LOCAL_POOL_OUT;
8651 } 8651 }
8652 8652
8653 /* 8653 /*
8666 break; 8666 break;
8667 case DW_HTML_GOFORWARD: 8667 case DW_HTML_GOFORWARD:
8668 [html goForward]; 8668 [html goForward];
8669 break; 8669 break;
8670 case DW_HTML_GOHOME: 8670 case DW_HTML_GOHOME:
8671 dw_html_url(handle, DW_HOME_URL);
8671 break; 8672 break;
8672 case DW_HTML_SEARCH: 8673 case DW_HTML_SEARCH:
8673 break; 8674 break;
8674 case DW_HTML_RELOAD: 8675 case DW_HTML_RELOAD:
8675 [html reload:html]; 8676 [html reload:html];
8718 [html loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]]; 8719 [html loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]];
8719 #else 8720 #else
8720 [[html mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]]; 8721 [[html mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[ NSString stringWithUTF8String:url ]]]];
8721 #endif 8722 #endif
8722 return 0; 8723 return 0;
8724 }
8725
8726 /*
8727 * Executes the javascript contained in "script" in the HTML window.
8728 * Parameters:
8729 * handle: Handle to the HTML window.
8730 * script: Javascript code to execute.
8731 * scriptdata: Data passed to the signal handler.
8732 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata.
8733 * Returns:
8734 * DW_ERROR_NONE (0) on success.
8735 */
8736 int dw_html_javascript_run(HWND handle, char *script, void *scriptdata)
8737 {
8738 #if WK_API_ENABLED
8739 DWWebView *html = handle;
8740 [html evaluateJavaScript:[NSString stringWithUTF8String:script] completionHandler:nil];
8741 return DW_ERROR_NONE;
8742 #else
8743 return DW_ERROR_UKNOWN;
8744 #endif
8723 } 8745 }
8724 8746
8725 /* 8747 /*
8726 * Create a new HTML window (widget) to be packed. 8748 * Create a new HTML window (widget) to be packed.
8727 * Not available under OS/2, eCS 8749 * Not available under OS/2, eCS