Re: Gtk2: GtkCellRendererText: changing bgcolor based on..



Erik Simonsen wrote:

  gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE);

. . .
/*When you add a row to the store, just add the color of the row as a string into that last column.  No need 
to deal with gdkcolors and allocations, etc.*/

   gtk_tree_store_set ( playlist_store, &iter,
        FILE_TREE_TEXT_COLUMN, "column text",
        FILE_TREE_IMAGE_COLUMN, minfo->icon,
        FILE_TREE_DATA_COLUMN, (gpointer) minfo,
        FILE_TREE_COLOR_COLUMN, "white",
        -1);

For the color column part, you can use several formats:  "white", "#202020", and i think "{ .4 .5 .2}" are 
all valid formats. easy peasy.

!!!! Remember, setting the background to white might be what you want, but if your REALLY looking for transparancy (i.e. the original background colours - which may change with different themes) set the colour to NULL.

eg:

   gtk_tree_store_set ( playlist_store, &iter,
        FILE_TREE_COLOR_COLUMN, NULL,
        -1);

Regards,

Martyn






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]