GTK + 2.0 Tree View tutorial

Source: Internet
Author: User
Tags dot net gtk
GTK + 2.0 Tree View tutorial
GTK + 2.0 Tree View tutorial

Tim-Philipp M ler

This is a tutorial on how to use the GTK (the gimp Toolkit)
Gtktreeview widget through its C interface.

Please mail all comments and suggestions<tim at centricular dot net
>

A tarball of the tutorial for off-line reading including the example source codes
Is available here: treeview-tutorial.tar.gz
.

There is also a version in PDF Format
(For easier
Printing) and the raw docbook XML Source Document
.

This tutorial is work-in-progress. The latest version can
Be found

Http://scentric.net/tutorial/

.

Some sections are a bit outdated (e.g. gtktreemodelfilter has been in GTK since 2.4 ),
Just haven'tgotten around to rewrite them or update them. Sorry!

Last Updated: Maid, 2005

Table of contents
1. Lists and trees: The gtktreeview widget
1.1. Hello World
2. components: model, Renderer, column, View
3. gtktreemodels for data storage: gtkliststore and gtktreestore
3.1. How data is organised in a store
3.2. Refering to rows: gtktreeiter, gtktreepath, gtktreerowreference
3.2.1. gtktreepath
3.2.2. gtktreeiter
3.2.3. gtktreerowreference
3.2.4. Usage
3.3. Adding rows to a store
3.3.1. Adding rows to a list store
3.3.2. Adding rows to a tree store
3.3.3. Speed issues when adding a lot of rows
3.4. manipulating row data
3.5. Retrieving row data
3.5.1. Freeing retrieved row data
3.6. Removing rows
3.7. Removing multiple rows
3.8. Storing gobjects (pixbufs etc .)
3.9. Storing data structures: of pointers, gboxed types, and gobject (Todo)
4. Creating a Tree View
4.1. Connecting Tree View and Model
4.1.1. reference counting
4.2. Tree View look and feel
5. mapping data to the screen: gtktreeviewcolumn and gtkcellrenderer
5.1. Cell renderers
5.2. Attributes
5.3. Cell Data Functions
5.4. gtkcellrenderertext and integer, Boolean and float types
5.5. gtkcellrenderertext, utf8, and pango Markup
5.6. A working example
5.7. How to make a whole row bold or coloured
5.8. How to pack icons into the Tree View
6. selections, double-clicks and context menus
6.1. Handling selections
6.1.1. selection modes
6.1.2. Getting the currently selected rows
6.1.3. Using Selection Functions
6.1.4. Checking whether a row is selected
6.1.5. Selecting and unselecting rows
6.1.6. Getting the number of selected rows
6.2. Double-clicks on a row
6.3. Context menus on right click
7. Sorting
7.1. gtktreesortable
7.2. gtktreemodelsort
7.3. Sorting and Tree View column headers
7.4. case-insensitive string comparing
8. editable Cells
8.1. editable text Cells
8.1.1. Setting the cursor to a specific cell
8.2. editable toggle and radio button cells
8.3. editable spin Button Cells
9. Miscellaneous
9.1. Getting the column number from a Tree View column widget
9.2. Column expander visibility
9.2.1. Hiding the column expander
9.2.2. Forcing column expander visibility
9.3. Getting the cell Renderer a click event happened on
9.4. glade and tree views
10. Drag 'n' drop (DND) ***** needs revision ***
10.1. Drag 'n' dropping row-unrelated data to and from a tree view from other windows or widgets
10.2. Dragging rows around within a tree ***** todo ***
10.3. Dragging rows from one tree to another ***** todo ***
11. Writing custom Models
11.1. When is a custom model useful?
11.2. What does writing a custom model involve?
11.3. Example: A simple custom list Model
11.3.1 custom-list.h
11.3.2 custom-list.c
11.4. From a list to a tree
11.5. Additional interfaces, here: the gtktreesortable Interface
11.6. Working Example: custom list model source code
11.6.1 custom-list.h
11.6.2. custom-list.c
11.6.3. Main. c
12. Writing custom cell renderers
12.1. Working Example: a progress bar cell Renderer
12.1.1 custom-cell-renderer-progressbar.h
12.1.2 custom-cell-renderer-progressbar.c
12.1.3. Main. c
12.2. Cell renderers others have written
13. Other resources
14. Copyright, license, credits, and revision history
14.1. Copyright and license
14.2. Credits
14.3. revision history
    Next >>>
    Lists and trees: The gtktreeview widget

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.