diff win/dw.c @ 584:420c6c94abc7

Added dw_html_* functionality for embedding HTML pages in Dynamic Windows applications.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 22 May 2005 18:07:23 +0000
parents 67dfd0cea50d
children bb439280ece2
line wrap: on
line diff
--- a/win/dw.c	Fri May 20 11:28:16 2005 +0000
+++ b/win/dw.c	Sun May 22 18:07:23 2005 +0000
@@ -2,8 +2,8 @@
  * Dynamic Windows:
  *          A GTK like implementation of the Win32 GUI
  *
- * (C) 2000-2004 Brian Smith <dbsoft@technologist.com>
- * (C) 2003-2004 Mark Hessling <m.hessling@qut.edu.au>
+ * (C) 2000-2005 Brian Smith <dbsoft@technologist.com>
+ * (C) 2003-2005 Mark Hessling <m.hessling@qut.edu.au>
  *
  */
 #define _WIN32_IE 0x0500
@@ -74,6 +74,7 @@
 HBRUSH _colors[18];
 
 
+LRESULT CALLBACK _browserWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 void _resize_notebook_page(HWND handle, int pageid);
 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y);
 int _lookup_icon(HWND handle, HICON hicon, int type);
@@ -3277,6 +3278,13 @@
 
 	RegisterClass(&wc);
 
+	/* Register HTML renderer class */
+	memset(&wc, 0, sizeof(WNDCLASS));
+	wc.lpfnWndProc = (WNDPROC)_browserWindowProc;
+	wc.lpszClassName = BrowserClassName;
+	wc.style = CS_HREDRAW|CS_VREDRAW;
+	RegisterClass(&wc);
+
 	/* Create a set of brushes using the default OS/2 and DOS colors */
 	for(z=0;z<18;z++)
 		_colors[z] = CreateSolidBrush(RGB(_red[z],_green[z],_blue[z]));
@@ -3339,6 +3347,7 @@
 	InitializeSecurityDescriptor(&_dwsd, SECURITY_DESCRIPTOR_REVISION);
 	SetSecurityDescriptorDacl(&_dwsd, TRUE, (PACL) NULL, FALSE);
 
+	OleInitialize(NULL);
 	return 0;
 }
 
@@ -4018,6 +4027,23 @@
 }
 
 /*
+ * Create a new HTML browser frame to be packed.
+ * Parameters:
+ *       id: An ID to be used with dw_window_from_id or 0L.
+ */
+HWND API dw_html_new(unsigned long id)
+{
+	return CreateWindow(BrowserClassName,
+						"",
+						WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS,
+						0,0,2000,1000,
+						DW_HWND_OBJECT,
+						(HMENU)id,
+						DWInstance,
+						NULL);
+}
+
+/*
  * Create a bitmap object to be packed.
  * Parameters:
  *       id: An ID to be used with dw_window_from_id or 0L.
@@ -8165,6 +8191,7 @@
  */
 void API dw_exit(int exitcode)
 {
+	OleUninitialize();
 	exit(exitcode);
 }