diff 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
line wrap: on
line diff
--- a/mac/dw.m	Sun Jun 03 19:44:04 2012 +0000
+++ b/mac/dw.m	Mon Jun 04 22:18:56 2012 +0000
@@ -6213,6 +6213,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.
@@ -6224,9 +6237,10 @@
 {
     char **newtitles = malloc(sizeof(char *) * (count + 1));
     unsigned long *newflags = malloc(sizeof(unsigned long) * (count + 1));
+    char *coltitle = (char *)dw_window_get_data(handle, "_dw_coltitle");
     DWContainer *cont = handle;
 
-    newtitles[0] = "Filename";
+    newtitles[0] = coltitle ? coltitle : "Filename";
 
     newflags[0] = DW_CFA_STRINGANDICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR;
 
@@ -6236,6 +6250,11 @@
     dw_container_setup(handle, newflags, newtitles, count + 1, 0);
     [cont setFilesystem:YES];
 
+    if(coltitle)
+    {
+        dw_window_set_data(handle, "_dw_coltitle", NULL);
+        free(coltitle);
+    }
     free(newtitles);
     free(newflags);
     return DW_ERROR_NONE;