comparison os2/dw.c @ 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 a297b2bde127
children 7dd1659c2693
comparison
equal deleted inserted replaced
1743:a297b2bde127 1744:535e8c19a13d
8946 free(offStruct); 8946 free(offStruct);
8947 return DW_ERROR_NONE; 8947 return DW_ERROR_NONE;
8948 } 8948 }
8949 8949
8950 /* 8950 /*
8951 * Configures the main filesystem columnn title for localization.
8952 * Parameters:
8953 * handle: Handle to the container to be configured.
8954 * title: The title to be displayed in the main column.
8955 */
8956 void API dw_filesystem_set_column_title(HWND handle, char *title)
8957 {
8958 char *newtitle = strdup(title ? title : "");
8959
8960 dw_window_set_data(handle, "_dw_coltitle", newtitle);
8961 }
8962
8963 /*
8951 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. 8964 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
8952 * Parameters: 8965 * Parameters:
8953 * handle: Handle to the container to be configured. 8966 * handle: Handle to the container to be configured.
8954 * flags: An array of unsigned longs with column flags. 8967 * flags: An array of unsigned longs with column flags.
8955 * titles: An array of strings with column text titles. 8968 * titles: An array of strings with column text titles.
8957 */ 8970 */
8958 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) 8971 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count)
8959 { 8972 {
8960 char **newtitles = malloc(sizeof(char *) * (count + 2)); 8973 char **newtitles = malloc(sizeof(char *) * (count + 2));
8961 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2)); 8974 unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2));
8962 8975 char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle");
8963 newtitles[0] = "Icon"; 8976
8964 newtitles[1] = "Filename"; 8977 newtitles[0] = "";
8978 newtitles[1] = coltitle ? coltitle : "Filename";
8965 8979
8966 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR; 8980 newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR;
8967 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR; 8981 newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR;
8968 8982
8969 memcpy(&newtitles[2], titles, sizeof(char *) * count); 8983 memcpy(&newtitles[2], titles, sizeof(char *) * count);
8970 memcpy(&newflags[2], flags, sizeof(unsigned long) * count); 8984 memcpy(&newflags[2], flags, sizeof(unsigned long) * count);
8971 8985
8972 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0); 8986 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0);
8973 8987
8988 if(coltitle)
8989 {
8990 dw_window_set_data(handle, "_dw_coltitle", NULL);
8991 free(coltitle);
8992 }
8974 free(newtitles); 8993 free(newtitles);
8975 free(newflags); 8994 free(newflags);
8976 return DW_ERROR_NONE; 8995 return DW_ERROR_NONE;
8977 } 8996 }
8978 8997