cvs: php-gtk-doc /examples/reference/gtk/gtktreestore append.phpw constructor.phpw /manual/en/reference/gtk gtktreestore.xml

From: Date: Wed, 18 Jan 2006 10:06:28 +0000
Subject: cvs: php-gtk-doc /examples/reference/gtk/gtktreestore append.phpw constructor.phpw /manual/en/reference/gtk gtktreestore.xml
Groups: php.gtk.doc 
Request: Send a blank email to php-gtk-doc+get-1766@lists.php.net to get a copy of this message
cweiske Wed Jan 18 10:06:28 2006 UTC Added files: /php-gtk-doc/examples/reference/gtk/gtktreestore append.phpw constructor.phpw Modified files: /php-gtk-doc/manual/en/reference/gtk gtktreestore.xml Log: Example for GtkTreeStore constructor and append() method http://cvs.php.net/viewcvs.cgi/php-gtk-doc/manual/en/reference/gtk/gtktreestore.xml?r1=1.2&r2=1.3&diff_format=u Index: php-gtk-doc/manual/en/reference/gtk/gtktreestore.xml diff -u php-gtk-doc/manual/en/reference/gtk/gtktreestore.xml:1.2 php-gtk-doc/manual/en/reference/gtk/gtktreestore.xml:1.3 --- php-gtk-doc/manual/en/reference/gtk/gtktreestore.xml:1.2 Tue Aug 2 11:01:45 2005 +++ php-gtk-doc/manual/en/reference/gtk/gtktreestore.xml Wed Jan 18 10:06:27 2006 @@ -3,28 +3,102 @@ <classmeta> <classtitle>GtkTreeStore</classtitle> <classparent>GObject</classparent> + <implements>GtkTreeModel</implements> + <implements>GtkTreeDragSource</implements> + <implements>GtkTreeDragDest</implements> + <implements>GtkTreeSortable</implements> <shortdesc> - + A tree-like data structure that can be used with the GtkTreeView. </shortdesc> <desc> - + <para> + The <classname>GtkTreeStore</classname> object is a list model + for use with a <classname>GtkTreeView</classname> widget. It implements + the <classname>GtkTreeModel</classname> interface, and consequentialy, can + use all of the methods available there. It also implements the + <classname>GtkTreeSortable</classname> interface so it can be sorted by + the view. Finally, it also implements the tree drag and drop interfaces. + </para> </desc> </classmeta> + + <constructors> + <constructor id="gtk.gtktreestore.constructor"> + <funcsynopsis> + <funcprototype> + <funcdef> <function>GtkTreeStore</function></funcdef> + <paramdef><enumname>GtkType</enumname> <parameter>type_column_0</parameter></paramdef> + <paramdef><enumname>GtkType</enumname> <parameter><optional>type_column_1</optional></parameter></paramdef> + <paramdef><enumname>GtkType</enumname> <parameter><optional>type_column_2</optional></parameter></paramdef> + <paramdef>...</paramdef> + </funcprototype> + </funcsynopsis> + <shortdesc> + Create a new tree store with a number of columns. + </shortdesc> + <desc> + <para> + Create a new tree store with a number of columns. For each colum, the + type has to be specified by choosing one of the <enumname>GtkType</enumname>s. + </para> + <example> + <title>Creating and filling a GtkTreeStore</title> + <programlisting role="php"> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="&directory.examples;/reference/gtk/gtktreestore/constructor.phpw" parse="text"> + <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback> + </xi:include> + </programlisting> + </example> + </desc> + </constructor> + </constructors> + + <methods> <method id="gtk.gtktreestore.method.append"> <funcsynopsis> <funcprototype> - <funcdef>void <function>append</function></funcdef> - <paramdef>void</paramdef> + <funcdef><classname>GtkTreeIter</classname> <function>append</function></funcdef> + <paramdef><classname>GtkTreeIter</classname> <parameter><optional>parent</optional></parameter></paramdef> + <paramdef>array <parameter>items</parameter></paramdef> </funcprototype> </funcsynopsis> <shortdesc> - + Appends a new row to the store. </shortdesc> <desc> - + <para> + Creates a new line and appends it to the end of the store. The first + parameter <parameter>parent</parameter> can be <literal>NULL</literal>. + If that's the case, the new entry will have no parent and thus + be a "root" entry. + </para> + <para> + The second parameter <parameter>items</parameter> is an array with a value + for each column. If your treestore has three columns, the array should have + three values. + </para> + <para> + The method returns a <classname>GtkTreeIter</classname> which you can use + to refer to the entry row; e.g. to use it as a parent for another row. + </para> + <para> + If you pass no parameters at all, an empty row with no values will be + created, and you have to use other methods like + <function class="GtkTreeStore">set</function> to change the column values. + </para> + <example> + <title>Creating and filling a GtkTreeStore</title> + <programlisting role="php"> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="&directory.examples;/reference/gtk/gtktreestore/append.phpw" parse="text"> + <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback> + </xi:include> + </programlisting> + </example> </desc> </method> @@ -36,10 +110,13 @@ </funcprototype> </funcsynopsis> <shortdesc> - + Removes all rows. </shortdesc> <desc> - + <para> + This method removes all rows from the store, clearing and leaving it + empty. + </para> </desc> </method> http://cvs.php.net/viewcvs.cgi/php-gtk-doc/examples/reference/gtk/gtktreestore/append.phpw?view=markup&rev=1.1 Index: php-gtk-doc/examples/reference/gtk/gtktreestore/append.phpw +++ php-gtk-doc/examples/reference/gtk/gtktreestore/append.phpw <?php //new model with just one column of type string $store = new GtkTreeStore(Gtk::TYPE_STRING); //create root entry: parent parameter is NULL $root = $store->append(null, array('This is the root')); //Create a child entry below the root one $child = $store->append($root, array('Child of root')); //Create a second child of root $store->append($root, array('Second child')); //create another root entry $root2 = $store->append(null, array('Another root')); //create empty root entry $empty = $store->append(); //create empty entry below child $subchild = $store->append($child); //Display the store $wnd = new GtkWindow(); $view = new GtkTreeView($store); $view->append_column( new GtkTreeViewColumn('String column', new GtkCellRendererText(), 'text', 0) ); $wnd->add($view); $wnd->connect_simple('destroy', array('gtk', 'main_quit')); $wnd->show_all(); Gtk::main(); ?> http://cvs.php.net/viewcvs.cgi/php-gtk-doc/examples/reference/gtk/gtktreestore/constructor.phpw?view=markup&rev=1.1 Index: php-gtk-doc/examples/reference/gtk/gtktreestore/constructor.phpw +++ php-gtk-doc/examples/reference/gtk/gtktreestore/constructor.phpw <?php /* * GtkTreeStore example: Regions and the population * of some european states * Create a tree store with string and long columns */ $store = new GtkTreeStore(Gtk::TYPE_STRING, Gtk::TYPE_LONG); //append a row to the root (NULL for parent) $nothern = $store->append(null, array('Northern europe', 0)); $western = $store->append(null, array('Western europe', 0)); $central = $store->append(null, array('Central europe', 0)); //append a row as a child to another row: $central as parent $store->append($central, array('Germany', 83251851)); //$western as parent $store->append($western, array('France', 59765983)); $store->append($western, array('Netherlands', 16318199)); $store->append($nothern, array('Norway', 4525116)); //display it $wnd = new GtkWindow(); $wnd->set_title('GtkTreeStore example'); $wnd->connect_simple('destroy', array('gtk', 'main_quit')); //create the view with the tree store set as model $view = new GtkTreeView($store); //cell renderer, which actually displays the text $cell_renderer = new GtkCellRendererText(); //append one column to the view which displays the tree store column 0 $view->append_column(new GtkTreeViewColumn('Country', $cell_renderer, 'text', 0)); //display column 1 from the tree store $view->append_column(new GtkTreeViewColumn('Population', $cell_renderer, 'text', 1)); //show all children at once $view->expand_all(); $wnd->add($view); $wnd->show_all(); Gtk::main(); ?>

« previous php.gtk.doc (#1766) next »