Gtk2HsContentsIndex
Graphics.UI.Gtk.TreeList.TreeView
Description

This widget constitutes the main widget for displaying lists and other structured data.

  • The widget supports scrolling natively. This implies that pixel coordinates can be given in two formats: relative to the current view's upper left corner or relative to the whole list's coordinates. The former are called widget coordinates while the letter are called tree coordinates.

TODO

  • treeViewMoveColumnAfter and treeViewMoveColumnFirst are not dealt with in Mogul
  • gtk_tree_view_get_bin_window is to compare the GDK window from incoming events. We don't marshal that window parameter, so this function is not bound either.
  • All functions related to drag and drop are missing.
  • get_search_equal_func is missing: proper memory management is impossible
  • gtk_tree_view_set_destroy_count_func is not meant to be useful
  • expand-collapse-cursor-row needs to be bound if it is useful to expand and collapse rows in a user-defined manner. Would only work on Gtk 2.2 and higher since the return parameter changed
  • move_cursor, select_all, select_cursor_parent, select_cursor_row toggle_cursor_row, unselect_all are not bound. These functions are only useful to change the widgets behaviour for these actions. Everything else can be done with cursor_changed and columns_changed
  • set_scroll_adjustment makes sense if the user monitors the scroll bars *and* the scroll bars can be replaced anytime (the latter is odd)
