[gtkmm] cell rendering



This question is very similar to the recent discussion on a slow
treeview.  I do want to have control over the color of each cell.  Think
about a list of temperatures and you'd like to color cold temps blue and
hot red.  Moreover, I want to do this as updates are coming in, so I
have to have control over what color is used, because it may change from
update-to-update.  Do I then have to use a set_cell_data_func to handle
the decision as to what color is to be used?  If so, I looked at the
documentation for set_cell_data_func and it's confusing to me.

here's the signature for it:

class TreeViewColumn

void set_cell_data_func (CellRenderer& cell_renderer, const
SlotCellData& slot)


I'm not sure how this SlotCellData type works:

typedef SigC::Slot2<void, CellRenderer*, const
Gtk::TreeModel::iterator&> Gtk::TreeViewColumn::SlotCellData
  
is this how to use it?

void column_callback(CellRenderer* r, const Gtk::TreeModel::iterator&
it)
{
}

....
SigC::Slot2<CellRenderer*,
            const Gtk::TreeModel::iterator&>  S(column_callback);

pColumn->set_cell_data_func(*pRenderer, S);

this is not compiling for me, (I can get the message if needed) but I
think that I just have a misunderstanding with how I'm using this
function

Thanks





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