Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
256:63d68387d924 | 257:9ea4ac9a097f |
---|---|
4125 { | 4125 { |
4126 return id; | 4126 return id; |
4127 } | 4127 } |
4128 | 4128 |
4129 /* | 4129 /* |
4130 * Obtains an icon from a file. | |
4131 * Parameters: | |
4132 * filename: Name of the file, omit extention to have | |
4133 * DW pick the appropriate file extension. | |
4134 * (ICO on OS/2 or Windows, XPM on Unix) | |
4135 */ | |
4136 unsigned long API dw_icon_load_from_file(char *filename) | |
4137 { | |
4138 char *file = alloca(strlen(filename) + 5); | |
4139 | |
4140 if(!file) | |
4141 return 0; | |
4142 | |
4143 strcpy(file, filename); | |
4144 | |
4145 /* check if we can read from this file (it exists and read permission) */ | |
4146 if(access(file, 04) != 0) | |
4147 { | |
4148 /* Try with .bmp extention */ | |
4149 strcat(file, ".xpm"); | |
4150 if(access(file, 04) != 0) | |
4151 return 0; | |
4152 } | |
4153 /* Need to add code to add to the internal pixmap lists */ | |
4154 return 0; | |
4155 } | |
4156 | |
4157 /* | |
4130 * Frees a loaded resource in OS/2 and Windows. | 4158 * Frees a loaded resource in OS/2 and Windows. |
4131 * Parameters: | 4159 * Parameters: |
4132 * handle: Handle to icon returned by dw_icon_load(). | 4160 * handle: Handle to icon returned by dw_icon_load(). |
4133 */ | 4161 */ |
4134 void dw_icon_free(unsigned long handle) | 4162 void dw_icon_free(unsigned long handle) |