Synopsis
data TreeView
class ContainerClass o => TreeViewClass o
castToTreeView :: GObjectClass obj => obj -> TreeView
treeViewNew :: IO TreeView
treeViewNewWithModel :: TreeModelClass tm => tm -> IO TreeView
treeViewGetModel :: TreeViewClass tv => tv -> IO (Maybe TreeModel)
treeViewSetModel :: (TreeViewClass tv, TreeModelClass tm) => tv -> tm -> IO ()
treeViewGetSelection :: TreeViewClass tv => tv -> IO TreeSelection
treeViewGetHadjustment :: TreeViewClass tv => tv -> IO (Maybe Adjustment)
treeViewSetHadjustment :: TreeViewClass tv => Maybe Adjustment -> tv -> IO ()
treeViewGetVadjustment :: TreeViewClass tv => tv -> IO (Maybe Adjustment)
treeViewSetVadjustment :: TreeViewClass tv => Maybe Adjustment -> tv -> IO ()
treeViewGetHeadersVisible :: TreeViewClass tv => tv -> IO Bool
treeViewSetHeadersVisible :: TreeViewClass tv => tv -> Bool -> IO ()
treeViewColumnsAutosize :: TreeViewClass tv => tv -> IO ()
treeViewSetHeadersClickable :: TreeViewClass tv => tv -> Bool -> IO ()
treeViewGetRulesHint :: TreeViewClass tv => tv -> IO Bool
treeViewSetRulesHint :: TreeViewClass tv => tv -> Bool -> IO ()
treeViewAppendColumn :: TreeViewClass tv => tv -> TreeViewColumn -> IO Int
treeViewRemoveColumn :: TreeViewClass tv => tv -> TreeViewColumn -> IO Int
treeViewInsertColumn :: TreeViewClass tv => tv -> TreeViewColumn -> Int -> IO Int
treeViewInsertColumnWithAttributes :: (TreeViewClass tv, CellRendererClass cr) => tv -> Int -> String -> cr -> [(String, Int)] -> IO ()
treeViewGetColumn :: TreeViewClass tv => tv -> Int -> IO (Maybe TreeViewColumn)
treeViewGetColumns :: TreeViewClass tv => tv -> IO [TreeViewColumn]
treeViewMoveColumnAfter :: TreeViewClass tv => tv -> TreeViewColumn -> TreeViewColumn -> IO ()
treeViewMoveColumnFirst :: TreeViewClass tv => tv -> TreeViewColumn -> IO ()
treeViewSetExpanderColumn :: TreeViewClass tv => tv -> Maybe TreeViewColumn -> IO ()
treeViewGetExpanderColumn :: TreeViewClass tv => tv -> IO TreeViewColumn
treeViewSetColumnDragFunction :: TreeViewClass tv => tv -> Maybe (TreeViewColumn -> Maybe TreeViewColumn -> Maybe TreeViewColumn -> IO Bool) -> IO ()
treeViewScrollToPoint :: TreeViewClass tv => tv -> Int -> Int -> IO ()
treeViewScrollToCell :: TreeViewClass tv => tv -> TreePath -> TreeViewColumn -> Maybe (Float, Float) -> IO ()
treeViewSetCursor :: TreeViewClass tv => tv -> TreePath -> Maybe (TreeViewColumn, Bool) -> IO ()
treeViewSetCursorOnCell :: TreeViewClass tv => tv -> TreePath -> TreeViewColumn -> CellRenderer -> Bool -> IO ()
treeViewGetCursor :: TreeViewClass tv => tv -> IO (Maybe TreePath, Maybe TreeViewColumn)
treeViewRowActivated :: TreeViewClass tv => tv -> TreePath -> TreeViewColumn -> IO ()
treeViewExpandAll :: TreeViewClass tv => tv -> IO ()
treeViewCollapseAll :: TreeViewClass tv => tv -> IO ()
treeViewExpandToPath :: TreeViewClass tv => tv -> TreePath -> IO ()
treeViewExpandRow :: TreeViewClass tv => TreePath -> Bool -> tv -> IO Bool
treeViewCollapseRow :: TreeViewClass tv => tv -> TreePath -> IO Bool
treeViewMapExpandedRows :: TreeViewClass tv => tv -> (TreePath -> IO ()) -> IO ()
treeViewRowExpanded :: TreeViewClass tv => tv -> TreePath -> IO Bool
treeViewGetReorderable :: TreeViewClass tv => tv -> IO Bool
treeViewSetReorderable :: TreeViewClass tv => tv -> Bool -> IO ()
type Point = (Int, Int)
treeViewGetPathAtPos :: TreeViewClass tv => tv -> Point -> IO (Maybe (TreePath, TreeViewColumn, Point))
treeViewGetCellArea :: TreeViewClass tv => tv -> Maybe TreePath -> TreeViewColumn -> IO Rectangle
treeViewGetBackgroundArea :: TreeViewClass tv => tv -> Maybe TreePath -> TreeViewColumn -> IO Rectangle
treeViewGetVisibleRect :: TreeViewClass tv => tv -> IO Rectangle
treeViewWidgetToTreeCoords :: TreeViewClass tv => tv -> Point -> IO Point
treeViewTreeToWidgetCoords :: TreeViewClass tv => tv -> Point -> IO Point
treeViewCreateRowDragIcon :: TreeViewClass tv => tv -> TreePath -> IO Pixmap
treeViewGetEnableSearch :: TreeViewClass tv => tv -> IO Bool
treeViewSetEnableSearch :: TreeViewClass tv => tv -> Bool -> IO ()
treeViewGetSearchColumn :: TreeViewClass tv => tv -> IO Int
treeViewSetSearchColumn :: TreeViewClass tv => tv -> Int -> IO ()
treeViewSetSearchEqualFunc :: TreeViewClass tv => tv -> (Int -> String -> TreeIter -> IO Bool) -> IO ()
onColumnsChanged :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)
afterColumnsChanged :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)
onCursorChanged :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)
afterCursorChanged :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)
onRowActivated :: TreeViewClass tv => tv -> (TreePath -> TreeViewColumn -> IO ()) -> IO (ConnectId tv)
afterRowActivated :: TreeViewClass tv => tv -> (TreePath -> TreeViewColumn -> IO ()) -> IO (ConnectId tv)
onRowCollapsed :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO ()) -> IO (ConnectId tv)
afterRowCollapsed :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO ()) -> IO (ConnectId tv)
onRowExpanded :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO ()) -> IO (ConnectId tv)
afterRowExpanded :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO ()) -> IO (ConnectId tv)
onStartInteractiveSearch :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)
afterStartInteractiveSearch :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)
onTestCollapseRow :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO Bool) -> IO (ConnectId tv)
afterTestCollapseRow :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO Bool) -> IO (ConnectId tv)
onTestExpandRow :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO Bool) -> IO (ConnectId tv)
afterTestExpandRow :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO Bool) -> IO (ConnectId tv)
Documentation
data TreeView
Instances
TreeViewClass TreeView
ContainerClass TreeView
WidgetClass TreeView
ObjectClass TreeView
GObjectClass TreeView
class ContainerClass o => TreeViewClass o
Instances
TreeViewClass TreeView
castToTreeView :: GObjectClass obj => obj -> TreeView
treeViewNew :: IO TreeView
Make a new TreeView widget.
treeViewNewWithModel :: TreeModelClass tm => tm -> IO TreeView
Create a new TreeView widget with tm as the storage model.
treeViewGetModel :: TreeViewClass tv => tv -> IO (Maybe TreeModel)
Retrieve the TreeModel that supplies the data for this TreeView. Returns Nothing if no model is currently set.
treeViewSetModel :: (TreeViewClass tv, TreeModelClass tm) => tv -> tm -> IO ()
Set the TreeModel for the current View.
treeViewGetSelection :: TreeViewClass tv => tv -> IO TreeSelection
Retrieve a TreeSelection that holds the current selected nodes of the View.
treeViewGetHadjustment :: TreeViewClass tv => tv -> IO (Maybe Adjustment)
Get the Adjustment that represents the horizontal aspect.
treeViewSetHadjustment :: TreeViewClass tv => Maybe Adjustment -> tv -> IO ()
Set the Adjustment that controls the horizontal aspect. If adj is Nothing then set no Adjustment widget.
treeViewGetVadjustment :: TreeViewClass tv => tv -> IO (Maybe Adjustment)
Get the Adjustment that represents the vertical aspect.
treeViewSetVadjustment :: TreeViewClass tv => Maybe Adjustment -> tv -> IO ()
Set the Adjustment that controls the vertical aspect. If adj is Nothing then set no Adjustment widget.
treeViewGetHeadersVisible :: TreeViewClass tv => tv -> IO Bool
Query if the column headers are visible.
treeViewSetHeadersVisible :: TreeViewClass tv => tv -> Bool -> IO ()
Set the visibility state of the column headers.
treeViewColumnsAutosize :: TreeViewClass tv => tv -> IO ()
Resize the columns to their optimal size.
treeViewSetHeadersClickable :: TreeViewClass tv => tv -> Bool -> IO ()
Set wether the columns headers are sensitive to mouse clicks.
treeViewGetRulesHint :: TreeViewClass tv => tv -> IO Bool

Give visual aid for wide columns.

  • This function tells GTK+ that the user interface for your application requires users to read across tree columns. By default, GTK+ will then render the tree with alternating row colors. Do not use it just because you prefer the appearance of the ruled tree; that's a question for the theme. Some themes will draw tree rows in alternating colors even when rules are turned off, and users who prefer that appearance all the time can choose those themes. You should call this function only as a semantic hint to the theme engine that your tree makes alternating colors useful from a functional standpoint (since it has lots of columns, generally).
treeViewSetRulesHint :: TreeViewClass tv => tv -> Bool -> IO ()
Query if visual aid for wide columns is turned on.
treeViewAppendColumn :: TreeViewClass tv => tv -> TreeViewColumn -> IO Int
Append a new column to the TreeView. Returns the new number of columns.
treeViewRemoveColumn :: TreeViewClass tv => tv -> TreeViewColumn -> IO Int
Remove column tvc from the TreeView widget. The number of remaining columns is returned.
treeViewInsertColumn :: TreeViewClass tv => tv -> TreeViewColumn -> Int -> IO Int
Inserts column tvc into the TreeView widget at the position pos. Returns the number of columns after insertion. Specify -1 for pos to insert the column at the end.
treeViewInsertColumnWithAttributes :: (TreeViewClass tv, CellRendererClass cr) => tv -> Int -> String -> cr -> [(String, Int)] -> IO ()

Insert new TreeViewColumn.

  • Inserts new column into the TreeView tv at position pos with title ref argtitle, cell renderer cr and attributes attribs. Specify -1 for pos to insert the column at the end.
treeViewGetColumn :: TreeViewClass tv => tv -> Int -> IO (Maybe TreeViewColumn)

Retrieve a TreeViewColumn.

  • Retrieve the pos th columns of TreeView. If the index is out of range Nothing is returned.
treeViewGetColumns :: TreeViewClass tv => tv -> IO [TreeViewColumn]
Return all TreeViewColumns in this TreeView.
treeViewMoveColumnAfter :: TreeViewClass tv => tv -> TreeViewColumn -> TreeViewColumn -> IO ()

Move a specific column.

  • Use treeViewMoveColumnToFront if you want to move the column to the left end of the TreeView.
treeViewMoveColumnFirst :: TreeViewClass tv => tv -> TreeViewColumn -> IO ()

Move a specific column.

treeViewSetExpanderColumn :: TreeViewClass tv => tv -> Maybe TreeViewColumn -> IO ()

Set location of hierarchy controls.

  • Sets the column to draw the expander arrow at. If col is Nothing, then the expander arrow is always at the first visible column.
treeViewGetExpanderColumn :: TreeViewClass tv => tv -> IO TreeViewColumn

Get location of hierarchy controls.

  • Gets the column to draw the expander arrow at. If col is Nothing, then the expander arrow is always at the first visible column.
treeViewSetColumnDragFunction :: TreeViewClass tv => tv -> Maybe (TreeViewColumn -> Maybe TreeViewColumn -> Maybe TreeViewColumn -> IO Bool) -> IO ()

