Re: cursors and eventboxes
| From: | Steph | Date: | Sat, 04 Jan 2003 18:21:33 +0000 |
| Subject: | Re: cursors and eventboxes | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2838@lists.php.net to get a copy of this message | ||
That'll be because it's a gdkwindow method :)
First you need to decide which cursor you're using - you can get this
info from GTK+ source, use gnome.org's lxr and trawl through
gtk+/gdk/gdkcursors.h, or by trial and tribulation (cursor numbers are
in the range 0 - 154 inclusive, even numbers only), or even by using the
'cursors' routine in Andrei's test/gtk.php which also gives this
information while running, I just noticed :). They're also enums of a
kind, so you could use the cursor name if you happen to know it (e.g.
GDK_HAND1, GDK_HAND2) - I'm assuming this from source, haven't tested
the theory but it should work.
You set up the cursor as a new cursor, e.g.
$cursor = gdk::cursor_new(58);
and then do:
$gdkwindow->set_cursor($cursor);
----- Original Message -----
From: "firepage" <firepage@firepages.org>
To: <php-gtk-general@lists.php.net>
Sent: Saturday, January 04, 2003 7:11 AM
Subject: [PHP-GTK] cursors and eventboxes
Hi, I am here again
I was trying to make a clickable link out of a GtkLabel & have managed
that to a point (i.e. it works)
$label= & new GtkLabel('blah')
$ebox = &new GtkEventBox();
$ebox->set_events(GDK_BUTTON_PRESS_MASK|GDK_ENTER_NOTIFY_MASK|GDK_LEAVE_
NOTIFY_MASK);
$ebox->connect('button-press-event',array(&$this,'e_hit));
$ebox->connect('enter-notify-event',array(&$this,'e_in'));
$ebox->connect('leave-notify-event',array(&$this,'e_out'));
$ebox->add($label);
but I would really like to set the cursor to a hand (or whatever) on
mouseover of the event box.
I looked at the cursor code in the example gtk.php file but just got
more confused as the set_cursor() function appears to call itself ? or
is there a Gtk method for set_cursor() ?if so I cant find it , basically
I am as confused as usual ;)
....gtk.php...
function set_cursor($spinner, $darea, $cur_name)
{
$c = $spinner->get_value_as_int();
$c = $c & 0xfe;
$cursor = gdk::cursor_new($c);
$window = $darea->window;
$window->set_cursor($cursor); /* cant seem to find set_cursor() in
the manual ? */
$cur_name->set_text($cursor->name);
}
errr one more thing ! , if I want to underline the text in GtkLabel....
do I have to count chars and set_pattern($set of lines) ? is there an
easier way ?
Regards
Simon Wheeler
firepages
firepages :: PHP/*SQL/Perl/Python/CDML/C++/C#/GTK/*NIX or Win32
data mining&divining/website design, hosting & DNS services
http://firepages.com.au :: http://firepages.org
Mob :: 0403358160 [preffered]
Ph :: (+61) 8 94192175
Fax :: no faxes please
general :: simon@firepages.com.au
hosting :: host@firepages.com.au
phpdev related :: phpdev@firepages.org
firepages :: ABN 65 991 214 711