diff -ur cvs/ext/gtk+/gtk-2.12.overrides cvsbob/ext/gtk+/gtk-2.12.overrides --- cvs/ext/gtk+/gtk-2.12.overrides 2007-11-14 09:07:40.000000000 -0500 +++ cvsbob/ext/gtk+/gtk-2.12.overrides 2007-11-15 13:12:52.000000000 -0500 @@ -0,0 +1,107 @@ +%% {{{ GtkScaleButton + +%% +headers +static void phpg_scale_button_set_icons_marshal(GtkScaleButton *, zval *); + +%% +add-arginfo GtkScaleButton __construct +static +ZEND_BEGIN_ARG_INFO_EX(ARGINFO_NAME, 0, 0, 0) + ZEND_ARG_INFO(0, iconsize) + ZEND_ARG_INFO(0, min) + ZEND_ARG_INFO(0, max) + ZEND_ARG_INFO(0, step) + ZEND_ARG_INFO(0, iconlist) +ZEND_END_ARG_INFO(); + +%% +override gtk_scale_button_new +PHP_METHOD +{ + gint iconsize; + gdouble min, max, step; + GtkWidget *obj; + zval *iconlist = NULL; + + if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"iddd|a",&iconsize,&min,&max,&step,&iconlist)) { + return; + } + + obj = gtk_scale_button_new(iconsize,min,max,step,NULL); + if(!obj) { PHPG_THROW_CONSTRUCT_EXCEPTION(GtkScaleButton); } + + if(iconlist) { + phpg_scale_button_set_icons_marshal( + GTK_SCALE_BUTTON(obj), + iconlist + ); + } + + phpg_gobject_set_wrapper( + this_ptr, + G_OBJECT(obj) TSRMLS_CC + ); +} + +%% +override gtk_scale_button_set_icons +static void +phpg_scale_button_set_icons_marshal(GtkScaleButton *button, zval *iconlist) +{ + gchar **list = NULL; + zval **iconname; + int listlen,iter; + + if(iconlist) { + listlen = zend_hash_num_elements(Z_ARRVAL_P(iconlist)); + } else { + listlen = 0; + } + + if(listlen > 0) { + list = g_malloc0(sizeof(gchar **) * (listlen + 1)); + iter = 0; + + //. building null terminated gchar array for the constructor. + zend_hash_internal_pointer_reset(Z_ARRVAL_P(iconlist)); + while(zend_hash_get_current_data(Z_ARRVAL_P(iconlist),(void **)&iconname) == SUCCESS) { + if(Z_TYPE_PP(iconname) == IS_STRING) { + list[iter++] = g_strdup(Z_STRVAL_PP(iconname)); + } else { + php_error_docref(NULL TSRMLS_CC,E_WARNING,"each item in icon array is to be a string"); + } + + zend_hash_move_forward(Z_ARRVAL_P(iconlist)); + } list[iter] = NULL; + + } else { + list = NULL; + } + + gtk_scale_button_set_icons( + GTK_SCALE_BUTTON(button), + (const gchar **)list + ); + + if(list) { + g_strfreev(list); + } +} + +PHP_METHOD +{ + zval *iconlist = NULL; + + if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"a",&iconlist)) { + return; + } + + phpg_scale_button_set_icons_marshal( + GTK_SCALE_BUTTON(PHPG_GOBJECT(this_ptr)), + iconlist + ); +} + +%% }}} +