comparison 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
comparison
equal deleted inserted replaced
1206:c7bb48cda53a 1207:423da07c8f05
5968 { 5968 {
5969 return dw_container_get_column_type( handle, column + 1 ); 5969 return dw_container_get_column_type( handle, column + 1 );
5970 } 5970 }
5971 5971
5972 /* 5972 /*
5973 * Sets the alternating row colors for container window (widget) handle.
5974 * Parameters:
5975 * handle: The window (widget) handle.
5976 * oddcolor: Odd row background color in DW_RGB format or a default color index.
5977 * DW_CLR_DEFAULT will disable coloring odd rows.
5978 * evencolor: Even row background color in DW_RGB format or a default color index.
5979 * DW_CLR_DEFAULT will disable coloring even rows.
5980 */
5981 void API dw_container_set_row_bg(HWND handle, unsigned long oddcolor, unsigned long evencolor)
5982 {
5983 GtkWidget *cont;
5984 int _locked_by_me = FALSE;
5985 DW_MUTEX_LOCK;
5986 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
5987
5988 /* Make sure it is the correct tree type */
5989 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
5990 {
5991 if(oddcolor == DW_CLR_DEFAULT && evencolor == DW_CLR_DEFAULT)
5992 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(cont), FALSE);
5993 else
5994 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(cont), TRUE);
5995 }
5996 DW_MUTEX_UNLOCK;
5997 }
5998
5999 /*
5973 * Sets the width of a column in the container. 6000 * Sets the width of a column in the container.
5974 * Parameters: 6001 * Parameters:
5975 * handle: Handle to window (widget) of container. 6002 * handle: Handle to window (widget) of container.
5976 * column: Zero based column of width being set. 6003 * column: Zero based column of width being set.
5977 * width: Width of column in pixels. 6004 * width: Width of column in pixels.
5981 GtkWidget *cont; 6008 GtkWidget *cont;
5982 int _locked_by_me = FALSE; 6009 int _locked_by_me = FALSE;
5983 6010
5984 DW_MUTEX_LOCK; 6011 DW_MUTEX_LOCK;
5985 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user"); 6012 cont = (GtkWidget *)g_object_get_data(G_OBJECT(handle), "_dw_user");
5986 6013
5987 /* Make sure it is the correct tree type */ 6014 /* Make sure it is the correct tree type */
5988 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER)) 6015 if(cont && GTK_IS_TREE_VIEW(cont) && g_object_get_data(G_OBJECT(cont), "_dw_tree_type") == GINT_TO_POINTER(_DW_TREE_TYPE_CONTAINER))
5989 { 6016 {
5990 GtkTreeViewColumn *col = gtk_tree_view_get_column(GTK_TREE_VIEW(cont), column); 6017 GtkTreeViewColumn *col = gtk_tree_view_get_column(GTK_TREE_VIEW(cont), column);
5991 6018