Mercurial > dwindows
comparison win/dw.c @ 1999:4e808c4cadfb
Win: Add initial support for Microsoft Edge (Chromium) embedding.
Only works with Visual Studio currently due to the SDK being a nuget package.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 31 Oct 2019 07:01:35 +0000 |
parents | 0e354f2edb16 |
children | 77e43d71eaa7 |
comparison
equal
deleted
inserted
replaced
1998:a3de27b07a8d | 1999:4e808c4cadfb |
---|---|
308 | 308 |
309 HFONT _DefaultFont = NULL; | 309 HFONT _DefaultFont = NULL; |
310 | 310 |
311 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) | 311 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) |
312 LRESULT CALLBACK _browserWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); | 312 LRESULT CALLBACK _browserWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
313 #ifdef BUILD_EDGE | |
314 BOOL _DW_EDGE_DETECTED = FALSE; | |
315 LRESULT CALLBACK _edgeWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); | |
316 #endif | |
313 #endif | 317 #endif |
314 LRESULT CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2); | 318 LRESULT CALLBACK _colorwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2); |
315 void _resize_notebook_page(HWND handle, int pageid); | 319 void _resize_notebook_page(HWND handle, int pageid); |
316 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); | 320 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); |
317 int _lookup_icon(HWND handle, HICON hicon, int type); | 321 int _lookup_icon(HWND handle, HICON hicon, int type); |
4281 RegisterClass(&wc); | 4285 RegisterClass(&wc); |
4282 | 4286 |
4283 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) | 4287 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) |
4284 /* Register HTML renderer class */ | 4288 /* Register HTML renderer class */ |
4285 memset(&wc, 0, sizeof(WNDCLASS)); | 4289 memset(&wc, 0, sizeof(WNDCLASS)); |
4286 wc.lpfnWndProc = (WNDPROC)_browserWindowProc; | |
4287 wc.lpszClassName = BrowserClassName; | 4290 wc.lpszClassName = BrowserClassName; |
4288 wc.style = CS_HREDRAW|CS_VREDRAW; | 4291 wc.style = CS_HREDRAW | CS_VREDRAW; |
4292 #ifdef BUILD_EDGE | |
4293 /* Check if Microsoft Edge (Chromium) is installed */ | |
4294 if(_DW_EDGE_DETECTED = _dw_edge_detect()) | |
4295 { | |
4296 wc.lpfnWndProc = (WNDPROC)_edgeWindowProc; | |
4297 } | |
4298 else | |
4299 #endif | |
4300 { | |
4301 wc.lpfnWndProc = (WNDPROC)_browserWindowProc; | |
4302 } | |
4289 RegisterClass(&wc); | 4303 RegisterClass(&wc); |
4290 #endif | 4304 #endif |
4291 | 4305 |
4292 /* Create a set of brushes using the default OS/2 and DOS colors */ | 4306 /* Create a set of brushes using the default OS/2 and DOS colors */ |
4293 for(z=0;z<18;z++) | 4307 for(z=0;z<18;z++) |
5681 | 5695 |
5682 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) | 5696 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) |
5683 void _dw_html_action(HWND hwnd, int action); | 5697 void _dw_html_action(HWND hwnd, int action); |
5684 int _dw_html_raw(HWND hwnd, char *string); | 5698 int _dw_html_raw(HWND hwnd, char *string); |
5685 int _dw_html_url(HWND hwnd, char *url); | 5699 int _dw_html_url(HWND hwnd, char *url); |
5700 #ifdef BUILD_EDGE | |
5701 void _dw_edge_action(HWND hwnd, int action); | |
5702 int _dw_edge_raw(HWND hwnd, LPCWSTR string); | |
5703 int _dw_edge_url(HWND hwnd, LPCWSTR url); | |
5704 BOOL _dw_edge_detect(VOID); | |
5705 #endif | |
5686 #endif | 5706 #endif |
5687 | 5707 |
5688 /* | 5708 /* |
5689 * Causes the embedded HTML widget to take action. | 5709 * Causes the embedded HTML widget to take action. |
5690 * Parameters: | 5710 * Parameters: |
5692 * action: One of the DW_HTML_* constants. | 5712 * action: One of the DW_HTML_* constants. |
5693 */ | 5713 */ |
5694 void API dw_html_action(HWND handle, int action) | 5714 void API dw_html_action(HWND handle, int action) |
5695 { | 5715 { |
5696 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) | 5716 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) |
5717 #ifdef BUILD_EDGE | |
5718 if (_DW_EDGE_DETECTED) | |
5719 _dw_edge_action(handle, action); | |
5720 else | |
5721 #endif | |
5697 _dw_html_action(handle, action); | 5722 _dw_html_action(handle, action); |
5698 #endif | 5723 #endif |
5699 } | 5724 } |
5700 | 5725 |
5701 /* | 5726 /* |
5708 * DW_ERROR_NONE (0) on success. | 5733 * DW_ERROR_NONE (0) on success. |
5709 */ | 5734 */ |
5710 int API dw_html_raw(HWND handle, char *string) | 5735 int API dw_html_raw(HWND handle, char *string) |
5711 { | 5736 { |
5712 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) | 5737 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) |
5738 #ifdef BUILD_EDGE | |
5739 if (_DW_EDGE_DETECTED) | |
5740 return _dw_edge_raw(handle, UTF8toWide(string)); | |
5741 #endif | |
5713 return _dw_html_raw(handle, string); | 5742 return _dw_html_raw(handle, string); |
5714 #else | 5743 #else |
5715 return DW_ERROR_GENERAL; | 5744 return DW_ERROR_GENERAL; |
5716 #endif | 5745 #endif |
5717 } | 5746 } |
5726 * DW_ERROR_NONE (0) on success. | 5755 * DW_ERROR_NONE (0) on success. |
5727 */ | 5756 */ |
5728 int API dw_html_url(HWND handle, char *url) | 5757 int API dw_html_url(HWND handle, char *url) |
5729 { | 5758 { |
5730 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) | 5759 #if (defined(BUILD_DLL) || defined(BUILD_HTML)) |
5760 #if BUILD_EDGE | |
5761 if (_DW_EDGE_DETECTED) | |
5762 return _dw_edge_url(handle, UTF8toWide(url)); | |
5763 #endif | |
5731 return _dw_html_url(handle, url); | 5764 return _dw_html_url(handle, url); |
5732 #else | 5765 #else |
5733 return DW_ERROR_GENERAL; | 5766 return DW_ERROR_GENERAL; |
5734 #endif | 5767 #endif |
5735 } | 5768 } |