A visible column in a GtkTreeView widget
Class GtkTreeViewColumn
The GtkTreeViewColumn object represents a visible column in a GtkTreeView 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 for an overview of all the objects and data types related to the tree widget and how they work together.
Methods | |
add_attribute | Adds an attribute mapping to the list in tree_column. |
cell_get_position | Obtains the horizontal position and size of a cell in a column. |
cell_get_size | Obtains the width and height needed to render the column. |
cell_is_visible | Returns TRUE if any of the cells packed into the tree_column are visible. |
cell_set_cell_data | Sets the cell renderer based on the tree_model and iter. |
clear | Unsets all the mappings on all renderers on the tree_column. |
clear_attributes | Clears all existing attributes previously set with gtk_tree_view_column_set_attributes(). |
clicked | Emits the "clicked" signal on the column. |
focus_cell | Sets the current keyboard focus to be at cell, if the column contains 2 or more editable and activatable cells. |
get_alignment | Returns the current x alignment of tree_column. |
get_clickable | Returns TRUE if the user can click on the header for the column. |
get_expand | Return TRUE if the column expands to take any available space. |
get_fixed_width | Gets the fixed width of the column. |
get_max_width | Returns the maximum width in pixels of the tree_column, or -1 if no maximum width is set. |
get_min_width | Returns the minimum width in pixels of the tree_column, or -1 if no minimum width is set. |
get_reorderable | Returns TRUE if the tree_column can be reordered by the user. |
get_resizable | Returns TRUE if the tree_column can be resized by the end user. |
get_sizing | Returns the current type of tree_column. |
get_sort_column_id | Gets the logical sort_column_id that the model sorts on when this column is selected for sorting. |
get_sort_indicator | Gets the value set by gtk_tree_view_column_set_sort_indicator(). |
get_sort_order | Gets the value set by gtk_tree_view_column_set_sort_order(). |
get_spacing | Returns the spacing of tree_column. |
get_title | Returns the title of the widget. |
get_tree_view | Returns the GtkTreeView wherein tree_column has been inserted. |
get_visible | Returns TRUE if tree_column is visible. |
get_widget | Returns the GtkWidget in the button on the column header. |
get_width | Returns the current size of tree_column in pixels. |
new_with_attributes | Creates a new GtkTreeViewColumn with a number of default values. |
pack_end | Adds the cell to end of the column. |
pack_start | Packs the cell into the beginning of the column. |
queue_resize | Flags the column, and the cell renderers added to this column, to have their sizes renegotiated. |
set_alignment | Sets the alignment of the title or custom widget inside the column header. |
set_attributes | Sets the attributes in the list as the attributes of tree_column. |
set_cell_data_func | Sets the GtkTreeViewColumnFunc to use for the column. |
set_clickable | Sets the header to be active if active is TRUE. |
set_expand | Sets the column to take available extra space. |
set_fixed_width | Sets the size of the column in pixels. |
set_max_width | Sets the maximum width of the tree_column. |
set_min_width | Sets the minimum width of the tree_column. |
set_reorderable | If reorderable is TRUE, then the column can be reordered by the end user dragging the header. |
set_resizable | If resizable is TRUE, then the user can explicitly resize the column by grabbing the outer edge of the column button. |
set_sizing | Sets the growth behavior of tree_column to type. |
set_sort_column_id | Sets the logical sort_column_id that this column sorts on when this column is selected for sorting. |
set_sort_indicator | Call this function with a setting of TRUE to display an arrow in the header button indicating the column is sorted. |
set_sort_order | Changes the appearance of the sort indicator. |
set_spacing | Sets the spacing field of tree_column, which is the number of pixels to place between cell renderers packed into it. |
set_title | Sets the title of the tree_column. |
set_visible | Sets the visibility of tree_column. |
set_widget | Sets the widget in the header to be widget. |
signal_clicked | ? |
Adds an attribute mapping to the list in tree_column.
GtkTreeViewColumn.add_attribute( cell_renderer, attribute, column )
cell_renderer | the GtkCellRenderer to set attributes on |
attribute | An attribute on the renderer |
column | The column position on the model to get the attribute from. |
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 GtkCellRendererText get its values from column 2.
Obtains the horizontal position and size of a cell in a column.
GtkTreeViewColumn.cell_get_position( cell )
cell | a GtkCellRenderer |
Return | an array [ horizontal position of cell within tree_column, width of cell ], or nil |
If the cell is not found in the column, nil is returned.
Obtains the width and height needed to render the column.
GtkTreeViewColumn.cell_get_size( cell_area )
cell_area | The area (GdkRectangle) a cell in the column will be allocated, or NULL. |
Return | an array [ x offset, y offset of a cell relative to cell_area, width, height needed to render a cell ] |
This is used primarily by the GtkTreeView.
Returns TRUE if any of the cells packed into the tree_column are visible.
GtkTreeViewColumn.cell_is_visible()
Return | TRUE, if any of the cells packed into the tree_column are currently visible |
For this to be meaningful, you must first initialize the cells with gtk_tree_view_column_cell_set_cell_data()
Sets the cell renderer based on the tree_model and iter.
GtkTreeViewColumn.cell_set_cell_data( tree_model, iter, is_expander, is_expanded )
tree_model | The GtkTreeModel to to get the cell renderers attributes from. |
iter | The GtkTreeIter to 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 |
That is, forevery 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 GtkTreeView.
Unsets all the mappings on all renderers on the tree_column.
GtkTreeViewColumn.clear()
Clears all existing attributes previously set with gtk_tree_view_column_set_attributes().
GtkTreeViewColumn.clear_attributes( cell_renderer )
cell_renderer | a GtkCellRenderer to clear the attribute mapping on. |
Emits the "clicked" signal on the column.
GtkTreeViewColumn.clicked()
This function will only work if tree_column is clickable.
Sets the current keyboard focus to be at cell, if the column contains 2 or more editable and activatable cells.
GtkTreeViewColumn.focus_cell( cell )
cell | A GtkCellRenderer |
Returns the current x alignment of tree_column.
GtkTreeViewColumn.get_alignment()
This value can range between 0.0 and 1.0.
Returns TRUE if the user can click on the header for the column.
GtkTreeViewColumn.get_clickable()
Return | TRUE if user can click the column header. |
Return TRUE if the column expands to take any available space.
GtkTreeViewColumn.get_expand()
Return | TRUE, if the column expands |
Gets the fixed width of the column.
GtkTreeViewColumn.get_fixed_width()
This value is only meaning may not be the actual width of the column on the screen, just what is requested.
Returns the maximum width in pixels of the tree_column, or -1 if no maximum width is set.
GtkTreeViewColumn.get_max_width()
Return | The maximum width of the tree_column. |
Returns the minimum width in pixels of the tree_column, or -1 if no minimum width is set.
GtkTreeViewColumn.get_min_width()
Return | The minimum width of the tree_column. |
Returns TRUE if the tree_column can be reordered by the user.
GtkTreeViewColumn.get_reorderable()
Return | TRUE if the tree_column can be reordered by the user. |
Returns TRUE if the tree_column can be resized by the end user.
GtkTreeViewColumn.get_resizable()
Return | TRUE, if the tree_column can be resized. |
Returns the current type of tree_column.
GtkTreeViewColumn.get_sizing()
Return | The type of tree_column (GtkTreeViewColumnSizing). |
Gets the logical sort_column_id that the model sorts on when this column is selected for sorting.
GtkTreeViewColumn.get_sort_column_id()
Return | the current sort_column_id for this column, or -1 if this column can't be used for sorting. |
See gtk_tree_view_column_set_sort_column_id().
Gets the value set by gtk_tree_view_column_set_sort_indicator().
GtkTreeViewColumn.get_sort_indicator()
Return | whether the sort indicator arrow is displayed |
Gets the value set by gtk_tree_view_column_set_sort_order().
GtkTreeViewColumn.get_sort_order()
Return | the sort order the sort indicator is indicating (GtkSortType) |
Returns the spacing of tree_column.
GtkTreeViewColumn.get_spacing()
Return | the spacing of tree_column. |
Returns the title of the widget.
GtkTreeViewColumn.get_title()
Return | the title of the column. |
Returns the GtkTreeView wherein tree_column has been inserted.
GtkTreeViewColumn.get_tree_view()
Return | The tree view wherein column has been inserted if any, NULL otherwise. |
If column is currently not inserted in any tree view, NULL is returned.
Returns TRUE if tree_column is visible.
GtkTreeViewColumn.get_visible()
Return | whether the column is visible or not. If it is visible, then the tree will show the column. |
Returns the GtkWidget in the button on the column header.
GtkTreeViewColumn.get_widget()
Return | The GtkWidget in the column header, or NULL |
If a custom widget has not been set then NULL is returned.
Returns the current size of tree_column in pixels.
GtkTreeViewColumn.get_width()
Return | The current width of tree_column. |
Creates a new GtkTreeViewColumn with a number of default values.
GtkTreeViewColumn.new_with_attributes( title, cell, attributes )
title | The title to set the header to. |
cell | The GtkCellRenderer. |
attributes | An array of pairs [ attribute, column, ... ] |
Return | a new GtkTreeViewColumn |
This is equivalent to calling gtk_tree_view_column_set_title(), gtk_tree_view_column_pack_start(), and gtk_tree_view_column_set_attributes() on the newly created GtkTreeViewColumn.
Adds the cell to end of the column.
GtkTreeViewColumn.pack_end( cell, expand )
cell | The GtkCellRenderer. |
expand | TRUE if cell is to be given extra space allocated to tree_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.
Packs the cell into the beginning of the column.
GtkTreeViewColumn.pack_start( cell, expand )
cell | The GtkCellRenderer. |
expand | TRUE if cell is to be given extra space allocated to tree_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.
Flags the column, and the cell renderers added to this column, to have their sizes renegotiated.
GtkTreeViewColumn.queue_resize()
Sets the alignment of the title or custom widget inside the column header.
GtkTreeViewColumn.set_alignment( xalign )
xalign | The alignment, which is between [0.0 and 1.0] inclusive. |
The alignment determines its location inside the button -- 0.0 for left, 0.5 for center, 1.0 for right.
Sets the attributes in the list as the attributes of tree_column.
GtkTreeViewColumn.set_attributes( cell_renderer, attributes )
cell_renderer | the GtkCellRenderer we're setting the attributes of |
attributes | An array of pairs [ attribute, column, ... ] |
The attributes should be in attribute/column order, as in gtk_tree_view_column_add_attribute(). All existing attributes are removed, and replaced with the new attributes.
Sets the GtkTreeViewColumnFunc to use for the column.
GtkTreeViewColumn.set_cell_data_func( cell_renderer, func, func_data )
cell_renderer | A GtkCellRenderer |
func | The GtkTreeViewColumnFunc to use, or nil. |
func_data | The user data for func, or nil. |
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 NULL to remove an older one.
Sets the header to be active if active is TRUE.
GtkTreeViewColumn.set_clickable( clickable )
clickable | TRUE if the header is active. |
When the header is active, then it can take keyboard focus, and can be clicked.
Sets the column to take available extra space.
GtkTreeViewColumn.set_expand( expand )
expand | TRUE if the column should take available extra space, FALSE if not |
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.
Sets the size of the column in pixels.
GtkTreeViewColumn.set_fixed_width( fixed_width )
fixed_width | The size to set tree_column to. Must be greater than 0. |
This is meaningful only if the sizing type is GTK_TREE_VIEW_COLUMN_FIXED The size of the column is clamped to the min/max width for the column. Please note that the min/max width of the column doesn't actually affect the "fixed_width" property of the widget, just the actual size when displayed.
Sets the maximum width of the tree_column.
GtkTreeViewColumn.set_max_width( max_width )
max_width | The maximum width of the column in pixels, or -1. |
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.
Sets the minimum width of the tree_column.
GtkTreeViewColumn.set_min_width( min_width )
min_width | The minimum width of the column in pixels, or -1. |
If min_width is -1, then the minimum width is unset.
If reorderable is TRUE, then the column can be reordered by the end user dragging the header.
GtkTreeViewColumn.set_reorderable( reorderable )
reorderable | TRUE, if the column can be reordered. |
If resizable is TRUE, then the user can explicitly resize the column by grabbing the outer edge of the column button.
GtkTreeViewColumn.set_resizable( resizeable )
resizeable | TRUE, if the column can be resized |
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.
Sets the growth behavior of tree_column to type.
GtkTreeViewColumn.set_sizing( type )
type | The GtkTreeViewColumnSizing. |
Sets the logical sort_column_id that this column sorts on when this column is selected for sorting.
GtkTreeViewColumn.set_sort_column_id( sort_column_id )
sort_column_id | The sort_column_id of the model to sort on. |
Doing so makes the column header clickable.
Call this function with a setting of TRUE to display an arrow in the header button indicating the column is sorted.
GtkTreeViewColumn.set_sort_indicator( setting )
setting | TRUE to display an indicator that the column is sorted |
Call gtk_tree_view_column_set_sort_order() to change the direction of the arrow.
Changes the appearance of the sort indicator.
GtkTreeViewColumn.set_sort_order( order )
order | sort order that the sort indicator should indicate (GtkSortType) |
This does not actually sort the model. Use gtk_tree_view_column_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() 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 gtk_tree_view_column_set_sort_indicator().
Sets the spacing field of tree_column, which is the number of pixels to place between cell renderers packed into it.
GtkTreeViewColumn.set_spacing( distance )
distance | between cell renderers in pixels. |
Sets the title of the tree_column.
GtkTreeViewColumn.set_title( title )
title | The title of the tree_column. |
If a custom widget has been set, then this value is ignored.
Sets the visibility of tree_column.
GtkTreeViewColumn.set_visible( visible )
visible | TRUE if the tree_column is visible. |
Sets the widget in the header to be widget.
GtkTreeViewColumn.set_widget( widget )
widget | A child GtkWidget, or NULL. |
If widget is NULL, then the header button is set with a GtkLabel set to the title of tree_column.
?
GtkTreeViewColumn.signal_clicked()