class Gtk::ColumnViewColumn

Overview

Gtk::ColumnViewColumn represents the columns being added to Gtk::ColumnView.

The main ingredient for a Gtk::ColumnViewColumn is the Gtk::ListItemFactory 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 Gtk::ColumnViewColumn#header_menu=.

A sorter can be associated with a column using Gtk::ColumnViewColumn#sorter=, to let users influence sorting by clicking on the column header.

Defined in:

lib/gi-crystal/src/auto/gtk-4.0/column_view_column.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class GObject::Object

bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding bind_property, bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding bind_property_full, data(key : String) : Pointer(Void)? data, finalize finalize, freeze_notify : Nil freeze_notify, getv(names : Enumerable(String), values : Enumerable(_)) : Nil getv, notify(property_name : String) : Nil notify, notify_by_pspec(pspec : GObject::ParamSpec) : Nil notify_by_pspec, notify_signal notify_signal, property(property_name : String, value : _) : Nil property, qdata(quark : UInt32) : Pointer(Void)? qdata, ref_count : UInt32 ref_count, run_dispose : Nil run_dispose, set_data(key : String, data : Pointer(Void)?) : Nil set_data, set_property(property_name : String, value : _) : Nil set_property, steal_data(key : String) : Pointer(Void)? steal_data, steal_qdata(quark : UInt32) : Pointer(Void)? steal_qdata, thaw_notify : Nil thaw_notify, to_unsafe : Pointer(Void) to_unsafe, watch_closure(closure : GObject::Closure) : Nil watch_closure

Constructor methods inherited from class GObject::Object

cast(obj : GObject::Object) : self cast, cast?(obj : GObject::Object) : self? cast?, new(pointer : Pointer(Void), transfer : GICrystal::Transfer)
new
new
, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv

Class methods inherited from class GObject::Object

compat_control(what : UInt64, data : Pointer(Void)?) : UInt64 compat_control, g_type : UInt64 g_type, interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec interface_find_property, interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec) interface_list_properties

Constructor Detail

def self.new(title : String?, factory : Gtk::ListItemFactory?) : self #

Creates a new Gtk::ColumnViewColumn that uses the given @factory for mapping items to widgets.

You most likely want to call Gtk::ColumnView#append_column next.

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

WARNING ⚠️ The following code is in c ⚠️

column = gtk_column_view_column_new (_("Name"),
  gtk_builder_list_item_factory_new_from_resource ("/name.ui"));

def self.new #

Initialize a new ColumnViewColumn.


def self.new(*, column_view : Gtk::ColumnView? = nil, expand : Bool? = nil, factory : Gtk::ListItemFactory? = nil, fixed_width : Int32? = nil, header_menu : Gio::MenuModel? = nil, resizable : Bool? = nil, sorter : Gtk::Sorter? = nil, title : String? = nil, visible : Bool? = nil) #

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


Instance Method Detail

def column_view : Gtk::ColumnView? #

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

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


def expand : Bool #

Returns whether this column should expand.


def expand=(expand : Bool) : Nil #

Sets the column to take available extra space.

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


def expand? : Bool #

def factory : Gtk::ListItemFactory? #

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


def factory=(factory : Gtk::ListItemFactory?) : Nil #

Sets the Gtk::ListItemFactory to use for populating list items for this column.


def fixed_width : Int32 #

Gets the fixed width of the column.


def fixed_width=(fixed_width : Int32) : Nil #

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.


def header_menu : Gio::MenuModel? #

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


def header_menu=(menu : Gio::MenuModel?) : Nil #

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


def resizable : Bool #

Returns whether this column is resizable.


def resizable=(resizable : Bool) : Nil #

Sets whether this column should be resizable by dragging.


def resizable? : Bool #

def sorter : Gtk::Sorter? #

Returns the sorter that is associated with the column.


def sorter=(sorter : Gtk::Sorter?) : Nil #

Associates a sorter with the column.

If @sorter is nil, 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 Gtk::ColumnView#sort_by_column.

See Gtk::ColumnView#sorter for the necessary steps for setting up customizable sorting for Gtk::ColumnView.


def title : String? #

Returns the title set with gtk_column_view_column_set_title().


def title=(value : String) : String #

def title=(title : String?) : Nil #

Sets the title of this column.

The title is displayed in the header of a Gtk::ColumnView for this column and is therefore user-facing text that should be translated.


def visible : Bool #

Returns whether this column is visible.


def visible=(visible : Bool) : Nil #

Sets whether this column should be visible in views.


def visible? : Bool #