GtkNumericSorter

GtkNumericSorter — Sort by comparing numbers

Properties

GtkExpression * expression Read / Write
GtkSortType sort-order Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GtkSorter
        ╰── GtkNumericSorter

Includes

#include <gtk/gtk.h>

Description

GtkNumericSorter is a GtkSorter that compares numbers.

To obtain the numbers to compare, this sorter evaluates a GtkExpression.

Functions

gtk_numeric_sorter_new ()

GtkNumericSorter *
gtk_numeric_sorter_new (GtkExpression *expression);

Creates a new numeric sorter using the given expression .

Smaller numbers will be sorted first. You can call gtk_numeric_sorter_set_sort_order() to change this.

Parameters

expression

The expression to evaluate.

[transfer full][nullable]

Returns

a new GtkNumericSorter


gtk_numeric_sorter_get_expression ()

GtkExpression *
gtk_numeric_sorter_get_expression (GtkNumericSorter *self);

Gets the expression that is evaluated to obtain numbers from items.

Parameters

self

a GtkNumericSorter

 

Returns

a GtkExpression, or NULL.

[transfer none][nullable]


gtk_numeric_sorter_set_expression ()

void
gtk_numeric_sorter_set_expression (GtkNumericSorter *self,
                                   GtkExpression *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.

Parameters

self

a GtkNumericSorter

 

expression

a GtkExpression, or NULL.

[nullable][transfer none]

gtk_numeric_sorter_get_sort_order ()

GtkSortType
gtk_numeric_sorter_get_sort_order (GtkNumericSorter *self);

Gets whether this sorter will sort smaller numbers first.

Parameters

self

a GtkNumericSorter

 

Returns

the order of the numbers


gtk_numeric_sorter_set_sort_order ()

void
gtk_numeric_sorter_set_sort_order (GtkNumericSorter *self,
                                   GtkSortType sort_order);

Sets whether to sort smaller numbers before larger ones.

Parameters

self

a GtkNumericSorter

 

sort_order

whether to sort smaller numbers first

 

Types and Values

GtkNumericSorter

typedef struct _GtkNumericSorter GtkNumericSorter;

Property Details

The “expression” property

  “expression”               GtkExpression *

The expression to evaluate on items to get a number to compare with

[type GtkExpression]

Owner: GtkNumericSorter

Flags: Read / Write


The “sort-order” property

  “sort-order”               GtkSortType

Whether the sorter will sort smaller numbers first

Owner: GtkNumericSorter

Flags: Read / Write

Default value: GTK_SORT_ASCENDING

See Also

GtkExpression