About all my projects
Gnome::Gtk4::TreeViewColumn

Gnome::Gtk4::TreeViewColumn

Description

A visible column in a Gnome::Gtk4::TreeView widget

The Gnome::Gtk4::TreeViewColumn object represents a visible column in a Gnome::Gtk4::TreeView widget. It allows to set properties of the column header, and functions as a holding pen for the cell renderers which determine how the data in the column is displayed.

Please refer to the [tree widget conceptual overview](section-tree-widget.html) for an overview of all the objects and data types related to the tree widget and how they work together, and to the Gnome::Gtk4::TreeView documentation for specifics about the CSS node structure for treeviews and their headers.

Class initialization

Note: The native version of this class is deprecated in gtk4-lib() since version 4.10

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

new-treeviewcolumn

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Creates a new Gnome::Gtk4::TreeViewColumn.

method new-treeviewcolumn ( --> Gnome::Gtk4::TreeViewColumn \)

new-with-area

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Creates a new Gnome::Gtk4::TreeViewColumn using $area to render its cells.

method new-with-area ( N-Object() $area --> Gnome::Gtk4::TreeViewColumn \)
  • $area; the Gnome::Gtk4::CellArea that the newly created column should use to layout cells..

new-with-attributes This function is not yet available

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Creates a new Gnome::Gtk4::TreeViewColumn with a number of default values. This is equivalent to calling .set-title(), .pack-start(), and .set-attributes() on the newly created Gnome::Gtk4::TreeViewColumn.

Here’s a simple example:

method new-with-attributes ( Str $title, N-Object() $cell, … --> Gnome::Gtk4::TreeViewColumn \)
  • $title; The title to set the header to.

  • $cell; The Gnome::Gtk4::CellRenderer.

  • …; …. Note that each argument must be specified as a type followed by its value!

Methods

add-attribute

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Adds an attribute mapping to the list in $tree-column.

The $column is the column of the model to get a value from, and the $attribute is the parameter on $cell-renderer to be set from the value. So for example if column 2 of the model contains strings, you could have the “text” attribute of a Gnome::Gtk4::CellRendererText get its values from column 2.

method add-attribute ( N-Object() $cell-renderer, Str $attribute, Int() $column )
  • $cell-renderer; the Gnome::Gtk4::CellRenderer to set attributes on.

  • $attribute; An attribute on the renderer.

  • $column; The column position on the model to get the attribute from..

cell-get-position

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Obtains the horizontal position and size of a cell in a column.

If the cell is not found in the column, $start-pos and $width are not changed and False is returned.

method cell-get-position ( N-Object() $cell-renderer, Array[Int] $x-offset, Array[Int] $width --> Bool )
  • $cell-renderer; a Gnome::Gtk4::CellRenderer.

  • $x-offset; (transfer ownership: full) return location for the horizontal position of $cell within $tree-column.

  • $width; (transfer ownership: full) return location for the width of $cell.

Return value; True if $cell belongs to $tree-column.

cell-get-size

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Obtains the width and height needed to render the column. This is used primarily by the Gnome::Gtk4::TreeView.

method cell-get-size ( Array[Int] $x-offset, Array[Int] $y-offset, Array[Int] $width, Array[Int] $height )
  • $x-offset; (transfer ownership: full) location to return x offset of a cell relative to $cell-area.

  • $y-offset; (transfer ownership: full) location to return y offset of a cell relative to $cell-area.

  • $width; (transfer ownership: full) location to return width needed to render a cell.

  • $height; (transfer ownership: full) location to return height needed to render a cell.

cell-is-visible

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns True if any of the cells packed into the $tree-column are visible. For this to be meaningful, you must first initialize the cells with .cell-set-cell-data()

method cell-is-visible (--> Bool )

Return value; True, if any of the cells packed into the $tree-column are currently visible.

cell-set-cell-data

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the cell renderer based on the $tree-model and $iter. That is, for every attribute mapping in $tree-column, it will get a value from the set column on the $iter, and use that value to set the attribute on the cell renderer. This is used primarily by the Gnome::Gtk4::TreeView.

method cell-set-cell-data ( N-Object() $tree-model, N-Object $iter, Bool() $is-expander, Bool() $is-expanded )
  • $tree-model; The Gnome::Gtk4::R-TreeModel to get the cell renderers attributes from..

  • $iter; The Gnome::Gtk4::N-TreeIter to get the cell renderer’s attributes from.

  • $is-expander; True, if the row has children.

  • $is-expanded; True, if the row has visible children.

clear

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Unsets all the mappings on all renderers on the $tree-column.

method clear ( )

clear-attributes

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Clears all existing attributes previously set with .set-attributes().

method clear-attributes ( N-Object() $cell-renderer )
  • $cell-renderer; a Gnome::Gtk4::CellRenderer to clear the attribute mapping on..

clicked

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Emits the “clicked” signal on the column. This function will only work if $tree-column is clickable.

method clicked ( )

focus-cell

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the current keyboard focus to be at $cell, if the column contains 2 or more editable and activatable cells.