Specify where a column may be dropped.

  • Sets a user function for determining where a column may be dropped when dragged. This function is called on every column pair in turn at the beginning of a column drag to determine where a drop can take place. * The callback function take the TreeViewColumn to be moved, the second and third arguments are the columns on the left and right side of the new location. At most one of them might be Nothing which indicates that the column is about to be dropped at the left or right end of the TreeView. * The predicate pred should return True if it is ok to insert the column at this place. * Use Nothing for the predicate if columns can be inserted anywhere.
treeViewScrollToPoint :: TreeViewClass tv => tv -> Int -> Int -> IO ()
treeViewScrollToCell :: TreeViewClass tv => tv -> TreePath -> TreeViewColumn -> Maybe (Float, Float) -> IO ()

Scroll to a cell.

  • Scroll to a cell as specified by path and tvc. The cell is aligned within the TreeView widget as follows: horizontally by hor from left (0.0) to right (1.0) and vertically by ver from top (0.0) to buttom (1.0).
treeViewSetCursor :: TreeViewClass tv => tv -> TreePath -> Maybe (TreeViewColumn, Bool) -> IO ()

Selects a specific row.

  • Sets the current keyboard focus to be at path, and selects it. This is useful when you want to focus the user's attention on a particular row. If focusColumn is given, then the input focus is given to the column specified by it. Additionally, if focusColumn is specified, and startEditing is True, then editing will be started in the specified cell. This function is often followed by a widgetGrabFocus to the TreeView in order to give keyboard focus to the widget.
treeViewSetCursorOnCell :: TreeViewClass tv => tv -> TreePath -> TreeViewColumn -> CellRenderer -> Bool -> IO ()

Selects a cell in a specific row.

treeViewGetCursor :: TreeViewClass tv => tv -> IO (Maybe TreePath, Maybe TreeViewColumn)

Retrieves the position of the focus.

  • Returns a pair (path, column).If the cursor is not currently set, path will be Nothing. If no column is currently selected, column will be Nothing.
treeViewRowActivated :: TreeViewClass tv => tv -> TreePath -> TreeViewColumn -> IO ()
Emit the activated signal on a cell.
treeViewExpandAll :: TreeViewClass tv => tv -> IO ()
Expand all nodes in the TreeView.
treeViewCollapseAll :: TreeViewClass tv => tv -> IO ()
Collapse all nodes in the TreeView.
treeViewExpandToPath :: TreeViewClass tv => tv -> TreePath -> IO ()

Make a certain path visible.

  • This will expand all parent rows of tp as necessary.
  • Only available in Gtk 2.2 and higher.
treeViewExpandRow :: TreeViewClass tv => TreePath -> Bool -> tv -> IO Bool

Expand a row.

  • Expand a node that is specified by path. If the all is True every child will be expanded recursively. Returns True if the row existed and had children.
treeViewCollapseRow :: TreeViewClass tv => tv -> TreePath -> IO Bool
Collapse a row. Returns True if the row existed.
treeViewMapExpandedRows :: TreeViewClass tv => tv -> (TreePath -> IO ()) -> IO ()
Call function for every expaned row.
treeViewRowExpanded :: TreeViewClass tv => tv -> TreePath -> IO Bool
Check if row is expanded.
treeViewGetReorderable :: TreeViewClass tv => tv -> IO Bool

Query if rows can be moved around.

treeViewSetReorderable :: TreeViewClass tv => tv -> Bool -> IO ()

Check if rows can be moved around.

  • Set whether the user can use drag and drop (DND) to reorder the rows in the store. This works on both TreeStore and ListStore models. If ro is True, then the user can reorder the model by dragging and dropping rows. The developer can listen to these changes by connecting to the model's signals. This function does not give you any degree of control over the order -- any reorderering is allowed. If more control is needed, you should probably handle drag and drop manually.
type Point = (Int, Int)
Represents the x and y coordinate of a point.
treeViewGetPathAtPos :: TreeViewClass tv => tv -> Point -> IO (Maybe (TreePath, TreeViewColumn, Point))

Map a pixel to the specific cell.

  • Finds the path at the Point (x, y). The coordinates x and y are relative to the top left corner of the TreeView drawing window. As such, coordinates in a mouse click event can be used directly to determine the cell which the user clicked on. This is therefore a way to realize for popup menus.
  • The returned point is the input point relative to the cell's upper left corner. The whole TreeView is divided between all cells. The returned point is relative to the rectangle this cell occupies within the TreeView.
