Gtk.ColumnViewColumn

g GObject.Object GObject.Object Gtk.ColumnViewColumn Gtk.ColumnViewColumn GObject.Object->Gtk.ColumnViewColumn

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (title, factory)

get_column_view ()

get_expand ()

get_factory ()

get_fixed_width ()

get_header_menu ()

get_id ()

get_resizable ()

get_sorter ()

get_title ()

get_visible ()

set_expand (expand)

set_factory (factory)

set_fixed_width (fixed_width)

set_header_menu (menu)

set_id (id)

set_resizable (resizable)

set_sorter (sorter)

set_title (title)

set_visible (visible)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

column-view

Gtk.ColumnView

r/en

expand

bool

r/w/en

factory

Gtk.ListItemFactory

r/w/en

fixed-width

int

r/w/en

header-menu

Gio.MenuModel

r/w/en

id

str

r/w/en

resizable

bool

r/w/en

sorter

Gtk.Sorter

r/w/en

title

str

r/w/en

visible

bool

r/w/en

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Gtk.ColumnViewColumn(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gtk.ColumnViewColumnClass

GtkColumnViewColumn represents the columns being added to 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 [method`Gtk`.ColumnViewColumn.set_header_menu].

A sorter can be associated with a column using [method`Gtk`.ColumnViewColumn.set_sorter], to let users influence sorting by clicking on the column header.

classmethod new(title, factory)[source]
Parameters:
Returns:

a new GtkColumnViewColumn using the given factory

Return type:

Gtk.ColumnViewColumn

Creates a new GtkColumnViewColumn that uses the given factory for mapping items to widgets.

You most likely want to call [method`Gtk`.ColumnView.append_column] next.

The function takes ownership of the argument, so you can write code like:

``c column = gtk_column_view_column_new (_(“Name”),

gtk_builder_list_item_factory_new_from_resource (“/name.ui”));

``

get_column_view()[source]
Returns:

The column view displaying self.

Return type:

Gtk.ColumnView or None

Gets the column view that’s currently displaying this column.

If self has not been added to a column view yet, None is returned.

get_expand()[source]
Returns:

True if this column expands

Return type:

bool

Returns whether this column should expand.

get_factory()[source]
Returns:

The factory in use

Return type:

Gtk.ListItemFactory or None

Gets the factory that’s currently used to populate list items for this column.

get_fixed_width()[source]
Returns:

the fixed with of the column

Return type:

int

Gets the fixed width of the column.

get_header_menu()[source]
Returns:

the GMenuModel

Return type:

Gio.MenuModel or None

Gets the menu model that is used to create the context menu for the column header.

get_id()[source]
Returns:

The column’s ID

Return type:

str or None

Returns the ID set with Gtk.ColumnViewColumn.set_id().

New in version 4.10.

get_resizable()[source]
Returns:

True if this column is resizable

Return type:

bool

Returns whether this column is resizable.

get_sorter()[source]
Returns:

the GtkSorter of self

Return type:

Gtk.Sorter or None

Returns the sorter that is associated with the column.

get_title()[source]
Returns:

The column’s title

Return type:

str or None

Returns the title set with Gtk.ColumnViewColumn.set_title().

get_visible()[source]
Returns:

True if this column is visible

Return type:

bool

Returns whether this column is visible.

set_expand(expand)[source]
Parameters:

expand (bool) – True if this column should expand to fill available sace

Sets the column to take available extra space.

The extra space is shared equally amongst all columns that have the expand set to True.

set_factory(factory)[source]
Parameters:

factory (Gtk.ListItemFactory or None) – the factory to use

Sets the GtkListItemFactory to use for populating list items for this column.

set_fixed_width(fixed_width)[source]
Parameters:

fixed_width (int) – the new fixed width, or -1

If fixed_width is not -1, sets the fixed width of column; otherwise unsets it.

Setting a fixed width overrides the automatically calculated width. Interactive resizing also sets the “fixed-width” property.

set_header_menu(menu)[source]
Parameters:

menu (Gio.MenuModel or None) – a GMenuModel

Sets the menu model that is used to create the context menu for the column header.

set_id(id)[source]
Parameters:

id (str or None) – ID to use for this column

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.

New in version 4.10.

set_resizable(resizable)[source]
Parameters:

resizable (bool) – whether this column should be resizable

Sets whether this column should be resizable by dragging.

set_sorter(sorter)[source]
Parameters:

sorter (Gtk.Sorter or None) – the GtkSorter to associate with column

Associates a sorter with the column.

If sorter is None, 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 [method`Gtk`.ColumnView.sort_by_column].

See [method`Gtk`.ColumnView.get_sorter] for the necessary steps for setting up customizable sorting for [class`Gtk`.ColumnView].

set_title(title)[source]
Parameters:

title (str or None) – Title to use for this column

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.

set_visible(visible)[source]
Parameters:

visible (bool) – whether this column should be visible

Sets whether this column should be visible in views.

Property Details

Gtk.ColumnViewColumn.props.column_view
Name:

column-view

Type:

Gtk.ColumnView

Default Value:

None

Flags:

READABLE, EXPLICIT_NOTIFY

The GtkColumnView this column is a part of.

Gtk.ColumnViewColumn.props.expand
Name:

expand

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Column gets share of extra width allocated to the view.

Gtk.ColumnViewColumn.props.factory
Name:

factory

Type:

Gtk.ListItemFactory

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Factory for populating list items.

Gtk.ColumnViewColumn.props.fixed_width
Name:

fixed-width

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

If not -1, this is the width that the column is allocated, regardless of the size of its content.

Gtk.ColumnViewColumn.props.header_menu
Name:

header-menu

Type:

Gio.MenuModel

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Menu model used to create the context menu for the column header.

Gtk.ColumnViewColumn.props.id
Name:

id

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.

New in version 4.10.

Gtk.ColumnViewColumn.props.resizable
Name:

resizable

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether this column is resizable.

Gtk.ColumnViewColumn.props.sorter
Name:

sorter

Type:

Gtk.Sorter

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Sorter for sorting items according to this column.

Gtk.ColumnViewColumn.props.title
Name:

title

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Title displayed in the header.

Gtk.ColumnViewColumn.props.visible
Name:

visible

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether this column is visible.