comparison 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
comparison
equal deleted inserted replaced
2014:b1838dd5509a 2015:c30f4354966e
362 } SignalList; 362 } SignalList;
363 363
364 static int in_checkbox_handler = 0; 364 static int in_checkbox_handler = 0;
365 365
366 /* List of signals and their equivilent Win32 message */ 366 /* List of signals and their equivilent Win32 message */
367 #define SIGNALMAX 17 367 #define SIGNALMAX 19
368 368
369 SignalList SignalTranslate[SIGNALMAX] = { 369 SignalList SignalTranslate[SIGNALMAX] = {
370 { WM_SIZE, DW_SIGNAL_CONFIGURE }, 370 { WM_SIZE, DW_SIGNAL_CONFIGURE },
371 { WM_CHAR, DW_SIGNAL_KEY_PRESS }, 371 { WM_CHAR, DW_SIGNAL_KEY_PRESS },
372 { WM_LBUTTONDOWN, DW_SIGNAL_BUTTON_PRESS }, 372 { WM_LBUTTONDOWN, DW_SIGNAL_BUTTON_PRESS },
381 { TVN_SELCHANGED, DW_SIGNAL_ITEM_SELECT }, 381 { TVN_SELCHANGED, DW_SIGNAL_ITEM_SELECT },
382 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS }, 382 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS },
383 { WM_VSCROLL, DW_SIGNAL_VALUE_CHANGED }, 383 { WM_VSCROLL, DW_SIGNAL_VALUE_CHANGED },
384 { TCN_SELCHANGE, DW_SIGNAL_SWITCH_PAGE }, 384 { TCN_SELCHANGE, DW_SIGNAL_SWITCH_PAGE },
385 { LVN_COLUMNCLICK, DW_SIGNAL_COLUMN_CLICK }, 385 { LVN_COLUMNCLICK, DW_SIGNAL_COLUMN_CLICK },
386 { TVN_ITEMEXPANDED,DW_SIGNAL_TREE_EXPAND } 386 { TVN_ITEMEXPANDED,DW_SIGNAL_TREE_EXPAND },
387 { WM_USER+100, DW_SIGNAL_HTML_RESULT },
388 { WM_USER+101, DW_SIGNAL_HTML_CHANGED }
387 }; 389 };
388 390
389 #ifdef BUILD_DLL 391 #ifdef BUILD_DLL
390 void Win32_Set_Instance(HINSTANCE hInstance) 392 void Win32_Set_Instance(HINSTANCE hInstance)
391 { 393 {
2378 } 2380 }
2379 tmp = NULL; 2381 tmp = NULL;
2380 msg = 0; 2382 msg = 0;
2381 } 2383 }
2382 } 2384 }
2385 }
2386 break;
2387 case WM_USER+100:
2388 {
2389 int (DWSIGNAL *htmlresultfunc)(HWND, int, char *, void *, void *) = tmp->signalfunction;
2390
2391 return htmlresultfunc(tmp->window, mp1 ? DW_ERROR_NONE : DW_ERROR_UNKNOWN, (char *)mp1, (void *)mp2, tmp->data);
2392 }
2393 break;
2394 case WM_USER+101:
2395 {
2396 int (DWSIGNAL *htmlchangedfunc)(HWND, int, char *, void *) = tmp->signalfunction;
2397
2398 return htmlchangedfunc(tmp->window, DW_POINTER_TO_INT(mp1), (char *)mp2, tmp->data);
2383 } 2399 }
2384 break; 2400 break;
2385 } 2401 }
2386 } 2402 }
2387 if(tmp) 2403 if(tmp)
5766 return DW_ERROR_GENERAL; 5782 return DW_ERROR_GENERAL;
5767 #endif 5783 #endif
5768 } 5784 }
5769 5785
5770 /* 5786 /*
5787 * Executes the javascript contained in "script" in the HTML window.
5788 * Parameters:
5789 * handle: Handle to the HTML window.
5790 * script: Javascript code to execute.
5791 * scriptdata: Data passed to the signal handler.
5792 * Notes: A DW_SIGNAL_HTML_RESULT event will be raised with scriptdata.
5793 * Returns:
5794 * DW_ERROR_NONE (0) on success.
5795 */
5796 int dw_html_javascript_run(HWND handle, char *script, void *scriptdata)
5797 {
5798 #if (defined(BUILD_DLL) || defined(BUILD_HTML))
5799 #if BUILD_EDGE
5800 if (_DW_EDGE_DETECTED)
5801 return _dw_edge_javascript_run(handle, UTF8toWide(script), scriptdata);
5802 #endif
5803 return _dw_html_javascript_run(handle, script, scriptdata);
5804 #else
5805 return DW_ERROR_UNKNOWN;
5806 #endif
5807 }
5808
5809 /*
5771 * Create a bitmap object to be packed. 5810 * Create a bitmap object to be packed.
5772 * Parameters: 5811 * Parameters:
5773 * id: An ID to be used with dw_window_from_id or 0L. 5812 * id: An ID to be used with dw_window_from_id or 0L.
5774 */ 5813 */
5775 HWND API dw_bitmap_new(ULONG id) 5814 HWND API dw_bitmap_new(ULONG id)