GtkTreeView: GtkTreeView

Description Methods and Functions Hierarchy Interfaces Detailed Description GtkTreeView as GtkBuildable Structures Convenient Construction Enums and Flags User Functions Signals Properties Style Properties Author(s) References See Also

Description

A widget for displaying both trees and lists

Methods and Functions

gtkTreeViewNew(show = TRUE)
gtkTreeViewGetLevelIndentation(object)
gtkTreeViewGetShowExpanders(object)
gtkTreeViewSetLevelIndentation(object, indentation)
gtkTreeViewSetShowExpanders(object, enabled)
gtkTreeViewNewWithModel(model = NULL, show = TRUE)
gtkTreeViewGetModel(object)
gtkTreeViewSetModel(object, model = NULL)
gtkTreeViewGetSelection(object)
gtkTreeViewGetHadjustment(object)
gtkTreeViewSetHadjustment(object, adjustment)
gtkTreeViewGetVadjustment(object)
gtkTreeViewSetVadjustment(object, adjustment)
gtkTreeViewGetHeadersVisible(object)
gtkTreeViewSetHeadersVisible(object, headers.visible)
gtkTreeViewColumnsAutosize(object)
gtkTreeViewGetHeadersClickable(object)
gtkTreeViewSetHeadersClickable(object, active)
gtkTreeViewSetRulesHint(object, setting)
gtkTreeViewGetRulesHint(object)
gtkTreeViewAppendColumn(object, column)
gtkTreeViewRemoveColumn(object, column)
gtkTreeViewInsertColumn(object, column, position)
gtkTreeViewInsertColumnWithAttributes(object, position, title, cell, ...)
gtkTreeViewInsertColumnWithDataFunc(object, position, title, cell, func, data = NULL)
gtkTreeViewGetColumn(object, n)
gtkTreeViewGetColumns(object)
gtkTreeViewMoveColumnAfter(object, column, base.column = NULL)
gtkTreeViewSetExpanderColumn(object, column)
gtkTreeViewGetExpanderColumn(object)
gtkTreeViewSetColumnDragFunction(object, func, user.data = NULL)
gtkTreeViewScrollToPoint(object, tree.x, tree.y)
gtkTreeViewScrollToCell(object, path, column = NULL, use.align = FALSE, row.align = 0, col.align = 0)
gtkTreeViewSetCursor(object, path, focus.column = NULL, start.editing = FALSE)
gtkTreeViewSetCursorOnCell(object, path, focus.column = NULL, focus.cell = NULL, start.editing = FALSE)
gtkTreeViewGetCursor(object)
gtkTreeViewRowActivated(object, path, column)
gtkTreeViewExpandAll(object)
gtkTreeViewCollapseAll(object)
gtkTreeViewExpandToPath(object, path)
gtkTreeViewExpandRow(object, path, open.all)
gtkTreeViewCollapseRow(object, path)
gtkTreeViewMapExpandedRows(object, func, data = NULL)
gtkTreeViewRowExpanded(object, path)
gtkTreeViewSetReorderable(object, reorderable)
gtkTreeViewGetReorderable(object)
gtkTreeViewGetPathAtPos(object, x, y)
gtkTreeViewGetCellArea(object, path, column)
gtkTreeViewGetBackgroundArea(object, path, column)
gtkTreeViewGetVisibleRect(object)
gtkTreeViewGetVisibleRange(object)
gtkTreeViewGetBinWindow(object)
gtkTreeViewWidgetToTreeCoords(object, wx, wy)
gtkTreeViewTreeToWidgetCoords(object, tx, ty)
gtkTreeViewConvertBinWindowToTreeCoords(object, bx, by)
gtkTreeViewConvertBinWindowToWidgetCoords(object, bx, by)
gtkTreeViewConvertTreeToBinWindowCoords(object, tx, ty)
gtkTreeViewConvertTreeToWidgetCoords(object, tx, ty)
gtkTreeViewConvertWidgetToBinWindowCoords(object, wx, wy)
gtkTreeViewConvertWidgetToTreeCoords(object, wx, wy)
gtkTreeViewEnableModelDragDest(object, targets, actions)
gtkTreeViewEnableModelDragSource(object, start.button.mask, targets, actions)
gtkTreeViewUnsetRowsDragSource(object)
gtkTreeViewUnsetRowsDragDest(object)
gtkTreeViewSetDragDestRow(object, path, pos)
gtkTreeViewGetDragDestRow(object, path)
gtkTreeViewGetDestRowAtPos(object, drag.x, drag.y)
gtkTreeViewCreateRowDragIcon(object, path)
gtkTreeViewSetEnableSearch(object, enable.search)
gtkTreeViewGetEnableSearch(object)
gtkTreeViewGetSearchColumn(object)
gtkTreeViewSetSearchColumn(object, column)
gtkTreeViewGetSearchEqualFunc(object)
gtkTreeViewSetSearchEqualFunc(object, search.equal.func, search.user.data = NULL)
gtkTreeViewGetSearchEntry(object)
gtkTreeViewSetSearchEntry(object, entry = NULL)
gtkTreeViewGetSearchPositionFunc(object)
gtkTreeViewSetSearchPositionFunc(object, func, data)
gtkTreeViewGetFixedHeightMode(object)
gtkTreeViewSetFixedHeightMode(object, enable)
gtkTreeViewGetHoverSelection(object)
gtkTreeViewSetHoverSelection(object, hover)
gtkTreeViewGetHoverExpand(object)
gtkTreeViewSetHoverExpand(object, expand)
gtkTreeViewSetDestroyCountFunc(object, func, data = NULL)
gtkTreeViewGetRowSeparatorFunc(object)
gtkTreeViewSetRowSeparatorFunc(object, func, data = NULL)
gtkTreeViewGetRubberBanding(object)
gtkTreeViewSetRubberBanding(object, enable)
gtkTreeViewIsRubberBandingActive(object)
gtkTreeViewGetEnableTreeLines(object)
gtkTreeViewSetEnableTreeLines(object, enabled)
gtkTreeViewGetGridLines(object)
gtkTreeViewSetGridLines(object, grid.lines)
gtkTreeViewSetTooltipRow(object, tooltip, path)
gtkTreeViewSetTooltipCell(object, tooltip, path, column, cell)
gtkTreeViewGetTooltipContext(object, x, y, keyboard.tip)
gtkTreeViewGetTooltipColumn(object)
gtkTreeViewSetTooltipColumn(object, column)
gtkTreeView(model = NULL, show = TRUE)

Hierarchy

1
2
3
4
5
6
GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkTreeView

Interfaces

GtkTreeView implements AtkImplementorIface and GtkBuildable.

Detailed Description

Widget that displays any object that implements the GtkTreeModel interface.

Please refer to the tree widget conceptual overview for an overview of all the objects and data types related to the tree widget and how they work together.

Several different coordinate systems are exposed in the GtkTreeView API. These are:

Several functions are available for converting between the different coordinate systems. The most common translations are between widget and bin window coordinates and between bin window and tree coordinates. For the former you can use gtkTreeViewConvertWidgetToBinWindowCoords (and vice versa), for the latter gtkTreeViewConvertBinWindowToTreeCoords (and vice versa).

GtkTreeView as GtkBuildable

The GtkTreeView implementation of the GtkBuildable interface accepts GtkTreeViewColumn objects as <child> elements in UI definitions.

A UI definition fragment with GtkTreeView

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<object class="GtkTreeView" id="treeview">
  <property name="model">liststore1</property>
  <child>
    <object class="GtkTreeViewColumn" id="test-column">
      <property name="title">Test</property>
      <child>
        <object class="GtkCellRendererText" id="test-renderer"/>
        <attributes>
          <attribute name="text">1</attribute>
        </attributes>
      </child>
    </object>
  </child>
</object>

Structures

GtkTreeView

undocumented

Convenient Construction

gtkTreeView is the result of collapsing the constructors of GtkTreeView (gtkTreeViewNew, gtkTreeViewNewWithModel) and accepts a subset of its arguments matching the required arguments of one of its delegate constructors.

Enums and Flags

GtkTreeViewDropPosition

An enum for determining where a dropped row goes.

before

dropped row is inserted before

after

dropped row is inserted after

into-or-before

dropped row becomes a child or is inserted before

into-or-after

dropped row becomes a child or is inserted after

GtkTreeViewGridLines

Used to indicate which grid lines to draw in a tree view.

none

No grid lines.

horizontal

Horizontal grid lines.

vertical

Vertical grid lines.

both

Horizontal and vertical grid lines.

User Functions

GtkTreeViewColumnDropFunc(tree.view, column, prev.column, next.column, data)

Function type for determining whether column can be dropped in a particular spot (as determined by prev.column and next.column). In left to right locales, prev.column is on the left of the potential drop spot, and next.column is on the right. In right to left mode, this is reversed. This function should return TRUE if the spot is a valid drop spot. Please note that returning TRUE does not actually indicate that the column drop was made, but is meant only to indicate a possible drop spot to the user.

tree.view

A GtkTreeView

column

The GtkTreeViewColumn being dragged

prev.column

A GtkTreeViewColumn on one side of column

next.column

A GtkTreeViewColumn on the other side of column

data

user data

Returns: [logical] TRUE, if column can be dropped in this spot

GtkTreeViewMappingFunc(tree.view, path, user.data)

