gtklistitemfactory.go RawHistoryFolder
1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/bnema/puregotk/v4/gobject"
9 "github.com/bnema/puregotk/v4/gobject/types"
10)
11
12type ListItemFactoryClass struct {
13 _ structs.HostLayout
14}
15
16func (x *ListItemFactoryClass) GoPointer() uintptr {
17 return uintptr(unsafe.Pointer(x))
18}
19
20// Creates widgets for the items taken from a `GListModel`.
21//
22// This is one of the core concepts of handling list widgets such
23// as [class@Gtk.ListView] or [class@Gtk.GridView].
24//
25// The `GtkListItemFactory` is tasked with creating widgets for items
26// taken from the model when the views need them and updating them as
27// the items displayed by the view change.
28//
29// A view is usually only able to display anything after both a factory
30// and a model have been set on the view. So it is important that you do
31// not skip this step when setting up your first view.
32//
33// Because views do not display the whole list at once but only a few
34// items, they only need to maintain a few widgets at a time. They will
35// instruct the `GtkListItemFactory` to create these widgets and bind them
36// to the items that are currently displayed.
37//
38// As the list model changes or the user scrolls to the list, the items will
39// change and the view will instruct the factory to bind the widgets to those
40// new items.
41//
42// The actual widgets used for displaying those widgets is provided by you.
43//
44// When the factory needs widgets created, it will create a `GtkListItem`
45// and hand it to your code to set up a widget for. This list item will provide
46// various properties with information about what item to display and provide
47// you with some opportunities to configure its behavior. See the
48// [class@Gtk.ListItem] documentation for further details.
49//
50// Various implementations of `GtkListItemFactory` exist to allow you different
51// ways to provide those widgets. The most common implementations are
52// [class@Gtk.BuilderListItemFactory] which takes a `GtkBuilder` .ui file
53// and then creates widgets and manages everything automatically from the
54// information in that file and [class@Gtk.SignalListItemFactory] which allows
55// you to connect to signals with your own code and retain full control over
56// how the widgets are setup and managed.
57//
58// A `GtkListItemFactory` is supposed to be final - that means its behavior should
59// not change and the first widget created from it should behave the same way as
60// the last widget created from it.
61// If you intend to do changes to the behavior, it is recommended that you create
62// a new `GtkListItemFactory` which will allow the views to recreate its widgets.
63//
64// Once you have chosen your factory and created it, you need to set it on the view
65// widget you want to use it with, such as via [method@Gtk.ListView.set_factory].
66// Reusing factories across different views is allowed, but very uncommon.
67type ListItemFactory struct {
68 gobject.Object
69}
70
71var xListItemFactoryGLibType func() types.GType
72
73func ListItemFactoryGLibType() types.GType {
74 return xListItemFactoryGLibType()
75}
76
77func ListItemFactoryNewFromInternalPtr(ptr uintptr) *ListItemFactory {
78 cls := &ListItemFactory{}
79 cls.Ptr = ptr
80 return cls
81}
82
83func (c *ListItemFactory) GoPointer() uintptr {
84 if c == nil {
85 return 0
86 }
87 return c.Ptr
88}
89
90func (c *ListItemFactory) SetGoPointer(ptr uintptr) {
91 c.Ptr = ptr
92}