Gnome::Gtk4::NumericSorter
Description
Gnome::Gtk4::NumericSorter is a Gnome::Gtk4::Sorter that compares numbers.
To obtain the numbers to compare, this sorter evaluates a Gnome::Gtk4::Expression.
Class initialization
new
:native-object
Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object :$native-object! )
new-numericsorter
Creates a new numeric sorter using the given $expression
.
Smaller numbers will be sorted first. You can call .set-sort-order()
to change this.
method new-numericsorter ( N-Object() $expression --> Gnome::Gtk4::NumericSorter \)
$expression; (transfer ownership: full) The expression to evaluate.
Methods
get-expression
Gets the expression that is evaluated to obtain numbers from items.
method get-expression (--> N-Object )
Return value; a Gnome::Gtk4::Expression.
get-sort-order
Gets whether this sorter will sort smaller numbers first.
method get-sort-order (--> GtkSortType )
Return value; the order of the numbers.
set-expression
Sets the expression that is evaluated to obtain numbers from items.
Unless an expression is set on $self
, the sorter will always compare items as invalid.
The expression must have a return type that can be compared numerically, such as G_TYPE_INT
or G_TYPE_DOUBLE
.
method set-expression ( N-Object() $expression )
$expression; a Gnome::Gtk4::Expression.
set-sort-order
Sets whether to sort smaller numbers before larger ones.
method set-sort-order ( GtkSortType $sort-order )
$sort-order; whether to sort smaller numbers first.