Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
583:67dfd0cea50d | 584:420c6c94abc7 |
---|---|
1 /* | 1 /* |
2 * Dynamic Windows: | 2 * Dynamic Windows: |
3 * A GTK like implementation of the Win32 GUI | 3 * A GTK like implementation of the Win32 GUI |
4 * | 4 * |
5 * (C) 2000-2004 Brian Smith <dbsoft@technologist.com> | 5 * (C) 2000-2005 Brian Smith <dbsoft@technologist.com> |
6 * (C) 2003-2004 Mark Hessling <m.hessling@qut.edu.au> | 6 * (C) 2003-2005 Mark Hessling <m.hessling@qut.edu.au> |
7 * | 7 * |
8 */ | 8 */ |
9 #define _WIN32_IE 0x0500 | 9 #define _WIN32_IE 0x0500 |
10 #define WINVER 0x500 | 10 #define WINVER 0x500 |
11 #include <windows.h> | 11 #include <windows.h> |
72 0x00, 0x00, 0x00, 0xff, 0xff, 0xee, 0xff, 0xaa, 0x00}; | 72 0x00, 0x00, 0x00, 0xff, 0xff, 0xee, 0xff, 0xaa, 0x00}; |
73 | 73 |
74 HBRUSH _colors[18]; | 74 HBRUSH _colors[18]; |
75 | 75 |
76 | 76 |
77 LRESULT CALLBACK _browserWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); | |
77 void _resize_notebook_page(HWND handle, int pageid); | 78 void _resize_notebook_page(HWND handle, int pageid); |
78 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); | 79 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); |
79 int _lookup_icon(HWND handle, HICON hicon, int type); | 80 int _lookup_icon(HWND handle, HICON hicon, int type); |
80 HFONT _acquire_font(HWND handle, char *fontname); | 81 HFONT _acquire_font(HWND handle, char *fontname); |
81 | 82 |
3275 wc.lpszMenuName = NULL; | 3276 wc.lpszMenuName = NULL; |
3276 wc.lpszClassName = FRAMECLASSNAME; | 3277 wc.lpszClassName = FRAMECLASSNAME; |
3277 | 3278 |
3278 RegisterClass(&wc); | 3279 RegisterClass(&wc); |
3279 | 3280 |
3281 /* Register HTML renderer class */ | |
3282 memset(&wc, 0, sizeof(WNDCLASS)); | |
3283 wc.lpfnWndProc = (WNDPROC)_browserWindowProc; | |
3284 wc.lpszClassName = BrowserClassName; | |
3285 wc.style = CS_HREDRAW|CS_VREDRAW; | |
3286 RegisterClass(&wc); | |
3287 | |
3280 /* Create a set of brushes using the default OS/2 and DOS colors */ | 3288 /* Create a set of brushes using the default OS/2 and DOS colors */ |
3281 for(z=0;z<18;z++) | 3289 for(z=0;z<18;z++) |
3282 _colors[z] = CreateSolidBrush(RGB(_red[z],_green[z],_blue[z])); | 3290 _colors[z] = CreateSolidBrush(RGB(_red[z],_green[z],_blue[z])); |
3283 | 3291 |
3284 /* Register an Object Windows class like OS/2 and Win2k+ | 3292 /* Register an Object Windows class like OS/2 and Win2k+ |
3337 | 3345 |
3338 /* Initialize Security for named events and memory */ | 3346 /* Initialize Security for named events and memory */ |
3339 InitializeSecurityDescriptor(&_dwsd, SECURITY_DESCRIPTOR_REVISION); | 3347 InitializeSecurityDescriptor(&_dwsd, SECURITY_DESCRIPTOR_REVISION); |
3340 SetSecurityDescriptorDacl(&_dwsd, TRUE, (PACL) NULL, FALSE); | 3348 SetSecurityDescriptorDacl(&_dwsd, TRUE, (PACL) NULL, FALSE); |
3341 | 3349 |
3350 OleInitialize(NULL); | |
3342 return 0; | 3351 return 0; |
3343 } | 3352 } |
3344 | 3353 |
3345 /* | 3354 /* |
3346 * Runs a message loop for Dynamic Windows. | 3355 * Runs a message loop for Dynamic Windows. |
4016 &ccs); | 4025 &ccs); |
4017 return hwndframe; | 4026 return hwndframe; |
4018 } | 4027 } |
4019 | 4028 |
4020 /* | 4029 /* |
4030 * Create a new HTML browser frame to be packed. | |
4031 * Parameters: | |
4032 * id: An ID to be used with dw_window_from_id or 0L. | |
4033 */ | |
4034 HWND API dw_html_new(unsigned long id) | |
4035 { | |
4036 return CreateWindow(BrowserClassName, | |
4037 "", | |
4038 WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, | |
4039 0,0,2000,1000, | |
4040 DW_HWND_OBJECT, | |
4041 (HMENU)id, | |
4042 DWInstance, | |
4043 NULL); | |
4044 } | |
4045 | |
4046 /* | |
4021 * Create a bitmap object to be packed. | 4047 * Create a bitmap object to be packed. |
4022 * Parameters: | 4048 * Parameters: |
4023 * id: An ID to be used with dw_window_from_id or 0L. | 4049 * id: An ID to be used with dw_window_from_id or 0L. |
4024 */ | 4050 */ |
4025 HWND API dw_bitmap_new(ULONG id) | 4051 HWND API dw_bitmap_new(ULONG id) |
8163 * Parameters: | 8189 * Parameters: |
8164 * exitcode: Exit code reported to the operating system. | 8190 * exitcode: Exit code reported to the operating system. |
8165 */ | 8191 */ |
8166 void API dw_exit(int exitcode) | 8192 void API dw_exit(int exitcode) |
8167 { | 8193 { |
8194 OleUninitialize(); | |
8168 exit(exitcode); | 8195 exit(exitcode); |
8169 } | 8196 } |
8170 | 8197 |
8171 /* | 8198 /* |
8172 * Creates a splitbar window (widget) with given parameters. | 8199 * Creates a splitbar window (widget) with given parameters. |