Re: Cell rendering issue



Hi,

Le 20/06/2011 19:45, Thomas Bollmeier a écrit :
Hi GTK-experts,

currently I work on a small location finder application
(http://www.bolles-werk.org/software-projects/quoloco.html). Basically
the application shall allow users to search for arbitrary keywords. The
results are displayed both in a map (a champlain view) and in a tree
view (GtkTreeView).
For the latter one I have to solve a problem: The tree shall consist of
"search nodes" on the top level and "location nodes" as their children.
Both node types have different data associated to them. The search node
has to display the keywords of the search whereas the location nodes
shall display a checkbox (to toggle their visibility in the map) as well
as latitude and longitude. So the tree view has  four columns ("key
words", "visible", "latitude", "longitude") in total. For search nodes
the last three columns shall be empty, for location nodes the first column.
Is it somehow possible to implement that? In the documentation I only
find ways (using the cell data function) to have control over the
properties of the column's renderers. However I actually would like to
be able to set the renderer per cell (depending on the node type)
instead of per column. Of course there would be the alternative to
implement my own custom renderer - but at the moment I would like to
avoid this effort. Any ideas?

The simpler solution I can think of is to set the visibility of the cell
renderer in the cell_data_func(), depending on whether the row should
display it or not.

So, for your toplevel rows keyword would be set to be visible and all
three other to be hidden, and the inverse for children rows.

That's the only other solution I know of apart writing your own "proxy"
cell renderer (note that for example gconf-editor does so, so if your
application has a compatible license you could borrow its code as a
basis). Of course perhaps there's other ways I don't know of, I'm not a
GTK god ^^

Regards,
Colomban



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