Re: GtkCellLayout::set_cell_data_func
| From: | Steph Fox | Date: | Thu, 19 Jan 2006 22:14:56 +0000 |
| Subject: | Re: GtkCellLayout::set_cell_data_func | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-2229@lists.php.net to get a copy of this message | ||
one +%% }} too many... (and what's with the extra spacing?) Apart from that it looks ok here. Will test when get time.
----- Original Message ----- From: "Christian Weiske" <cweiske@cweiske.de>
To: "PHP-GTK Dev list" <php-gtk-dev@lists.php.net>
Sent: Thursday, January 19, 2006 11:58 PM
Subject: [PHP-GTK-DEV] GtkCellLayout::set_cell_data_func
Hi One more function, copied from the GtkTreeViewColumn implementation. Demo script: $entry = new GtkEntry(); $compl = new GtkEntryCompletion(); $entry->set_completion($compl); $store = new GtkListStore(Gtk::TYPE_STRING); $compl->set_model($store); $compl->set_text_column(0); $store->append(array('small')); $store->append(array('little')); $store->append(array('lowercase')); $renderer = new GtkCellRendererText(); $compl->clear(); $compl->pack_start($renderer, true); $compl->set_cell_data_func($renderer, 'makeUpper'); function makeUpper($column, $cell, $model, $iter) { $info = $model->get_value($iter, 0); $cell->set_property('text', strtoupper($info)); } $wnd = new GtkWindow(); $wnd->add($entry); $wnd->connect_simple('destroy', array('gtk', 'main_quit')); $wnd->show_all(); Gtk::main(); -- Regards/MfG, Christian Weiske--------------------------------------------------------------------------------
--- orig/gtk.overrides 2006-01-19 22:34:38.000000000 +0100 +++ php-gtk/ext/gtk+/gtk.overrides 2006-01-19 22:34:14.000000000 +0100 @@ -37,6 +37,7 @@gtk_button_new_with_label gtk_button_new_with_mnemonic gtk_color_button_new + gtk_combo_box_new_with_model gtk_dialog_new gtk_exit gtk_entry_new_with_max_length@@ -846,6 +847,45 @@ %% }}} + +%% {{{ GtkCellLayout + +%% +add-arginfo GtkCellLayout set_cell_data_func +static +ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0)+ ZEND_ARG_OBJ_INFO(0, cellrenderer, GtkCellRenderer, 1) + ZEND_ARG_INFO(0, callback)+ZEND_END_ARG_INFO(); + +%% +override gtk_cell_layout_set_cell_data_func +PHP_METHOD +{+ zval *php_cell; + GtkCellRenderer *cell; + zval *callback, *extra; + phpg_cb_data_t *cb_data;++ NOT_STATIC_METHOD();++ if (!php_gtk_parse_varargs(ZEND_NUM_ARGS(), 2, &extra, "OV", &php_cell, gtkcellrenderer_ce, &callback)) + return;++ cell = GTK_CELL_RENDERER(PHPG_GOBJECT(php_cell));++ zval_add_ref(&callback); + cb_data = phpg_cb_data_new(callback, extra TSRMLS_CC);+ + gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(PHPG_GOBJECT(this_ptr)), cell, + (GtkCellLayoutDataFunc)phpg_cell_data_func_marshal,+ cb_data, phpg_cb_data_destroy);+} +%% }}} + + +%% }} + %% {{{ GtkCheckButton %% add-arginfo GtkCheckButton __construct @@ -1057,6 +1097,7 @@ } %% }}} + %% include gtkcontainer.overrides %% {{{ GtkDialog @@ -2432,6 +2473,7 @@ %% {{{ GtkWindow + %% override gtk_window_get_position PHP_METHOD