Function used for gtkTreeViewMapExpandedRows.

tree.view

A GtkTreeView

path

The path that's expanded

user.data

user data

GtkTreeViewSearchEqualFunc(model, column, key, iter, search.data)

A function used for checking whether a row in model matches a search key string entered by the user. Note the return value is reversed from what you would normally expect, though it has some similarity to strcmp() returning 0 for equal strings.

model

the GtkTreeModel being searched

column

the search column set by gtkTreeViewSetSearchColumn

key

the key string to compare with

iter

a GtkTreeIter pointing the row of model that should be compared with key.

search.data

user data from gtkTreeViewSetSearchEqualFunc

Returns: [logical] FALSE if the row matches, TRUE otherwise.

GtkTreeViewSearchPositionFunc()

undocumented

GtkTreeDestroyCountFunc()

undocumented

GtkTreeViewRowSeparatorFunc(model, iter, data)

Function type for determining whether the row pointed to by iter should be rendered as a separator. A common way to implement this is to have a boolean column in the model, whose values the GtkTreeViewRowSeparatorFunc returns.

model

the GtkTreeModel

iter

a GtkTreeIter pointing at a row in model

data

user data

Returns: [logical] TRUE if the row is a separator

Signals

columns-changed(tree.view, user.data)

The number of columns of the treeview has changed.

tree.view

the object on which the signal is emitted

user.data

user data set when the signal handler was connected.

cursor-changed(tree.view, user.data)

The position of the cursor (focused cell) has changed.

tree.view

the object on which the signal is emitted

user.data

user data set when the signal handler was connected.

expand-collapse-cursor-row(tree.view, user.data)

undocumented

tree.view

the object which received the signal.

user.data

user data set when the signal handler was connected.

move-cursor(tree.view, user.data)

undocumented

tree.view

the object which received the signal.

user.data

user data set when the signal handler was connected.

row-activated(tree.view, path, column, user.data)

The "row-activated" signal is emitted when the method gtkTreeViewRowActivated is called or the user double clicks a treeview row. It is also emitted when a non-editable row is selected and one of the keys: Space, Shift+Space, Return or Enter is pressed.

For selection handling refer to the tree widget conceptual overview as well as GtkTreeSelection.

tree.view

the object on which the signal is emitted

path

the GtkTreePath for the activated row

column

the GtkTreeViewColumn in which the activation occurred

user.data

user data set when the signal handler was connected.

row-collapsed(tree.view, iter, path, user.data)

The given row has been collapsed (child nodes are hidden).

tree.view

the object on which the signal is emitted

iter

the tree iter of the collapsed row

path

a tree path that points to the row

user.data

user data set when the signal handler was connected.

row-expanded(tree.view, iter, path, user.data)

The given row has been expanded (child nodes are shown).

tree.view

the object on which the signal is emitted

iter

the tree iter of the expanded row

path

a tree path that points to the row

user.data

user data set when the signal handler was connected.

select-all(tree.view, user.data)

undocumented

tree.view

the object which received the signal.

user.data

user data set when the signal handler was connected.

select-cursor-parent(tree.view, user.data)

undocumented

tree.view

the object which received the signal.

user.data

user data set when the signal handler was connected.

select-cursor-row(tree.view, user.data)

undocumented

tree.view

the object which received the signal.

user.data

user data set when the signal handler was connected.

set-scroll-adjustments(horizontal, vertical, user.data)

Set the scroll adjustments for the tree view. Usually scrolled containers like GtkScrolledWindow will emit this signal to connect two instances of GtkScrollbar to the scroll directions of the GtkTreeView.

horizontal

the horizontal GtkAdjustment

vertical

the vertical GtkAdjustment

user.data

user data set when the signal handler was connected.

start-interactive-search(tree.view, user.data)

undocumented

tree.view

the object which received the signal.

user.data

user data set when the signal handler was connected.

test-collapse-row(tree.view, iter, path, user.data)

The given row is about to be collapsed (hide its children nodes). Use this signal if you need to control the collapsibility of individual rows.

tree.view

the object on which the signal is emitted

iter

the tree iter of the row to collapse

path

a tree path that points to the row

user.data

user data set when the signal handler was connected.

Returns: [logical] FALSE to allow collapsing, TRUE to reject

test-expand-row(tree.view, iter, path, user.data)

The given row is about to be expanded (show its children nodes). Use this signal if you need to control the expandability of individual rows.

tree.view

the object on which the signal is emitted

iter

the tree iter of the row to expand

path

a tree path that points to the row

user.data

user data set when the signal handler was connected.

Returns: [logical] FALSE to allow expansion, TRUE to reject

toggle-cursor-row(tree.view, user.data)

undocumented

tree.view

the object which received the signal.

