[gtkmm] Gtk::CellRenderer, GLib::Property<>, and associated adventures




I've already wasted about a day's work on trying to figure this out by romping through the sources of GTK+, Glib, GTKMM, and GLIBMM and seem to not be getting to where I need to be.

I did a few searches on the mailing list archive to see of these issues had been discussed before, and I came up empty. If this is a topic that has been discussed before, I truly apologize -- being pointed in the right direction would be helpful.

I recently switched from using GTK+ 1.2.10 to using GTK+ 2.0.6 and GTKMM 1.3.24. The primary reason for this switch was because the Gtk::TreeView widget seemed to be much more flexible than the GTK+ 1.2 equivalent. I decided also switch to GTKMM because wrapping a C++ library with a C GUI library getting quite messy.

Things have been moving along smoothly until it came time to write my own custom CellRenderer. The CellRenderer I am writing is a track-view for creating,selecting,moving, and editing of waypoints that describe different values over time.

In attempting to wrestle with this, I realized that what I needed to create was a custom "property" for my CellRenderer that would hold the datatype that describes the waypoints. I could then use the Gtk::TreeViewColumn::add_attribute function to link that property to a specific field in my Gtk::TreeModel(Which just happens to be a Gtk::TreeView). So, I was off to research about how to add my own property to my CellRenderer. Just one property. Sounded simple...

This is where my adventure really began. First, I assumed that all I needed was a GLib::Property<> in my class to describe my property -- which would, at construction, be attached to my CellRenderer. This obviously didn't work. Finding no documentation on the subject of how to use the GLib::Property<> class and it's associated classes, I began to romp through the sources of GLIBMM.

The best documentation on the issue was in a fairly large comment at the top of glib/glibmm/property.cc. After some more research I figured out how the GLib::Property<> class was supposed to work, and why it wasn't working now. It needs to use it's own "get_property" and "set_property" functions in the widget's class structure.

So, I guess this means that I need to write a new class structure, and thus create a new widget all together. My question is, what is the best way to go about it? Is there a way that I can do this in GTKMM? Should I just write the widget in C and then try to wrap GTKMM around it? Is there a better way that I'm missing here?

Thanks in advance. This issue is starting to get depressing.

- darco
http://www.deepdarc.com


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