Re: How to change cursor
- From: Gregory Hosler <ghosler redhat com>
- To: AlannY <m alanny ru>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: How to change cursor
- Date: Tue, 25 Mar 2008 22:17:49 +0800
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
AlannY wrote:
| Hi there, my name is Alan.
|
| I have a custom widget and I want to change mouse cursor while it exists
| on some (custom) area of my widget. So ANSI art:
|
| +-----------------+
| | Custom widget |
| | +------+ |
| | | area | |
| | +------+ |
| +-----------------+
|
| I need to change cursor from "pointer (arrow)" to "hand" when mouse cursor
hovers over that area.
|
| I think, I need to capture "motion_notify_event" and check where cursor
| places, but how to change cursor image? I found a "gdk_window_set_cursor"
| function, but it takes "widget->window" as a parameter (not area).
| I'm really sorry, but now I can't check it. Is it a right way?
I'm getting ready to just about this exact thing, with 1 minor difference. My
"area" is a separate GtkVbox (which will have it's own window).
I haven't coded it yet, but from my looking at the dev pages
1) yes, you need to enable the GDK_ENTER_NOTIFY_MASK mask
2) you need to capture the enter-notify-event & leave-notify-event's
3) in the enter/leave notify events, you need to issue a
"gdk_window_set_cursor" (which means that in the enter, you will need to
actually create that cursor, at least the 1st time, "gdk_cursor_new..."
Most of the info on enabling NOTIFY MASK, and the enter/leave signals (and what
the signal handler receives :) is documented in the GtkWidget page.
Hope that helps. I'll be doing this in about a week, more or less, so if you
have more questions, a week from now, I should be able to give you fresh info.
:)
best rgds,
- -Greg
| Thank you.
| _______________________________________________
| gtk-app-devel-list mailing list
| gtk-app-devel-list gnome org
| http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
- --
+---------------------------------------------------------------------+
Please also check the log file at "/dev/null" for additional information.
~ (from /var/log/Xorg.setup.log)
| Greg Hosler ghosler redhat com |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFH6QmL404fl/0CV/QRAnGvAJ97qexOlpKSY1D8AfRhdAKEnTe6YACcCdpm
4patM4ro4eRwkGHVKdppCPQ=
=1kOW
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]