This page will give you an introduction into the core design concepts of libccc.
- retained mode API
- similar to GNOME canvas
1. Container Items
With libccc, every item is a potential container. And - even more important - items don't lose this capability when inheriting. This make a great difference for everyone who wants to compose items: to create a text with a frame, you can easily do this:
CcItem* text = cc_text_new (); CcItem* frame = cc_rectangle_new (); cc_text_set_text (CC_TEXT (text), "libccc makes item composition very easy"); cc_item_append (text, frame);
And you're done. With GnomeCanvas you had to create a group and then but both of the items into it (which requires more code for the developers to write - which is unnecessary in such a case).
2. Useful Text Item
CcText provides all the required features for editable text. You can easily create your own editable text elements, by just using the CcText item for the text display and by forwarding events to it.
3. Model/View
I decided to keep all the information about a canvas item within one class for this item (the alternative would be having CanvasItems in the model and one ViewItem per CanvasItem in each view). This way creating new items can be done by implementing one new class instead of two.
4. Event handling
Event handling got a lot better than with GNOME Canvas: there is still one generic "event" signal for each CcItem, but there are also other signals like "motion-notify-event", "button-press-event", "enter-notify-event" (similar to GtkWidget).
And its also easier to get signals that are not forwarded to any item. Just g_signal_connect() on the CcViewWidget to the type of event that your interested in and get any event that doesn't get processed by an item.
5. More
Of course, there's a lot more. I'll try to get this page filles with more useful information later.