Mercurial > dwindows
comparison dwtest.c @ 2974:fffb4904c90b
Mac: Initial support for dw_html_javascript_add() and DW_SIGNAL_HTML_MESSAGE
for callbacks into native code. Code for iOS next...
Then GTK3/4, Windows and Android in that order.
Also implemented simple rawhtml tests in the test programs.
C++: Added HTML class support for the message callbacks.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 24 Mar 2023 11:39:24 +0000 |
parents | 4b075e64536c |
children | ae4d6856b983 |
comparison
equal
deleted
inserted
replaced
2973:ac880987a2c4 | 2974:fffb4904c90b |
---|---|
2078 free(text); | 2078 free(text); |
2079 } | 2079 } |
2080 return FALSE; | 2080 return FALSE; |
2081 } | 2081 } |
2082 | 2082 |
2083 /* Handle web javascript message */ | |
2084 int DWSIGNAL web_html_message(HWND html, char *name, char *message, void *data) | |
2085 { | |
2086 dw_messagebox("Javascript Message", DW_MB_OK | DW_MB_INFORMATION, "Name: %s Message: %s", | |
2087 name, message); | |
2088 return TRUE; | |
2089 } | |
2090 | |
2083 void html_add(void) | 2091 void html_add(void) |
2084 { | 2092 { |
2085 rawhtml = dw_html_new(1001); | 2093 rawhtml = dw_html_new(1001); |
2086 if(rawhtml) | 2094 if(rawhtml) |
2087 { | 2095 { |
2093 dw_listbox_append(javascript, "window.scrollTo(0,500);"); | 2101 dw_listbox_append(javascript, "window.scrollTo(0,500);"); |
2094 dw_listbox_append(javascript, "window.document.title;"); | 2102 dw_listbox_append(javascript, "window.document.title;"); |
2095 dw_listbox_append(javascript, "window.navigator.userAgent;"); | 2103 dw_listbox_append(javascript, "window.navigator.userAgent;"); |
2096 | 2104 |
2097 dw_box_pack_start(notebookbox7, rawhtml, 0, 100, TRUE, FALSE, 0); | 2105 dw_box_pack_start(notebookbox7, rawhtml, 0, 100, TRUE, FALSE, 0); |
2098 dw_html_raw(rawhtml, "<html><body><center><h1>dwtest</h1></center></body></html>"); | 2106 dw_html_javascript_add(rawhtml, "test"); |
2107 dw_signal_connect(rawhtml, DW_SIGNAL_HTML_MESSAGE, DW_SIGNAL_FUNC(web_html_message), DW_POINTER(javascript)); | |
2108 dw_html_raw(rawhtml, "<html><body><center><h1><a href=\"javascript:test('This is the message');\">dwtest</a></h1></center></body></html>"); | |
2099 html = dw_html_new(1002); | 2109 html = dw_html_new(1002); |
2100 | 2110 |
2101 dw_box_pack_start(notebookbox7, hbox, 0, 0, TRUE, FALSE, 0); | 2111 dw_box_pack_start(notebookbox7, hbox, 0, 0, TRUE, FALSE, 0); |
2102 | 2112 |
2103 /* Add navigation buttons */ | 2113 /* Add navigation buttons */ |