FW: [PHP-GTK-DEV] create cursor

From: Date: Tue, 03 Aug 2004 16:27:21 +0000
Subject: FW: [PHP-GTK-DEV] create cursor
Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-665@lists.php.net to get a copy of this message
grr! -----Original Message----- From: Steph [mailto:steph@zend.com] Sent: 03 August 2004 17:24 To: Christian Weiske; PHP-GTK Dev list Subject: RE: [PHP-GTK-DEV] create cursor oops, forgot to add test script (based on Christian's). > -----Original Message----- > From: Steph [mailto:steph@zend.com] > Sent: 03 August 2004 17:16 > To: Christian Weiske; PHP-GTK Dev list > Subject: RE: [PHP-GTK-DEV] create cursor > > > It shouldn't have a pixmap as a second parameter - that looks like an > original GTK+ bug to me. Don't have the time to make a new build > and check > right now, but if anyone does, all you'd need to do is alter > gdk.defs so it > reads GdkBitmap for the second parameter of cursor_new_from_pixmap and > rebuild (for test purposes - actual fix should be added to overrides). > > Anyone? > > > -----Original Message----- > > From: Christian Weiske [mailto:cweiske@cweiske.de] > > Sent: 03 August 2004 16:12 > > To: PHP-GTK Dev list > > Subject: [PHP-GTK-DEV] create cursor > > > > > > 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 > > > > -- > PHP-GTK Development Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

<?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')); $cursorpmp = array( "5 5 2 1", "0 m white", "1 m black", "11111", "10000", "10000", "10000", "10000" ); $window->realize(); $gdkwin = $window->window; list($pixmap, $mask) = gdk::pixmap_create_from_xpm_d($gdkwin, null, $cursorpmp); $style = new GtkStyle(); $cursor =gdk::cursor_new_from_pixmap($pixmap, $mask, $style->white, $style->black, 1, 1); $gdkwin->set_cursor($cursor); $window->show(); gtk::main(); ?>
« previous php.gtk.dev (#665) next »