diff 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
line wrap: on
line diff
--- a/os2/dw.c	Sun Jun 03 19:44:04 2012 +0000
+++ b/os2/dw.c	Mon Jun 04 22:18:56 2012 +0000
@@ -8948,6 +8948,19 @@
 }
 
 /*
+ * Configures the main filesystem columnn title for localization.
+ * Parameters:
+ *          handle: Handle to the container to be configured.
+ *          title: The title to be displayed in the main column.
+ */
+void API dw_filesystem_set_column_title(HWND handle, char *title)
+{
+	char *newtitle = strdup(title ? title : "");
+	
+	dw_window_set_data(handle, "_dw_coltitle", newtitle);
+}
+
+/*
  * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
  * Parameters:
  *          handle: Handle to the container to be configured.
@@ -8959,9 +8972,10 @@
 {
    char **newtitles = malloc(sizeof(char *) * (count + 2));
    unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 2));
-
-   newtitles[0] = "Icon";
-   newtitles[1] = "Filename";
+   char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle");
+
+   newtitles[0] = "";
+   newtitles[1] = coltitle ? coltitle : "Filename";
 
    newflags[0] = DW_CFA_BITMAPORICON | DW_CFA_CENTER | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR;
    newflags[1] = DW_CFA_STRING | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR;
@@ -8971,6 +8985,11 @@
 
    dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0);
 
+   if(coltitle)
+   {
+	  dw_window_set_data(handle, "_dw_coltitle", NULL);
+	  free(coltitle);
+   }
    free(newtitles);
    free(newflags);
    return DW_ERROR_NONE;