Mercurial > dwindows
diff win/dw.c @ 2015:c30f4354966e
Win: Added support for dw_html_javascript_run() using Edge (Chromium).
OS/2: Added dw_html_javascript_run() stub for OS/2 so things compile.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 07 Nov 2019 10:12:25 +0000 |
parents | f7acca46f795 |
children | 686b2d049056 |
line wrap: on
line diff
--- a/win/dw.c Thu Nov 07 08:11:28 2019 +0000 +++ b/win/dw.c Thu Nov 07 10:12:25 2019 +0000 @@ -364,7 +364,7 @@ static int in_checkbox_handler = 0; /* List of signals and their equivilent Win32 message */ -#define SIGNALMAX 17 +#define SIGNALMAX 19 SignalList SignalTranslate[SIGNALMAX] = { { WM_SIZE, DW_SIGNAL_CONFIGURE }, @@ -383,7 +383,9 @@ { WM_VSCROLL, DW_SIGNAL_VALUE_CHANGED }, { TCN_SELCHANGE, DW_SIGNAL_SWITCH_PAGE }, { LVN_COLUMNCLICK, DW_SIGNAL_COLUMN_CLICK }, - { TVN_ITEMEXPANDED,DW_SIGNAL_TREE_EXPAND } + { TVN_ITEMEXPANDED,DW_SIGNAL_TREE_EXPAND }, + { WM_USER+100, DW_SIGNAL_HTML_RESULT }, + { WM_USER+101, DW_SIGNAL_HTML_CHANGED } }; #ifdef BUILD_DLL @@ -2382,6 +2384,20 @@ } } break; + case WM_USER+100: + { + int (DWSIGNAL *htmlresultfunc)(HWND, int, char *, void *, void *) = tmp->signalfunction; + + return htmlresultfunc(tmp->window, mp1 ? DW_ERROR_NONE : DW_ERROR_UNKNOWN, (char *)mp1, (void *)mp2, tmp->data); + } + break; + case WM_USER+101: + { + int (DWSIGNAL *htmlchangedfunc)(HWND, int, char *, void *) = tmp->signalfunction; + + return htmlchangedfunc(tmp->window, DW_POINTER_TO_INT(mp1), (char *)mp2, tmp->data); + } + break; } } if(tmp) @@ -5768,6 +5784,29 @@ } /* + * 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 (defined(BUILD_DLL) || defined(BUILD_HTML)) +#if BUILD_EDGE + if (_DW_EDGE_DETECTED) + return _dw_edge_javascript_run(handle, UTF8toWide(script), scriptdata); +#endif + return _dw_html_javascript_run(handle, script, scriptdata); +#else + return DW_ERROR_UNKNOWN; +#endif +} + +/* * Create a bitmap object to be packed. * Parameters: * id: An ID to be used with dw_window_from_id or 0L.