1// Package adw was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package adw
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gio"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14 "github.com/bnema/puregotk/v4/gtk"
15)
16
17type ShortcutsSectionClass struct {
18 _ structs.HostLayout
19
20 ParentClass gobject.ObjectClass
21}
22
23func (x *ShortcutsSectionClass) GoPointer() uintptr {
24 return uintptr(unsafe.Pointer(x))
25}
26
27// An object representing a section in [class@ShortcutsDialog].
28//
29// It contains [class@ShortcutsItem] objects, use [method@ShortcutsSection.add] to
30// add them.
31//
32// `AdwShortcutsSection` implements the [iface@Gio.ListModel] interface and
33// allows to access the added shortcut items through it.
34//
35// ## `AdwShortcutsSection` as `GtkBuildable`
36//
37// `AdwShortcutsSection` allows adding `AdwShortcutsItem` objects as children.
38type ShortcutsSection struct {
39 gobject.Object
40}
41
42var xShortcutsSectionGLibType func() types.GType
43
44func ShortcutsSectionGLibType() types.GType {
45 return xShortcutsSectionGLibType()
46}
47
48func ShortcutsSectionNewFromInternalPtr(ptr uintptr) *ShortcutsSection {
49 cls := &ShortcutsSection{}
50 cls.Ptr = ptr
51 return cls
52}
53
54var xNewShortcutsSection func(uintptr) uintptr
55
56// Creates a new `AdwShortcutsSection` with @title as its title if provided.
57func NewShortcutsSection(TitleVar *string) *ShortcutsSection {
58 var cls *ShortcutsSection
59
60 TitleVarPtr := core.GStrdupNullable(TitleVar)
61 defer core.GFreeNullable(TitleVarPtr)
62
63 cret := xNewShortcutsSection(TitleVarPtr)
64
65 if cret == 0 {
66 return nil
67 }
68 cls = &ShortcutsSection{}
69 cls.Ptr = cret
70 return cls
71}
72
73var xShortcutsSectionAdd func(uintptr, uintptr)
74
75// Adds @item to @self.
76func (x *ShortcutsSection) Add(ItemVar *ShortcutsItem) {
77
78 xShortcutsSectionAdd(x.GoPointer(), ItemVar.GoPointer())
79
80}
81
82var xShortcutsSectionGetTitle func(uintptr) string
83
84// Gets the title of @self.
85func (x *ShortcutsSection) GetTitle() string {
86
87 cret := xShortcutsSectionGetTitle(x.GoPointer())
88 return cret
89}
90
91var xShortcutsSectionSetTitle func(uintptr, uintptr)
92
93// Sets the title of @self.
94func (x *ShortcutsSection) SetTitle(TitleVar *string) {
95
96 TitleVarPtr := core.GStrdupNullable(TitleVar)
97 defer core.GFreeNullable(TitleVarPtr)
98
99 xShortcutsSectionSetTitle(x.GoPointer(), TitleVarPtr)
100
101}
102
103func (c *ShortcutsSection) GoPointer() uintptr {
104 if c == nil {
105 return 0
106 }
107 return c.Ptr
108}
109
110func (c *ShortcutsSection) SetGoPointer(ptr uintptr) {
111 c.Ptr = ptr
112}
113
114// SetPropertyTitle sets the "title" property.
115// The title of the section, can be `NULL`.
116func (x *ShortcutsSection) SetPropertyTitle(value string) {
117 var v gobject.Value
118 v.Init(gobject.TypeStringVal)
119 v.SetString(&value)
120 x.SetProperty("title", &v)
121}
122
123// GetPropertyTitle gets the "title" property.
124// The title of the section, can be `NULL`.
125func (x *ShortcutsSection) GetPropertyTitle() string {
126 var v gobject.Value
127 x.GetProperty("title", &v)
128 return v.GetString()
129}
130
131// Get the item at @position.
132//
133// If @position is greater than the number of items in @list, %NULL is
134// returned.
135//
136// %NULL is never returned for an index that is smaller than the length
137// of the list.
138//
139// See also: g_list_model_get_n_items()
140func (x *ShortcutsSection) GetItem(PositionVar uint) uintptr {
141
142 cret := gio.XGListModelGetItem(x.GoPointer(), PositionVar)
143 return cret
144}
145
146// Gets the type of the items in @list.
147//
148// All items returned from g_list_model_get_item() are of the type
149// returned by this function, or a subtype, or if the type is an
150// interface, they are an implementation of that interface.
151//
152// The item type of a #GListModel can not change during the life of the
153// model.
154func (x *ShortcutsSection) GetItemType() types.GType {
155
156 cret := gio.XGListModelGetItemType(x.GoPointer())
157 return cret
158}
159
160// Gets the number of items in @list.
161//
162// Depending on the model implementation, calling this function may be
163// less efficient than iterating the list with increasing values for
164// @position until g_list_model_get_item() returns %NULL.
165func (x *ShortcutsSection) GetNItems() uint {
166
167 cret := gio.XGListModelGetNItems(x.GoPointer())
168 return cret
169}
170
171// Get the item at @position.
172//
173// If @position is greater than the number of items in @list, %NULL is
174// returned.
175//
176// %NULL is never returned for an index that is smaller than the length
177// of the list.
178//
179// This function is meant to be used by language bindings in place
180// of g_list_model_get_item().
181//
182// See also: g_list_model_get_n_items()
183func (x *ShortcutsSection) GetObject(PositionVar uint) *gobject.Object {
184 var cls *gobject.Object
185
186 cret := gio.XGListModelGetObject(x.GoPointer(), PositionVar)
187
188 if cret == 0 {
189 return nil
190 }
191 cls = &gobject.Object{}
192 cls.Ptr = cret
193 return cls
194}
195
196// Emits the #GListModel::items-changed signal on @list.
197//
198// This function should only be called by classes implementing
199// #GListModel. It has to be called after the internal representation
200// of @list has been updated, because handlers connected to this signal
201// might query the new state of the list.
202//
203// Implementations must only make changes to the model (as visible to
204// its consumer) in places that will not cause problems for that
205// consumer. For models that are driven directly by a write API (such
206// as #GListStore), changes can be reported in response to uses of that
207// API. For models that represent remote data, changes should only be
208// made from a fresh mainloop dispatch. It is particularly not
209// permitted to make changes in response to a call to the #GListModel
210// consumer API.
211//
212// Stated another way: in general, it is assumed that code making a
213// series of accesses to the model via the API, without returning to the
214// mainloop, and without calling other code, will continue to view the
215// same contents of the model.
216func (x *ShortcutsSection) ItemsChanged(PositionVar uint, RemovedVar uint, AddedVar uint) {
217
218 gio.XGListModelItemsChanged(x.GoPointer(), PositionVar, RemovedVar, AddedVar)
219
220}
221
222// Gets the ID of the @buildable object.
223//
224// `GtkBuilder` sets the name based on the ID attribute
225// of the `<object>` tag used to construct the @buildable.
226func (x *ShortcutsSection) GetBuildableId() string {
227
228 cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
229 return cret
230}
231
232func init() {
233 core.SetPackageName("ADW", "libadwaita-1")
234 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
235 var libs []uintptr
236 for _, libPath := range core.GetPaths("ADW") {
237 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
238 if err != nil {
239 panic(err)
240 }
241 libs = append(libs, lib)
242 }
243
244 core.PuregoSafeRegister(&xShortcutsSectionGLibType, libs, "adw_shortcuts_section_get_type")
245
246 core.PuregoSafeRegister(&xNewShortcutsSection, libs, "adw_shortcuts_section_new")
247
248 core.PuregoSafeRegister(&xShortcutsSectionAdd, libs, "adw_shortcuts_section_add")
249 core.PuregoSafeRegister(&xShortcutsSectionGetTitle, libs, "adw_shortcuts_section_get_title")
250 core.PuregoSafeRegister(&xShortcutsSectionSetTitle, libs, "adw_shortcuts_section_set_title")
251
252}