method focus-cell ( N-Object() $cell )
  • $cell; A Gnome::Gtk4::CellRenderer.

get-alignment

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the current x alignment of $tree-column. This value can range between 0.0 and 1.0.

method get-alignment (--> Num )

Return value; The current alignent of $tree-column..

get-button

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the button used in the treeview column header

method get-button (--> N-Object )

Return value; The button for the column header..

get-clickable

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns True if the user can click on the header for the column.

method get-clickable (--> Bool )

Return value; True if user can click the column header..

get-expand

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns True if the column expands to fill available space.

method get-expand (--> Bool )

Return value; True if the column expands to fill available space..

get-fixed-width

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the fixed width of the column. This may not be the actual displayed width of the column; for that, use .get-width().

method get-fixed-width (--> Int )

Return value; The fixed width of the column..

get-max-width

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the maximum width in pixels of the $tree-column, or -1 if no maximum width is set.

method get-max-width (--> Int )

Return value; The maximum width of the $tree-column..

get-min-width

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the minimum width in pixels of the $tree-column, or -1 if no minimum width is set.

method get-min-width (--> Int )

Return value; The minimum width of the $tree-column..

get-reorderable

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns True if the $tree-column can be reordered by the user.

method get-reorderable (--> Bool )

Return value; True if the $tree-column can be reordered by the user..

get-resizable

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns True if the $tree-column can be resized by the end user.

method get-resizable (--> Bool )

Return value; True, if the $tree-column can be resized..

get-sizing

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the current type of $tree-column.

method get-sizing (--> GtkTreeViewColumnSizing )

Return value; The type of $tree-column..

get-sort-column-id

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the logical $sort-column-id that the model sorts on when this column is selected for sorting.

See .set-sort-column-id().

method get-sort-column-id (--> Int )

Return value; the current $sort-column-id for this column, or -1 if this column can’t be used for sorting.

get-sort-indicator

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the value set by .set-sort-indicator().

method get-sort-indicator (--> Bool )

Return value; whether the sort indicator arrow is displayed.

get-sort-order

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets the value set by .set-sort-order().

method get-sort-order (--> GtkSortType )

Return value; the sort order the sort indicator is indicating.

get-spacing

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the spacing of $tree-column.

method get-spacing (--> Int )

Return value; the spacing of $tree-column..

get-title

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the title of the widget.

method get-title (--> Str )

Return value; the title of the column. This string should not be modified or freed..

get-tree-view

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the Gnome::Gtk4::TreeView wherein $tree-column has been inserted. If $column is currently not inserted in any tree view, undefined is returned.

method get-tree-view (--> N-Object )

Return value; The tree view wherein $column has been inserted.

get-visible

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns True if $tree-column is visible.

method get-visible (--> Bool )

Return value; whether the column is visible or not. If it is visible, then the tree will show the column..

get-widget

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the Gnome::Gtk4::Widget in the button on the column header.

If a custom widget has not been set then undefined is returned.

method get-widget (--> N-Object )

Return value; The Gnome::Gtk4::Widget in the column header.

get-width

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the current size of $tree-column in pixels.

method get-width (--> Int )

Return value; The current width of $tree-column..

get-x-offset

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns the current X offset of $tree-column in pixels.

method get-x-offset (--> Int )

Return value; The current X offset of $tree-column..

pack-end

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Adds the $cell to end of the column. If $expand is False, then the $cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which $expand is True.

method pack-end ( N-Object() $cell, Bool() $expand )
  • $cell; The Gnome::Gtk4::CellRenderer.

  • $expand; True if $cell is to be given extra space allocated to $tree-column..

pack-start

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Packs the $cell into the beginning of the column. If $expand is False, then the $cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which $expand is True.

method pack-start ( N-Object() $cell, Bool() $expand )
  • $cell; The Gnome::Gtk4::CellRenderer.

  • $expand; True if $cell is to be given extra space allocated to $tree-column..

queue-resize

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Flags the column, and the cell renderers added to this column, to have their sizes renegotiated.

method queue-resize ( )

set-alignment

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the alignment of the title or custom widget inside the column header. The alignment determines its location inside the button -- 0.0 for left, 0.5 for center, 1.0 for right.

method set-alignment ( Num() $xalign )
  • $xalign; The alignment, which is between [0.0 and 1.0] inclusive..

set-attributes This function is not yet available

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the attributes in the list as the attributes of $tree-column.

The attributes should be in attribute/column order, as in .add-attribute(). All existing attributes are removed, and replaced with the new attributes.

method set-attributes ( N-Object() $cell-renderer, … )
  • $cell-renderer; the Gnome::Gtk4::CellRenderer we’re setting the attributes of.

  • …; …. Note that each argument must be specified as a type followed by its value!

set-cell-data-func This function is not yet available

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the Gnome::Gtk4::T-treeviewcolumn to use for the column.

This function is used instead of the standard attributes mapping for setting the column value, and should set the value of $tree-column's cell renderer as appropriate. $func may be undefined to remove an older one.

