GtkPlug and GtkSocket
| From: | Sean | Date: | Thu, 12 Jan 2006 21:13:25 +0000 |
| Subject: | GtkPlug and GtkSocket | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-2182@lists.php.net to get a copy of this message | ||
Hello all..
Have the GtkPlug and Socket classes been fully implemented yet for linux? I
get the following error anytime I try to create a GtkPlug object.
"Fatal error: Class GtkPlug cannot be instantiated directly"
I've been trying any GtkPlug demo/sample code I can find for the original
php-gtk without any luck... maybe I'm missing some new syntax or rules with
php-gtk2 ?
Thanks for your time.
- Sean
<?php
//file: window.php
$label = new GtkLabel( '...SHOW ME THE WINDOW !!!');
$window = new GtkWindow();
$window->connect_simple('destroy', array('gtk', 'main_quit'));
$window->set_title( 'this window will be stolen');
$window->set_default_size( 200, 100);
$vbox = new GtkVBox();
$window->add( $label);
$window->show_all();
echo 'window xid: ' . $window->window->xid . "\r\n";
Gtk::main();
?>
...then run
<?php
//file: plugin.php
if( $GLOBALS['argc'] !== 2) {
//check to see if winXID was passed
die ("\r\n! Please pass the Window XID you wish to plug (try: xwininfo
-int) !\r\n\r\n");
}
$win = new GtkWindow();
$win->set_position(Gtk::WIN_POS_CENTER);
$win->set_default_size(640, 480);
$win->connect_simple('destroy', array('gtk', 'main_quit'));
$win->set_title('you complete me, if you can...');
//setup the socket
$sock = new GtkSocket();
$win->add($sock);
$sock->realize();
$sock_id = $sock->$GLOBALS['argv'][1];
//use the window xid passed in
$plug = new GtkPlug($GLOBALS['argv'][1]);
$plug->construct($sock_id);
$plug->show_all();
$win->show_all();
Gtk::main();
?>