Re: TreeView renders



On 10/18/07, Iker Perez de Albeniz <ialbeniz cbt es> wrote:
> Is there any manual or howto to create custom Cellrenders.. i have been
> reading example codes and are a bit dificult to understand...
>
>
> thanks,
>
> El mar, 16-10-2007 a las 13:39 +0400, Andrew E. Makeev escribió:
> > В Втр, 16/10/2007 в 11:29 +0200, Iker Perez de Albeniz пишет:
> > > I have made my own widget from a Gtk::EventBox (with a gtk::DrawingArtea
> > > inside) and i want to place it in a Treeview. I dont know hoy to do it
> > > because all the renderers i have tried dont work.. is there any
> > > posibility to place an user made widget on a treeview
> > >
> > > thanks,
> >
> > well, yes, it's possible if you implement custom CellRenderer, almost
> > same way as you did for your custom widget.
> >
> > Look at examples and source code (GTK+).
> >
> > -andrew
> >

I'm not sure that there's any good tutorial-type articles on creating
a custom cell renderer.  I've been meaning to add something like that
to the gtkmm book, but keep forgetting / don't have time (hint: if you
file a bug, I might remember).  So your best bet at the moment is to
look at examples that people have already created.  There is a basic
example in the gtkmm tarball that you can view here:
http://svn.gnome.org/viewvc/gtkmm/trunk/examples/cellrenderercustom/

Alternately, here's a basic example from one of my applications that
draws a square 'swatch' of a particular color in the treeview:
http://repo.or.cz/w/agave.git?a=blob;f=src/widgets/gcs-cellrendererswatch.h;h=8510d78cde2c25c937895c593d099576ffb786b0;hb=HEAD
http://repo.or.cz/w/agave.git?a=blob;f=src/widgets/gcs-cellrendererswatch.cc;h=54bb8461a74f31e89f75f3911b419248c03eeac7;hb=HEAD
(you can see what it looks like here: http://home.gna.org/colorscheme/)

If other people that have written custom cellrenderers could chime in
with links to their implementations, maybe we could create a list of
existing implementations that we could point people to next time the
question comes up.  (Having a lot of examples to reference might also
help me or somebody else when they actualy sit down to write
tutorial-style documentation for creating custom cell renderers).
-- 
jonner


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