treeViewGetCellArea :: TreeViewClass tv => tv -> Maybe TreePath -> TreeViewColumn -> IO Rectangle

Retrieve the smallest bounding box of a cell.

  • Fills the bounding rectangle in tree window coordinates for the cell at the row specified by tp and the column specified by tvc. If path is Nothing or points to a path not currently displayed, the y and height fields of the Rectangle will be filled with 0. The sum of all cell rectangles does not cover the entire tree; there are extra pixels in between rows, for example.
treeViewGetBackgroundArea :: TreeViewClass tv => tv -> Maybe TreePath -> TreeViewColumn -> IO Rectangle

Retrieve the largest bounding box of a cell.

  • Fills the bounding rectangle in tree window coordinates for the cell at the row specified by tp and the column specified by tvc. If path is Nothing or points to a path not currently displayed, the y and height fields of the Rectangle will be filled with 0. The background areas tile the widget's area to cover the entire tree window (except for the area used for header buttons). Contrast this with treeViewGetCellArea.
treeViewGetVisibleRect :: TreeViewClass tv => tv -> IO Rectangle

Retrieve the currently visible area.

  • The returned rectangle gives the visible part of the tree in tree coordinates.
treeViewWidgetToTreeCoords :: TreeViewClass tv => tv -> Point -> IO Point

Convert widget to tree pixel coordinates.

  • See module description.
treeViewTreeToWidgetCoords :: TreeViewClass tv => tv -> Point -> IO Point

Convert tree to widget pixel coordinates.

  • See module description.
treeViewCreateRowDragIcon :: TreeViewClass tv => tv -> TreePath -> IO Pixmap
Creates a Pixmap representation of the row at the given path. This image can be used for a drag icon.
treeViewGetEnableSearch :: TreeViewClass tv => tv -> IO Bool

Set if user can search entries.

  • If enabled, the user can type in text which will set the cursor to the first matching entry.
treeViewSetEnableSearch :: TreeViewClass tv => tv -> Bool -> IO ()
Check if user can search entries.
treeViewGetSearchColumn :: TreeViewClass tv => tv -> IO Int
Gets the column searched on by the interactive search.
treeViewSetSearchColumn :: TreeViewClass tv => tv -> Int -> IO ()

Set the column searched on by by the interactive search.

  • Additionally, turns on interactive searching.
treeViewSetSearchEqualFunc :: TreeViewClass tv => tv -> (Int -> String -> TreeIter -> IO Bool) -> IO ()

Set the predicate to test for equality.

  • The default function assumes that the column col has contains Attribute cr String. It conducts a case insensitive comparison of the text typed by the user and the text in the tree model. This function can be used to override this behaviour. The predicate returns True if the entries should be considered to match. The parameters are the column number, the text the user typed in and a TreeIter which points to the cell to be compared.
onColumnsChanged :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)
The user has dragged a column to another position.
afterColumnsChanged :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)
onCursorChanged :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)
The cursor in the tree has moved.
afterCursorChanged :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)
onRowActivated :: TreeViewClass tv => tv -> (TreePath -> TreeViewColumn -> IO ()) -> IO (ConnectId tv)

A row was activated.

  • Activation usually means the user has pressed return on a row.
afterRowActivated :: TreeViewClass tv => tv -> (TreePath -> TreeViewColumn -> IO ()) -> IO (ConnectId tv)
onRowCollapsed :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO ()) -> IO (ConnectId tv)
Children of this node were hidden.
afterRowCollapsed :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO ()) -> IO (ConnectId tv)
onRowExpanded :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO ()) -> IO (ConnectId tv)
Children of this node are made visible.
afterRowExpanded :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO ()) -> IO (ConnectId tv)
onStartInteractiveSearch :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)

The user wants to search interactively.

  • Connect to this signal if you want to provide you own search facility. Note that you must handle all keyboard input yourself.
afterStartInteractiveSearch :: TreeViewClass tv => tv -> IO () -> IO (ConnectId tv)
onTestCollapseRow :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO Bool) -> IO (ConnectId tv)

Determine if this row should be collapsed.

  • If the application connects to this function and returns False, the specifc row will not be altered.
afterTestCollapseRow :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO Bool) -> IO (ConnectId tv)
onTestExpandRow :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO Bool) -> IO (ConnectId tv)

Determine if this row should be expanded.

  • If the application connects to this function and returns False, the specifc row will not be altered.
afterTestExpandRow :: TreeViewClass tv => tv -> (TreeIter -> TreePath -> IO Bool) -> IO (ConnectId tv)
Produced by Haddock version 0.6