Re: [gtkmm] treeview/liststore cellrenderer color <-> background color of a single cell?



On Sun, Sep 19, 2004 at 08:15:19AM -0500, David Jensen wrote:
> Florian Schmidt wrote:
> >i want a single cell (not the whole column) to have another background 
> >color.
> >
> >at the moment i use TreeViewColumn::set_cell_data_func() to specify a
> >custom column-renderer-function.
> >..
> what i use is.
> 
> Gtk::TreeViewColumn *tvc = tv.get_column(i);
> tvc->add_attribute(*tv.get_column_cell_renderer(i),
> 		"foreground_set", m_color_enable);
> tvc->add_attribute(*tv.get_column_cell_renderer(i),
> 		"foreground_gdk", m_color);
> 
> these columns are in the model.
> 	Gtk::TreeModelColumn<Gdk::Color> color;
> 	Gtk::TreeModelColumn<bool> color_enable;
> i is the column to render, m_color_enable and m_color are those column 
> numbers as enum values
> 
> so if row[color_enable] is true, row[color] is used, else default
> i leave it to you to fill in the columns, this just sets up the renderer.

thanx david, this also works for me, but does anybody now a "nicer" solution?

the solution of david needs for each column a second column to specify
whether the foreground_gdk-color shall be used...

in my application i have a big database-result-set to show, and i want
the "NULL"-values to be marked with a different color.

i could have very much columns and i would need a bool-model-column for each
view-column... i don't like this idea very much, but i will use it, because
i dont know how to make it better...

thanks! 

-- 
Florian Schmidt			      schmidt_florian gmx de 
GCS d? s+: a-- C++++ UL+++ P--- L+++ E W- N+ o+ K++ w--- O-
M-- V- PS+ PE Y PGP- t++ 5- X+ R- tv+ b+ DI D G e+ h+ r-- y?



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