method set-cell-data-func ( N-Object() $cell-renderer, &func, gpointer $func-data, … )
  • $cell-renderer; A Gnome::Gtk4::CellRenderer.

  • &func; The Gnome::Gtk4::T-treeviewcolumn to use.. Tthe function must be specified with following signature; :( N-Object $tree-column, N-Object $cell, N-Object $tree-model, N-Object $iter, gpointer $data ).

  • $func-data; The user data for $func..

  • destroy; The destroy notification for $func-data. Note that each argument must be specified as a type followed by its value!

set-clickable

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the header to be active if $clickable is True. When the header is active, then it can take keyboard focus, and can be clicked.

method set-clickable ( Bool() $clickable )
  • $clickable; True if the header is active..

set-expand

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the column to take available extra space. This space is shared equally amongst all columns that have the expand set to True. If no column has this option set, then the last column gets all extra space. By default, every column is created with this False.

Along with “fixed-width”, the “expand” property changes when the column is resized by the user.

method set-expand ( Bool() $expand )
  • $expand; True if the column should expand to fill available space..

set-fixed-width

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

If $fixed-width is not -1, sets the fixed width of $tree-column; otherwise unsets it. The effective value of $fixed-width is clamped between the minimum and maximum width of the column; however, the value stored in the “fixed-width” property is not clamped. If the column sizing is GTK_TREE_VIEW_COLUMN_GROW_ONLY or GTK_TREE_VIEW_COLUMN_AUTOSIZE, setting a fixed width overrides the automatically calculated width. Note that $fixed-width is only a hint to GTK; the width actually allocated to the column may be greater or less than requested.

Along with “expand”, the “fixed-width” property changes when the column is resized by the user.

method set-fixed-width ( Int() $fixed-width )
  • $fixed-width; The new fixed width, in pixels, or -1..

set-max-width

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the maximum width of the $tree-column. If $max-width is -1, then the maximum width is unset. Note, the column can actually be wider than max width if it’s the last column in a view. In this case, the column expands to fill any extra space.

method set-max-width ( Int() $max-width )
  • $max-width; The maximum width of the column in pixels, or -1..

set-min-width

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the minimum width of the $tree-column. If $min-width is -1, then the minimum width is unset.

method set-min-width ( Int() $min-width )
  • $min-width; The minimum width of the column in pixels, or -1..

set-reorderable

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

If $reorderable is True, then the column can be reordered by the end user dragging the header.

method set-reorderable ( Bool() $reorderable )
  • $reorderable; True, if the column can be reordered..

set-resizable

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

If $resizable is True, then the user can explicitly resize the column by grabbing the outer edge of the column button.

If resizable is True and sizing mode of the column is GTK_TREE_VIEW_COLUMN_AUTOSIZE, then the sizing mode is changed to GTK_TREE_VIEW_COLUMN_GROW_ONLY.

method set-resizable ( Bool() $resizable )
  • $resizable; True, if the column can be resized.

set-sizing

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the growth behavior of $tree-column to $type.

method set-sizing ( GtkTreeViewColumnSizing $type )
  • $type; The Gnome::Gtk4::TreeViewColumnSizing..

set-sort-column-id

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the logical $sort-column-id that this column sorts on when this column is selected for sorting. Doing so makes the column header clickable.

method set-sort-column-id ( Int() $sort-column-id )
  • $sort-column-id; The $sort-column-id of the model to sort on..

set-sort-indicator

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Call this function with a $setting of True to display an arrow in the header button indicating the column is sorted. Call .set-sort-order() to change the direction of the arrow.

method set-sort-indicator ( Bool() $setting )
  • $setting; True to display an indicator that the column is sorted.

set-sort-order

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Changes the appearance of the sort indicator.

This does not actually sort the model. Use .set-sort-column-id() if you want automatic sorting support. This function is primarily for custom sorting behavior, and should be used in conjunction with gtk_tree_sortable_set_sort_column_id() to do that. For custom models, the mechanism will vary.

The sort indicator changes direction to indicate normal sort or reverse sort. Note that you must have the sort indicator enabled to see anything when calling this function; see .set-sort-indicator().

method set-sort-order ( GtkSortType $order )
  • $order; sort order that the sort indicator should indicate.

set-spacing

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the spacing field of $tree-column, which is the number of pixels to place between cell renderers packed into it.

method set-spacing ( Int() $spacing )
  • $spacing; distance between cell renderers in pixels..

set-title

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the title of the $tree-column. If a custom widget has been set, then this value is ignored.

method set-title ( Str $title )
  • $title; The title of the $tree-column..

set-visible

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the visibility of $tree-column.

method set-visible ( Bool() $visible )
  • $visible; True if the $tree-column is visible..

set-widget

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets the widget in the header to be $widget. If widget is undefined, then the header button is set with a Gnome::Gtk4::Label set to the title of $tree-column.

method set-widget ( N-Object() $widget )
  • $widget; A child Gnome::Gtk4::Widget.

Signals

clicked

Emitted when the column's header has been clicked.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TreeViewColumn :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TreeViewColumn object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.