Gtk.ColumnViewColumn¶
class — extends GObject.Object
Represents the columns in a GtkColumnView.
The main ingredient for a GtkColumnViewColumn is the GtkListItemFactory
that tells the columnview how to create cells for this column from items in
the model.
Columns have a title, and can optionally have a header menu set
with ColumnViewColumn.set_header_menu.
A sorter can be associated with a column using
ColumnViewColumn.set_sorter, to let users influence sorting
by clicking on the column header.
Constructors¶
new¶
@classmethod
def new(cls, title: str | None = ..., factory: ListItemFactory | None = ...) -> ColumnViewColumn
Creates a new GtkColumnViewColumn that uses the given factory for
mapping items to widgets.
You most likely want to call ColumnView.append_column next.
The function takes ownership of the argument, so you can write code like:
column = gtk_column_view_column_new (_("Name"),
gtk_builder_list_item_factory_new_from_resource ("/name.ui"));
Parameters:
title— Title to use for this columnfactory— The factory to populate items with
Methods¶
get_column_view¶
Gets the column view that's currently displaying this column.
If self has not been added to a column view yet, NULL is returned.
get_expand¶
Returns whether this column should expand.
get_factory¶
Gets the factory that's currently used to populate list items for this column.
get_fixed_width¶
Gets the fixed width of the column.
get_header_menu¶
Gets the menu model that is used to create the context menu for the column header.
get_id¶
Returns the ID set with ColumnViewColumn.set_id.
get_resizable¶
Returns whether this column is resizable.
get_sorter¶
Returns the sorter that is associated with the column.
get_title¶
Returns the title set with ColumnViewColumn.set_title.
get_visible¶
Returns whether this column is visible.
set_expand¶
Sets the column to take available extra space.
The extra space is shared equally amongst all columns that have are set to expand.
Parameters:
expand— whether this column should expand to fill available space
set_factory¶
Sets the GtkListItemFactory to use for populating list items
for this column.
Parameters:
factory— the factory to use
set_fixed_width¶
Sets the fixed width of the column.
If fixed_width is -1, the fixed width of the column is unset.
Setting a fixed width overrides the automatically calculated width. Interactive resizing also sets the “fixed-width” property.
Parameters:
fixed_width— the new fixed width, or -1
set_header_menu¶
Sets the menu model that is used to create the context menu for the column header.
Parameters:
menu— aGMenuModel
set_id¶
Sets the id of this column.
GTK makes no use of this, but applications can use it when storing column view configuration.
It is up to callers to ensure uniqueness of IDs.
Parameters:
id— ID to use for this column
set_resizable¶
Sets whether this column should be resizable by dragging.
Parameters:
resizable— whether this column should be resizable
set_sorter¶
Associates a sorter with the column.
If sorter is unset, the column will not let users change
the sorting by clicking on its header.
This sorter can be made active by clicking on the column
header, or by calling ColumnView.sort_by_column.
See ColumnView.get_sorter for the necessary steps
for setting up customizable sorting for ColumnView.
Parameters:
sorter— theGtkSorterto associate withcolumn
set_title¶
Sets the title of this column.
The title is displayed in the header of a GtkColumnView
for this column and is therefore user-facing text that should
be translated.
Parameters:
title— Title to use for this column
set_visible¶
Sets whether this column should be visible in views.
Parameters:
visible— whether this column should be visible
Properties¶
column_view¶
The GtkColumnView this column is a part of.
expand¶
Column gets share of extra width allocated to the view.
factory¶
Factory for populating list items.
The factory must be for configuring ColumnViewCell objects.
fixed_width¶
If not -1, this is the width that the column is allocated, regardless of the size of its content.
header_menu¶
Menu model used to create the context menu for the column header.
id¶
An ID for the column.
GTK is not currently using the ID for anything, but it can be used by applications when saving column view configurations.
It is up to applications to ensure uniqueness of IDs.
resizable¶
Whether this column is resizable.
sorter¶
Sorter for sorting items according to this column.
title¶
Title displayed in the header.
visible¶
Whether this column is visible.