Commit 7b0e05fc authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Use gtk-doc abbrevs instead of spelled out links.

2005-05-16  Matthias Clasen  <mclasen@redhat.com>

	* gtk/tree_widget.sgml: Use gtk-doc abbrevs instead of
	spelled out links.

	* gtk/gtk-docs.sgml: Included the processed file xml/tree_widget.sgml.

	* gtk/Makefile.am (expand_content_files): Add tree_widget.sgml.
parent 37a4e334
2005-05-16 Matthias Clasen <mclasen@redhat.com> 2005-05-16 Matthias Clasen <mclasen@redhat.com>
* configure.in (GTK_DOC_CHECK): Check for gtk-doc 1.4.
* gtk/gtktoggleaction.c (connect_proxy): Be more careful when * gtk/gtktoggleaction.c (connect_proxy): Be more careful when
casting. (#304089, Philip Langdale) casting. (#304089, Philip Langdale)
......
2005-05-16 Matthias Clasen <mclasen@redhat.com> 2005-05-16 Matthias Clasen <mclasen@redhat.com>
* configure.in (GTK_DOC_CHECK): Check for gtk-doc 1.4.
* gtk/gtktoggleaction.c (connect_proxy): Be more careful when * gtk/gtktoggleaction.c (connect_proxy): Be more careful when
casting. (#304089, Philip Langdale) casting. (#304089, Philip Langdale)
......
2005-05-16 Matthias Clasen <mclasen@redhat.com> 2005-05-16 Matthias Clasen <mclasen@redhat.com>
* configure.in (GTK_DOC_CHECK): Check for gtk-doc 1.4.
* gtk/gtktoggleaction.c (connect_proxy): Be more careful when * gtk/gtktoggleaction.c (connect_proxy): Be more careful when
casting. (#304089, Philip Langdale) casting. (#304089, Philip Langdale)
......
...@@ -1543,7 +1543,7 @@ fi ...@@ -1543,7 +1543,7 @@ fi
# Checks for gtk-doc and docbook-tools # Checks for gtk-doc and docbook-tools
################################################## ##################################################
GTK_DOC_CHECK([1.0]) GTK_DOC_CHECK([1.4])
AC_CHECK_PROG(DB2HTML, db2html, true, false) AC_CHECK_PROG(DB2HTML, db2html, true, false)
AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML) AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
......
2005-05-16 Matthias Clasen <mclasen@redhat.com>
* gtk/tree_widget.sgml: Use gtk-doc abbrevs instead of
spelled out links.
* gtk/gtk-docs.sgml: Included the processed file xml/tree_widget.sgml.
* gtk/Makefile.am (expand_content_files): Add tree_widget.sgml.
2005-05-08 Matthias Clasen <mclasen@redhat.com> 2005-05-08 Matthias Clasen <mclasen@redhat.com>
* gdk/tmpl/visuals.sgml: Fix a typo (#303473, Masao Mutoh) * gdk/tmpl/visuals.sgml: Fix a typo (#303473, Masao Mutoh)
......
...@@ -110,6 +110,9 @@ content_files = \ ...@@ -110,6 +110,9 @@ content_files = \
gtk-update-icon-cache.xml \ gtk-update-icon-cache.xml \
visual_index.xml visual_index.xml
expand_content_files = \
tree_widget.sgml
# Images to copy into HTML directory # Images to copy into HTML directory
HTML_IMAGES = \ HTML_IMAGES = \
$(top_srcdir)/gtk/stock-icons/stock_about_24.png \ $(top_srcdir)/gtk/stock-icons/stock_about_24.png \
......
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
<!ENTITY index-Objects-Grouped SYSTEM "objects_grouped.sgml"> <!ENTITY index-Objects-Grouped SYSTEM "objects_grouped.sgml">
<!ENTITY gtk-TextWidget SYSTEM "text_widget.sgml"> <!ENTITY gtk-TextWidget SYSTEM "text_widget.sgml">
<!ENTITY gtk-TreeWidget SYSTEM "tree_widget.sgml"> <!ENTITY gtk-TreeWidget SYSTEM "xml/tree_widget.sgml">
<!ENTITY gtk-Compiling SYSTEM "compiling.sgml"> <!ENTITY gtk-Compiling SYSTEM "compiling.sgml">
<!ENTITY gtk-Building SYSTEM "building.sgml"> <!ENTITY gtk-Building SYSTEM "building.sgml">
<!ENTITY gtk-Running SYSTEM "running.sgml"> <!ENTITY gtk-Running SYSTEM "running.sgml">
......
...@@ -7,18 +7,15 @@ ...@@ -7,18 +7,15 @@
<refnamediv> <refnamediv>
<refname>Tree and List Widget Overview</refname> <refname>Tree and List Widget Overview</refname>
<refpurpose>Overview of <link <refpurpose>Overview of #GtkTreeModel, #GtkTreeView, and other
linkend="GtkTreeModel">GtkTreeModel</link>, <link associated widgets</refpurpose>
linkend="GtkTreeView">GtkTreeView</link>, and other associated widgets</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title>Overview</title> <title>Overview</title>
<para> <para>
To create a tree or list in GTK+, use the <link To create a tree or list in GTK+, use the #GtkTreeModel interface in
linkend="GtkTreeModel">GtkTreeModel</link> interface in conjunction with the #GtkTreeView widget. This widget is
conjunction with the <link
linkend="GtkTreeView">GtkTreeView</link> widget. This widget is
designed around a <firstterm>Model/View/Controller</firstterm> designed around a <firstterm>Model/View/Controller</firstterm>
design and consists of four major parts: design and consists of four major parts:
<simplelist> <simplelist>
...@@ -46,13 +43,12 @@ ...@@ -46,13 +43,12 @@
<refsect1> <refsect1>
<title>Creating a model</title> <title>Creating a model</title>
<para> <para>
GTK+ provides two simple models that can be used: the <link GTK+ provides two simple models that can be used: the #GtkListStore
linkend="GtkListStore">GtkListStore</link> and the <link and the #GtkTreeStore. GtkListStore is used to model list widgets,
linkend="GtkTreeStore">GtkTreeStore</link>. GtkListStore is used while the GtkTreeStore models trees. It is possible to develop a new
to model list widgets, while the GtkTreeStore models trees. It type of model, but the existing models should be satisfactory for all
is possible to develop a new type of model, but the existing but the most specialized of situations. Creating the model is quite
models should be satisfactory for all but the most specialized of simple:
situations. Creating the model is quite simple:
</para> </para>
<informalexample><programlisting><![CDATA[ <informalexample><programlisting><![CDATA[
GtkListStore *store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN); GtkListStore *store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN);
...@@ -80,16 +76,15 @@ GtkTreeStore *store = gtk_tree_store_new (N_COLUMNS, /* Total number of co ...@@ -80,16 +76,15 @@ GtkTreeStore *store = gtk_tree_store_new (N_COLUMNS, /* Total number of co
G_TYPE_BOOLEAN); /* Is checked out? */ G_TYPE_BOOLEAN); /* Is checked out? */
]]></programlisting></informalexample> ]]></programlisting></informalexample>
<para> <para>
Adding data to the model is done using <link linkend="gtk-tree-store-set"> Adding data to the model is done using gtk_tree_store_set() or
gtk_tree_store_set()</link> or <link linkend="gtk-list-store-set"> gtk_list_store_set(), depending upon which sort of model was
gtk_list_store_set()</link>, depending upon which sort of model was created. To do this, a #GtkTreeIter must be acquired. The iterator
created. To do this, a <link linkend="GtkTreeIter">GtkTreeIter</link> must points to the location where data will be added.
be acquired. The iterator points to the location where data will be added.
</para> </para>
<para> <para>
Once an iterator has been acquired, <link linkend="gtk-tree-store-set"> Once an iterator has been acquired, gtk_tree_store_set() is used to
gtk_tree_store_set()</link> is used to apply data to the part of the model apply data to the part of the model that the iterator points to.
that the iterator points to. Consider the following example: Consider the following example:
</para> </para>
<informalexample><programlisting><![CDATA[ <informalexample><programlisting><![CDATA[
GtkTreeIter iter; GtkTreeIter iter;
...@@ -110,7 +105,7 @@ gtk_tree_store_set (store, &iter, ...@@ -110,7 +105,7 @@ gtk_tree_store_set (store, &iter,
columns in a given row. columns in a given row.
</para> </para>
<para> <para>
The third argument to <link linkend="gtk-tree-store-append">gtk_tree_store_append()</link> is the parent iterator. It The third argument to gtk_tree_store_append() is the parent iterator. It
is used to add a row to a GtkTreeStore as a child of an existing row. This is used to add a row to a GtkTreeStore as a child of an existing row. This
means that the new row will only be visible when its parent is visible and means that the new row will only be visible when its parent is visible and
in its expanded state. Consider the following example: in its expanded state. Consider the following example:
...@@ -148,11 +143,9 @@ gtk_tree_store_set (store, &iter2, ...@@ -148,11 +143,9 @@ gtk_tree_store_set (store, &iter2,
<para> <para>
While there are several different models to choose from, there is While there are several different models to choose from, there is
only one view widget to deal with. It works with either the list only one view widget to deal with. It works with either the list
or the tree store. Setting up a <link or the tree store. Setting up a #GtkTreeView is not a difficult
linkend="GtkTreeView">GtkTreeView</link> is not a difficult matter. It needs a #GtkTreeModel to know where to retrieve its data
matter. It needs a <link from.
linkend="GtkTreeModel">GtkTreeModel</link> to know where to
retrieve its data from.
</para> </para>
<informalexample><programlisting><![CDATA[ <informalexample><programlisting><![CDATA[
GtkWidget *tree; GtkWidget *tree;
...@@ -163,32 +156,27 @@ tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); ...@@ -163,32 +156,27 @@ tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
<refsect2> <refsect2>
<title>Columns and cell renderers</title> <title>Columns and cell renderers</title>
<para> <para>
Once the <link linkend="GtkTreeView">GtkTreeView</link> widget Once the #GtkTreeView widget has a model, it will need to know how
has a model, it will need to know how to display the model. It to display the model. It does this with columns and cell renderers.
does this with columns and cell renderers.
</para> </para>
<para> <para>
Cell renderers are used to draw the data in the tree model in a Cell renderers are used to draw the data in the tree model in a
way. There are a number of cell renderers that come with GTK+ 2.x, way. There are a number of cell renderers that come with GTK+ 2.x,
including the <link including the #GtkCellRendererText, #GtkCellRendererPixbuf and
linkend="GtkCellRendererText">GtkCellRendererText</link>, <link the #GtkCellRendererToggle.
linkend="GtkCellRendererPixbuf">GtkCellRendererPixbuf</link> and
the <link
linkend="GtkCellRendererToggle">GtkCellRendererToggle</link>.
It is relatively easy to write a custom renderer. It is relatively easy to write a custom renderer.
</para> </para>
<para> <para>
A <link linkend="GtkTreeViewColumn">GtkTreeViewColumn</link> is the A #GtkTreeViewColumn is the object that GtkTreeView uses to organize
object that GtkTreeView uses to organize the vertical columns in the vertical columns in the tree view. It needs to know the name of
the tree view. It needs to know the name of the column to label the column to label for the user, what type of cell renderer to use,
for the user, what type of cell renderer to use, and which piece of and which piece of data to retrieve from the model for a given row.
data to retrieve from the model for a given row.
</para> </para>
<informalexample><programlisting><![CDATA[ <informalexample><programlisting><![CDATA[
GtkCellRenderer *renderer; GtkCellRenderer *renderer;
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new (<!-- -->);
column = gtk_tree_view_column_new_with_attributes ("Author", column = gtk_tree_view_column_new_with_attributes ("Author",
renderer, renderer,
"text", AUTHOR_COLUMN, "text", AUTHOR_COLUMN,
...@@ -205,9 +193,9 @@ gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column); ...@@ -205,9 +193,9 @@ gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
<refsect2> <refsect2>
<title>Selection handling</title> <title>Selection handling</title>
<para> <para>
Most applications will need to not only deal with displaying data, but also Most applications will need to not only deal with displaying data, but
receiving input events from users. To do this, simply get a reference to also receiving input events from users. To do this, simply get a
a selection object and connect to the "changed" signal. reference to a selection object and connect to the "changed" signal.
</para> </para>
<informalexample><programlisting><![CDATA[ <informalexample><programlisting><![CDATA[
/* Prototype for selection handler callback */ /* Prototype for selection handler callback */
...@@ -249,13 +237,11 @@ tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data) ...@@ -249,13 +237,11 @@ tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data)
<refsect1> <refsect1>
<title>Simple Example</title> <title>Simple Example</title>
<para> <para>
Here is a simple example of using a <link Here is a simple example of using a #GtkTreeView widget in context
linkend="GtkTreeView">GtkTreeView</link> widget in context of the of the other widgets. It simply creates a simple model and view,
other widgets. It simply creates a simple model and view, and and puts them together. Note that the model is never populated
puts them together. Note that the model is never populated with with data &mdash; that is left as an exercise for the reader.
data &mdash; that is left as an exercise for the reader. More More information can be found on this in the #GtkTreeModel section.
information can be found on this in the <link
linkend="GtkTreeStore">GtkTreeModel</link> section.
<informalexample><programlisting><![CDATA[ <informalexample><programlisting><![CDATA[
enum enum
{ {
...@@ -292,7 +278,7 @@ setup_tree (void) ...@@ -292,7 +278,7 @@ setup_tree (void)
/* Create a cell render and arbitrarily make it red for demonstration /* Create a cell render and arbitrarily make it red for demonstration
* purposes */ * purposes */
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new (<!-- -->);
g_object_set (G_OBJECT (renderer), g_object_set (G_OBJECT (renderer),
"foreground", "red", "foreground", "red",
NULL); NULL);
...@@ -307,7 +293,7 @@ setup_tree (void) ...@@ -307,7 +293,7 @@ setup_tree (void)
gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column); gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
/* Second column.. title of the book. */ /* Second column.. title of the book. */
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new (<!-- -->);
column = gtk_tree_view_column_new_with_attributes ("Title", column = gtk_tree_view_column_new_with_attributes ("Title",
renderer, renderer,
"text", TITLE_COLUMN, "text", TITLE_COLUMN,
...@@ -315,7 +301,7 @@ setup_tree (void) ...@@ -315,7 +301,7 @@ setup_tree (void)
gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column); gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
/* Last column.. whether a book is checked out. */ /* Last column.. whether a book is checked out. */
renderer = gtk_cell_renderer_toggle_new (); renderer = gtk_cell_renderer_toggle_new (<!-- -->);
column = gtk_tree_view_column_new_with_attributes ("Checked out", column = gtk_tree_view_column_new_with_attributes ("Checked out",
renderer, renderer,
"active", CHECKED_COLUMN, "active", CHECKED_COLUMN,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment