
Gnome::Gtk3::TreeView
A widget for displaying both trees and lists

Description
Widget that displays any object that implements the Gnome::Gtk3::TreeModel interface.
Please refer to the [tree widget conceptual overview](https://developer.gnome.org/gtk3/3.24/TreeWidget.html) for an overview of all the objects and data types related to the tree widget and how they work together.
Coordinate systems
Several different coordinate systems are exposed in the Gnome::Gtk3::TreeView API.

Coordinate systems in Gnome::Gtk3::TreeView API:
Widget coordinates: Coordinates relative to the widget (usually `widget->window`).
Bin window coordinates: Coordinates relative to the window that Gnome::Gtk3::TreeView renders to.
Tree coordinates: Coordinates relative to the entire scrollable area of Gnome::Gtk3::TreeView. These coordinates start at (0, 0) for row 0 of the tree.
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 gtk_tree_view_convert_widget_to_bin_window_coords()
(and vice versa), for the latter gtk_tree_view_convert_bin_window_to_tree_coords()
(and vice versa).
Gnome::Gtk3::TreeView as Gnome::Gtk3::Buildable
The Gnome::Gtk3::TreeView implementation of the Gnome::Gtk3::Buildable interface accepts Gnome::Gtk3::TreeViewColumn objects as <child> elements and exposes the internal Gnome::Gtk3::TreeSelection in UI definitions.
An example of a UI definition fragment with Gnome::Gtk3::TreeView:
<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> <child internal-child="selection"> <object class="GtkTreeSelection" id="selection"> <signal name="changed" handler="on_treeview_selection_changed"/> </object> </child> </object>
Css Nodes
treeview.view ├── header │ ├── <column header> ┊ ┊ │ ╰── <column header> │ ╰── [rubberband]
Gnome::Gtk3::TreeView has a main CSS node with name treeview and style class .view. It has a subnode with name header, which is the parent for all the column header widgets' CSS nodes. For rubberband selection, a subnode with name rubberband is used.
Implemented Interfaces
Gnome::Gtk3::TreeView implements
See Also
Gnome::Gtk3::TreeViewColumn, Gnome::Gtk3::TreeSelection, Gnome::Gtk3::TreeModel,
Synopsis
Declaration
unit class Gnome::Gtk3::TreeView; also is Gnome::Gtk3::Container; also does Gnome::Gtk3::Scrollable;
Uml Diagram
Inheriting this class
Inheriting is done in a special way in that it needs a call from new() to get the native object created by the class you are inheriting from.
use Gnome::Gtk3::TreeView:api<1>; unit class MyGuiClass; also is Gnome::Gtk3::TreeView; submethod new ( |c ) { # let the Gnome::Gtk3::TreeView class process the options self.bless( :GtkTreeView, |c); } submethod BUILD ( ... ) { ... }
Types
enum GtkTreeViewDropPosition
An enum for determining where a dropped row goes.
GTK_TREE_VIEW_DROP_BEFORE: dropped row is inserted before
GTK_TREE_VIEW_DROP_AFTER: dropped row is inserted after
GTK_TREE_VIEW_DROP_INTO_OR_BEFORE: dropped row becomes a child or is inserted before
GTK_TREE_VIEW_DROP_INTO_OR_AFTER: dropped row becomes a child or is inserted after
Methods
new
default, no options
Create a new plain object.
multi method new ( )
:model
Create a new tree view object using a model. This can be e.g. a Gnome::Gtk3::ListStore or Gnome::Gtk3::TreeStore.
multi method new ( Bool :model! )
[gtk_] tree_view_new
Creates a new Gnome::Gtk3::TreeView widget.
method gtk_tree_view_new ( --> N-GObject )
[[gtk_] tree_view_] new_with_model
Creates a new Gnome::Gtk3::TreeView widget with the model initialized to model.
method gtk_tree_view_new_with_model ( N-GObject $model --> N-GObject )
N-GObject $model; the model.
[[gtk_] tree_view_] get_model
Returns the model the Gnome::Gtk3::TreeView is based on. Returns Any
if the model is unset.
Returns: A Gnome::Gtk3::TreeModel, or Any
if none is currently being used.
method gtk_tree_view_get_model ( --> N-GObject )
[[gtk_] tree_view_] set_model
Sets the model for a Gnome::Gtk3::TreeView. If the tree_view already has a model set, it will remove it before setting the new model. If model is Any
, then it will unset the old model.
method gtk_tree_view_set_model ( N-GObject $model )
N-GObject $model; (allow-none): The model.
[[gtk_] tree_view_] get_selection
Gets the Gnome::Gtk3::TreeSelection associated with this tree_view.
method gtk_tree_view_get_selection ( --> N-GObject )
[[gtk_] tree_view_] get_headers_visible
Returns 1
if the headers on the tree_view are visible.
method gtk_tree_view_get_headers_visible ( --> Int )
[[gtk_] tree_view_] set_headers_visible
Sets the visibility state of the headers.
method gtk_tree_view_set_headers_visible ( Int $headers_visible )
Int $headers_visible;
1
if the headers are visible
[[gtk_] tree_view_] columns_autosize
Resizes all columns to their optimal width. Only works after the treeview has been realized.
method gtk_tree_view_columns_autosize ( )
[[gtk_] tree_view_] get_headers_clickable
Returns 1
if all header columns are clickable, otherwise 0
method gtk_tree_view_get_headers_clickable ( --> Int )
[[gtk_] tree_view_] set_headers_clickable
Allow the column title buttons to be clicked.
method gtk_tree_view_set_headers_clickable ( Int $setting )
Int $setting;
1
if the columns are clickable.
[[gtk_] tree_view_] get_activate_on_single_click
Gets the setting set by gtk_tree_view_set_activate_on_single_click()
. The method returns 1
if row-activated will be emitted on a single click.
method gtk_tree_view_get_activate_on_single_click ( --> Int )
[[gtk_] tree_view_] set_activate_on_single_click
Cause the row-activated signal to be emitted on a single click instead of a double click.
method gtk_tree_view_set_activate_on_single_click ( Bool $single )
Bool $single;
True
to emit row-activated on a single click
[[gtk_] tree_view_] append_column
Appends $column to the list of columns. If this tree view has “fixed_height” mode enabled, then $column must have its “sizing” property set to be GTK_TREE_VIEW_COLUMN_FIXED
.
Returns: The number of columns in tree_view after appending.
method gtk_tree_view_append_column ( Gnome::Gtk3::TreeViewColumn $column --> Int )
Gnome::Gtk3::TreeViewColumn $column; The column to add.
[[gtk_] tree_view_] remove_column
Removes $column from this tree_view.
Returns: The number of columns in tree_view after removing.
method gtk_tree_view_remove_column ( N-GObject $column --> Int )
N-GObject $column; The Gnome::Gtk3::TreeViewColumn to remove.
[[gtk_] tree_view_] insert_column
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
.
Returns: The number of columns in tree_view after insertion.
method gtk_tree_view_insert_column ( N-GObject $column, Int $position --> Int )
N-GObject $column; The Gnome::Gtk3::TreeViewColumn to be inserted.
Int $position; The position to insert column in.
insert-column-with-attributes
Creates a new Gnome::Gtk3::TreeViewColumn and inserts it into the tree_view at $position. If $position is -1, then the newly created column is inserted at the end. The column is initialized with the attributes given. If tree_view has “fixed_height” mode enabled, then the new column will have its sizing property set to be GTK_TREE_VIEW_COLUMN_FIXED
.
Returns: The number of columns in this treeview after insertion.
method insert-column-with-attributes ( Int $insert-position, Str $title, Gnome::Gtk3::CellRenderer $cellrenderer, ... --> Int )
A repeating list of
Int $position; The position to insert the new column in
Str $title; The title to set the header to
Gnome::Gtk3::CellRenderer $cell; The cell renderer
[[gtk_] tree_view_] insert_column_with_data_func
Convenience function that inserts a new column into the Gnome::Gtk3::TreeView with the given cell renderer and a Gnome::Gtk3::TreeCellDataFunc to set cell renderer attributes (normally using data from the model). See also gtk_tree_view_column_set_cell_data_func()
, gtk_tree_view_column_pack_start()
. If tree_view has “fixed_height” mode enabled, then the new column will have its “sizing” property set to be GTK_TREE_VIEW_COLUMN_FIXED.
Returns: number of columns in the tree view post-insert
method gtk_tree_view_insert_column_with_data_func ( Int $position, Str $title, N-GObject $cell, GtkTreeCellDataFunc $func, Pointer $data, GDestroyNotify $dnotify --> Int )
Int $position; Position to insert, -1 for append
Str $title; column title
N-GObject $cell; cell renderer for column
GtkTreeCellDataFunc $func; function to set attributes of cell renderer
Pointer $data; data for func
GDestroyNotify $dnotify; destroy notifier for data
[[gtk_] tree_view_] get_n_columns
Queries the number of columns in the given tree_view.
Returns: The number of columns in the tree_view
method gtk_tree_view_get_n_columns ( --> UInt )
[[gtk_] tree_view_] get_column
Gets the Gnome::Gtk3::TreeViewColumn at the given position in the tree_view or undefined if the position is outside the range of columns.
method gtk_tree_view_get_column ( Int $n --> Gnome::Gtk3::TreeViewColumn )
Int $n; The position of the column, counting from 0.
[[gtk_] tree_view_] get_columns
Returns a GList of all the Gnome::Gtk3::TreeViewColumn s currently in tree_view. The returned list must be freed with g_list_free()
.
Returns: (element-type Gnome::Gtk3::TreeViewColumn) (transfer container): A list of Gnome::Gtk3::TreeViewColumn s
method gtk_tree_view_get_columns ( --> N-GList )
[[gtk_] tree_view_] move_column_after
Moves column to be after to base_column. If base_column is Any
, then column is placed in the first position.
method gtk_tree_view_move_column_after ( N-GObject $column, N-GObject $base_column )
N-GObject $column; The Gnome::Gtk3::TreeViewColumn to be moved.
N-GObject $base_column; (allow-none): The Gnome::Gtk3::TreeViewColumn to be moved relative to, or
Any
.
[[gtk_] tree_view_] set_expander_column
Sets the column to draw the expander arrow at. It must be in tree_view. If column is Any
, 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.
method gtk_tree_view_set_expander_column ( N-GObject $column )
N-GObject $column;
Any
, or the column to draw the expander arrow at.
[[gtk_] tree_view_] get_expander_column
Returns the column that is the current expander column. This column has the expander arrow drawn next to it.
Returns: (transfer none): The expander column.
method gtk_tree_view_get_expander_column ( --> N-GObject )
[[gtk_] tree_view_] set_column_drag_function
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 arguments passed to func are: the tree_view, the Gnome::Gtk3::TreeViewColumn being dragged, the two Gnome::Gtk3::TreeViewColumn s determining the drop spot, and user_data. If either of the Gnome::Gtk3::TreeViewColumn arguments for the drop spot are Any
, then they indicate an edge. If func is set to be Any
, then tree_view reverts to the default behavior of allowing all columns to be dropped everywhere.
method gtk_tree_view_set_column_drag_function ( GtkTreeViewColumnDropFunc $func, Pointer $user_data, GDestroyNotify $destroy )
GtkTreeViewColumnDropFunc $func; (allow-none): A function to determine which columns are reorderable, or
Any
.Pointer $user_data; (allow-none): User data to be passed to func, or
Any
GDestroyNotify $destroy; (allow-none): Destroy notifier for user_data, or
Any
[[gtk_] tree_view_] scroll_to_point
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.
method gtk_tree_view_scroll_to_point ( Int $tree_x, Int $tree_y )
Int $tree_x; X coordinate of new top-left pixel of visible area, or -1
Int $tree_y; Y coordinate of new top-left pixel of visible area, or -1
[[gtk_] tree_view_] scroll_to_cell
Moves the alignments of tree_view to the position specified by column and path. If column is Any
, then no horizontal scrolling occurs. Likewise, if path is Any
no vertical scrolling occurs. At a minimum, one of column or path need to be non-Any
. 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 0
, 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.
method gtk_tree_view_scroll_to_cell ( N-GtkTreePath $path, N-GObject $column, Int $use_align, Num $row_align, Num $col_align )
N-GtkTreePath $path; (allow-none): The path of the row to move to, or
Any
.N-GObject $column; (allow-none): The Gnome::Gtk3::TreeViewColumn to move horizontally to, or
Any
.Int $use_align; whether to use alignment arguments, or
0
.Num $row_align; The vertical alignment of the row specified by path.
Num $col_align; The horizontal alignment of the column specified by column.
[[gtk_] tree_view_] row_activated
Activates the cell determined by path and column.
method gtk_tree_view_row_activated ( N-GtkTreePath $path, N-GObject $column )
N-GtkTreePath $path; The Gnome::Gtk3::TreePath to be activated.
N-GObject $column; The Gnome::Gtk3::TreeViewColumn to be activated.
[[gtk_] tree_view_] expand_all
Recursively expands all nodes in the tree_view.
method gtk_tree_view_expand_all ( )
[[gtk_] tree_view_] collapse_all
Recursively collapses all visible, expanded nodes in tree_view.
method gtk_tree_view_collapse_all ( )
[[gtk_] tree_view_] expand_to_path
Expands the row at $path. This will also expand all parent rows of $path as necessary.
method gtk_tree_view_expand_to_path ( N-GtkTreePath $path )
N-GtkTreePath $path; path to a row.
[[gtk_] tree_view_] expand_row
Opens the row so its children are visible.
Returns: 1
if the row existed and had children
method gtk_tree_view_expand_row ( N-GtkTreePath $path, Bool $open_all --> Int )
N-GtkTreePath $path; path to a row
Int $open_all; whether to recursively expand, or just expand immediate children
[[gtk_] tree_view_] collapse_row
Collapses a row (hides its child rows, if they exist).
Returns: 1
if the row was collapsed.
method gtk_tree_view_collapse_row ( N-GtkTreePath $path --> Int )
N-GtkTreePath $path; path to a row in the tree_view
[[gtk_] tree_view_] map_expanded_rows
Calls func on all expanded rows.
method gtk_tree_view_map_expanded_rows ( GtkTreeViewMappingFunc $func, Pointer $data )
GtkTreeViewMappingFunc $func; (scope call): A function to be called
Pointer $data; User data to be passed to the function.
[[gtk_] tree_view_] row_expanded
Returns 1
if the node pointed to by $path is expanded.
method gtk_tree_view_row_expanded ( N-GtkTreePath $path --> Int )
[[gtk_] tree_view_] set_reorderable
This function is a convenience function to allow you to reorder models that support the Gnome::Gtk3::TreeDragSourceIface and the Gnome::Gtk3::TreeDragDestIface. Both Gnome::Gtk3::TreeStore and Gnome::Gtk3::ListStore support these. If reorderable is 1
, 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 row-inserted and 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.
method gtk_tree_view_set_reorderable ( Int $reorderable )
Int $reorderable;
1
, if the tree can be reordered.
[[gtk_] tree_view_] get_reorderable
Retrieves whether the user can reorder the tree via drag-and-drop. See gtk_tree_view_set_reorderable()
.
Returns: 1
if the tree can be reordered.
method gtk_tree_view_get_reorderable ( --> Int )
[[gtk_] tree_view_] set_cursor
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 Any
, then focus is given to the column specified by it. Additionally, if focus_column is specified, and start_editing is 1
, 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.
method gtk_tree_view_set_cursor ( N-GtkTreePath $path, N-GObject $focus_column, Int $start_editing )
N-GtkTreePath $path; A Gnome::Gtk3::TreePath
N-GObject $focus_column; (allow-none): A Gnome::Gtk3::TreeViewColumn, or
Any
Int $start_editing;
1
if the specified cell should start being edited.
[[gtk_] tree_view_] set_cursor_on_cell
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 Any
, then focus is given to the column specified by it. If focus_column and focus_cell are not Any
, 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 1
, 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.
method gtk_tree_view_set_cursor_on_cell ( N-GtkTreePath $path, N-GObject $focus_column, N-GObject $focus_cell, Int $start_editing )
N-GtkTreePath $path; A Gnome::Gtk3::TreePath
N-GObject $focus_column; (allow-none): A Gnome::Gtk3::TreeViewColumn, or
Any
N-GObject $focus_cell; (allow-none): A Gnome::Gtk3::CellRenderer, or
Any
Int $start_editing;
1
if the specified cell should start being edited.
[[gtk_] tree_view_] get_cursor
Fills in path and focus_column with the current path and focus column. If the cursor isn’t currently set, then *path will be Any
. If no column currently has focus, then *focus_column will be Any
.
The returned Gnome::Gtk3::TreePath must be freed with gtk_tree_path_free()
when you are done with it.
method gtk_tree_view_get_cursor ( N-GtkTreePath $path, N-GObject $focus_column )
N-GtkTreePath $path; (out) (transfer full) (optional) (nullable): A pointer to be filled with the current cursor path, or
Any
N-GObject $focus_column; (out) (transfer none) (optional) (nullable): A pointer to be filled with the current focus column, or
Any
[[gtk_] tree_view_] get_bin_window
Returns the window that tree_view renders to. This is used primarily to compare to `event->window` to confirm that the event on tree_view is on the right window.
Returns: A native Gnome::Gdk3::Window, or Any
when the tree_view hasn’t been realized yet.
method gtk_tree_view_get_bin_window ( --> N-GObject )
[[gtk_] tree_view_] get_path_at_pos
Finds the path at the point ($x, $y), relative to bin_window coordinates (please see gtk_tree_view_get_bin_window()
). That is, $x and $y are relative to an events coordinates. $x and $y must come from an event on the tree_view only where `event->window == gtk_tree_view_get_bin_window()
`. It is primarily for things like popup menus. If $path is non-Any
, then it will be set with the Gnome::Gtk3::TreePath at that point. This path should be freed with .clear-object()
. If $column is defined, then it set with the column at that point. $cell_x and $cell_y return the coordinates relative to the cell background (i.e. the background_area passed to gtk_cell_renderer_render()
). This function is only meaningful if tree_view is realized. Therefore this function will always return 0
if tree_view is not realized or does not have a model.
For converting widget coordinates (eg. the ones you get from Gnome::Gtk3::Widget::query-tooltip), please see gtk_tree_view_convert_widget_to_bin_window_coords()
.
method gtk_tree_view_get_path_at_pos ( Int $x, Int $y --> List )
Int $x; The x position to be identified (relative to bin_window).
Int $y; The y position to be identified (relative to bin_window).
The returned list holds
Bool $exists:
True
if a row exists at that coordinate.N-GtkTreePath $path; A native Gnome::Gtk3::TreePath, or
Any
N-GObject $column; A native Gnome::Gtk3::TreeViewColumn, or
Any
Int $cell_x; X coordinate relative to the cell, or
Any
Int $cell_y; Y coordinate relative to the cell, or
Any
[[gtk_] tree_view_] get_cell_area
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 undefined, or points to a path not currently displayed, the y and height fields of the rectangle will be filled with 0. If $column is undefined, 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()
.
method gtk_tree_view_get_cell_area ( N-GtkTreePath $path, N-GObject $column --> N-GdkRectangle )
N-GtkTreePath $path; a Gnome::Gtk3::TreePath for the row, or
Any
to get only horizontal coordinatesN-GObject $column; a Gnome::Gtk3::TreeViewColumn for the column, or
Any
to get only vertical coordinates
Returns a N-GdkRectangle rectangle to fill with cell rectangle
[[gtk_] tree_view_] get_background_area
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 Any
, 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 Any
, 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.
method gtk_tree_view_get_background_area ( N-GtkTreePath $path, N-GObject $column, N-GObject $rect )
N-GtkTreePath $path; (allow-none): a Gnome::Gtk3::TreePath for the row, or
Any
to get only horizontal coordinatesN-GObject $column; (allow-none): a Gnome::Gtk3::TreeViewColumn for the column, or
Any
to get only vertical coordiantesN-GObject $rect; (out): rectangle to fill with cell background rect
[[gtk_] tree_view_] get_visible_rect
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.
method gtk_tree_view_get_visible_rect ( N-GObject $visible_rect )
N-GObject $visible_rect; (out): rectangle to fill
[[gtk_] tree_view_] get_visible_range
Sets start_path and end_path to be the first and last visible path. Note that there may be invisible paths in between.
The paths should be freed with gtk_tree_path_free()
after use.
Returns: 1
, if valid paths were placed in start_path and end_path.
method gtk_tree_view_get_visible_range ( N-GtkTreePath $start_path, N-GtkTreePath $end_path --> Int )
N-GtkTreePath $start_path; (out) (allow-none): Return location for start of region, or
Any
.N-GtkTreePath $end_path; (out) (allow-none): Return location for end of region, or
Any
.
[[gtk_] tree_view_] is_blank_at_pos
Determine whether the point (x, y) in tree_view is blank, that is no cell content nor an expander arrow is drawn at the location. If so, the location can be considered as the background. You might wish to take special action on clicks on the background, such as clearing a current selection, having a custom context menu or starting rubber banding.
The x and y coordinate that are provided must be relative to bin_window coordinates. That is, x and y must come from an event on tree_view where `event->window == gtk_tree_view_get_bin_window()
`.
For converting widget coordinates (eg. the ones you get from Gnome::Gtk3::Widget::query-tooltip), please see gtk_tree_view_convert_widget_to_bin_window_coords()
.
The path, column, cell_x and cell_y arguments will be filled in likewise as for gtk_tree_view_get_path_at_pos()
. Please see gtk_tree_view_get_path_at_pos()
for more information.
Returns: 1
if the area at the given coordinates is blank, 0
otherwise.
method gtk_tree_view_is_blank_at_pos ( Int $x, Int $y, N-GtkTreePath $path, N-GObject $column, Int $cell_x, Int $cell_y --> Int )
Int $x; The x position to be identified (relative to bin_window)
Int $y; The y position to be identified (relative to bin_window)
N-GtkTreePath $path; (out) (allow-none): A pointer to a Gnome::Gtk3::TreePath pointer to be filled in, or
Any
N-GObject $column; (out) (allow-none): A pointer to a Gnome::Gtk3::TreeViewColumn pointer to be filled in, or
Any
Int $cell_x; (out) (allow-none): A pointer where the X coordinate relative to the cell can be placed, or
Any
Int $cell_y; (out) (allow-none): A pointer where the Y coordinate relative to the cell can be placed, or
Any
[[gtk_] tree_view_] enable_model_drag_source
Turns tree_view into a drag source for automatic DND. Calling this method sets reorderable to 0
.
method gtk_tree_view_enable_model_drag_source ( GdkModifierType $start_button_mask, GtkTargetEntry $targets, Int $n_targets, GdkDragAction $actions )
GdkModifierType $start_button_mask; Mask of allowed buttons to start drag
GtkTargetEntry $targets; (array length=n_targets): the table of targets that the drag will support
Int $n_targets; the number of items in targets
GdkDragAction $actions; the bitmask of possible actions for a drag from this widget
[[gtk_] tree_view_] enable_model_drag_dest
Turns tree_view into a drop destination for automatic DND. Calling this method sets reorderable to 0
.
method gtk_tree_view_enable_model_drag_dest ( GtkTargetEntry $targets, Int $n_targets, GdkDragAction $actions )
GtkTargetEntry $targets; (array length=n_targets): the table of targets that the drag will support
Int $n_targets; the number of items in targets
GdkDragAction $actions; the bitmask of possible actions for a drag from this widget
[[gtk_] tree_view_] unset_rows_drag_source
Undoes the effect of gtk_tree_view_enable_model_drag_source()
. Calling this method sets reorderable to 0
.
method gtk_tree_view_unset_rows_drag_source ( )
[[gtk_] tree_view_] unset_rows_drag_dest
Undoes the effect of gtk_tree_view_enable_model_drag_dest()
. Calling this method sets reorderable to 0
.
method gtk_tree_view_unset_rows_drag_dest ( )
[[gtk_] tree_view_] set_drag_dest_row
Sets the row that is highlighted for feedback. If path is Any
, an existing highlight is removed.
method gtk_tree_view_set_drag_dest_row ( N-GtkTreePath $path, GtkTreeViewDropPosition $pos )
N-GtkTreePath $path; (allow-none): The path of the row to highlight, or
Any
GtkTreeViewDropPosition $pos; Specifies whether to drop before, after or into the row
[[gtk_] tree_view_] get_drag_dest_row
Gets information about the row that is highlighted for feedback.
method gtk_tree_view_get_drag_dest_row ( N-GtkTreePath $path, GtkTreeViewDropPosition $pos )
N-GtkTreePath $path; (out) (optional) (nullable): Return location for the path of the highlighted row, or
Any
.GtkTreeViewDropPosition $pos; (out) (optional): Return location for the drop position, or
Any
[[gtk_] tree_view_] get_dest_row_at_pos
Determines the destination row for a given position. drag_x and drag_y are expected to be in widget coordinates. This function is only meaningful if tree_view is realized. Therefore this function will always return 0
if tree_view is not realized or does not have a model.
Returns: whether there is a row at the given position, 1
if this is indeed the case.
method gtk_tree_view_get_dest_row_at_pos ( Int $drag_x, Int $drag_y, N-GtkTreePath $path, GtkTreeViewDropPosition $pos --> Int )
Int $drag_x; the position to determine the destination row for
Int $drag_y; the position to determine the destination row for
N-GtkTreePath $path; (out) (optional) (nullable): Return location for the path of the highlighted row, or
Any
.GtkTreeViewDropPosition $pos; (out) (optional): Return location for the drop position, or
Any
[[gtk_] tree_view_] create_row_drag_icon
Creates a cairo_surface_t representation of the row at path. This image is used for a drag icon.
Returns: (transfer full): a newly-allocated surface of the drag icon.
method gtk_tree_view_create_row_drag_icon ( N-GtkTreePath $path --> cairo_surface_t )
N-GtkTreePath $path; a Gnome::Gtk3::TreePath in tree_view
[[gtk_] tree_view_] set_enable_search
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 0
, the user can still initiate a search using the “start-interactive-search” key binding.
method gtk_tree_view_set_enable_search ( Int $enable_search )
Int $enable_search;
1
, if the user can search interactively
[[gtk_] tree_view_] get_enable_search
Returns whether or not the tree allows to start interactive searching by typing in text.
Returns: whether or not to let the user search interactively
method gtk_tree_view_get_enable_search ( --> Int )
[[gtk_] tree_view_] get_search_column
Gets the column searched on by the interactive search code.
Returns: the column the interactive search code searches in.
method gtk_tree_view_get_search_column ( --> Int )
[[gtk_] tree_view_] set_search_column
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.
method gtk_tree_view_set_search_column ( Int $column )
Int $column; the column of the model to search in, or -1 to disable searching
[[gtk_] tree_view_] get_search_equal_func
Returns the compare function currently in use.
Returns: the currently used compare function for the search code.
method gtk_tree_view_get_search_equal_func ( --> GtkTreeViewSearchEqualFunc )
[[gtk_] tree_view_] set_search_equal_func
Sets the compare function for the interactive search capabilities; note that somewhat like strcmp()
returning 0 for equality Gnome::Gtk3::TreeViewSearchEqualFunc returns 0
on matches.
method gtk_tree_view_set_search_equal_func ( GtkTreeViewSearchEqualFunc $search_equal_func, Pointer $search_user_data, GDestroyNotify $search_destroy )
GtkTreeViewSearchEqualFunc $search_equal_func; the compare function to use during the search
Pointer $search_user_data; (allow-none): user data to pass to search_equal_func, or
Any
GDestroyNotify $search_destroy; (allow-none): Destroy notifier for search_user_data, or
Any
[[gtk_] tree_view_] get_search_entry
Returns the Gnome::Gtk3::Entry which is currently in use as interactive search entry for tree_view. In case the built-in entry is being used, Any
will be returned.
Returns: (transfer none): the entry currently in use as search entry.
method gtk_tree_view_get_search_entry ( --> N-GObject )
[[gtk_] tree_view_] set_search_entry
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 Any
for entry will make the interactive search code use the built-in popup entry again.
method gtk_tree_view_set_search_entry ( N-GObject $entry )
N-GObject $entry; (allow-none): the entry the interactive search code of tree_view should use or
Any
[[gtk_] tree_view_] get_search_position_func
Returns the positioning function currently in use.
Returns: the currently used function for positioning the search dialog.
method gtk_tree_view_get_search_position_func ( --> GtkTreeViewSearchPositionFunc )
[[gtk_] tree_view_] set_search_position_func
Sets the function to use when positioning the search dialog.
method gtk_tree_view_set_search_position_func ( GtkTreeViewSearchPositionFunc $func, Pointer $data, GDestroyNotify $destroy )
GtkTreeViewSearchPositionFunc $func; (allow-none): the function to use to position the search dialog, or
Any
to use the default search position functionPointer $data; (allow-none): user data to pass to func, or
Any
GDestroyNotify $destroy; (allow-none): Destroy notifier for data, or
Any
[[gtk_] tree_view_] convert_widget_to_tree_coords
Converts widget coordinates to coordinates for the tree (the full scrollable area of the tree).
method gtk_tree_view_convert_widget_to_tree_coords ( Int $wx, Int $wy, Int $tx, Int $ty )
Int $wx; X coordinate relative to the widget
Int $wy; Y coordinate relative to the widget
Int $tx; (out): return location for tree X coordinate
Int $ty; (out): return location for tree Y coordinate
[[gtk_] tree_view_] convert_tree_to_widget_coords
Converts tree coordinates (coordinates in full scrollable area of the tree) to widget coordinates.
method gtk_tree_view_convert_tree_to_widget_coords ( Int $tx, Int $ty, Int $wx, Int $wy )
Int $tx; X coordinate relative to the tree
Int $ty; Y coordinate relative to the tree
Int $wx; (out): return location for widget X coordinate
Int $wy; (out): return location for widget Y coordinate
[[gtk_] tree_view_] convert_widget_to_bin_window_coords
Converts widget coordinates to coordinates for the bin_window (see gtk_tree_view_get_bin_window()
).
method gtk_tree_view_convert_widget_to_bin_window_coords ( Int $wx, Int $wy --> List )
Int $wx; X coordinate relative to the widget
Int $wy; Y coordinate relative to the widget
The returned List holds;
Int $bx; bin_window X coordinate
Int $by; bin_window Y coordinate
[[gtk_] tree_view_] convert_bin_window_to_widget_coords
Converts bin_window coordinates (see gtk_tree_view_get_bin_window()
) to widget relative coordinates.
method gtk_tree_view_convert_bin_window_to_widget_coords ( Int $bx, Int $by, Int $wx, Int $wy )
Int $bx; bin_window X coordinate
Int $by; bin_window Y coordinate
Int $wx; (out): return location for widget X coordinate
Int $wy; (out): return location for widget Y coordinate
[[gtk_] tree_view_] convert_tree_to_bin_window_coords
Converts tree coordinates (coordinates in full scrollable area of the tree) to bin_window coordinates.
method gtk_tree_view_convert_tree_to_bin_window_coords ( Int $tx, Int $ty, Int $bx, Int $by )
Int $tx; tree X coordinate
Int $ty; tree Y coordinate
Int $bx; (out): return location for X coordinate relative to bin_window
Int $by; (out): return location for Y coordinate relative to bin_window
[[gtk_] tree_view_] convert_bin_window_to_tree_coords
Converts bin_window coordinates to coordinates for the tree (the full scrollable area of the tree).
method gtk_tree_view_convert_bin_window_to_tree_coords ( Int $bx, Int $by, Int $tx, Int $ty )
Int $bx; X coordinate relative to bin_window
Int $by; Y coordinate relative to bin_window
Int $tx; (out): return location for tree X coordinate
Int $ty; (out): return location for tree Y coordinate
[[gtk_] tree_view_] set_fixed_height_mode
Enables or disables the fixed height mode of tree_view. Fixed height mode speeds up Gnome::Gtk3::TreeView 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
.
method gtk_tree_view_set_fixed_height_mode ( Int $enable )
Int $enable;
1
to enable fixed height mode
[[gtk_] tree_view_] get_fixed_height_mode
Returns whether fixed height mode is turned on for tree_view.
Returns: 1
if tree_view is in fixed height mode
method gtk_tree_view_get_fixed_height_mode ( --> Int )
[[gtk_] tree_view_] set_hover_selection
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
.
method gtk_tree_view_set_hover_selection ( Int $hover )
Int $hover;
1
to enable hover selection mode
[[gtk_] tree_view_] get_hover_selection
Returns whether hover selection mode is turned on for tree_view.
Returns: 1
if tree_view is in hover selection mode
method gtk_tree_view_get_hover_selection ( --> Int )
[[gtk_] tree_view_] set_hover_expand
Enables or disables the hover expansion mode of tree_view. Hover expansion makes rows expand or collapse if the pointer moves over them.
method gtk_tree_view_set_hover_expand ( Int $expand )
Int $expand;
1
to enable hover selection mode
[[gtk_] tree_view_] get_hover_expand
Returns whether hover expansion mode is turned on for tree_view.
Returns: 1
if tree_view is in hover expansion mode
method gtk_tree_view_get_hover_expand ( --> Int )
[[gtk_] tree_view_] set_rubber_banding
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.
method gtk_tree_view_set_rubber_banding ( Int $enable )
Int $enable;
1
to enable rubber banding
[[gtk_] tree_view_] get_rubber_banding
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.
Returns: 1
if rubber banding in tree_view is enabled.
method gtk_tree_view_get_rubber_banding ( --> Int )
[[gtk_] tree_view_] is_rubber_banding_active
Returns whether a rubber banding operation is currently being done in tree_view.
Returns: 1
if a rubber banding operation is currently being done in tree_view.
method gtk_tree_view_is_rubber_banding_active ( --> Int )
[[gtk_] tree_view_] get_row_separator_func
Returns the current row separator function.
Returns: the current row separator function.
method gtk_tree_view_get_row_separator_func ( --> GtkTreeViewRowSeparatorFunc )
[[gtk_] tree_view_] set_row_separator_func
Sets the row separator function, which is used to determine whether a row should be drawn as a separator. If the row separator function is Any
, no separators are drawn. This is the default value.
method gtk_tree_view_set_row_separator_func ( GtkTreeViewRowSeparatorFunc $func, Pointer $data, GDestroyNotify $destroy )
GtkTreeViewRowSeparatorFunc $func; (allow-none): a Gnome::Gtk3::TreeViewRowSeparatorFunc
Pointer $data; (allow-none): user data to pass to func, or
Any
GDestroyNotify $destroy; (allow-none): destroy notifier for data, or
Any
[[gtk_] tree_view_] get_grid_lines
Returns which grid lines are enabled in tree_view.
Returns: a Gnome::Gtk3::TreeViewGridLines value indicating which grid lines are enabled.
method gtk_tree_view_get_grid_lines ( --> GtkTreeViewGridLines )
[[gtk_] tree_view_] set_grid_lines
Sets which grid lines to draw in tree_view.
method gtk_tree_view_set_grid_lines ( GtkTreeViewGridLines $grid_lines )
GtkTreeViewGridLines $grid_lines; a Gnome::Gtk3::TreeViewGridLines value indicating which grid lines to enable.
[[gtk_] tree_view_] get_enable_tree_lines
Returns whether or not tree lines are drawn in tree_view.
Returns: 1
if tree lines are drawn in tree_view, 0
otherwise.
method gtk_tree_view_get_enable_tree_lines ( --> Int )
[[gtk_] tree_view_] set_enable_tree_lines
Sets whether to draw lines interconnecting the expanders in tree_view. This does not have any visible effects for lists.
method gtk_tree_view_set_enable_tree_lines ( Int $enabled )
Int $enabled;
1
to enable tree line drawing,0
otherwise.
[[gtk_] tree_view_] set_show_expanders
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.
method gtk_tree_view_set_show_expanders ( Int $enabled )
Int $enabled;
1
to enable expander drawing,0
otherwise.
[[gtk_] tree_view_] get_show_expanders
Returns whether or not expanders are drawn in tree_view.
Returns: 1
if expanders are drawn in tree_view, 0
otherwise.
method gtk_tree_view_get_show_expanders ( --> Int )
[[gtk_] tree_view_] set_level_indentation
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.
method gtk_tree_view_set_level_indentation ( Int $indentation )
Int $indentation; the amount, in pixels, of extra indentation in tree_view.
[[gtk_] tree_view_] get_level_indentation
Returns the amount, in pixels, of extra indentation for child levels in tree_view.
Returns: the amount of extra indentation for child levels in tree_view. A return value of 0 means that this feature is disabled.
method gtk_tree_view_get_level_indentation ( --> Int )
[[gtk_] tree_view_] set_tooltip_row
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()
.
method gtk_tree_view_set_tooltip_row ( N-GObject $tooltip, N-GtkTreePath $path )
N-GObject $tooltip; a Gnome::Gtk3::Tooltip
N-GtkTreePath $path; a Gnome::Gtk3::TreePath
[[gtk_] tree_view_] set_tooltip_cell
Sets the tip area of $tooltip to the area $path, $column and $cell have in common. For example if $path is undefined 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.
method gtk_tree_view_set_tooltip_cell ( N-GObject $tooltip, N-GtkTreePath $path, N-GObject $column, N-GObject $cell )
N-GObject $tooltip; a Gnome::Gtk3::Tooltip
N-GtkTreePath $path; a Gnome::Gtk3::TreePath or
Any
N-GObject $column; a Gnome::Gtk3::TreeViewColumn or
Any
N-GObject $cell; a Gnome::Gtk3::CellRenderer or
Any
[[gtk_] tree_view_] get_tooltip_context
This function is supposed to be used in a query-tooltip signal handler for Gnome::Gtk3::TreeView. The x, y and keyboard_tip values which are received in the signal handler, should be passed to this function without modification.
The return value indicates whether there is a tree view row at the given coordinates (1
) or not (0
) for mouse tooltips. For keyboard tooltips the row returned will be the cursor row. When 1
, then any of model, path and iter which have been provided will be set to point to that row and the corresponding model. x and y will always be converted to be relative to tree_view’s bin_window if keyboard_tooltip is 0
.
Returns: whether or not the given tooltip context points to a row.
method gtk_tree_view_get_tooltip_context ( Int $x, Int $y, Int $keyboard_tip, N-GObject $model, N-GtkTreePath $path, GtkTreeIter $iter --> Int )
Int $x; (inout): the x coordinate (relative to widget coordinates)
Int $y; (inout): the y coordinate (relative to widget coordinates)
Int $keyboard_tip; whether this is a keyboard tooltip or not
N-GObject $model; (out) (optional) (nullable) (transfer none): a pointer to receive a Gnome::Gtk3::TreeModel or
Any
N-GtkTreePath $path; (out) (optional): a pointer to receive a Gnome::Gtk3::TreePath or
Any
GtkTreeIter $iter; (out) (optional): a pointer to receive a Gnome::Gtk3::TreeIter or
Any
[[gtk_] tree_view_] set_tooltip_column
If you only plan to have simple (text-only) tooltips on full rows, you can use this function to have Gnome::Gtk3::TreeView 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, has-tooltip will be set to 1
and tree_view will connect a 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.
method gtk_tree_view_set_tooltip_column ( Int $column )
Int $column; an integer, which is a valid column number for tree_view’s model
[[gtk_] tree_view_] get_tooltip_column
Returns the column of tree_view’s model which is being used for displaying tooltips on tree_view’s rows.
Returns: the index of the tooltip column that is currently being used, or -1 if this is disabled.
method gtk_tree_view_get_tooltip_column ( --> Int )
Signals
There are two ways to connect to a signal. The first option you have is to use register-signal()
from Gnome::GObject::Object. The second option is to use g_signal_connect_object()
directly from Gnome::GObject::Signal.
First method
The positional arguments of the signal handler are all obligatory as well as their types. The named attributes :$widget
and user data are optional.
# handler method method mouse-event ( N-GdkEvent $event, :$widget ) { ... } # connect a signal on window object my Gnome::Gtk3::Window $w .= new( ... ); $w.register-signal( self, 'mouse-event', 'button-press-event');
Second method
my Gnome::Gtk3::Window $w .= new( ... ); my Callable $handler = sub ( N-GObject $native, N-GdkEvent $event, OpaquePointer $data ) { ... } $w.connect-object( 'button-press-event', $handler);
Also here, the types of positional arguments in the signal handler are important. This is because both methods register-signal()
and g_signal_connect_object()
are using the signatures of the handler routines to setup the native call interface.
Supported signals
row-activated
The "row-activated" signal is emitted when the method gtk_tree_view_row_activated()
is called, when the user double clicks a treeview row with the "activate-on-single-click" property set to 0
, or when the user single clicks a row when the "activate-on-single-click" property set to 1
. 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][TreeWidget] as well as Gnome::Gtk3::TreeSelection.
method handler ( N-GtkTreePath $path, N-GObject $column, Int :$_handler_id, Gnome::GObject::Object :_widget($tree_view), *%user-options );
$tree_view; the object on which the signal is emitted
$path; the native Gnome::Gtk3::TreePath for the activated row
$column; the native Gnome::Gtk3::TreeViewColumn in which the activation occurred
test-expand-row
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.
Returns: 0
to allow expansion, 1
to reject
method handler ( N-GtkTreeIter $iter, N-GtkTreePath $path, Int :$_handler_id, Gnome::GObject::Object :_widget($tree_view), *%user-options --> Int );
$tree_view; the object on which the signal is emitted
N-GtkTreeIter $iter; the native Gnome::Gtk3::TreeIter of the row to expand
N-GtkTreePath $path; the native Gnome::Gtk3::TreePath that points to the row
test-collapse-row
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.
Returns: 0
to allow collapsing, 1
to reject
method handler ( N-GtkTreeIter $iter, N-GtkTreePath $path, Int :$_handler_id, Gnome::GObject::Object :_widget($tree_view), *%user-options --> Int );
$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
row-expanded
The given row has been expanded (child nodes are shown).
method handler ( N-GtkTreeIter $iter, N-GtkTreePath $path, Int :$_handler_id, Gnome::GObject::Object :_widget($tree_view), *%user-options );
$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
row-collapsed
The given row has been collapsed (child nodes are hidden).
method handler ( N-GtkTreeIter $iter, N-GtkTreePath $path, Int :$_handler_id, Gnome::GObject::Object :_widget($tree_view), *%user-options );
$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
columns-changed
The number of columns of the treeview has changed.
method handler ( Int :$_handler_id, Gnome::GObject::Object :_widget($tree_view), *%user-options );
$tree_view; the object on which the signal is emitted
cursor-changed
The position of the cursor (focused cell) has changed.
method handler ( Int :$_handler_id, Gnome::GObject::Object :_widget($tree_view), *%user-options );
$tree_view; the object on which the signal is emitted
Properties
An example of using a string type property of a Gnome::Gtk3::Label object. This is just showing how to set/read a property, not that it is the best way to do it. This is because a) The class initialization often provides some options to set some of the properties and b) the classes provide many methods to modify just those properties. In the case below one can use new(:label('my text label')) or gtk_label_set_text('my text label').
my Gnome::Gtk3::Label $label .= new; my Gnome::GObject::Value $gv .= new(:init(G_TYPE_STRING)); $label.g-object-get-property( 'label', $gv); $gv.g-value-set-string('my text label');
Supported properties
TreeView Model
The model for the tree view Widget type: GTK_TYPE_TREE_MODEL
The Gnome::GObject::Value type of property model is G_TYPE_OBJECT
.
Headers Visible
Show the column header buttons Default value: True
The Gnome::GObject::Value type of property headers-visible is G_TYPE_BOOLEAN
.
Headers Clickable
Column headers respond to click events Default value: True
The Gnome::GObject::Value type of property headers-clickable is G_TYPE_BOOLEAN
.
Expander Column
Set the column for the expander column Widget type: GTK_TYPE_TREE_VIEW_COLUMN
The Gnome::GObject::Value type of property expander-column is G_TYPE_OBJECT
.
Reorderable
View is reorderable Default value: False
The Gnome::GObject::Value type of property reorderable is G_TYPE_BOOLEAN
.
Enable Search
View allows user to search through columns interactively Default value: True
The Gnome::GObject::Value type of property enable-search is G_TYPE_BOOLEAN
.
Search Column
The Gnome::GObject::Value type of property search-column is G_TYPE_INT
.
Fixed Height Mode
Setting the fixed-height-mode property to 1
speeds up Gnome::Gtk3::TreeView by assuming that all rows have the same height. Only enable this option if all rows are the same height. Please see gtk_tree_view_set_fixed_height_mode()
for more information on this option.
The Gnome::GObject::Value type of property fixed-height-mode is G_TYPE_BOOLEAN
.
Hover Selection
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
. This mode is primarily intended for treeviews in popups, e.g. in Gnome::Gtk3::ComboBox or Gnome::Gtk3::EntryCompletion.
The Gnome::GObject::Value type of property hover-selection is G_TYPE_BOOLEAN
.
Hover Expand
Enables or 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 Gnome::Gtk3::ComboBox or Gnome::Gtk3::EntryCompletion.
The Gnome::GObject::Value type of property hover-expand is G_TYPE_BOOLEAN
.
Show Expanders
1
if the view has expanders.
The Gnome::GObject::Value type of property show-expanders is G_TYPE_BOOLEAN
.
Level Indentation
Extra indentation for each level.
The Gnome::GObject::Value type of property level-indentation is G_TYPE_INT
.
Rubber Banding
Whether to enable selection of multiple items by dragging the mouse pointer Default value: False
The Gnome::GObject::Value type of property rubber-banding is G_TYPE_BOOLEAN
.
Enable Grid Lines
Whether grid lines should be drawn in the tree view Default value: False
The Gnome::GObject::Value type of property enable-grid-lines is G_TYPE_ENUM
.
Enable Tree Lines
Whether tree lines should be drawn in the tree view Default value: False
The Gnome::GObject::Value type of property enable-tree-lines is G_TYPE_BOOLEAN
.
Tooltip Column
The Gnome::GObject::Value type of property tooltip-column is G_TYPE_INT
.
Activate on Single Click
The activate-on-single-click property specifies whether the "row-activated" signal will be emitted after a single click.
The Gnome::GObject::Value type of property activate-on-single-click is G_TYPE_BOOLEAN
.