Mercurial > dwindows
diff win/dw.c @ 671:c60a4f6cfae8
Implemented icon support on the Mac. In the process created a new HICN type.
The existing implementation works well on OS/2 but it is kind of bad on the
other platforms. I should revisit the Windows and GTK implementations.
The typedef currently in use should be backwards compatible for now.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 27 Feb 2011 19:01:40 +0000 |
parents | 2b260f4309bb |
children | 388f2a48aaae |
line wrap: on
line diff
--- a/win/dw.c Sun Feb 27 08:18:20 2011 +0000 +++ b/win/dw.c Sun Feb 27 19:01:40 2011 +0000 @@ -2,7 +2,7 @@ * Dynamic Windows: * A GTK like implementation of the Win32 GUI * - * (C) 2000-2005 Brian Smith <dbsoft@technologist.com> + * (C) 2000-2011 Brian Smith <brian@dbsoft.org> * (C) 2003-2005 Mark Hessling <m.hessling@qut.edu.au> * */ @@ -7054,7 +7054,7 @@ * parent: Parent handle or 0 if root. * itemdata: Item specific data. */ -HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, unsigned long icon, HTREEITEM parent, void *itemdata) +HTREEITEM API dw_tree_insert_after(HWND handle, HTREEITEM item, char *title, HICN icon, HTREEITEM parent, void *itemdata) { TVITEM tvi; TVINSERTSTRUCT tvins; @@ -7088,7 +7088,7 @@ * parent: Parent handle or 0 if root. * itemdata: Item specific data. */ -HTREEITEM API dw_tree_insert(HWND handle, char *title, unsigned long icon, HTREEITEM parent, void *itemdata) +HTREEITEM API dw_tree_insert(HWND handle, char *title, HICN icon, HTREEITEM parent, void *itemdata) { TVITEM tvi; TVINSERTSTRUCT tvins; @@ -7121,7 +7121,7 @@ * title: The text title of the entry. * icon: Handle to coresponding icon. */ -void API dw_tree_item_change(HWND handle, HTREEITEM item, char *title, unsigned long icon) +void API dw_tree_item_change(HWND handle, HTREEITEM item, char *title, HICN icon) { TVITEM tvi; void **ptrs; @@ -7401,9 +7401,9 @@ * Windows, on GTK this is converted to a pointer * to an embedded XPM. */ -unsigned long API dw_icon_load(unsigned long module, unsigned long id) -{ - return (unsigned long)LoadIcon(DWInstance, MAKEINTRESOURCE(id)); +HICN API dw_icon_load(unsigned long module, unsigned long id) +{ + return (HICN)LoadIcon(DWInstance, MAKEINTRESOURCE(id)); } /* @@ -7413,7 +7413,7 @@ * DW pick the appropriate file extension. * (ICO on OS/2 or Windows, XPM on Unix) */ -unsigned long API dw_icon_load_from_file(char *filename) +HICN API dw_icon_load_from_file(char *filename) { char *file = malloc(strlen(filename) + 5); HANDLE icon; @@ -7436,7 +7436,7 @@ } icon = LoadImage(NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE); free(file); - return (unsigned long)icon; + return (HICN)icon; } /* @@ -7446,7 +7446,7 @@ * DW pick the appropriate file extension. * (ICO on OS/2 or Windows, XPM on Unix) */ -unsigned long API dw_icon_load_from_data(char *data, int len) +HICN API dw_icon_load_from_data(char *data, int len) { HANDLE icon; char *file; @@ -7471,7 +7471,7 @@ } unlink( file ); } - return (unsigned long)icon; + return (HICN)icon; } /* @@ -7479,7 +7479,7 @@ * Parameters: * handle: Handle to icon returned by dw_icon_load(). */ -void API dw_icon_free(unsigned long handle) +void API dw_icon_free(HICN handle) { DestroyIcon((HICON)handle); } @@ -7574,7 +7574,7 @@ * row: Zero based row of data being set. * data: Pointer to the data to be added. */ -void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, unsigned long icon) +void API dw_filesystem_set_file(HWND handle, void *pointer, int row, char *filename, HICN icon) { LV_ITEM lvi; @@ -7736,7 +7736,7 @@ * row: Zero based row of data being set. * data: Pointer to the data to be added. */ -void API dw_filesystem_change_file(HWND handle, int row, char *filename, unsigned long icon) +void API dw_filesystem_change_file(HWND handle, int row, char *filename, HICN icon) { dw_filesystem_set_file(handle, NULL, row, filename, icon); } @@ -8096,7 +8096,7 @@ * icon: Icon handle to display in the taskbar. * bubbletext: Text to show when the mouse is above the icon. */ -void API dw_taskbar_insert(HWND handle, unsigned long icon, char *bubbletext) +void API dw_taskbar_insert(HWND handle, HICN icon, char *bubbletext) { NOTIFYICONDATA tnid; @@ -8120,7 +8120,7 @@ * handle: Window handle that was used with dw_taskbar_insert(). * icon: Icon handle that was used with dw_taskbar_insert(). */ -void API dw_taskbar_delete(HWND handle, unsigned long icon) +void API dw_taskbar_delete(HWND handle, HICN icon) { NOTIFYICONDATA tnid;