Mercurial > dwindows
diff gtk/dw.c @ 257:9ea4ac9a097f
Added dw_icon_load_from_file() on OS/2 and Windows. Added a stub on Unix
to be filled in shortly.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 20 Feb 2003 20:19:09 +0000 |
parents | 63d68387d924 |
children | b2c436c84e5d |
line wrap: on
line diff
--- a/gtk/dw.c Thu Feb 20 17:55:56 2003 +0000 +++ b/gtk/dw.c Thu Feb 20 20:19:09 2003 +0000 @@ -4127,6 +4127,34 @@ } /* + * Obtains an icon from a file. + * Parameters: + * filename: Name of the file, omit extention to have + * 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) +{ + char *file = alloca(strlen(filename) + 5); + + if(!file) + return 0; + + strcpy(file, filename); + + /* check if we can read from this file (it exists and read permission) */ + if(access(file, 04) != 0) + { + /* Try with .bmp extention */ + strcat(file, ".xpm"); + if(access(file, 04) != 0) + return 0; + } + /* Need to add code to add to the internal pixmap lists */ + return 0; +} + +/* * Frees a loaded resource in OS/2 and Windows. * Parameters: * handle: Handle to icon returned by dw_icon_load().