diff gtk3/dw.c @ 1207:423da07c8f05

Basic support for row colors on GTK3... Currently the specified colors are ignored and just sets the rules-hint property if both parameters are not DW_CLR_DEFAULT. Will try to set the odd-row-color and even-row-color properties using the theme in the future.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 08 Oct 2011 19:01:53 +0000
parents fc87309372ef
children 70dca53cb071
line wrap: on
line diff
--- a/gtk3/dw.c	Sat Oct 08 18:37:48 2011 +0000
+++ b/gtk3/dw.c	Sat Oct 08 19:01:53 2011 +0000
@@ -5970,6 +5970,33 @@
 }
 
 /*
+ * Sets the alternating row colors for container window (widget) handle.
+ * Parameters:
+ *          handle: The window (widget) handle.
+ *          oddcolor: Odd row background color in DW_RGB format or a default color index.
+ *                    DW_CLR_DEFAULT will disable coloring odd rows.
+ *          evencolor: Even row background color in DW_RGB format or a default color index.
+ *                    DW_CLR_DEFAULT will disable coloring even rows.
+ */
+void API dw_container_set_row_bg(HWND handle, unsigned long oddcolor, unsigned long evencolor)
+{
+   GtkWidget *cont;
+   int _locked_by_me = FALSE;
+   DW_MUTEX_LOCK;
+   cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
+
+   /* Make sure it is the correct tree type */
+   if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
+   {
+      if(oddcolor == DW_CLR_DEFAULT && evencolor == DW_CLR_DEFAULT)
+         gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(cont), FALSE);
+      else  
+         gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(cont), TRUE);
+   }
+   DW_MUTEX_UNLOCK;
+}
+
+/*
  * Sets the width of a column in the container.
  * Parameters:
  *          handle: Handle to window (widget) of container.
@@ -5983,7 +6010,7 @@
 
    DW_MUTEX_LOCK;
    cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
-
+   
    /* Make sure it is the correct tree type */
    if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
    {