package ocgtk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Wrappers.Tree_view

type t = [ `tree_view | `widget | `initially_unowned | `object_ ] Gobject.obj
val new_ : unit -> t

Create a new TreeView

val new_with_model : [ `tree_model ] Gobject.obj -> t

Create a new TreeView

val unset_rows_drag_source : t -> unit

Undoes the effect of gtk_tree_view_enable_model_drag_source(). Calling this method sets `GtkTreeView`:reorderable to %FALSE.

val unset_rows_drag_dest : t -> unit

Undoes the effect of gtk_tree_view_enable_model_drag_dest(). Calling this method sets `GtkTreeView`:reorderable to %FALSE.

val set_tooltip_row : t -> [ `tooltip | `object_ ] Gobject.obj -> [ `tree_path ] Gobject.obj -> unit

Sets the tip area of @tooltip to be the area covered by the row at @path. See also gtk_tree_view_set_tooltip_column() for a simpler alternative. See also gtk_tooltip_set_tip_area().

val set_tooltip_column : t -> int -> unit

If you only plan to have simple (text-only) tooltips on full rows, you can use this function to have `GtkTreeView` handle these automatically for you. @column should be set to the column in @tree_view’s model containing the tooltip texts, or -1 to disable this feature.

When enabled, `GtkWidget:has-tooltip` will be set to %TRUE and @tree_view will connect a `GtkWidget::query-tooltip` signal handler.

Note that the signal handler sets the text with gtk_tooltip_set_markup(), so &, <, etc have to be escaped in the text.

val set_tooltip_cell : t -> [ `tooltip | `object_ ] Gobject.obj -> [ `tree_path ] Gobject.obj option -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj option -> [ `cell_renderer | `initially_unowned | `object_ ] Gobject.obj option -> unit

Sets the tip area of @tooltip to the area @path, @column and @cell have in common. For example if @path is %NULL and @column is set, the tip area will be set to the full area covered by @column. See also gtk_tooltip_set_tip_area().

Note that if @path is not specified and @cell is set and part of a column containing the expander, the tooltip might not show and hide at the correct position. In such cases @path must be set to the current node under the mouse cursor for this function to operate correctly.

See also gtk_tree_view_set_tooltip_column() for a simpler alternative.

val set_show_expanders : t -> bool -> unit

Sets whether to draw and enable expanders and indent child rows in @tree_view. When disabled there will be no expanders visible in trees and there will be no way to expand and collapse rows by default. Also note that hiding the expanders will disable the default indentation. You can set a custom indentation in this case using gtk_tree_view_set_level_indentation(). This does not have any visible effects for lists.

val set_search_entry : t -> [ `editable ] Gobject.obj option -> unit

Sets the entry which the interactive search code will use for this @tree_view. This is useful when you want to provide a search entry in our interface at all time at a fixed position. Passing %NULL for @entry will make the interactive search code use the built-in popup entry again.

val set_search_column : t -> int -> unit

Sets @column as the column where the interactive search code should search in for the current model.

If the search column is set, users can use the “start-interactive-search” key binding to bring up search popup. The enable-search property controls whether simply typing text will also start an interactive search.

Note that @column refers to a column of the current model. The search column is reset to -1 when the model is changed.

val set_rubber_banding : t -> bool -> unit

Enables or disables rubber banding in @tree_view. If the selection mode is %GTK_SELECTION_MULTIPLE, rubber banding will allow the user to select multiple rows by dragging the mouse.

val set_reorderable : t -> bool -> unit

This function is a convenience function to allow you to reorder models that support the `GtkTreeDragSourceIface` and the `GtkTreeDragDestIface`. Both `GtkTreeStore` and `GtkListStore` support these. If @reorderable 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 `GtkTreeModel::row-inserted` and `GtkTreeModel::row-deleted` signals. The reordering is implemented by setting up the tree view as a drag source and destination. Therefore, drag and drop can not be used in a reorderable view for any other purpose.

This function does not give you any degree of control over the order -- any reordering is allowed. If more control is needed, you should probably handle drag and drop manually.

val set_model : t -> [ `tree_model ] Gobject.obj option -> unit

Sets the model for a `GtkTreeView`. If the @tree_view already has a model set, it will remove it before setting the new model. If @model is %NULL, then it will unset the old model.

val set_level_indentation : t -> int -> unit

Sets the amount of extra indentation for child levels to use in @tree_view in addition to the default indentation. The value should be specified in pixels, a value of 0 disables this feature and in this case only the default indentation will be used. This does not have any visible effects for lists.

val set_hover_selection : t -> bool -> unit

Enables or 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.

val set_hover_expand : t -> bool -> unit

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

val set_headers_visible : t -> bool -> unit

Sets the visibility state of the headers.

val set_headers_clickable : t -> bool -> unit

Allow the column title buttons to be clicked.

val set_grid_lines : t -> Gtk_enums.treeviewgridlines -> unit

Sets which grid lines to draw in @tree_view.

val set_fixed_height_mode : t -> bool -> unit

Enables or disables the fixed height mode of @tree_view. Fixed height mode speeds up `GtkTreeView` by assuming that all rows have the same height. Only enable this option if all rows are the same height and all columns are of type %GTK_TREE_VIEW_COLUMN_FIXED.

val set_expander_column : t -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj option -> unit

Sets the column to draw the expander arrow at. It must be in @tree_view. If @column is %NULL, then the expander arrow is always at the first visible column.

If you do not want expander arrow to appear in your tree, set the expander column to a hidden column.

val set_enable_tree_lines : t -> bool -> unit

Sets whether to draw lines interconnecting the expanders in @tree_view. This does not have any visible effects for lists.

If @enable_search is set, then the user can type in text to search through the tree interactively (this is sometimes called "typeahead find").

Note that even if this is %FALSE, the user can still initiate a search using the “start-interactive-search” key binding.

val set_drag_dest_row : t -> [ `tree_path ] Gobject.obj option -> Gtk_enums.treeviewdropposition -> unit

Sets the row that is highlighted for feedback. If @path is %NULL, an existing highlight is removed.

val set_cursor_on_cell : t -> [ `tree_path ] Gobject.obj -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj option -> [ `cell_renderer | `initially_unowned | `object_ ] Gobject.obj option -> bool -> unit

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 @focus_column is not %NULL, then focus is given to the column specified by it. If @focus_column and @focus_cell are not %NULL, and @focus_column contains 2 or more editable or activatable cells, then focus is given to the cell specified by @focus_cell. Additionally, if @focus_column is specified, and @start_editing is %TRUE, then editing should be started in the specified cell. This function is often followed by @gtk_widget_grab_focus (@tree_view) in order to give keyboard focus to the widget. Please note that editing can only happen when the widget is realized.

If @path is invalid for @model, the current cursor (if any) will be unset and the function will return without failing.

val set_cursor : t -> [ `tree_path ] Gobject.obj -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj option -> bool -> unit

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 @focus_column is not %NULL, then focus is given to the column specified by it. Additionally, if @focus_column is specified, and @start_editing is %TRUE, then editing should be started in the specified cell. This function is often followed by @gtk_widget_grab_focus (@tree_view) in order to give keyboard focus to the widget. Please note that editing can only happen when the widget is realized.

If @path is invalid for @model, the current cursor (if any) will be unset and the function will return without failing.

val set_activate_on_single_click : t -> bool -> unit

Cause the `GtkTreeView`::row-activated signal to be emitted on a single click instead of a double click.

val scroll_to_point : t -> int -> int -> unit

Scrolls the tree view such that the top-left corner of the visible area is @tree_x, @tree_y, where @tree_x and @tree_y are specified in tree coordinates. The @tree_view must be realized before this function is called. If it isn't, you probably want to be using gtk_tree_view_scroll_to_cell().

If either @tree_x or @tree_y are -1, then that direction isn’t scrolled.

val scroll_to_cell : t -> [ `tree_path ] Gobject.obj option -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj option -> bool -> float -> float -> unit

Moves the alignments of @tree_view to the position specified by @column and @path. If @column is %NULL, then no horizontal scrolling occurs. Likewise, if @path is %NULL no vertical scrolling occurs. At a minimum, one of @column or @path need to be non-%NULL. @row_align determines where the row is placed, and @col_align determines where @column is placed. Both are expected to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means right/bottom alignment, 0.5 means center.

If @use_align is %FALSE, then the alignment arguments are ignored, and the tree does the minimum amount of work to scroll the cell onto the screen. This means that the cell will be scrolled to the edge closest to its current position. If the cell is currently visible on the screen, nothing is done.

This function only works if the model is set, and @path is a valid row on the model. If the model changes before the @tree_view is realized, the centered path will be modified to reflect this change.

val row_expanded : t -> [ `tree_path ] Gobject.obj -> bool

Returns %TRUE if the node pointed to by @path is expanded in @tree_view.

val row_activated : t -> [ `tree_path ] Gobject.obj -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj option -> unit

Activates the cell determined by @path and @column.

val remove_column : t -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj -> int

Removes @column from @tree_view.

val move_column_after : t -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj option -> unit

Moves @column to be after to @base_column. If @base_column is %NULL, then @column is placed in the first position.

val is_rubber_banding_active : t -> bool

Returns whether a rubber banding operation is currently being done in @tree_view.

val insert_column : t -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj -> int -> int

This inserts the @column into the @tree_view at @position. If @position is -1, then the column is inserted at the end. If @tree_view has “fixed_height” mode enabled, then @column must have its “sizing” property set to be GTK_TREE_VIEW_COLUMN_FIXED.

val get_visible_rect : t -> Ocgtk_gdk.Gdk.Wrappers.Rectangle.t

Fills @visible_rect with the currently-visible region of the buffer, in tree coordinates. Convert to bin_window coordinates with gtk_tree_view_convert_tree_to_bin_window_coords(). Tree coordinates start at 0,0 for row 0 of the tree, and cover the entire scrollable area of the tree.

val get_tooltip_column : t -> int

Returns the column of @tree_view’s model which is being used for displaying tooltips on @tree_view’s rows.

val get_show_expanders : t -> bool

Returns whether or not expanders are drawn in @tree_view.

val get_selection : t -> [ `tree_selection | `object_ ] Gobject.obj

Gets the `GtkTreeSelection` associated with @tree_view.

val get_search_entry : t -> [ `editable ] Gobject.obj option

Returns the `GtkEntry` which is currently in use as interactive search entry for @tree_view. In case the built-in entry is being used, %NULL will be returned.

val get_search_column : t -> int

Gets the column searched on by the interactive search code.

val get_rubber_banding : t -> bool

Returns whether rubber banding is turned on for @tree_view. If the selection mode is %GTK_SELECTION_MULTIPLE, rubber banding will allow the user to select multiple rows by dragging the mouse.

val get_reorderable : t -> bool

Retrieves whether the user can reorder the tree via drag-and-drop. See gtk_tree_view_set_reorderable().

val get_n_columns : t -> int

Queries the number of columns in the given @tree_view.

val get_model : t -> [ `tree_model ] Gobject.obj option

Returns the model the `GtkTreeView` is based on. Returns %NULL if the model is unset.

val get_level_indentation : t -> int

Returns the amount, in pixels, of extra indentation for child levels in @tree_view.

val get_hover_selection : t -> bool

Returns whether hover selection mode is turned on for @tree_view.

val get_hover_expand : t -> bool

Returns whether hover expansion mode is turned on for @tree_view.

val get_headers_visible : t -> bool

Returns %TRUE if the headers on the @tree_view are visible.

val get_headers_clickable : t -> bool

Returns whether all header columns are clickable.

val get_grid_lines : t -> Gtk_enums.treeviewgridlines

Returns which grid lines are enabled in @tree_view.

val get_fixed_height_mode : t -> bool

Returns whether fixed height mode is turned on for @tree_view.

val get_expander_column : t -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj option

Returns the column that is the current expander column, or %NULL if none has been set. This column has the expander arrow drawn next to it.

val get_enable_tree_lines : t -> bool

Returns whether or not tree lines are drawn in @tree_view.

Returns whether or not the tree allows to start interactive searching by typing in text.

val get_columns : t -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj list

Returns a `GList` of all the `GtkTreeViewColumn`s currently in @tree_view. The returned list must be freed with g_list_free ().

val get_column : t -> int -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj option

Gets the `GtkTreeViewColumn` at the given position in the #tree_view.

val get_cell_area : t -> [ `tree_path ] Gobject.obj option -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj option -> Ocgtk_gdk.Gdk.Wrappers.Rectangle.t

Fills the bounding rectangle in bin_window coordinates for the cell at the row specified by @path and the column specified by @column. If @path is %NULL, or points to a path not currently displayed, the @y and @height fields of the rectangle will be filled with 0. If @column is %NULL, the @x and @width fields will be filled with 0. The sum of all cell rects does not cover the entire tree; there are extra pixels in between rows, for example. The returned rectangle is equivalent to the @cell_area passed to gtk_cell_renderer_render(). This function is only valid if @tree_view is realized.

val get_background_area : t -> [ `tree_path ] Gobject.obj option -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj option -> Ocgtk_gdk.Gdk.Wrappers.Rectangle.t

Fills the bounding rectangle in bin_window coordinates for the cell at the row specified by @path and the column specified by @column. If @path is %NULL, or points to a node not found in the tree, the @y and @height fields of the rectangle will be filled with 0. If @column is %NULL, the @x and @width fields will be filled with 0. The returned rectangle is equivalent to the @background_area passed to gtk_cell_renderer_render(). These background areas tile to cover the entire bin window. Contrast with the @cell_area, returned by gtk_tree_view_get_cell_area(), which returns only the cell itself, excluding surrounding borders and the tree expander area.

val get_activate_on_single_click : t -> bool

Gets the setting set by gtk_tree_view_set_activate_on_single_click().

val expand_to_path : t -> [ `tree_path ] Gobject.obj -> unit

Expands the row at @path. This will also expand all parent rows of @path as necessary.

val expand_row : t -> [ `tree_path ] Gobject.obj -> bool -> bool

Opens the row so its children are visible.

val expand_all : t -> unit

Recursively expands all nodes in the @tree_view.

Turns @tree_view into a drag source for automatic DND. Calling this method sets `GtkTreeView`:reorderable to %FALSE.

val enable_model_drag_dest : t -> Ocgtk_gdk.Gdk.Wrappers.Content_formats.t -> Ocgtk_gdk.Gdk.dragaction -> unit

Turns @tree_view into a drop destination for automatic DND. Calling this method sets `GtkTreeView`:reorderable to %FALSE.

val create_row_drag_icon : t -> [ `tree_path ] Gobject.obj -> Ocgtk_gdk.Gdk.Wrappers.Paintable.t option

Creates a `cairo_surface_t` representation of the row at @path. This image is used for a drag icon.

val convert_widget_to_tree_coords : t -> int -> int -> int * int

Converts widget coordinates to coordinates for the tree (the full scrollable area of the tree).

val convert_widget_to_bin_window_coords : t -> int -> int -> int * int

Converts widget coordinates to coordinates for the bin_window.

val convert_tree_to_widget_coords : t -> int -> int -> int * int

Converts tree coordinates (coordinates in full scrollable area of the tree) to widget coordinates.

val convert_tree_to_bin_window_coords : t -> int -> int -> int * int

Converts tree coordinates (coordinates in full scrollable area of the tree) to bin_window coordinates.

val convert_bin_window_to_widget_coords : t -> int -> int -> int * int

Converts bin_window coordinates to widget relative coordinates.

val convert_bin_window_to_tree_coords : t -> int -> int -> int * int

Converts bin_window coordinates to coordinates for the tree (the full scrollable area of the tree).

val columns_autosize : t -> unit

Resizes all columns to their optimal width. Only works after the treeview has been realized.

val collapse_row : t -> [ `tree_path ] Gobject.obj -> bool

Collapses a row (hides its child rows, if they exist).

val collapse_all : t -> unit

Recursively collapses all visible, expanded nodes in @tree_view.

val append_column : t -> [ `tree_view_column | `initially_unowned | `object_ ] Gobject.obj -> int

Appends @column to the list of columns. If @tree_view has “fixed_height” mode enabled, then @column must have its “sizing” property set to be GTK_TREE_VIEW_COLUMN_FIXED.

val get_enable_grid_lines : t -> Gtk_enums.treeviewgridlines

Get property: enable-grid-lines

val set_enable_grid_lines : t -> Gtk_enums.treeviewgridlines -> unit

Set property: enable-grid-lines

val on_columns_changed : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_cursor_changed : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id
val on_expand_collapse_cursor_row : ?after:bool -> t -> callback:(object_:bool -> p0:bool -> p1:bool -> bool) -> Gobject.Signal.handler_id
val on_move_cursor : ?after:bool -> t -> callback: (step:Gtk_enums.movementstep -> direction:int -> extend:bool -> modify:bool -> bool) -> Gobject.Signal.handler_id
val on_select_all : ?after:bool -> t -> callback:(unit -> bool) -> Gobject.Signal.handler_id
val on_select_cursor_parent : ?after:bool -> t -> callback:(unit -> bool) -> Gobject.Signal.handler_id
val on_select_cursor_row : ?after:bool -> t -> callback:(object_:bool -> bool) -> Gobject.Signal.handler_id
val on_toggle_cursor_row : ?after:bool -> t -> callback:(unit -> bool) -> Gobject.Signal.handler_id
val on_unselect_all : ?after:bool -> t -> callback:(unit -> bool) -> Gobject.Signal.handler_id