A visible column in a widget
The GtkTreeViewColumn object represents a visible column in a
<gtk-tree-view>
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.
Derives from
<gtk-buildable>
,<gtk-cell-layout>
,<gtk-object>
.This class defines the following slots:
visible
- Whether to display the column
resizable
- Column is user-resizable
width
- Current width of the column
spacing
- Space which is inserted between cells
sizing
- Resize mode of the column
fixed-width
- Current fixed width of the column
min-width
- Minimum allowed width of the column
max-width
- Maximum allowed width of the column
title
- Title to appear in column header
expand
- Column gets share of extra width allocated to the widget
clickable
- Whether the header can be clicked
widget
- Widget to put in column header button instead of column title
alignment
- X Alignment of the column header text or widget
reorderable
- Whether the column can be reordered around the headers
sort-indicator
- Whether to show a sort indicator
sort-order
- Sort direction the sort indicator should indicate
<gtk-tree-view-column>
)Creates a new
<gtk-tree-view-column>
.
- ret
- A newly created
<gtk-tree-view-column>
.
<gtk-tree-view-column>
) (cell <gtk-cell-renderer>
) (expand bool
)Packs the cell into the beginning of the column. If expand is ‘
#f
’, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is ‘#t
’.
- tree-column
- A
<gtk-tree-view-column>
.- cell
- The
<gtk-cell-renderer>
.- expand
- ‘
#t
’ if cell is to be given extra space allocated to tree-column.
<gtk-tree-view-column>
) (cell <gtk-cell-renderer>
) (expand bool
)Adds the cell to end of the column. If expand is ‘
#f
’, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is ‘#t
’.
- tree-column
- A
<gtk-tree-view-column>
.- cell
- The
<gtk-cell-renderer>
.- expand
- ‘
#t
’ if cell is to be given extra space allocated to tree-column.
<gtk-tree-view-column>
)Unsets all the mappings on all renderers on the tree-column.
- tree-column
- A
<gtk-tree-view-column>
<gtk-tree-view-column>
) (cell_renderer <gtk-cell-renderer>
) (attribute mchars
) (column int
)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
<gtk-cell-renderer-text>
get its values from column 2.
- tree-column
- A
<gtk-tree-view-column>
.- cell-renderer
- the
<gtk-cell-renderer>
to set attributes on- attribute
- An attribute on the renderer
- column
- The column position on the model to get the attribute from.
<gtk-tree-view-column>
) (spacing int
)Sets the spacing field of tree-column, which is the number of pixels to place between cell renderers packed into it.
- tree-column
- A
<gtk-tree-view-column>
.- spacing
- distance between cell renderers in pixels.
<gtk-tree-view-column>
) ⇒ (ret int
)Returns the spacing of tree-column.
- tree-column
- A
<gtk-tree-view-column>
.- ret
- the spacing of tree-column.
<gtk-tree-view-column>
) (visible bool
)Sets the visibility of tree-column.
- tree-column
- A
<gtk-tree-view-column>
.- visible
- ‘
#t
’ if the tree-column is visible.
<gtk-tree-view-column>
) ⇒ (ret bool
)Returns ‘
#t
’ if tree-column is visible.
- tree-column
- A
<gtk-tree-view-column>
.- ret
- whether the column is visible or not. If it is visible, then the tree will show the column.
<gtk-tree-view-column>
) (resizable bool
)If resizable is ‘
#t
’, then the user can explicitly resize the column by grabbing the outer edge of the column button. If resizable is ‘#t
’ 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>
.
- tree-column
- A
<gtk-tree-view-column>
- resizable
- ‘
#t
’, if the column can be resized
<gtk-tree-view-column>
) ⇒ (ret bool
)Returns ‘
#t
’ if the tree-column can be resized by the end user.
- tree-column
- A
<gtk-tree-view-column>
- ret
- ‘
#t
’, if the tree-column can be resized.
<gtk-tree-view-column>
) (type <gtk-tree-view-column-sizing>
)Sets the growth behavior of tree-column to type.
- tree-column
- A
<gtk-tree-view-column>
.- type
- The
<gtk-tree-view-column-sizing>
.
<gtk-tree-view-column>
) ⇒ (ret <gtk-tree-view-column-sizing>
)Returns the current type of tree-column.
- tree-column
- A
<gtk-tree-view-column>
.- ret
- The type of tree-column.
<gtk-tree-view-column>
) ⇒ (ret int
)Returns the current size of tree-column in pixels.
- tree-column
- A
<gtk-tree-view-column>
.- ret
- The current width of tree-column.
<gtk-tree-view-column>
) (min_width int
)Sets the minimum width of the tree-column. If min-width is -1, then the minimum width is unset.
- tree-column
- A
<gtk-tree-view-column>
.- min-width
- The minimum width of the column in pixels, or -1.
<gtk-tree-view-column>
) ⇒ (ret int
)Returns the minimum width in pixels of the tree-column, or -1 if no minimum width is set.
- tree-column
- A
<gtk-tree-view-column>
.- ret
- The minimum width of the tree-column.
<gtk-tree-view-column>
) (max_width int
)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.
- tree-column
- A
<gtk-tree-view-column>
.- max-width
- The maximum width of the column in pixels, or -1.
<gtk-tree-view-column>
) ⇒ (ret int
)Returns the maximum width in pixels of the tree-column, or -1 if no maximum width is set.
- tree-column
- A
<gtk-tree-view-column>
.- ret
- The maximum width of the tree-column.
<gtk-tree-view-column>
)Emits the "clicked" signal on the column. This function will only work if tree-column is clickable.
- tree-column
- a
<gtk-tree-view-column>
<gtk-tree-view-column>
) (title mchars
)Sets the title of the tree-column. If a custom widget has been set, then this value is ignored.
- tree-column
- A
<gtk-tree-view-column>
.- title
- The title of the tree-column.
<gtk-tree-view-column>
) ⇒ (ret mchars
)Returns the title of the widget.
- tree-column
- A
<gtk-tree-view-column>
.- ret
- the title of the column. This string should not be modified or freed.
<gtk-tree-view-column>
) (expand bool
)Sets the column to take available extra space. This space is shared equally amongst all columns that have the expand set to ‘
#t
’. If no column has this option set, then the last column gets all extra space. By default, every column is created with this ‘#f
’.
- tree-column
- A
<gtk-tree-view-column>
- expand
- ‘
#t
’ if the column should take available extra space, ‘#f
’ if notSince 2.4
<gtk-tree-view-column>
) ⇒ (ret bool
)Return ‘
#t
’ if the column expands to take any available space.
- tree-column
- a
<gtk-tree-view-column>
- ret
- ‘
#t
’, if the column expandsSince 2.4
<gtk-tree-view-column>
) (clickable bool
)Sets the header to be active if active is ‘
#t
’. When the header is active, then it can take keyboard focus, and can be clicked.
- tree-column
- A
<gtk-tree-view-column>
.- clickable
- ‘
#t
’ if the header is active.
<gtk-tree-view-column>
) ⇒ (ret bool
)Returns ‘
#t
’ if the user can click on the header for the column.
- tree-column
- a
<gtk-tree-view-column>
- ret
- ‘
#t
’ if user can click the column header.
<gtk-tree-view-column>
) (widget <gtk-widget>
)Sets the widget in the header to be widget. If widget is ‘
#f
’, then the header button is set with a<gtk-label>
set to the title of tree-column.
- tree-column
- A
<gtk-tree-view-column>
.- widget
- A child
<gtk-widget>
, or ‘#f
’.
<gtk-tree-view-column>
) ⇒ (ret <gtk-widget>
)Returns the
<gtk-widget>
in the button on the column header. If a custom widget has not been set then ‘#f
’ is returned.
- tree-column
- A
<gtk-tree-view-column>
.- ret
- The
<gtk-widget>
in the column header, or ‘#f
’
<gtk-tree-view-column>
) (xalign float
)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.
- tree-column
- A
<gtk-tree-view-column>
.- xalign
- The alignment, which is between [0.0 and 1.0] inclusive.
<gtk-tree-view-column>
) ⇒ (ret float
)Returns the current x alignment of tree-column. This value can range between 0.0 and 1.0.
- tree-column
- A
<gtk-tree-view-column>
.- ret
- The current alignent of tree-column.
<gtk-tree-view-column>
) (order <gtk-sort-type>
)Changes the appearance of the sort indicator.
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 withgtk-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
.
- tree-column
- a
<gtk-tree-view-column>
- order
- sort order that the sort indicator should indicate
<gtk-tree-view-column>
) ⇒ (ret <gtk-sort-type>
)Gets the value set by
gtk-tree-view-column-set-sort-order
.
- tree-column
- a
<gtk-tree-view-column>
- ret
- the sort order the sort indicator is indicating
<gtk-tree-view-column>
) (cell <gtk-cell-renderer>
)Sets the current keyboard focus to be at cell, if the column contains 2 or more editable and activatable cells.
- tree-column
- A
<gtk-tree-view-column>
- cell
- A
<gtk-cell-renderer>
Since 2.2