Re: Deriving from Gtk::ListStore




On Dec 12, 2007, at 4:37 AM, Murray Cumming wrote:

On Wed, 2007-12-12 at 11:33 +0300, Andrew E. Makeev wrote:
В Втр, 11/12/2007 в 12:53 -0600, Joaquim Schmidlap пишет:

Can anyone offer a roadmap or an example on how to proceed from here? At first cut, it looks like deriving from ListStore is a lot of work, and might require me to build my own iterator classes, etc. which seems like a lot of work. Or, is there a better way to wrap up the behavior I want to hide?

Actually, there is not so much work to implement your own TreeModel.

Look at treemodelcustom/ example, and read documentation carefully
(there are few method implementations missed in example to make it work
completelly right).

And you should derive from TreeModel, TreeModelSortable (if you will
implement sorting).

Unfortunatelly, you have to implement Iterator behavior, but that's not
so complicated as you may think. You shall learn everything from
example.

I still don't think that deriving a TreeModel is documented well enough,
but yes, it's possible.

Depending on the situation, you might also solve your problem by using
the cell_data_func() technique:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/ classGtk_1_1TreeViewColumn.html#765296845c9e9757ba405becbbc13d96

As it turns out, simply deriving from ListStore and TreeStore is working just fine for my needs. All I needed to do to meet my requirements for now was to override set_value_impl, which is how all the various iterators and operators ultimately write into the model proper.

Thanks for the suggestions.

JS


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