Re: [gtkmm] How to derive from TreeModel?



On Tue, 2002-07-02 at 22:10, Benjamin Dauvergne wrote:
> Le mar 02/07/2002 à 13:30, Murray Cumming a écrit :
>     On Tue, 2002-07-02 at 11:08, Benjamin Dauvergne wrote:
>     > 
>     > Is it possible to derive TreeModel without creating a derived class from
>     > GTK+ TreeModel i.e linking the vfunc slot  table you find in
>     > gtk-2.0/gtk/gtktreemodel.h to your own iterator function ?
>     
>     I believe that it's now possible. It should be slightly easier than
>     deriving in C, but it's still not going to be easy, because the whole
>     TreeModel thing depends on some funky use of the GtkTreeIter fields.
>     
> I don't how it is possible, it seems that code, gtk/gtkmm/treemodel.cc:
> /*
>   _WRAP_VFUNC(bool iter_next(iterator& iter), iter_next)
[snip]
> */
> used to do it but it is commented, and the C vfunc like iter_next are
> never defined elsewhere.

I'm fixing that now. I don't know why it was commented -  maybe because
they are _only_ used now for deriving new TreeModels.

>     If you really want to do it then you should search the archive for
>     "CellRenderer", which can be derived by using a similar "custom GType"
>     technique.
>     
> I don't sees how this two relates since cellrenderepopup is derived from
> Gtk::CellRendererText whos represents GtkRendererRext who has already
> overrided the vfunc of the abstract Gtk class, GtkCellRenderer.

Did you look in the archive? It's the "custom Gtype" bit that's
interesting:
http://cvs.gnome.org/lxr/source/gtkmm-root/examples/cellrenderercustom/cellrendererpopup.cc#34

Deriving a new TreeModel is going to be difficult. I can at least say
that it won't be more difficult than doing it in C.

-- 
Murray Cumming
murrayc usa net
www.murrayc.com




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