Re: Making custom class objects viewable via TreeView

But what have custom signals to do with making an object viewable via TreeView?
I have to specify TreeModelColumnRecord, should I put there a column which stores Foo?
Then how to make certain fields visible in a View? How those signals can help with exposing data?

2011/8/31 lecas malecas <darkiiiiii gmail com>
I'm not sure if I understand what you're saying, but have you
considered using custom signals?
You could emit a signal in the Foo class which would send the data you
want (but there could be a better way).

On Tue, Aug 30, 2011 at 4:27 PM, Adrian Zgorzalek <a zgorzalek gmail com> wrote:
> Hello,
> I got a bunch of questions connected with TreeView, making data viewable
> via TreeView and some design issues.
> Firstly, I'll state a problem. I would like to have a collection of Foo
> objects.
> They have their methods, store some data. I want the collection to supply
> me, besides collection interface, some methods to call on stored data.
> I also want to expose objects stored in the collection to user, allow they
> to modify them, add, delete and reorder.
> Obvious idea is to use TreeView, but I met some serious problems.
> First, how to make Foo objects viewable? Deriving from
> Gtk::TreeModelColumnRecord
> leads me to nowhere, since then I have no access to data stored inside Foo,
> Gtk::TreeModelColumn<T> seems to be just a meta-data for a model to create
> View and
> Store. More clearly, I want to e.g. have object representing triple on plain
> (int, int, int),
> and got some methods like symmetry along a given line etc. Implemeting it
> inside
> TreeModelColumnRecord is impossible - no access to stored data. Making a
> class Foo
> that got 3 private ints leads me to no idea how to make this object viewable
> through
> view.
> Ideally, I look for something like as follows:
> I have a Store that has Foo objects. Then to a View I add columns like (x),
> (y), (z),
> corresponding to example above, and specify accessors methods inside Foo
> object, so that
> View can correctly save and show data to/from a Foo.
> One more problem connected with deriving from Gtk::TreeModelColumnRecord is
> that in my
> opinion it brakes OOP rule: its not Foo business to take care of being
> viewable,
> it exposes methods to modify itself and get stored data, but how it is done
> is just a matter of somebody
> writing class responsible for showing data to a user. Also storing
> everything in one place:
> data and display issues, is making code messy.
> I suppose that deriving my collection from ListStore or TreeStore will solve
> a problem
> of adding some methods to call on stored data.
> So far, after investigating materials I've found and after some talks on IRC
> channel
> the only idea I have is to keep data in two places and try to sync them, but
> it seems
> to be a pain in the neck, it also makes my memory usage twice as more... so
> its not
> a solution at all.
> I would appreciate any help with this problem, I am not looking for easy
> solutions,
> rather elegant.
> If elegant solution does not exist, then please point me the least awful way
> to do what I want.
> Looking forward to hearing from you,
> Regards,
> Adrian
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org

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