Re: Re: GtkSheet style

From: Date: Thu, 13 Jan 2005 21:15:19 +0000
Subject: Re: Re: GtkSheet style
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-865@lists.php.net to get a copy of this message
the struct is define in gtksheet.h and not into gtkextra.h If I understand you if I put this struct into the extra.overrides will work well no? i will try ... El jue, 13-01-2005 a las 22:07, Steph escribió: > It's an object, no? > > Firstly - is it defined in gtkextra.h? (I don't have this on board > currently.) If it isn't you'll need to find the definition and add the > relevant header to overrides before you can wrap it. > > ----- Original Message ----- > From: "Ivan Rodriguez" <epplestun@gmail.com> > To: <alan@akbkhome.com> > Cc: <steph@zend.com>; <php-gtk-dev@lists.php.net> > Sent: Thursday, January 13, 2005 10:59 PM > Subject: Re: [PHP-GTK-DEV] Re: [PHP-GTK] Re: GtkSheet style > > > Hello > > I write this in the extra.defs file: > > (struct SheetRange > (in-module Gtk) > (c-name GtkSheetRange) > (field (type-and-name gint row0)) > (field (type-and-name gint col0)) > (field (type-and-name gint rowi)) > (field (type-and-name gint coli)) > ) > > > > With this code the functions range_set_* compile perfect and generate > the C code in gen_extra.c > > PHP_GTK_EXPORT_CE(gtk_sheet_range_ce); > > /* struct GtkSheetRange */ > > zval *PHP_GTK_EXPORT_FUNC(php_gtk_sheet_range_new)(GtkSheetRange *obj) > { > zval *result; > TSRMLS_FETCH(); > > if (!obj) { > MAKE_STD_ZVAL(result); > ZVAL_NULL(result); > return result; > } > > MAKE_STD_ZVAL(result); > object_init_ex(result, gtk_sheet_range_ce); > > add_property_long(result, "row0", obj->row0); > add_property_long(result, "col0", obj->col0); > add_property_long(result, "rowi", obj->rowi); > add_property_long(result, "coli", obj->coli); > > return result; > } > > > zend_bool PHP_GTK_EXPORT_FUNC(php_gtk_sheet_range_get)(zval *wrapper, > GtkSheetRange *obj) > { > zval **item; > TSRMLS_FETCH(); > > if (!php_gtk_check_class(wrapper, gtk_sheet_range_ce)) > return 0; > > if (zend_hash_find(Z_OBJPROP_P(wrapper), "row0", sizeof("row0"), (void > **)&item) == SUCCESS && Z_TYPE_PP(item) == IS_LONG) > obj->row0 = (gint)Z_LVAL_PP(item); > else > return 0; > > if (zend_hash_find(Z_OBJPROP_P(wrapper), "col0", sizeof("col0"), (void > **)&item) == SUCCESS && Z_TYPE_PP(item) == IS_LONG) > obj->col0 = (gint)Z_LVAL_PP(item); > else > return 0; > > if (zend_hash_find(Z_OBJPROP_P(wrapper), "rowi", sizeof("rowi"), (void > **)&item) == SUCCESS && Z_TYPE_PP(item) == IS_LONG) > obj->rowi = (gint)Z_LVAL_PP(item); > else > return 0; > > if (zend_hash_find(Z_OBJPROP_P(wrapper), "coli", sizeof("coli"), (void > **)&item) == SUCCESS && Z_TYPE_PP(item) == IS_LONG) > obj->coli = (gint)Z_LVAL_PP(item); > else > return 0; > > > return 1; > } > > > PHP_FUNCTION(gtksheetrange) > { > long row0, col0, rowi, coli; > > NOT_STATIC_METHOD(); > > if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "iiii", &row0, &col0, &rowi, > &coli)) { > php_gtk_invalidate(this_ptr); > return; > } > > add_property_long(this_ptr, "row0", row0); > add_property_long(this_ptr, "col0", col0); > add_property_long(this_ptr, "rowi", rowi); > add_property_long(this_ptr, "coli", coli); > } > > > static function_entry php_gtk_sheet_range_functions[] = { > {"GtkSheetRange", PHP_FN(gtksheetrange), NULL}, > {"gtksheet_range", PHP_FN(gtksheetrange), NULL}, > {NULL, NULL, NULL} > }; > > INIT_CLASS_ENTRY(ce, "GtkSheetRange", php_gtk_sheet_range_functions); > gtk_sheet_range_ce = zend_register_internal_class_ex(&ce, NULL, NULL > TSRMLS_CC); > > Now if y do this in PHP: > > $cmap = gtk::widget_get_default_colormap(); > $bgcolor = $cmap->alloc('#eae8e3'); > > $sheet = new GtkSheet(5, 5, "test"); > $sheet->range_set_background(1, $bgcolor); > $sheet->show(); > > PHP says: > Warning: range_set_background() expects argument 1 to be GtkSheetRange, > integer given in /home/epplestun/sheet.php on line 24 > > But I don't know how to create a GtkSheetRange in PHP code, I try with > new GtkSheetRange but not work :-( > > Any idea?¿ > > > El jue, 13-01-2005 a las 15:38, Ivan Rodriguez escribió: > > Hi > > > > I´m thinking to something like: > > > > (object SheetRange > > (in-module Gtk) > > (parent Widget (Gtk)) > > (c-name GtkSheetRange) > > ) > > > > (method set_range > > (of-object SheetRange (Gtk)) > > (c-name gtk_sheet_range_get_points) > > (return-type GtkSheetRange) > > (parameter (type-and-name gint* *row0)) > > (parameter (type-and-name gint* *col0)) > > (parameter (type-and-name gint* *rowi)) > > (parameter (type-and-name gint* *coli)) > > ) > > > > The problem is that there is no a function like the written one and I > > don´t know how to assing the values to the object, what can I do? -- Ivan Rodriguez <epplestun@gmail.com>

« previous php.gtk.dev (#865) next »