changeset 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 2dfce1ced00f
children 7303b35a9f4d
files mac/dw.m
diffstat 1 files changed, 29 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Thu Nov 07 04:49:04 2019 +0000
+++ b/mac/dw.m	Thu Nov 07 05:26:04 2019 +0000
@@ -8608,7 +8608,7 @@
 }
 
 /*
- * Sets the current date of a calendar
+ * Sets the current date of a calendar.
  * Parameters:
  *       handle: The handle to the calendar returned by dw_calendar_new().
  *       year...
@@ -8632,9 +8632,9 @@
 }
 
 /*
- * Gets the position of a splitbar (pecentage).
- * Parameters:
- *       handle: The handle to the splitbar returned by dw_splitbar_new().
+ * Gets the current date of a calendar.
+ * Parameters:
+ *       handle: The handle to the calendar returned by dw_calendar_new().
  */
 void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day)
 {
@@ -8643,9 +8643,9 @@
     NSCalendar *mycalendar = [[NSCalendar alloc] initWithCalendarIdentifier:DWCalendarIdentifierGregorian];
     NSDate *date = [calendar dateValue];
     NSDateComponents* components = [mycalendar components:DWCalendarUnitDay|DWCalendarUnitMonth|DWCalendarUnitYear fromDate:date];
-    *day = [components day];
-    *month = [components month];
-    *year = [components year];
+    *day = (unsigned int)[components day];
+    *month = (unsigned int)[components month];
+    *year = (unsigned int)[components year];
     [mycalendar release];
     DW_LOCAL_POOL_OUT;
 }
@@ -8668,6 +8668,7 @@
             [html goForward];
             break;
         case DW_HTML_GOHOME:
+            dw_html_url(handle, DW_HOME_URL);
             break;
         case DW_HTML_SEARCH:
             break;
@@ -8723,6 +8724,27 @@
 }
 
 /*
+ * Executes the javascript contained in "script" in the HTML window.
+ * Parameters:
+ *       handle: Handle to the HTML window.
+ *       script: Javascript code to execute.
+ *       scriptdata: Data passed to the signal handler.
+ * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata.
+ * Returns:
+ *       DW_ERROR_NONE (0) on success.
+ */
+int dw_html_javascript_run(HWND handle, char *script, void *scriptdata)
+{
+#if WK_API_ENABLED
+    DWWebView *html = handle;
+    [html evaluateJavaScript:[NSString stringWithUTF8String:script] completionHandler:nil];
+    return DW_ERROR_NONE;
+#else
+    return DW_ERROR_UKNOWN;
+#endif
+}
+
+/*
  * Create a new HTML window (widget) to be packed.
  * Not available under OS/2, eCS
  * Parameters: