Re: Specialized TreeView.



On Thu, 6 Jan 2005 11:00:18 -0800 (PST), Harring Figueiredo
<harringf yahoo com> wrote:

 - Write a custom cell renderer that draws something different depending on
   what string was passed:
      "pixbuf: ...location"
      "string: string to write"

  I don't think you need to write a cell renderer -- cellrenderer to display
pixbuf, strings, and pixubuf and strings are already provided by the lib.

Yes, but a single cell renderer cant render a "string OR pixbuf"

While they would all be columns of the same "type" (G_TYPE_STRING), the
custom cell renderer will treat it differently because of the string content.
  
  Why not then have it as a G_TYPE_POINTER ?

If all the members will be strings, no need to call them pointers.

What kind of impact will this have on the width ?
I noticed there is no "fixed_width_mode" on treeviews, does this mean that
I'm stuck with a fixed column width across rows ?

   I believe the width automatically expands to fit the widest data
(string/pixbuf) on that column.

Ok, so that will be a problem (that will limit me to using a single cell row).

If thats the case, does it make sence to write it with one column of type
G_TYPE_STRING and a custom cell renderer that parses a string which
represents the entire row ?

   hmmm... I really think that you should not write a cellrenderer yourself for
this case..

  Have you looked at the gtk demo that comes with GTK ?
/demos/gtk-demo

  There is a treeview demo for something similar to what you are describing...

Just looked at demo, unfortunatly it doesn't do anything miraculous :(

The GtkTreeStore demo has a bunch of columns, the first column can
serve two different purposes though, the first column can either be a 
"Month" or a "Holiday", but both the month and holiday are G_TYPE_STRING
(and can be displayed with a GtkCellRendererText).

What I would idealy need, would be to describe a column scheme for
every list of children (even if the column description had "per depth"
granularity it wouldn't be good enough, what if I wanted to display a
few rows in format A for parent FOO in the root depth, and then I want
to display a few rows in format B for parent BAR in root depth).

From what I understand, I'll have to go with a one column GtkTreeStore 
(type G_TYPE_STRING) with a custom cellrenderer, the custom cell renderer
would parse the column string and display the entire row.

Soon I'll have to write that up, I hope it works :)

Cheers,
                                                                      
        -Tristan



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