
GnomeTools::Gtk::GridView
Description
A gridview is like the listview class a list of objects. The list however, can wrap to the next when the edge of the window or when the maximum columns is reached.
This class has only one event which is activate and can be set using .set-activate(). Other events which may be needed are defined in GnomeTools::Gtk::R-ListModel using the Gtk class Gnome::Gtk4::SignalListItemFactory.
CSS classes
The GnomeTools::Gtk::GridView class is placed in a Gnome::Gtk4::ScrolledWindow. That object has a classname gridview-window and the GnomeTools::Gtk::GridView object has a classname listview-tool. Other CSS nodes are defined for Gnome::Gtk4::GridView.
Methods
new
Instantiate the GnomeTools::Gtk::GridView class.
submethod BUILD ( Bool :$multi-select = False, :$orientation = GTK_ORIENTATION_VERTICAL, UInt :$min-columns, UInt :$max-columns )
$multi-select; Selection method. When True, more than one entry can be selected. By default False. Selections can be done a) by holding <CTRL> or <SHIFT> and click on the entries. b) by dragging the pointer over the entries (rubberband select).
$orientation; orientation of the list. By default shown vertically.
$min-columns; minimum columns before wrapping to next row. When the orientation is set to horizontal, the value is about the number of rows!
$max-columns; maximum number of columns to use for a row. Also here, when horizontal, the number is about rows!
set-activate
Define a callback routine for the activate event. The activate event is emitted when a row has been activated by the user. If an item is activatable, double-clicking on the item, using the Return key or calling .activate() in Gnome::Gtk4::Widget will activate the item. Activating instructs the containing view to handle activation.
method set-activate ( Any:D $object, Str:D $method, *%options )
$object; user object where methods are defined to process the events.
$method; the method called when the
activateevent arrives.*%options: any named arguments are passed to the callback method.
The callback method must have the following API;
method $object."$method" ( UInt $position, @selections, *%options);
$position; The position of the activated entry.
@selections; A list of the currently selected entries.
%options. Any named arguments provided to
.set-activate().
About my projects, references, blog posts, examples and tutorials