class Gtk::ColumnViewColumn

Overview

Represents the columns in a 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

==(other : self) ==, 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) | Nil data, finalize finalize, freeze_notify : Nil freeze_notify, getv(names : Enumerable(String), values : Enumerable(_)) : Nil getv, hash(hasher) hash, 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) | Nil qdata, ref_count : UInt32 ref_count, run_dispose : Nil run_dispose, set_data(key : String, data : Pointer(Void) | Nil) : Nil set_data, set_property(property_name : String, value : _) : Nil set_property, steal_data(key : String) : Pointer(Void) | Nil steal_data, steal_qdata(quark : UInt32) : Pointer(Void) | Nil 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, 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

cast?(obj : GObject::Object) : self | Nil cast?, compat_control(what : UInt64, data : Pointer(Void) | Nil) : 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

Macros inherited from class GObject::Object

previous_vfunc(*args) previous_vfunc, previous_vfunc!(*args) previous_vfunc!, signal(signature) signal

Constructor Detail

def self.new(title : String | Nil, factory : Gtk::ListItemFactory | Nil) : 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 = nil, expand : Bool | Nil = nil, factory : Gtk::ListItemFactory | Nil = nil, fixed_width : Int32 | Nil = nil, header_menu : Gio::MenuModel | Nil = nil, id : String | Nil = nil, resizable : Bool | Nil = nil, sorter : Gtk::Sorter | Nil = nil, title : String | Nil = nil, visible : Bool | Nil = nil) #

Class Method Detail

def self.g_type : UInt64 #

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


Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


def column_view : Gtk::ColumnView | Nil #

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

If self has not been added to a column view yet, NULL 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 are set to expand.


def expand? : Bool #

def factory : Gtk::ListItemFactory | Nil #

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


def factory=(factory : Gtk::ListItemFactory | Nil) : 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 #

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.


def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


def header_menu : Gio::MenuModel | Nil #

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


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

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


def id : String | Nil #

Returns the ID set with Gtk::ColumnViewColumn#id=.


def id=(value : String) : String #

def id=(value : Nil) : Nil #

Set #id property to nil.


def id=(id : String | Nil) : Nil #

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.


def id? : String | Nil #

Same as #id, but can return nil.


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 | Nil #

Returns the sorter that is associated with the column.


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

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 Gtk::ColumnView#sort_by_column.

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


def title : String | Nil #

Returns the title set with Gtk::ColumnViewColumn#title=.


def title=(value : String) : String #

def title=(value : Nil) : Nil #

Set #title property to nil.


def title=(title : String | Nil) : 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 title? : String | Nil #

Same as #title, but can return nil.


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 #