GraphicsContext Out of Context?
| From: | Ronald Vincent Tarrant | Date: | Fri, 11 Aug 2006 13:02:19 +0000 |
| Subject: | GraphicsContext Out of Context? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-3354@lists.php.net to get a copy of this message | ||
Hi all,
While playing around with the GtkDrawingArea widget, I came across something that's got me scratching my head. Perhaps I'm just not thinking straight this morning, but...
Why does a GtkDrawingArea need to be connected to an expose event before its GdkWindow is instantiated?
This works:
<?php
function doExpose($widget, $event)
{
$graphicsContext = new GdkGC($widget->window);
var_dump($graphicsContext);
}
$window = new GtkWindow();
$drawingArea = new GtkDrawingArea();
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
$drawingArea->connect('expose-event', 'doExpose');
$window->add($drawingArea);
$window->show_all();
Gtk::main();
?>
And this doesn't:
<?php
function doExpose($graphicsContext)
{
var_dump($graphicsContext);
} // doExpose()
$window = new GtkWindow();
$drawingArea = new GtkDrawingArea();
$graphicsContext = new GdkGC($drawingArea->window);
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
$drawingArea->connect_simple('expose-event', 'doExpose', $graphicsContext);
$window->add($drawingArea);
$window->show_all();
Gtk::main();
?>
Any insights would very much appreciated.
-Ron T.