cvs: php-gtk-doc /examples/reference/gtk/gtknotebook switch-page.phpw /manual/en/reference/gtk gtknotebook.xml

[email protected] ("Christian Weiske") Mon, 20 Nov 2006 14:35:33 -0000
Newsgroups php.gtk.doc
Message-ID <cvscweiske1164033333@cvsserver>
cweiske		Mon Nov 20 14:35:33 2006 UTC

  Added files:                 
    /php-gtk-doc/examples/reference/gtk/gtknotebook	switch-page.phpw 

  Modified files:              
    /php-gtk-doc/manual/en/reference/gtk	gtknotebook.xml 
  Log:
  GtkNotebook::switch-page signal example
  
  
http://cvs.php.net/viewvc.cgi/php-gtk-doc/manual/en/reference/gtk/gtknotebook.xml?r1=1.15&r2=1.16&diff_format=u
Index: php-gtk-doc/manual/en/reference/gtk/gtknotebook.xml
diff -u php-gtk-doc/manual/en/reference/gtk/gtknotebook.xml:1.15 php-gtk-doc/manual/en/reference/gtk/gtknotebook.xml:1.16
--- php-gtk-doc/manual/en/reference/gtk/gtknotebook.xml:1.15	Mon Oct 16 15:03:55 2006
+++ php-gtk-doc/manual/en/reference/gtk/gtknotebook.xml	Mon Nov 20 14:35:33 2006
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 1.15 $ -->
+<!-- $Revision: 1.16 $ -->
 <classentry id="gtk.gtknotebook">
  <classmeta>
   <classtitle>GtkNotebook</classtitle>
@@ -1086,8 +1086,8 @@
     <funcprototype>
      <funcdef>void <cbfunction>callback</cbfunction></funcdef>
      <paramdef><classname>GtkNotebook</classname> <parameter>notebook</parameter></paramdef>
-     <paramdef><!-- was: gpointer -->XXX <parameter>UNKNOWN</parameter></paramdef>
-     <paramdef>int <parameter>UNKNOWN</parameter></paramdef>
+     <paramdef>pointer <parameter>pointer</parameter></paramdef>
+     <paramdef>int <parameter>page_num</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <shortdesc>
@@ -1097,6 +1097,14 @@
     <para>
      Called when the page has been switched.
     </para>
+    <example>
+     <title>Listening to the switch-page signal</title>
+     <programlisting role="php">
+      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="&directory.examples;/reference/gtk/gtknotebook/switch-page.phpw" parse="text">
+       <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
+      </xi:include>
+     </programlisting>
+    </example>
    </desc>
   </signal>
 

http://cvs.php.net/viewvc.cgi/php-gtk-doc/examples/reference/gtk/gtknotebook/switch-page.phpw?view=markup&rev=1.1
Index: php-gtk-doc/examples/reference/gtk/gtknotebook/switch-page.phpw
+++ php-gtk-doc/examples/reference/gtk/gtknotebook/switch-page.phpw
<?php
//Create a new notebook
$ntbk = new GtkNotebook();

//Create a first page
$ntbk->append_page(new GtkLabel('Page one'), new GtkLabel('1.'));

$ntbk->append_page(
    new GtkLabel('This is the second child'),
    new GtkLabel('Second')
);

$ntbk->append_page(
    new GtkLabel('Third page'),
    new GtkLabel('3rd')
);

//the fourth tab has no user-defined label
// get_tab_label_text() will return NULL in this case
$ntbk->append_page(new GtkLabel('IV'));


function onSwitchPage($ntbk, $pointer, $pageNum, $wnd)
{
    //the number of the newly selected tab is $pageNum
    //use it to get the page child widget
    $pageWidget = $ntbk->get_nth_page($pageNum);
    //now we can use the page child to retrieve the tab label
    $text = $ntbk->get_tab_label_text($pageWidget);
    //show the selected tab's title in the window title
    $wnd->set_title($text);
}

$wnd = new GtkWindow();
//everytime the user switches the tab, call the onSwitchPage function
$ntbk->connect('switch-page', 'onSwitchPage', $wnd);


//The rest of the setup is standard
$wnd->set_default_size(300, -1);
$wnd->connect_simple('destroy', array('Gtk', 'main_quit'));
$wnd->add($ntbk);
$wnd->show_all();
Gtk::main();
?>