cvs: php-gtk / NEWS /ext/gtk+ gdk.overrides gtk-extrafuncs.defs gtk.defs gtk.overrides php_gtk+.h php_gtk+_types.c /generator arg_types.php
| From: | Andrei Zmievski | Date: | Thu, 19 Jul 2001 05:24:16 +0000 |
| Subject: | cvs: php-gtk / NEWS /ext/gtk+ gdk.overrides gtk-extrafuncs.defs gtk.defs gtk.overrides php_gtk+.h php_gtk+_types.c /generator arg_types.php | ||
| Groups: | php.gtk | ||
| Request: | Send a blank email to php-gtk+get-2278@lists.php.net to get a copy of this message | ||
andrei Thu Jul 19 01:24:16 2001 EDT
Modified files:
/php-gtk NEWS
/php-gtk/ext/gtk+ gdk.overrides gtk-extrafuncs.defs gtk.defs
gtk.overrides php_gtk+.h php_gtk+_types.c
/php-gtk/generator arg_types.php
Log:
- Modified GdkWindow::get_pointer() to be simpler, without XInput support.
- Changed 'area' event property to be an allocation.
- Changed 'is_hint' event property to be boolean.
- Added ability to query the state and allocation of a widget.
- Added direct construction of pixmaps.
- Added initial GdkDrawable support to argument parser.
- Added Scribble example.
Index: php-gtk/NEWS diff -u php-gtk/NEWS:1.29 php-gtk/NEWS:1.30 --- php-gtk/NEWS:1.29 Wed Jul 18 11:40:39 2001 +++ php-gtk/NEWS Thu Jul 19 01:24:15 2001 @@ -1,3 +1,10 @@ + - ported Scribble example from C. (Andrei) + - modified GdkWindow::get_pointer() to be simpler, without XInput support. + (Andrei) + - changed 'area' event property to be an allocation. (Andrei) + - changed 'is_hint' event property to be boolean. (Andrei) + - added ability to query the state and allocation of a widget. (Andrei) + - added direct construction of pixmaps. (Andrei) - added GdkWindow::set_icon() method. (Andrei) - implemented GtkList methods insert_items() and prepend_items. (Andrei) - implemented new PHP-like build system that supports adding extensions to Index: php-gtk/ext/gtk+/gdk.overrides diff -u php-gtk/ext/gtk+/gdk.overrides:1.2 php-gtk/ext/gtk+/gdk.overrides:1.3 --- php-gtk/ext/gtk+/gdk.overrides:1.2 Tue Jul 10 14:27:49 2001 +++ php-gtk/ext/gtk+/gdk.overrides Thu Jul 19 01:24:16 2001 @@ -4,6 +4,9 @@ GdkDebugFlag GdkColorInfoFlags %% +ignore + gdk_pixmap_new +%% override gdk_color_parse PHP_FUNCTION(wrap_gdk_color_parse) { Index: php-gtk/ext/gtk+/gtk-extrafuncs.defs diff -u php-gtk/ext/gtk+/gtk-extrafuncs.defs:1.2 php-gtk/ext/gtk+/gtk-extrafuncs.defs:1.3 --- php-gtk/ext/gtk+/gtk-extrafuncs.defs:1.2 Tue Jul 10 14:27:49 2001 +++ php-gtk/ext/gtk+/gtk-extrafuncs.defs Thu Jul 19 01:24:16 2001 @@ -20,6 +20,12 @@ (parameter (type-and-name guint flags)) ) +(method state + (of-object Widget (Gtk)) + (c-name GTK_WIDGET_STATE) + (return-type guint) +) + (method get_allocation (of-object Widget (Gtk)) (c-name gtk_widget_get_allocation) Index: php-gtk/ext/gtk+/gtk.defs diff -u php-gtk/ext/gtk+/gtk.defs:1.3 php-gtk/ext/gtk+/gtk.defs:1.4 --- php-gtk/ext/gtk+/gtk.defs:1.3 Fri Jul 13 16:25:06 2001 +++ php-gtk/ext/gtk+/gtk.defs Thu Jul 19 01:24:16 2001 @@ -42,6 +42,7 @@ (c-name GtkWidget) (field (type-and-name GtkStyle* style)) (field (type-and-name GdkWindow* window)) + (field (type-and-name GtkAllocation allocation)) ) (object Separator Index: php-gtk/ext/gtk+/gtk.overrides diff -u php-gtk/ext/gtk+/gtk.overrides:1.3 php-gtk/ext/gtk+/gtk.overrides:1.4 --- php-gtk/ext/gtk+/gtk.overrides:1.3 Thu Jul 12 14:11:06 2001 +++ php-gtk/ext/gtk+/gtk.overrides Thu Jul 19 01:24:16 2001 @@ -2023,3 +2023,12 @@ gtk_editable_insert_text(GTK_EDITABLE(PHP_GTK_GET(this_ptr)), text, len, &pos); RETURN_LONG(pos); } +%% +getprop GtkWidget allocation + GtkWidget *widget = GTK_WIDGET(PHP_GTK_GET(object)); + + object_init_ex(return_value, gtk_allocation_ce); + add_property_long(return_value, "x", widget->allocation.x); + add_property_long(return_value, "y", widget->allocation.y); + add_property_long(return_value, "width", widget->allocation.width); + add_property_long(return_value, "height", widget->allocation.height); Index: php-gtk/ext/gtk+/php_gtk+.h diff -u php-gtk/ext/gtk+/php_gtk+.h:1.4 php-gtk/ext/gtk+/php_gtk+.h:1.5 --- php-gtk/ext/gtk+/php_gtk+.h:1.4 Mon Jul 16 17:17:59 2001 +++ php-gtk/ext/gtk+/php_gtk+.h Thu Jul 19 01:24:16 2001 @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: php_gtk+.h,v 1.4 2001/07/16 21:17:59 andrei Exp $: */ +/* $Id: php_gtk+.h,v 1.5 2001/07/19 05:24:16 andrei Exp $: */ #ifndef _PHP_GTK_PLUS_H #define _PHP_GTK_PLUS_H @@ -80,6 +80,7 @@ extern PHP_GTK_EXPORT_CE(gtk_box_child_ce); extern PHP_GTK_EXPORT_CE(gtk_fixed_child_ce); extern PHP_GTK_EXPORT_CE(gtk_clist_row_ce); +extern PHP_GTK_EXPORT_CE(gtk_allocation_ce); #include "gen_ce_gtk.h" Index: php-gtk/ext/gtk+/php_gtk+_types.c diff -u php-gtk/ext/gtk+/php_gtk+_types.c:1.4 php-gtk/ext/gtk+/php_gtk+_types.c:1.5 --- php-gtk/ext/gtk+/php_gtk+_types.c:1.4 Wed Jul 18 11:40:39 2001 +++ php-gtk/ext/gtk+/php_gtk+_types.c Thu Jul 19 01:24:16 2001 @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: php_gtk+_types.c,v 1.4 2001/07/18 15:40:39 andrei Exp $ */ +/* $Id: php_gtk+_types.c,v 1.5 2001/07/19 05:24:16 andrei Exp $ */ #include "php_gtk.h" @@ -59,7 +59,8 @@ PHP_GTK_EXPORT_CE(gtk_box_child_ce); PHP_GTK_EXPORT_CE(gtk_fixed_child_ce); PHP_GTK_EXPORT_CE(gtk_clist_row_ce); -; +PHP_GTK_EXPORT_CE(gtk_allocation_ce); + /* GdkEvent */ static function_entry php_gdk_event_functions[] = { {"gdkevent", PHP_FN(wrap_no_direct_constructor), NULL}, @@ -96,11 +97,12 @@ break; case GDK_EXPOSE: - value = php_gtk_build_value("(iiii)", - event->expose.area.x, - event->expose.area.y, - event->expose.area.width, - event->expose.area.height); + MAKE_STD_ZVAL(value); + object_init_ex(value, gtk_allocation_ce); + add_property_long(value, "x", event->expose.area.x); + add_property_long(value, "y", event->expose.area.y); + add_property_long(value, "width", event->expose.area.width); + add_property_long(value, "height", event->expose.area.height); zend_hash_update(Z_OBJPROP_P(result), "area", sizeof("area"), &value, sizeof(zval *), NULL); add_property_long(result, "count", event->expose.count); break; @@ -113,7 +115,7 @@ add_property_double(result, "xtilt", event->motion.xtilt); add_property_double(result, "ytilt", event->motion.ytilt); add_property_long(result, "state", event->motion.state); - add_property_long(result, "is_hint", event->motion.is_hint); + add_property_bool(result, "is_hint", event->motion.is_hint); add_property_long(result, "source", event->motion.source); add_property_long(result, "deviceid", event->motion.deviceid); add_property_double(result, "x_root", event->motion.x_root); @@ -260,17 +262,16 @@ PHP_FUNCTION(gdk_window_get_pointer) { - guint32 deviceid; - gdouble x = 0.0, y = 0.0, pressure = 0.0, xtilt = 0.0, ytilt = 0.0; + gint x, y; GdkModifierType mask = 0; NOT_STATIC_METHOD(); - if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "i", &deviceid)) + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) return; - gdk_input_window_get_pointer(PHP_GDK_WINDOW_GET(this_ptr), deviceid, &x, &y, &pressure, &xtilt, &ytilt, &mask); - *return_value = *php_gtk_build_value("(dddddi)", x, y, pressure, xtilt, ytilt, mask); + gdk_window_get_pointer(PHP_GDK_WINDOW_GET(this_ptr), &x, &y, &mask); + *return_value = *php_gtk_build_value("(iii)", x, y, mask); } PHP_FUNCTION(gdk_window_set_cursor) @@ -575,8 +576,33 @@ {NULL, NULL, NULL} }; +PHP_FUNCTION(gdkpixmap) +{ + GdkWindow *window = NULL; + zval *php_window, *ret; + long width, height, depth; + GdkPixmap *wrapped_obj = NULL; + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "Niii", &php_window, gdk_window_ce, &width, &height, &depth)) { + php_gtk_invalidate(this_ptr); + return; + } + + if (Z_TYPE_P(php_window) != IS_NULL) + window = PHP_GDK_WINDOW_GET(php_window); + + wrapped_obj = gdk_pixmap_new(window, (gint)width, (gint)height, (gint)depth); + if (!wrapped_obj) { + php_error(E_WARNING, "%s(): could not create GtkWindow object", + get_active_function_name()); + return; + } + + php_gtk_set_object(this_ptr, wrapped_obj, le_gdk_window); +} + static function_entry php_gdk_pixmap_functions[] = { - {"gdkpixmap", PHP_FN(wrap_no_direct_constructor), NULL}, + {"gdkpixmap", PHP_FN(gdkpixmap), NULL}, {"new_gc", PHP_FN(gdk_window_new_gc), NULL}, {"property_get", PHP_FN(gdk_window_property_get), NULL}, {"property_change", PHP_FN(gdk_window_property_change), NULL}, @@ -2547,6 +2573,9 @@ INIT_OVERLOADED_CLASS_ENTRY(ce, "gtkclistrow", NULL, NULL, php_gtk_get_property, php_gtk_set_property); gtk_clist_row_ce = zend_register_internal_class_ex(&ce, NULL, NULL); php_gtk_register_prop_getter(gtk_clist_row_ce, gtk_clist_row_get_property); + + INIT_CLASS_ENTRY(ce, "gtkallocation", NULL); + gtk_allocation_ce = zend_register_internal_class_ex(&ce, &zend_standard_class_def, NULL); } #endif Index: php-gtk/generator/arg_types.php diff -u php-gtk/generator/arg_types.php:1.22 php-gtk/generator/arg_types.php:1.23 --- php-gtk/generator/arg_types.php:1.22 Fri May 4 00:31:39 2001 +++ php-gtk/generator/arg_types.php Thu Jul 19 01:24:16 2001 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: arg_types.php,v 1.22 2001/05/04 04:31:39 andrei Exp $ */ +/* $Id: arg_types.php,v 1.23 2001/07/19 05:24:16 andrei Exp $ */ /*======================================================================*\ Function: convert_typename @@ -443,6 +443,89 @@ } } +class Drawable_Arg extends Arg_Type { + var $type = 'GdkDrawable'; + + function write_param($type, $name, $default, $null_ok, &$var_list, + &$parse_list, &$arg_list, &$extra_code, $in_constructor) + { + if ($null_ok) { + if (isset($default)) { + $var_list->add($this->type, '*' . $name . ' = ' . $default); + $var_list->add('zval', '*php_' . $name . ' = NULL'); + $extra_code[] = " if (php_$name) {\n" . + " if (Z_TYPE_P(php_$name) == IS_NULL)\n" . + " $name = NULL;\n" . + " else\n" . + " $name = PHP_" . strtoupper($this->php_type). "_GET(php_" . $name . ");\n" . + " }\n"; + } else { + $var_list->add($this->type, '*' . $name); + $var_list->add('zval', '*php_' . $name); + $extra_code[] = + " if (Z_TYPE_P(php_$name) == IS_NULL) + $name = NULL; + if (php_gtk_check_class(php_$name, gdk_window_ce)) + $name = (GdkDrawable *)PHP_GDK_WINDOW_GET(php_$name); + else if(php_gtk_check_class(php_$name, gdk_pixmap_ce)) + $name = (GdkDrawable *)PHP_GDK_PIXMAP_GET(php_$name); + else if(php_gtk_check_class(php_$name, gdk_bitmap_ce)) + $name = (GdkDrawable *)PHP_GDK_BITMAP_GET(php_$name); + else { + php_error(E_WARNING, \"%s() expects the drawable to be GdkWindow, GdkPixmap, GdkBitmap, or null\", get_active_function_name()); + return; + } + "; + } + + $parse_list[] = '&php_' . $name; + $arg_list[] = $name; + + return 'V'; + } else { + if (isset($default)) { + $var_list->add($this->type, '*' . $name . ' = ' . $default); + $var_list->add('zval', '*php_' . $name . ' = NULL'); + + $parse_list[] = '&php_' . $name; + $parse_list[] = $this->php_type . '_ce'; + $arg_list[] = $name; + $extra_code[] = " if (php_$name)\n" . + " $name = PHP_" . strtoupper($this->php_type) . "_GET(" . $name . ");\n"; + } else { + $var_list->add($this->type, '*' . $name); + $var_list->add('zval', '*php_' . $name); + $parse_list[] = '&php_' . $name; + $arg_list[] = $name; + $extra_code[] = + " if (php_gtk_check_class(php_$name, gdk_window_ce)) + $name = (GdkDrawable *)PHP_GDK_WINDOW_GET(php_$name); + else if(php_gtk_check_class(php_$name, gdk_pixmap_ce)) + $name = (GdkDrawable *)PHP_GDK_PIXMAP_GET(php_$name); + else if(php_gtk_check_class(php_$name, gdk_bitmap_ce)) + $name = (GdkDrawable *)PHP_GDK_BITMAP_GET(php_$name); + else { + php_error(E_WARNING, \"%s() expects the drawable to be GdkWindow, GdkPixmap, or GdkBitmap\", get_active_function_name()); + return; + } + "; + } + + return 'V'; + } + } + + function write_return($type, &$var_list, $separate) + { + $var_list->add('zval', '*ret'); + return " ret = php_" . $this->php_type . "_new(%s);\n" . + ($separate ? " SEPARATE_ZVAL(&ret);\n" : "") . + " *return_value = *ret;\n" . + " return;"; + } +} + + class Arg_Matcher { var $arg_types = array(); @@ -535,11 +618,13 @@ $arg = new Atom_Arg(); $matcher->register('GdkAtom', $arg); +$arg = new Drawable_Arg(); +$matcher->register('GdkDrawable*', $arg); + $matcher->register_boxed('GdkEvent', 'gdk_event'); $matcher->register_boxed('GdkWindow', 'gdk_window'); $matcher->register_boxed('GdkPixmap', 'gdk_pixmap'); $matcher->register_boxed('GdkBitmap', 'gdk_bitmap'); -$matcher->register('GdkDrawable*', $matcher->get('GdkWindow*')); $matcher->register_boxed('GdkColor', 'gdk_color'); $matcher->register_boxed('GdkColormap', 'gdk_colormap'); $matcher->register_boxed('GdkCursor', 'gdk_cursor');
Index: php-gtk/NEWS diff -u php-gtk/NEWS:1.29 php-gtk/NEWS:1.30 --- php-gtk/NEWS:1.29 Wed Jul 18 11:40:39 2001 +++ php-gtk/NEWS Thu Jul 19 01:24:15 2001 @@ -1,3 +1,10 @@ + - ported Scribble example from C. (Andrei) + - modified GdkWindow::get_pointer() to be simpler, without XInput support. + (Andrei) + - changed 'area' event property to be an allocation. (Andrei) + - changed 'is_hint' event property to be boolean. (Andrei) + - added ability to query the state and allocation of a widget. (Andrei) + - added direct construction of pixmaps. (Andrei) - added GdkWindow::set_icon() method. (Andrei) - implemented GtkList methods insert_items() and prepend_items. (Andrei) - implemented new PHP-like build system that supports adding extensions to Index: php-gtk/ext/gtk+/gdk.overrides diff -u php-gtk/ext/gtk+/gdk.overrides:1.2 php-gtk/ext/gtk+/gdk.overrides:1.3 --- php-gtk/ext/gtk+/gdk.overrides:1.2 Tue Jul 10 14:27:49 2001 +++ php-gtk/ext/gtk+/gdk.overrides Thu Jul 19 01:24:16 2001 @@ -4,6 +4,9 @@ GdkDebugFlag GdkColorInfoFlags %% +ignore + gdk_pixmap_new +%% override gdk_color_parse PHP_FUNCTION(wrap_gdk_color_parse) { Index: php-gtk/ext/gtk+/gtk-extrafuncs.defs diff -u php-gtk/ext/gtk+/gtk-extrafuncs.defs:1.2 php-gtk/ext/gtk+/gtk-extrafuncs.defs:1.3 --- php-gtk/ext/gtk+/gtk-extrafuncs.defs:1.2 Tue Jul 10 14:27:49 2001 +++ php-gtk/ext/gtk+/gtk-extrafuncs.defs Thu Jul 19 01:24:16 2001 @@ -20,6 +20,12 @@ (parameter (type-and-name guint flags)) ) +(method state + (of-object Widget (Gtk)) + (c-name GTK_WIDGET_STATE) + (return-type guint) +) + (method get_allocation (of-object Widget (Gtk)) (c-name gtk_widget_get_allocation) Index: php-gtk/ext/gtk+/gtk.defs diff -u php-gtk/ext/gtk+/gtk.defs:1.3 php-gtk/ext/gtk+/gtk.defs:1.4 --- php-gtk/ext/gtk+/gtk.defs:1.3 Fri Jul 13 16:25:06 2001 +++ php-gtk/ext/gtk+/gtk.defs Thu Jul 19 01:24:16 2001 @@ -42,6 +42,7 @@ (c-name GtkWidget) (field (type-and-name GtkStyle* style)) (field (type-and-name GdkWindow* window)) + (field (type-and-name GtkAllocation allocation)) ) (object Separator Index: php-gtk/ext/gtk+/gtk.overrides diff -u php-gtk/ext/gtk+/gtk.overrides:1.3 php-gtk/ext/gtk+/gtk.overrides:1.4 --- php-gtk/ext/gtk+/gtk.overrides:1.3 Thu Jul 12 14:11:06 2001 +++ php-gtk/ext/gtk+/gtk.overrides Thu Jul 19 01:24:16 2001 @@ -2023,3 +2023,12 @@ gtk_editable_insert_text(GTK_EDITABLE(PHP_GTK_GET(this_ptr)), text, len, &pos); RETURN_LONG(pos); } +%% +getprop GtkWidget allocation + GtkWidget *widget = GTK_WIDGET(PHP_GTK_GET(object)); + + object_init_ex(return_value, gtk_allocation_ce); + add_property_long(return_value, "x", widget->allocation.x); + add_property_long(return_value, "y", widget->allocation.y); + add_property_long(return_value, "width", widget->allocation.width); + add_property_long(return_value, "height", widget->allocation.height); Index: php-gtk/ext/gtk+/php_gtk+.h diff -u php-gtk/ext/gtk+/php_gtk+.h:1.4 php-gtk/ext/gtk+/php_gtk+.h:1.5 --- php-gtk/ext/gtk+/php_gtk+.h:1.4 Mon Jul 16 17:17:59 2001 +++ php-gtk/ext/gtk+/php_gtk+.h Thu Jul 19 01:24:16 2001 @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: php_gtk+.h,v 1.4 2001/07/16 21:17:59 andrei Exp $: */ +/* $Id: php_gtk+.h,v 1.5 2001/07/19 05:24:16 andrei Exp $: */ #ifndef _PHP_GTK_PLUS_H #define _PHP_GTK_PLUS_H @@ -80,6 +80,7 @@ extern PHP_GTK_EXPORT_CE(gtk_box_child_ce); extern PHP_GTK_EXPORT_CE(gtk_fixed_child_ce); extern PHP_GTK_EXPORT_CE(gtk_clist_row_ce); +extern PHP_GTK_EXPORT_CE(gtk_allocation_ce); #include "gen_ce_gtk.h" Index: php-gtk/ext/gtk+/php_gtk+_types.c diff -u php-gtk/ext/gtk+/php_gtk+_types.c:1.4 php-gtk/ext/gtk+/php_gtk+_types.c:1.5 --- php-gtk/ext/gtk+/php_gtk+_types.c:1.4 Wed Jul 18 11:40:39 2001 +++ php-gtk/ext/gtk+/php_gtk+_types.c Thu Jul 19 01:24:16 2001 @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: php_gtk+_types.c,v 1.4 2001/07/18 15:40:39 andrei Exp $ */ +/* $Id: php_gtk+_types.c,v 1.5 2001/07/19 05:24:16 andrei Exp $ */ #include "php_gtk.h" @@ -59,7 +59,8 @@ PHP_GTK_EXPORT_CE(gtk_box_child_ce); PHP_GTK_EXPORT_CE(gtk_fixed_child_ce); PHP_GTK_EXPORT_CE(gtk_clist_row_ce); -; +PHP_GTK_EXPORT_CE(gtk_allocation_ce); + /* GdkEvent */ static function_entry php_gdk_event_functions[] = { {"gdkevent", PHP_FN(wrap_no_direct_constructor), NULL}, @@ -96,11 +97,12 @@ break; case GDK_EXPOSE: - value = php_gtk_build_value("(iiii)", - event->expose.area.x, - event->expose.area.y, - event->expose.area.width, - event->expose.area.height); + MAKE_STD_ZVAL(value); + object_init_ex(value, gtk_allocation_ce); + add_property_long(value, "x", event->expose.area.x); + add_property_long(value, "y", event->expose.area.y); + add_property_long(value, "width", event->expose.area.width); + add_property_long(value, "height", event->expose.area.height); zend_hash_update(Z_OBJPROP_P(result), "area", sizeof("area"), &value, sizeof(zval *), NULL); add_property_long(result, "count", event->expose.count); break; @@ -113,7 +115,7 @@ add_property_double(result, "xtilt", event->motion.xtilt); add_property_double(result, "ytilt", event->motion.ytilt); add_property_long(result, "state", event->motion.state); - add_property_long(result, "is_hint", event->motion.is_hint); + add_property_bool(result, "is_hint", event->motion.is_hint); add_property_long(result, "source", event->motion.source); add_property_long(result, "deviceid", event->motion.deviceid); add_property_double(result, "x_root", event->motion.x_root); @@ -260,17 +262,16 @@ PHP_FUNCTION(gdk_window_get_pointer) { - guint32 deviceid; - gdouble x = 0.0, y = 0.0, pressure = 0.0, xtilt = 0.0, ytilt = 0.0; + gint x, y; GdkModifierType mask = 0; NOT_STATIC_METHOD(); - if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "i", &deviceid)) + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) return; - gdk_input_window_get_pointer(PHP_GDK_WINDOW_GET(this_ptr), deviceid, &x, &y, &pressure, &xtilt, &ytilt, &mask); - *return_value = *php_gtk_build_value("(dddddi)", x, y, pressure, xtilt, ytilt, mask); + gdk_window_get_pointer(PHP_GDK_WINDOW_GET(this_ptr), &x, &y, &mask); + *return_value = *php_gtk_build_value("(iii)", x, y, mask); } PHP_FUNCTION(gdk_window_set_cursor) @@ -575,8 +576,33 @@ {NULL, NULL, NULL} }; +PHP_FUNCTION(gdkpixmap) +{ + GdkWindow *window = NULL; + zval *php_window, *ret; + long width, height, depth; + GdkPixmap *wrapped_obj = NULL; + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "Niii", &php_window, gdk_window_ce, &width, &height, &depth)) { + php_gtk_invalidate(this_ptr); + return; + } + + if (Z_TYPE_P(php_window) != IS_NULL) + window = PHP_GDK_WINDOW_GET(php_window); + + wrapped_obj = gdk_pixmap_new(window, (gint)width, (gint)height, (gint)depth); + if (!wrapped_obj) { + php_error(E_WARNING, "%s(): could not create GtkWindow object", + get_active_function_name()); + return; + } + + php_gtk_set_object(this_ptr, wrapped_obj, le_gdk_window); +} + static function_entry php_gdk_pixmap_functions[] = { - {"gdkpixmap", PHP_FN(wrap_no_direct_constructor), NULL}, + {"gdkpixmap", PHP_FN(gdkpixmap), NULL}, {"new_gc", PHP_FN(gdk_window_new_gc), NULL}, {"property_get", PHP_FN(gdk_window_property_get), NULL}, {"property_change", PHP_FN(gdk_window_property_change), NULL}, @@ -2547,6 +2573,9 @@ INIT_OVERLOADED_CLASS_ENTRY(ce, "gtkclistrow", NULL, NULL, php_gtk_get_property, php_gtk_set_property); gtk_clist_row_ce = zend_register_internal_class_ex(&ce, NULL, NULL); php_gtk_register_prop_getter(gtk_clist_row_ce, gtk_clist_row_get_property); + + INIT_CLASS_ENTRY(ce, "gtkallocation", NULL); + gtk_allocation_ce = zend_register_internal_class_ex(&ce, &zend_standard_class_def, NULL); } #endif Index: php-gtk/generator/arg_types.php diff -u php-gtk/generator/arg_types.php:1.22 php-gtk/generator/arg_types.php:1.23 --- php-gtk/generator/arg_types.php:1.22 Fri May 4 00:31:39 2001 +++ php-gtk/generator/arg_types.php Thu Jul 19 01:24:16 2001 @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: arg_types.php,v 1.22 2001/05/04 04:31:39 andrei Exp $ */ +/* $Id: arg_types.php,v 1.23 2001/07/19 05:24:16 andrei Exp $ */ /*======================================================================*\ Function: convert_typename @@ -443,6 +443,89 @@ } } +class Drawable_Arg extends Arg_Type { + var $type = 'GdkDrawable'; + + function write_param($type, $name, $default, $null_ok, &$var_list, + &$parse_list, &$arg_list, &$extra_code, $in_constructor) + { + if ($null_ok) { + if (isset($default)) { + $var_list->add($this->type, '*' . $name . ' = ' . $default); + $var_list->add('zval', '*php_' . $name . ' = NULL'); + $extra_code[] = " if (php_$name) {\n" . + " if (Z_TYPE_P(php_$name) == IS_NULL)\n" . + " $name = NULL;\n" . + " else\n" . + " $name = PHP_" . strtoupper($this->php_type). "_GET(php_" . $name . ");\n" . + " }\n"; + } else { + $var_list->add($this->type, '*' . $name); + $var_list->add('zval', '*php_' . $name); + $extra_code[] = + " if (Z_TYPE_P(php_$name) == IS_NULL) + $name = NULL; + if (php_gtk_check_class(php_$name, gdk_window_ce)) + $name = (GdkDrawable *)PHP_GDK_WINDOW_GET(php_$name); + else if(php_gtk_check_class(php_$name, gdk_pixmap_ce)) + $name = (GdkDrawable *)PHP_GDK_PIXMAP_GET(php_$name); + else if(php_gtk_check_class(php_$name, gdk_bitmap_ce)) + $name = (GdkDrawable *)PHP_GDK_BITMAP_GET(php_$name); + else { + php_error(E_WARNING, \"%s() expects the drawable to be GdkWindow, GdkPixmap, GdkBitmap, or null\", get_active_function_name()); + return; + } + "; + } + + $parse_list[] = '&php_' . $name; + $arg_list[] = $name; + + return 'V'; + } else { + if (isset($default)) { + $var_list->add($this->type, '*' . $name . ' = ' . $default); + $var_list->add('zval', '*php_' . $name . ' = NULL'); + + $parse_list[] = '&php_' . $name; + $parse_list[] = $this->php_type . '_ce'; + $arg_list[] = $name; + $extra_code[] = " if (php_$name)\n" . + " $name = PHP_" . strtoupper($this->php_type) . "_GET(" . $name . ");\n"; + } else { + $var_list->add($this->type, '*' . $name); + $var_list->add('zval', '*php_' . $name); + $parse_list[] = '&php_' . $name; + $arg_list[] = $name; + $extra_code[] = + " if (php_gtk_check_class(php_$name, gdk_window_ce)) + $name = (GdkDrawable *)PHP_GDK_WINDOW_GET(php_$name); + else if(php_gtk_check_class(php_$name, gdk_pixmap_ce)) + $name = (GdkDrawable *)PHP_GDK_PIXMAP_GET(php_$name); + else if(php_gtk_check_class(php_$name, gdk_bitmap_ce)) + $name = (GdkDrawable *)PHP_GDK_BITMAP_GET(php_$name); + else { + php_error(E_WARNING, \"%s() expects the drawable to be GdkWindow, GdkPixmap, or GdkBitmap\", get_active_function_name()); + return; + } + "; + } + + return 'V'; + } + } + + function write_return($type, &$var_list, $separate) + { + $var_list->add('zval', '*ret'); + return " ret = php_" . $this->php_type . "_new(%s);\n" . + ($separate ? " SEPARATE_ZVAL(&ret);\n" : "") . + " *return_value = *ret;\n" . + " return;"; + } +} + + class Arg_Matcher { var $arg_types = array(); @@ -535,11 +618,13 @@ $arg = new Atom_Arg(); $matcher->register('GdkAtom', $arg); +$arg = new Drawable_Arg(); +$matcher->register('GdkDrawable*', $arg); + $matcher->register_boxed('GdkEvent', 'gdk_event'); $matcher->register_boxed('GdkWindow', 'gdk_window'); $matcher->register_boxed('GdkPixmap', 'gdk_pixmap'); $matcher->register_boxed('GdkBitmap', 'gdk_bitmap'); -$matcher->register('GdkDrawable*', $matcher->get('GdkWindow*')); $matcher->register_boxed('GdkColor', 'gdk_color'); $matcher->register_boxed('GdkColormap', 'gdk_colormap'); $matcher->register_boxed('GdkCursor', 'gdk_cursor');