// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type NumericSorterClass struct { _ structs.HostLayout ParentClass SorterClass } func (x *NumericSorterClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // Sorts items numerically. // // To obtain the numbers to compare, this sorter evaluates a // [class@Gtk.Expression]. type NumericSorter struct { Sorter } var xNumericSorterGLibType func() types.GType func NumericSorterGLibType() types.GType { return xNumericSorterGLibType() } func NumericSorterNewFromInternalPtr(ptr uintptr) *NumericSorter { cls := &NumericSorter{} cls.Ptr = ptr return cls } var xNewNumericSorter func(uintptr) uintptr // Creates a new numeric sorter using the given @expression. // // Smaller numbers will be sorted first. You can call // [method@Gtk.NumericSorter.set_sort_order] to change this. func NewNumericSorter(ExpressionVar *Expression) *NumericSorter { var cls *NumericSorter cret := xNewNumericSorter(ExpressionVar.GoPointer()) if cret == 0 { return nil } cls = &NumericSorter{} cls.Ptr = cret return cls } var xNumericSorterGetExpression func(uintptr) uintptr // Gets the expression that is evaluated to obtain numbers from items. func (x *NumericSorter) GetExpression() *Expression { var cls *Expression cret := xNumericSorterGetExpression(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Expression{} cls.Ptr = cret return cls } var xNumericSorterGetSortOrder func(uintptr) SortType // Gets whether this sorter will sort smaller numbers first. func (x *NumericSorter) GetSortOrder() SortType { cret := xNumericSorterGetSortOrder(x.GoPointer()) return cret } var xNumericSorterSetExpression func(uintptr, uintptr) // 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. func (x *NumericSorter) SetExpression(ExpressionVar *Expression) { xNumericSorterSetExpression(x.GoPointer(), ExpressionVar.GoPointer()) } var xNumericSorterSetSortOrder func(uintptr, SortType) // Sets whether to sort smaller numbers before larger ones. func (x *NumericSorter) SetSortOrder(SortOrderVar SortType) { xNumericSorterSetSortOrder(x.GoPointer(), SortOrderVar) } func (c *NumericSorter) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *NumericSorter) SetGoPointer(ptr uintptr) { c.Ptr = ptr } func init() { core.SetPackageName("GTK", "gtk4") core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GTK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xNumericSorterGLibType, libs, "gtk_numeric_sorter_get_type") core.PuregoSafeRegister(&xNewNumericSorter, libs, "gtk_numeric_sorter_new") core.PuregoSafeRegister(&xNumericSorterGetExpression, libs, "gtk_numeric_sorter_get_expression") core.PuregoSafeRegister(&xNumericSorterGetSortOrder, libs, "gtk_numeric_sorter_get_sort_order") core.PuregoSafeRegister(&xNumericSorterSetExpression, libs, "gtk_numeric_sorter_set_expression") core.PuregoSafeRegister(&xNumericSorterSetSortOrder, libs, "gtk_numeric_sorter_set_sort_order") }