create cursor
| From: | Christian Weiske | Date: | Tue, 03 Aug 2004 15:11:57 +0000 |
| Subject: | create cursor | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-662@lists.php.net to get a copy of this message | ||
Hi
Today I tried to create my own cursor....
The Gdk::cursor_new_from_pixmap requires two pixmaps, but the pixmaps may have only 2 colors, so it could be a bitmap (but that's gtk specific). Now I tried it, and the application crashes.
In the gtk manual they created the cursor with the help of gdk_bitmap_create_from_data, but that's missing in php-gtk.
Am I'm right assuming that the create_cursor won't work?
======================
<?php
if( !extension_loaded('gtk')) {
dl( 'php_gtk.' . PHP_SHLIB_SUFFIX);
}
$window = &new GtkWindow();
$window->set_default_size(300, 300);
$window->connect_object('destroy', array('gtk', 'main_quit'));
transparent = &new GdkColor(0, 0, 0);
$cursor = array(
"5 5 2 1",
"0 m white",
"1 m black",
"11111",
"10000",
"10000",
"10000",
"10000"
);
$cursormask = array(
"5 5 2 1",
"0 m white",
"1 m black",
"11111",
"10000",
"10000",
"10000",
"10000"
);
$window->realize();
list($pixmap, $mask) = Gdk::pixmap_create_from_xpm_d($window->window, $transparent, $cursor);
list($pixmask, $mask) = Gdk::pixmap_create_from_xpm_d($window->window, $transparent, $cursor);
$style = &new GtkStyle();
$cursor = Gdk::cursor_new_from_pixmap( $pixmap, $pixmask, $style->white, $style->black, 1, 1);
//$pixmapwid = &new GtkPixmap($pixmap, $mask);
//$window->add( $pixmapwid);
$window->show_all();
gtk::main();
?>
======================
Regards/MfG,
Christian Weiske
--
XMMS is playing now:
Christina Aguilera - Infatuation
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc