php-groups.com | Post Question | Search | About | Groups | Contact | Register | Login


New in This Group

cvs: php-gtk /ext/gtk+ gtk.overrides
3/16/2008 3:09:35 PM

cvs: php-gtk /demos/examples gtkbuilder_api.php notebook.xml
3/16/2008 3:43:46 AM

cvs: php-gtk /ext/gtk+ gtk-2.12.overrides
3/16/2008 3:43:44 AM

cvs: php-gtk /demos/examples old_tooltips_api.php
3/15/2008 6:56:34 PM

cvs: php-gtk /ext/gtk+ gtk-types.defs gtk.defs gtk.overrides
3/15/2008 6:56:32 PM

cvs: php-gtk /demos/examples new_tooltips_api.php
3/15/2008 6:23:35 PM

cvs: php-gtk /ext/gtk+ gtk-2.12.defs gtk-2.12.overrides
3/15/2008 6:23:32 PM

cvs: php-gtk /generator generator.php override.php templates.php /main php_gtk_util.c
3/12/2008 3:46:45 PM

cvs: php-gtk /ext/gtk+ gtk.overrides
3/11/2008 1:29:30 PM

cvs: php-gtk /ext/gtk+ gtk.overrides
3/10/2008 8:30:56 PM

svn: /gtk/php-gtk/trunk/ demos/examples/notebook.php ext/gtk+/gtk-2.12.overrides Reply

Group: php.gtk.cvs Subscribe Posted:10/6/2009 2:20:32 PM Replies:0 Views:7 Items(0)
--e648577c13fd2d05798133ca179306f8e070d512
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

auroraeosrose Tue, 06 Oct 2009 14:20:32 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=289251

Log:
2 new 2.12 overrides: Gtknotebook::set_group and GtkNotebook::get_group Because php does not support pointers directly, get_group will not return the actual pointer but instead an integer representation of the pointer (mainly useful for comparison) set_group can take any variable, but can also take a gtknotebook instance - for gtknotebook instances it will internally call set_group(get_group()) so you can easily set multiple notebooks to the same group without keeping your initial variable used for the group hanging around

Changed paths:
U gtk/php-gtk/trunk/demos/examples/notebook.php
U gtk/php-gtk/trunk/ext/gtk+/gtk-2.12.overrides

Modified: gtk/php-gtk/trunk/demos/examples/notebook.php
===================================================================
--- gtk/php-gtk/trunk/demos/examples/notebook.php 2009-10-06 13:34:56 UTC (rev 289250)
+++ gtk/php-gtk/trunk/demos/examples/notebook.php 2009-10-06 14:20:32 UTC (rev 289251)
@@ -4,27 +4,40 @@
$window->set_title('Notebooks and Pages');
$window->connect_simple('destroy', array('gtk', 'main_quit'));
$window->add($vbox = new GtkHBox());
+$group = 'MyGroup';

-$vbox->add($notebook = new GtkNoteBook());
-$notebook->append_page($label = new GtkLabel('This is the first page'));
-$notebook->set_tab_detachable($label, true);
-$notebook->append_page($label = new GtkLabel('This is the second page'));
-$notebook->set_tab_detachable($label, true);
-$notebook->append_page($label = new GtkLabel('This is the third page'));
-$notebook->set_tab_detachable($label, true);
-$notebook->set_group('Mygroup');
-var_dump($notebook->get_group());
+$vbox->add($notebook1 = new GtkNoteBook());
+$notebook1->append_page($label = new GtkLabel('This is the first page'));
+$notebook1->set_tab_detachable($label, true);
+$notebook1->append_page($label = new GtkLabel('This is the second page'));
+$notebook1->set_tab_detachable($label, true);
+$notebook1->append_page($label = new GtkLabel('This is the third page'));
+$notebook1->set_tab_detachable($label, true);
+$notebook1->set_group($group);
+var_dump($notebook1->get_group());

-$vbox->add($notebook = new GtkNoteBook());
-$notebook->append_page($label = new GtkLabel('This is the first page'));
-$notebook->set_tab_detachable($label, true);
-$notebook->append_page($label = new GtkLabel('This is the second page'));
-$notebook->set_tab_detachable($label, true);
-$notebook->append_page($label = new GtkLabel('This is the third page'));
-$notebook->set_tab_detachable($label, true);
-$notebook->set_group('Mygroup');
+$vbox->add($notebook2 = new GtkNoteBook());
+$notebook2->append_page($label = new GtkLabel('This is the first page'));
+$notebook2->set_tab_detachable($label, true);
+$notebook2->append_page($label = new GtkLabel('This is the second page'));
+$notebook2->set_tab_detachable($label, true);
+$notebook2->append_page($label = new GtkLabel('This is the third page'));
+$notebook2->set_tab_detachable($label, true);
+$notebook2->set_group($group);
+var_dump($notebook2->get_group());

-var_dump($notebook->get_group());
+unset($group);
+
+$vbox->add($notebook3 = new GtkNoteBook());
+$notebook3->append_page($label = new GtkLabel('This is the first page'));
+$notebook3->set_tab_detachable($label, true);
+$notebook3->append_page($label = new GtkLabel('This is the second page'));
+$notebook3->set_tab_detachable($label, true);
+$notebook3->append_page($label = new GtkLabel('This is the third page'));
+$notebook3->set_tab_detachable($label, true);
+$notebook3->set_group($notebook1);
+var_dump($notebook3->get_group());
+
$window->show_all();
Gtk::main();
?>
\ No newline at end of file

Modified: gtk/php-gtk/trunk/ext/gtk+/gtk-2.12.overrides
===================================================================
--- gtk/php-gtk/trunk/ext/gtk+/gtk-2.12.overrides 2009-10-06 13:34:56 UTC (rev 289250)
+++ gtk/php-gtk/trunk/ext/gtk+/gtk-2.12.overrides 2009-10-06 14:20:32 UTC (rev 289251)
@@ -269,7 +269,54 @@

%% }}}

+%% {{{ GtkNotebook
+%%
+add-arginfo GtkNotebook set_group
+PHPGTK_ARG_INFO_STATIC
+ZEND_BEGIN_ARG_INFO_EX(ARGINFO_NAME, 0, 0, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()

+%%
+override gtk_notebook_set_group
+PHP_METHOD
+{
+ zval *php_pointer = NULL;
+
+ NOT_STATIC_METHOD();
+
+ /* Check for a gtknotebook instance first */
+ if (php_gtk_parse_args_quiet(ZEND_NUM_ARGS(),"O", &php_pointer, gtknotebook_ce)) {
+ gtk_notebook_set_group(GTK_NOTEBOOK(PHPG_GOBJECT(this_ptr)), (gpointer) gtk_notebook_get_group(GTK_NOTEBOOK(PHPG_GOBJECT(php_pointer))));
+ return;
+ }
+
+ /* Otherwise we want any other zval or null to "turn off" the group */
+ if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"|V", &php_pointer)) {
+ return;
+ }
+
+ gtk_notebook_set_group(GTK_NOTEBOOK(PHPG_GOBJECT(this_ptr)), (gpointer) php_pointer);
+}
+
+%%
+override gtk_notebook_get_group
+PHP_METHOD
+{
+ zval *php_pointer = NULL;
+
+ NOT_STATIC_METHOD();
+
+ if(!php_gtk_parse_args(ZEND_NUM_ARGS(),"")) {
+ return;
+ }
+
+ php_pointer = (zval *)gtk_notebook_get_group(GTK_NOTEBOOK(PHPG_GOBJECT(this_ptr)));
+ RETURN_LONG(php_pointer);
+}
+
+%% }}}
+
%% {{{ GtkIconView

%%

--e648577c13fd2d05798133ca179306f8e070d512--
auroraeosr...@php.net (=?utf-8?q?Elizabeth_Marie_Smith?=)
10/6/2009 2:20:32 PM





Reply:
| or Email(not shown): Name: | Register | Login

Alert me when someone responds to this posting.











Newest Articles

note 97095 added to soapclient.soapclient
4/1/2010 5:58:19 AM

note 97094 added to function.sqlite-changes
4/1/2010 5:06:46 AM

note 97093 added to function.sqlite-changes
4/1/2010 5:06:21 AM

note 97092 added to ref.xmlrpc
4/1/2010 4:52:18 AM

note 97091 added to function.var-export
4/1/2010 3:32:03 AM