Re: How to implement resizing handles?



On Sun, 2011-11-13 at 01:26 -0800, Linuxer Wang wrote:
> Hi, all
> 
> Does anybody know how to add resizing handles to a goocanvas item?  I 
> mean the eight small squares surrounding a widget so that you can use 
> your mouse to drag them to resize the widget.  Is it an existing 
> function in goocanvas?  Or do I need to implement it with children items 
> and event handling?  If it's the latter, could anybody give a 
> not-too-concise description of the implementation?

Sorry, I missed this.

You would need to create new items for each of the small squares, then
connect to the button signals on them:

  g_signal_connect (item, "motion_notify_event",
		    G_CALLBACK (on_motion_notify), NULL);
  g_signal_connect (item, "button_press_event",
		    G_CALLBACK (on_button_press), NULL);
  g_signal_connect (item, "button_release_event",
		    G_CALLBACK (on_button_release), NULL);

In the signal handlers you'd have to adjust the item and the handles.

Damon




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