user.data

user data set when the signal handler was connected.

unselect-all(tree.view, user.data)

undocumented

tree.view

the object which received the signal.

user.data

user data set when the signal handler was connected.

Properties

enable-grid-lines [GtkTreeViewGridLines : Read / Write]

Whether grid lines should be drawn in the tree view. Default value: GTK_TREE_VIEW_GRID_LINES_NONE

enable-search [logical : Read / Write]

View allows user to search through columns interactively. Default value: TRUE

enable-tree-lines [logical : Read / Write]

Whether tree lines should be drawn in the tree view. Default value: FALSE

expander-column [GtkTreeViewColumn : * : Read / Write]

Set the column for the expander column.

fixed-height-mode [logical : Read / Write]

Setting the ::fixed-height-mode property to TRUE speeds up GtkTreeView by assuming that all rows have the same height. Only enable this option if all rows are the same height. Please see gtkTreeViewSetFixedHeightMode for more information on this option. Default value: FALSE Since 2.4

hadjustment [GtkAdjustment : * : Read / Write]

Horizontal Adjustment for the widget.

headers-clickable [logical : Read / Write]

Column headers respond to click events. Default value: TRUE

headers-visible [logical : Read / Write]

Show the column header buttons. Default value: TRUE

hover-expand [logical : Read / Write]

Enables of disables the hover expansion mode of tree.view. Hover expansion makes rows expand or collapse if the pointer moves over them.

This mode is primarily intended for treeviews in popups, e.g. in GtkComboBox or GtkEntryCompletion. Default value: FALSE Since 2.6

hover-selection [logical : Read / Write]

Enables of disables the hover selection mode of tree.view. Hover selection makes the selected row follow the pointer. Currently, this works only for the selection modes GTK_SELECTION_SINGLE and GTK_SELECTION_BROWSE.

This mode is primarily intended for treeviews in popups, e.g. in GtkComboBox or GtkEntryCompletion. Default value: FALSE Since 2.6

level-indentation [integer : Read / Write]

Extra indentation for each level. Allowed values: >= 0 Default value: 0 Since 2.12

model [GtkTreeModel : * : Read / Write]

The model for the tree view.

reorderable [logical : Read / Write]

View is reorderable. Default value: FALSE

rubber-banding [logical : Read / Write]

Whether to enable selection of multiple items by dragging the mouse pointer. Default value: FALSE

rules-hint [logical : Read / Write]

Set a hint to the theme engine to draw rows in alternating colors. Default value: FALSE

search-column [integer : Read / Write]

Model column to search through during interactive search. Allowed values: >= -1 Default value: -1

show-expanders [logical : Read / Write]

TRUE if the view has expanders. Default value: TRUE Since 2.12

tooltip-column [integer : Read / Write]

The column in the model containing the tooltip texts for the rows. Allowed values: >= -1 Default value: -1

vadjustment [GtkAdjustment : * : Read / Write]

Vertical Adjustment for the widget.

Style Properties

allow-rules [logical : Read]

Allow drawing of alternating color rows. Default value: TRUE

even-row-color [GdkColor : * : Read]

Color to use for even rows.

expander-size [integer : Read]

Size of the expander arrow. Allowed values: >= 0 Default value: 12

grid-line-pattern [character : * : Read]

Dash pattern used to draw the tree view grid lines. Default value: "\001\001"

grid-line-width [integer : Read]

Width, in pixels, of the tree view grid lines. Allowed values: >= 0 Default value: 1

horizontal-separator [integer : Read]

Horizontal space between cells. Must be an even number. Allowed values: >= 0 Default value: 2

indent-expanders [logical : Read]

Make the expanders indented. Default value: TRUE

odd-row-color [GdkColor : * : Read]

Color to use for odd rows.

row-ending-details [logical : Read]

Enable extended row background theming. Default value: FALSE

tree-line-pattern [character : * : Read]

Dash pattern used to draw the tree view lines. Default value: "\001\001"

tree-line-width [integer : Read]

Width, in pixels, of the tree view lines. Allowed values: >= 0 Default value: 1

vertical-separator [integer : Read]

Vertical space between cells. Must be an even number. Allowed values: >= 0 Default value: 2

Author(s)

Derived by RGtkGen from GTK+ documentation

References

https://developer.gnome.org/gtk2/stable/GtkTreeView.html

See Also

GtkTreeViewColumn GtkTreeSelection GtkTreeSortable GtkTreeModelSort GtkListStore GtkTreeStore GtkCellRenderer GtkCellEditable GtkCellRendererPixbuf GtkCellRendererText GtkCellRendererToggle


RGtk2 documentation built on Oct. 14, 2021, 5:08 p.m.

Related to GtkTreeView in RGtk2...