Mercurial > dwindows
comparison mac/dw.m @ 1744:535e8c19a13d
Added dw_filesystem_set_column_title() function to aid in localization.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 04 Jun 2012 22:18:56 +0000 |
parents | 2d44ca344863 |
children | e4fcd1e81f0d |
comparison
equal
deleted
inserted
replaced
1743:a297b2bde127 | 1744:535e8c19a13d |
---|---|
6211 DW_MUTEX_UNLOCK; | 6211 DW_MUTEX_UNLOCK; |
6212 return DW_ERROR_NONE; | 6212 return DW_ERROR_NONE; |
6213 } | 6213 } |
6214 | 6214 |
6215 /* | 6215 /* |
6216 * Configures the main filesystem columnn title for localization. | |
6217 * Parameters: | |
6218 * handle: Handle to the container to be configured. | |
6219 * title: The title to be displayed in the main column. | |
6220 */ | |
6221 void API dw_filesystem_set_column_title(HWND handle, char *title) | |
6222 { | |
6223 char *newtitle = strdup(title ? title : ""); | |
6224 | |
6225 dw_window_set_data(handle, "_dw_coltitle", newtitle); | |
6226 } | |
6227 | |
6228 /* | |
6216 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. | 6229 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. |
6217 * Parameters: | 6230 * Parameters: |
6218 * handle: Handle to the container to be configured. | 6231 * handle: Handle to the container to be configured. |
6219 * flags: An array of unsigned longs with column flags. | 6232 * flags: An array of unsigned longs with column flags. |
6220 * titles: An array of strings with column text titles. | 6233 * titles: An array of strings with column text titles. |
6222 */ | 6235 */ |
6223 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) | 6236 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) |
6224 { | 6237 { |
6225 char **newtitles = malloc(sizeof(char *) * (count + 1)); | 6238 char **newtitles = malloc(sizeof(char *) * (count + 1)); |
6226 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 1)); | 6239 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 1)); |
6240 char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle"); | |
6227 DWContainer *cont = handle; | 6241 DWContainer *cont = handle; |
6228 | 6242 |
6229 newtitles[0] = "Filename"; | 6243 newtitles[0] = coltitle ? coltitle : "Filename"; |
6230 | 6244 |
6231 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; | 6245 newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; |
6232 | 6246 |
6233 memcpy(&newtitles[1], titles, sizeof(char *) * count); | 6247 memcpy(&newtitles[1], titles, sizeof(char *) * count); |
6234 memcpy(&newflags[1], flags, sizeof(unsigned long) * count); | 6248 memcpy(&newflags[1], flags, sizeof(unsigned long) * count); |
6235 | 6249 |
6236 dw_container_setup(handle, newflags, newtitles, count + 1, 0); | 6250 dw_container_setup(handle, newflags, newtitles, count + 1, 0); |
6237 [cont setFilesystem:YES]; | 6251 [cont setFilesystem:YES]; |
6238 | 6252 |
6253 if(coltitle) | |
6254 { | |
6255 dw_window_set_data(handle, "_dw_coltitle", NULL); | |
6256 free(coltitle); | |
6257 } | |
6239 free(newtitles); | 6258 free(newtitles); |
6240 free(newflags); | 6259 free(newflags); |
6241 return DW_ERROR_NONE; | 6260 return DW_ERROR_NONE; |
6242 } | 6261 } |
6243 | 6262 |