Creating custom items using goocanvasmm



Hi List!

I'm trying to create a custom Goocanvas::Item, using the goocanvasmm library.


So far i've created 2 classes, the Model class inherits from Goocanvas::GroupModel, and the View class
from Goocanvas::Group.

I've implemented the View by creating Goocanvas::Items in the View's class constructor and adding it to it by calling add_child(someItem), Then, in the Model class i implement the application logic.

As far as creating the objects, i'm trying to use the Goocanvas::Canvas::create_item() method, like this:

Glib::RefPtr<myCustomItemModel> model = myCustomItemModel::create();
Glib::RefPtr<myCustomItem> item = Glib::RefPtr<myCustomItem>::cast_dynamic(canvas->create_item(model));

Here however the dynamic cast to myCustomItem fails.

Is this the way to use the model/view canvas properly, or did i misunderstand the whole concept ?


Thanks for your help!


Robert







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