Re: How to imitate the image map functionality in gtk?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Le Mardi 27 Août 2002 04:04, Bryan Cramer a écrit :
K,

What set of widgets should I use to achieve the same functionality as an
image map on a web page in gtk?  For example, I define an image of 100x100
pixels and want to trap a mouse click event in an area of 10x10 pixels at
offset 50x50 from top left?

Any insights?

Yes... add event "button_press_event" to your widget (draw area i think) with 
"gtk_signal_connect", so you receive a GdkEventButton with x & y position of 
the mouse as parameter of the callback. See GTK doc widget for details.

After it's easy to test if pos x & y is part of the rect..


Bryan

- -- 
A+

jmh
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9az8QYilIC5+/QnYRAgb3AJ93LM++jRf6xpWEy74YpC8l3FxCugCeNqcE
5bCnhhTvrG1PEBdQ/JitTlU=
=yAvm
-----END PGP SIGNATURE-----



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