Web lists-archives.com

Events in custom widgets

Dear subscribers,

I want to create a custom widget derived from either GtkDrawingArea or GtkLayout (still do not know, which is better for my purpose - I need some advice).
Nevertheless, if I derive my widget from GtkDrawingArea, I can draw using Cairo (the draw callback gets called) but I cannot receive mouse events. I I replace the GtkDrawingArea with GtkLayout (in the same code) I am able to receive mouse events but cannot draw (the draw callback does not get called).

I need a plotting widget and I need the following features (many are standard requirements):
- have a grid sensitive to mouse (to invoke a configuring menu)
- add/remove plots
- plots sensitive to mouse (display the data coordinates)
- more cursors (to perform measurements)
- cursors capable of find edges of data plots
- scrolling

The widget should handle all tasks internally because I may want to put more widgets of the same into one window (vbox).

I would appreciate if somebody could help me to decide, whether GtkDrawingArea or GtkLayout (both with Cairo) is more suitable for my purpose. Then I would of course appreciate if somebody could help me to solve the above problems (draw, events).

I searched the net a lot but did not really find answers to my questions. I got already some useful examples but unfortunately these were not custom widgets.

Thank you in advance and best regards

gtk-list mailing list