Overview

screenshot.png

Note that the ../GtkTreeView does not have any border or scrollbars by itself. It is inside a GtkScrolledWindow which draws these around it.

Style Properties

Name

Default

Description

expander-size

12

Size of the expander arrow

vertical-separator

2

Vertical space between cells. Must be an even number

horizontal-separator

2

Horizontal space between cells. Must be an even number

allow-rules

TRUE

Allow drawing of alternating color rows

indent-expanders

TRUE

Make the expanders indented

even-row-color

-

Color to use for even rows. The result depends on the used engine.

odd-row-color

-

Color to use for odd rows. The result depends on the used engine.

row-ending-details

FALSE

Row Ending details - Enable extended row background theming

grid-line-width

1

Width, in pixels, of the tree view grid lines

tree-line-width

1

Width, in pixels, of the tree view lines

grid-line-pattern

"\1\1"

Dash pattern used to draw the tree view grid lines

tree-line-pattern

"\1\1"

Dash pattern used to draw the tree view lines

The even-row-color and odd-row-color style properties may not be used by the engine. The only engine that uses it currently is the buildin one, but many engines fall back to this implementation. This means there are quite a few engines where they work.

The grid and tree lines are not drawn using the theme, and the only way to control them are the above style properties. The application decides whether to use them or not. Their color is always black (hmm, that is bad, what about dark themes? someone file a bug please? ;-)).

Drawing

The interesting part of the treeview is that there is a large set of detail strings used. Even more if you enable row-ending-details.

Row Background

The rows are drawn using a flat_box, the area for each column seperatly. The shadow is NONE, and the state is SELECTED if the row is selected, otherwise NORMAL (and of course INSENSITIVE if the widget whole widget is insensitive).

The detail string depends a lot on the style properties and other settings. It starts either with "cell_even" or "cell_odd", and then more is added as following:

  • If both the allow-rules style property and the rules-hint property are set, add "_ruled".

  • If the treeview is sorted by the current column, add "_sorted".

  • If the row-ending-details style property is set, add "_start", "_middle" or "_end" if the column is the first, middle or last. Nothing is added if the treeview has only one column.

Focus

If the treeview is empty, a focus is drawn over the whole area. /!\ No detail string is set.

Row Focus

A focus is drawn for the focused row. The used state is the same as the one of the row itself.

The detail string used is "treeview", with an additional "-left", "-right", "-middle" or nothing if row-ending-details is set.

Drag and Drop Indicator

When a drag and drop operation is in process, a focus is drawn for the row underneath the cursor. In this case the detail string is "treeview-drop-indicator", add "-left", "-right", "-middle" or nothing if row-ending-details is set. The state is the same as the TreeView, so it will be NORMAL.

Expander

I don't think there is much to say about the expander. It works similar to every other expander (see ../GtkExpander) and has a detail of "treeview".

Separators

The separator line is a simple hline. No detail string is set.

GTK+ API Documentation

http://library.gnome.org/devel/gtk/stable/GtkTreeView.html

Bugs

There is something weird happening when base[NORMAL] is the same as bg[NORMAL]. bg_pixmap[NORMAL] will be used to draw the background then, but scrolling does not work correctly.

http://bugzilla.gnome.org/show_bug.cgi?id=354039

Attic/GnomeArt/Tutorials/GtkThemes/GtkTreeView (last edited 2013-11-27 14:33:56 by WilliamJonMcCann)