// 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/gio" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type NoSelectionClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass } func (x *NoSelectionClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // A selection model that does not allow selecting anything. // // This model is meant to be used as a simple wrapper around a `GListModel` // when a `GtkSelectionModel` is required. // // `GtkNoSelection` passes through sections from the underlying model. type NoSelection struct { gobject.Object } var xNoSelectionGLibType func() types.GType func NoSelectionGLibType() types.GType { return xNoSelectionGLibType() } func NoSelectionNewFromInternalPtr(ptr uintptr) *NoSelection { cls := &NoSelection{} cls.Ptr = ptr return cls } var xNewNoSelection func(uintptr) uintptr // Creates a new selection to handle @model. func NewNoSelection(ModelVar gio.ListModel) *NoSelection { var cls *NoSelection cret := xNewNoSelection(ModelVar.GoPointer()) if cret == 0 { return nil } cls = &NoSelection{} cls.Ptr = cret return cls } var xNoSelectionGetModel func(uintptr) uintptr // Gets the model that @self is wrapping. func (x *NoSelection) GetModel() *gio.ListModelBase { var cls *gio.ListModelBase cret := xNoSelectionGetModel(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &gio.ListModelBase{} cls.Ptr = cret return cls } var xNoSelectionSetModel func(uintptr, uintptr) // Sets the model that @self should wrap. // // If @model is %NULL, this model will be empty. func (x *NoSelection) SetModel(ModelVar gio.ListModel) { xNoSelectionSetModel(x.GoPointer(), ModelVar.GoPointer()) } func (c *NoSelection) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *NoSelection) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // GetPropertyNItems gets the "n-items" property. // The number of items. See [method@Gio.ListModel.get_n_items]. func (x *NoSelection) GetPropertyNItems() uint { var v gobject.Value x.GetProperty("n-items", &v) return v.GetUint() } // Get the item at @position. // // If @position is greater than the number of items in @list, %NULL is // returned. // // %NULL is never returned for an index that is smaller than the length // of the list. // // See also: g_list_model_get_n_items() func (x *NoSelection) GetItem(PositionVar uint) uintptr { cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar) return cret } // Gets the type of the items in @list. // // All items returned from g_list_model_get_item() are of the type // returned by this function, or a subtype, or if the type is an // interface, they are an implementation of that interface. // // The item type of a #GListModel can not change during the life of the // model. func (x *NoSelection) GetItemType() types.GType { cret := gio.XGListModelGetItemType(x.GoPointer()) return cret } // Gets the number of items in @list. // // Depending on the model implementation, calling this function may be // less efficient than iterating the list with increasing values for // @position until g_list_model_get_item() returns %NULL. func (x *NoSelection) GetNItems() uint { cret := gio.XGListModelGetNItems(x.GoPointer()) return cret } // Get the item at @position. // // If @position is greater than the number of items in @list, %NULL is // returned. // // %NULL is never returned for an index that is smaller than the length // of the list. // // This function is meant to be used by language bindings in place // of g_list_model_get_item(). // // See also: g_list_model_get_n_items() func (x *NoSelection) GetObject(PositionVar uint) *gobject.Object { var cls *gobject.Object cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar) if cret == 0 { return nil } cls = &gobject.Object{} cls.Ptr = cret return cls } // Emits the #GListModel::items-changed signal on @list. // // This function should only be called by classes implementing // #GListModel. It has to be called after the internal representation // of @list has been updated, because handlers connected to this signal // might query the new state of the list. // // Implementations must only make changes to the model (as visible to // its consumer) in places that will not cause problems for that // consumer. For models that are driven directly by a write API (such // as #GListStore), changes can be reported in response to uses of that // API. For models that represent remote data, changes should only be // made from a fresh mainloop dispatch. It is particularly not // permitted to make changes in response to a call to the #GListModel // consumer API. // // Stated another way: in general, it is assumed that code making a // series of accesses to the model via the API, without returning to the // mainloop, and without calling other code, will continue to view the // same contents of the model. func (x *NoSelection) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) { gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar) } // Query the section that covers the given position. The number of // items in the section can be computed by `out_end - out_start`. // // If the position is larger than the number of items, a single // range from n_items to G_MAXUINT will be returned. func (x *NoSelection) GetSection(PositionVar uint, OutStartVar *uint, OutEndVar *uint) { XGtkSectionModelGetSection(x.GoPointer(), PositionVar, OutStartVar, OutEndVar) } // This function emits the [signal@Gtk.SectionModel::sections-changed] // signal to notify about changes to sections. // // It must cover all positions that used to be a section start or that // are now a section start. It does not have to cover all positions for // which the section has changed. // // The [signal@Gio.ListModel::items-changed] implies the effect of the // [signal@Gtk.SectionModel::sections-changed] signal for all the items // it covers. // // It is recommended that when changes to the items cause section changes // in a larger range, that the larger range is included in the emission // of the [signal@Gio.ListModel::items-changed] instead of emitting // two signals. func (x *NoSelection) SectionsChanged(PositionVar uint, NItemsVar uint) { XGtkSectionModelSectionsChanged(x.GoPointer(), PositionVar, NItemsVar) } // Gets the set containing all currently selected items in the model. // // This function may be slow, so if you are only interested in single item, // consider using [method@Gtk.SelectionModel.is_selected] or if you are only // interested in a few, consider [method@Gtk.SelectionModel.get_selection_in_range]. func (x *NoSelection) GetSelection() *Bitset { cret := XGtkSelectionModelGetSelection(x.GoPointer()) return cret } // Gets the set of selected items in a range. // // This function is an optimization for // [method@Gtk.SelectionModel.get_selection] when you are only // interested in part of the model's selected state. A common use // case is in response to the [signal@Gtk.SelectionModel::selection-changed] // signal. func (x *NoSelection) GetSelectionInRange(PositionVar uint, NItemsVar uint) *Bitset { cret := XGtkSelectionModelGetSelectionInRange(x.GoPointer(), PositionVar, NItemsVar) return cret } // Checks if the given item is selected. func (x *NoSelection) IsSelected(PositionVar uint) bool { cret := XGtkSelectionModelIsSelected(x.GoPointer(), PositionVar) return cret } // Requests to select all items in the model. func (x *NoSelection) SelectAll() bool { cret := XGtkSelectionModelSelectAll(x.GoPointer()) return cret } // Requests to select an item in the model. func (x *NoSelection) SelectItem(PositionVar uint, UnselectRestVar bool) bool { cret := XGtkSelectionModelSelectItem(x.GoPointer(), PositionVar, UnselectRestVar) return cret } // Requests to select a range of items in the model. func (x *NoSelection) SelectRange(PositionVar uint, NItemsVar uint, UnselectRestVar bool) bool { cret := XGtkSelectionModelSelectRange(x.GoPointer(), PositionVar, NItemsVar, UnselectRestVar) return cret } // Helper function for implementations of `GtkSelectionModel`. // // Call this when the selection changes to emit the // [signal@Gtk.SelectionModel::selection-changed] signal. func (x *NoSelection) SelectionChanged(PositionVar uint, NItemsVar uint) { XGtkSelectionModelSelectionChanged(x.GoPointer(), PositionVar, NItemsVar) } // Make selection changes. // // This is the most advanced selection updating method that allows // the most fine-grained control over selection changes. If you can, // you should try the simpler versions, as implementations are more // likely to implement support for those. // // Requests that the selection state of all positions set in @mask // be updated to the respective value in the @selected bitmask. // // In pseudocode, it would look something like this: // // ```c // for (i = 0; i < n_items; i++) // // { // // don't change values not in the mask // if (!gtk_bitset_contains (mask, i)) // continue; // // if (gtk_bitset_contains (selected, i)) // select_item (i); // else // unselect_item (i); // } // // gtk_selection_model_selection_changed (model, // // first_changed_item, // n_changed_items); // // ``` // // @mask and @selected must not be modified. They may refer to the // same bitset, which would mean that every item in the set should // be selected. func (x *NoSelection) SetSelection(SelectedVar *Bitset, MaskVar *Bitset) bool { cret := XGtkSelectionModelSetSelection(x.GoPointer(), SelectedVar, MaskVar) return cret } // Requests to unselect all items in the model. func (x *NoSelection) UnselectAll() bool { cret := XGtkSelectionModelUnselectAll(x.GoPointer()) return cret } // Requests to unselect an item in the model. func (x *NoSelection) UnselectItem(PositionVar uint) bool { cret := XGtkSelectionModelUnselectItem(x.GoPointer(), PositionVar) return cret } // Requests to unselect a range of items in the model. func (x *NoSelection) UnselectRange(PositionVar uint, NItemsVar uint) bool { cret := XGtkSelectionModelUnselectRange(x.GoPointer(), PositionVar, NItemsVar) return cret } 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(&xNoSelectionGLibType, libs, "gtk_no_selection_get_type") core.PuregoSafeRegister(&xNewNoSelection, libs, "gtk_no_selection_new") core.PuregoSafeRegister(&xNoSelectionGetModel, libs, "gtk_no_selection_get_model") core.PuregoSafeRegister(&xNoSelectionSetModel, libs, "gtk_no_selection_set_model") }