comparison win/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 03a76c4185a8
children ff9a51706715
comparison
equal deleted inserted replaced
1743:a297b2bde127 1744:535e8c19a13d
8999 ListView_SetExtendedListViewStyle(handle, LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES); 8999 ListView_SetExtendedListViewStyle(handle, LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES);
9000 return DW_ERROR_NONE; 9000 return DW_ERROR_NONE;
9001 } 9001 }
9002 9002
9003 /* 9003 /*
9004 * Configures the main filesystem columnn title for localization.
9005 * Parameters:
9006 * handle: Handle to the container to be configured.
9007 * title: The title to be displayed in the main column.
9008 */
9009 void API dw_filesystem_set_column_title(HWND handle, char *title)
9010 {
9011 char *newtitle = strdup(title ? title : "");
9012
9013 dw_window_set_data(handle, "_dw_coltitle", newtitle);
9014 }
9015
9016 /*
9004 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. 9017 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
9005 * Parameters: 9018 * Parameters:
9006 * handle: Handle to the container to be configured. 9019 * handle: Handle to the container to be configured.
9007 * flags: An array of unsigned longs with column flags. 9020 * flags: An array of unsigned longs with column flags.
9008 * titles: An array of strings with column text titles. 9021 * titles: An array of strings with column text titles.
9009 * count: The number of columns (this should match the arrays). 9022 * count: The number of columns (this should match the arrays).
9010 */ 9023 */
9011 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count) 9024 int API dw_filesystem_setup(HWND handle, unsigned long *flags, char **titles, int count)
9012 { 9025 {
9026 char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle");
9013 LV_COLUMN lvc; 9027 LV_COLUMN lvc;
9014 9028
9015 lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; 9029 lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
9016 lvc.pszText = TEXT("Filename"); 9030 lvc.pszText = coltitle ? UTF8toWide(coltitle) : TEXT("Filename");
9017 lvc.cchTextMax = 8; 9031 lvc.cchTextMax = 8;
9018 lvc.fmt = 0; 9032 lvc.fmt = 0;
9019 if(!count) 9033 if(!count)
9020 lvc.cx = 300; 9034 lvc.cx = 300;
9021 else 9035 else
9022 lvc.cx = 150; 9036 lvc.cx = 150;
9023 lvc.iSubItem = count; 9037 lvc.iSubItem = count;
9024 SendMessage(handle, LVM_INSERTCOLUMN, (WPARAM)0, (LPARAM)&lvc); 9038 SendMessage(handle, LVM_INSERTCOLUMN, (WPARAM)0, (LPARAM)&lvc);
9025 dw_container_setup(handle, flags, titles, count, -1); 9039 dw_container_setup(handle, flags, titles, count, -1);
9040 if(coltitle)
9041 {
9042 dw_window_set_data(handle, "_dw_coltitle", NULL);
9043 free(coltitle);
9044 }
9026 return DW_ERROR_NONE; 9045 return DW_ERROR_NONE;
9027 } 9046 }
9028 9047
9029 /* 9048 /*
9030 * Obtains an icon from a module (or header in GTK). 9049 * Obtains an icon from a module (or header in GTK).