Re: [gtkmm] Treeview: selection and color



 > I'm trying to use gtkmm for an application which will help to desing
> schedule in an hospital. I plan to use a Treeview to make something like
> that :
>
>
>             |day1| d2 | d3 | d4 | d5 | d6 | ...
> ------------------------------------------------
> - nurse
>    Miss A     1     2    3    1    2    3   ...
>    Miss B     2     3    1    2    3    1   ...
>    ...
> + boss
> + ...
>
>
> where 1, 2, 3... are for example from 8.00 am to 4.00 pm...
> I want to represent these number as a string of two char. but, that's
> where the probem begin to be more complex, I would that all 1 appear in
> blue with a yellow background for example, all 2 with red/blue....

You can do non-default things with cell renderers as described here:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch08s02.html#id2510771

The CellRendererText cell renderer has a "markup" property that you can
use instead of the regular text property. Or you could use the
"foreground" property:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1CellRendererText.html

The set_cell_data_func() callback might be a good way to use this, but
other people have more experience with that than me:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeViewColumn.html#a19

> an other thing, is that I would have a radio button (in a toolbar) for
> each 1,2,3... and if I choose one of these button, if a click on one
> cell of my treeview, the cell take the correct value and correct
> color...

That should just be a matter of changing the correct data in your model.
The view should update automatically.

> I would so an other nice feature... I want to be able to change the
> value of a cell using a popup menu that is showed when I click with the
> third button of the mouse on this cell...

There are various popup/combo custom cellrenderers out there. There is
even one in examples/customcellrenderer. Also, there is an example in
examples/book/treeview/ which shows a popup context menu, if that's what
you want.


Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com



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