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/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/glib"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type ShortcutsSectionClass struct {
17 _ structs.HostLayout
18}
19
20func (x *ShortcutsSectionClass) GoPointer() uintptr {
21 return uintptr(unsafe.Pointer(x))
22}
23
24// A `GtkShortcutsSection` collects all the keyboard shortcuts and gestures
25// for a major application mode.
26//
27// If your application needs multiple sections, you should give each
28// section a unique [property@Gtk.ShortcutsSection:section-name] and
29// a [property@Gtk.ShortcutsSection:title] that can be shown in the
30// section selector of the [class@Gtk.ShortcutsWindow].
31//
32// The [property@Gtk.ShortcutsSection:max-height] property can be used
33// to influence how the groups in the section are distributed over pages
34// and columns.
35//
36// This widget is only meant to be used with [class@Gtk.ShortcutsWindow].
37//
38// The recommended way to construct a `GtkShortcutsSection` is with
39// [class@Gtk.Builder], by using the `<child>` tag to populate a
40// `GtkShortcutsSection` with one or more [class@Gtk.ShortcutsGroup]
41// instances, which in turn contain one or more [class@Gtk.ShortcutsShortcut]
42// objects.
43//
44// If you need to add a group programmatically, use
45// [method@Gtk.ShortcutsSection.add_group].
46//
47// # Shortcuts and Gestures
48//
49// Pan gestures allow to navigate between sections.
50//
51// The following signals have default keybindings:
52//
53// - [signal@Gtk.ShortcutsSection::change-current-page]
54type ShortcutsSection struct {
55 Box
56}
57
58var xShortcutsSectionGLibType func() types.GType
59
60func ShortcutsSectionGLibType() types.GType {
61 return xShortcutsSectionGLibType()
62}
63
64func ShortcutsSectionNewFromInternalPtr(ptr uintptr) *ShortcutsSection {
65 cls := &ShortcutsSection{}
66 cls.Ptr = ptr
67 return cls
68}
69
70var xShortcutsSectionAddGroup func(uintptr, uintptr)
71
72// Adds a group to the shortcuts section.
73//
74// This is the programmatic equivalent to using [class@Gtk.Builder] and a
75// `<child>` tag to add the child.
76//
77// Adding children with the `GtkBox` API is not appropriate, as
78// `GtkShortcutsSection` manages its children internally.
79func (x *ShortcutsSection) AddGroup(GroupVar *ShortcutsGroup) {
80
81 xShortcutsSectionAddGroup(x.GoPointer(), GroupVar.GoPointer())
82
83}
84
85func (c *ShortcutsSection) GoPointer() uintptr {
86 if c == nil {
87 return 0
88 }
89 return c.Ptr
90}
91
92func (c *ShortcutsSection) SetGoPointer(ptr uintptr) {
93 c.Ptr = ptr
94}
95
96// SetPropertyMaxHeight sets the "max-height" property.
97// The maximum number of lines to allow per column.
98//
99// This property can be used to influence how the groups in this
100// section are distributed across pages and columns. The default
101// value of 15 should work in most cases.
102func (x *ShortcutsSection) SetPropertyMaxHeight(value uint) {
103 var v gobject.Value
104 v.Init(gobject.TypeUintVal)
105 v.SetUint(value)
106 x.SetProperty("max-height", &v)
107}
108
109// GetPropertyMaxHeight gets the "max-height" property.
110// The maximum number of lines to allow per column.
111//
112// This property can be used to influence how the groups in this
113// section are distributed across pages and columns. The default
114// value of 15 should work in most cases.
115func (x *ShortcutsSection) GetPropertyMaxHeight() uint {
116 var v gobject.Value
117 x.GetProperty("max-height", &v)
118 return v.GetUint()
119}
120
121// SetPropertySectionName sets the "section-name" property.
122// A unique name to identify this section among the sections
123// added to the `GtkShortcutsWindow`.
124//
125// Setting the [property@Gtk.ShortcutsWindow:section-name] property
126// to this string will make this section shown in the `GtkShortcutsWindow`.
127func (x *ShortcutsSection) SetPropertySectionName(value string) {
128 var v gobject.Value
129 v.Init(gobject.TypeStringVal)
130 v.SetString(&value)
131 x.SetProperty("section-name", &v)
132}
133
134// GetPropertySectionName gets the "section-name" property.
135// A unique name to identify this section among the sections
136// added to the `GtkShortcutsWindow`.
137//
138// Setting the [property@Gtk.ShortcutsWindow:section-name] property
139// to this string will make this section shown in the `GtkShortcutsWindow`.
140func (x *ShortcutsSection) GetPropertySectionName() string {
141 var v gobject.Value
142 x.GetProperty("section-name", &v)
143 return v.GetString()
144}
145
146// SetPropertyTitle sets the "title" property.
147// The string to show in the section selector of the `GtkShortcutsWindow`
148// for this section.
149//
150// If there is only one section, you don't need to set a title,
151// since the section selector will not be shown in this case.
152func (x *ShortcutsSection) SetPropertyTitle(value string) {
153 var v gobject.Value
154 v.Init(gobject.TypeStringVal)
155 v.SetString(&value)
156 x.SetProperty("title", &v)
157}
158
159// GetPropertyTitle gets the "title" property.
160// The string to show in the section selector of the `GtkShortcutsWindow`
161// for this section.
162//
163// If there is only one section, you don't need to set a title,
164// since the section selector will not be shown in this case.
165func (x *ShortcutsSection) GetPropertyTitle() string {
166 var v gobject.Value
167 x.GetProperty("title", &v)
168 return v.GetString()
169}
170
171// SetPropertyViewName sets the "view-name" property.
172// A view name to filter the groups in this section by.
173//
174// See [property@Gtk.ShortcutsGroup:view].
175//
176// Applications are expected to use the
177// [property@Gtk.ShortcutsWindow:view-name] property
178// for this purpose.
179func (x *ShortcutsSection) SetPropertyViewName(value string) {
180 var v gobject.Value
181 v.Init(gobject.TypeStringVal)
182 v.SetString(&value)
183 x.SetProperty("view-name", &v)
184}
185
186// GetPropertyViewName gets the "view-name" property.
187// A view name to filter the groups in this section by.
188//
189// See [property@Gtk.ShortcutsGroup:view].
190//
191// Applications are expected to use the
192// [property@Gtk.ShortcutsWindow:view-name] property
193// for this purpose.
194func (x *ShortcutsSection) GetPropertyViewName() string {
195 var v gobject.Value
196 x.GetProperty("view-name", &v)
197 return v.GetString()
198}
199
200// Emitted when we change the current page.
201//
202// The default bindings for this signal are
203// <kbd>Ctrl</kbd>+<kbd>PgUp</kbd>, <kbd>PgUp</kbd>,
204// <kbd>Ctrl</kbd>+<kbd>PgDn</kbd>, <kbd>PgDn</kbd>.
205func (x *ShortcutsSection) ConnectChangeCurrentPage(cb *func(ShortcutsSection, int) bool) uint {
206 cbPtr := uintptr(unsafe.Pointer(cb))
207 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
208 handlerID := gobject.SignalConnect(x.GoPointer(), "change-current-page", cbRefPtr)
209 glib.SaveHandlerMapping(handlerID, cbPtr)
210 return handlerID
211 }
212
213 fcb := func(clsPtr uintptr, OffsetVarp int) bool {
214 fa := ShortcutsSection{}
215 fa.Ptr = clsPtr
216 cbFn := *cb
217
218 return cbFn(fa, OffsetVarp)
219
220 }
221 cbRefPtr := purego.NewCallback(fcb)
222 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
223 handlerID := gobject.SignalConnect(x.GoPointer(), "change-current-page", cbRefPtr)
224 glib.SaveHandlerMapping(handlerID, cbPtr)
225 return handlerID
226}
227
228// Requests the user's screen reader to announce the given message.
229//
230// This kind of notification is useful for messages that
231// either have only a visual representation or that are not
232// exposed visually at all, e.g. a notification about a
233// successful operation.
234//
235// Also, by using this API, you can ensure that the message
236// does not interrupts the user's current screen reader output.
237func (x *ShortcutsSection) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
238
239 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
240
241}
242
243// Retrieves the accessible parent for an accessible object.
244//
245// This function returns `NULL` for top level widgets.
246func (x *ShortcutsSection) GetAccessibleParent() *AccessibleBase {
247 var cls *AccessibleBase
248
249 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
250
251 if cret == 0 {
252 return nil
253 }
254 cls = &AccessibleBase{}
255 cls.Ptr = cret
256 return cls
257}
258
259// Retrieves the accessible role of an accessible object.
260func (x *ShortcutsSection) GetAccessibleRole() AccessibleRole {
261
262 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
263 return cret
264}
265
266// Retrieves the implementation for the given accessible object.
267func (x *ShortcutsSection) GetAtContext() *ATContext {
268 var cls *ATContext
269
270 cret := XGtkAccessibleGetAtContext(x.GoPointer())
271
272 if cret == 0 {
273 return nil
274 }
275 cls = &ATContext{}
276 cls.Ptr = cret
277 return cls
278}
279
280// Queries the coordinates and dimensions of this accessible
281//
282// This functionality can be overridden by `GtkAccessible`
283// implementations, e.g. to get the bounds from an ignored
284// child widget.
285func (x *ShortcutsSection) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
286
287 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
288 return cret
289}
290
291// Retrieves the first accessible child of an accessible object.
292func (x *ShortcutsSection) GetFirstAccessibleChild() *AccessibleBase {
293 var cls *AccessibleBase
294
295 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
296
297 if cret == 0 {
298 return nil
299 }
300 cls = &AccessibleBase{}
301 cls.Ptr = cret
302 return cls
303}
304
305// Retrieves the next accessible sibling of an accessible object
306func (x *ShortcutsSection) GetNextAccessibleSibling() *AccessibleBase {
307 var cls *AccessibleBase
308
309 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
310
311 if cret == 0 {
312 return nil
313 }
314 cls = &AccessibleBase{}
315 cls.Ptr = cret
316 return cls
317}
318
319// Queries a platform state, such as focus.
320//
321// This functionality can be overridden by `GtkAccessible`
322// implementations, e.g. to get platform state from an ignored
323// child widget, as is the case for `GtkText` wrappers.
324func (x *ShortcutsSection) GetPlatformState(StateVar AccessiblePlatformState) bool {
325
326 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
327 return cret
328}
329
330// Resets the accessible property to its default value.
331func (x *ShortcutsSection) ResetProperty(PropertyVar AccessibleProperty) {
332
333 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
334
335}
336
337// Resets the accessible relation to its default value.
338func (x *ShortcutsSection) ResetRelation(RelationVar AccessibleRelation) {
339
340 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
341
342}
343
344// Resets the accessible state to its default value.
345func (x *ShortcutsSection) ResetState(StateVar AccessibleState) {
346
347 XGtkAccessibleResetState(x.GoPointer(), StateVar)
348
349}
350
351// Sets the parent and sibling of an accessible object.
352//
353// This function is meant to be used by accessible implementations that are
354// not part of the widget hierarchy, and but act as a logical bridge between
355// widgets. For instance, if a widget creates an object that holds metadata
356// for each child, and you want that object to implement the `GtkAccessible`
357// interface, you will use this function to ensure that the parent of each
358// child widget is the metadata object, and the parent of each metadata
359// object is the container widget.
360func (x *ShortcutsSection) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
361
362 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
363
364}
365
366// Updates the next accessible sibling.
367//
368// That might be useful when a new child of a custom accessible
369// is created, and it needs to be linked to a previous child.
370func (x *ShortcutsSection) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
371
372 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
373
374}
375
376// Informs ATs that the platform state has changed.
377//
378// This function should be used by `GtkAccessible` implementations that
379// have a platform state but are not widgets. Widgets handle platform
380// states automatically.
381func (x *ShortcutsSection) UpdatePlatformState(StateVar AccessiblePlatformState) {
382
383 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
384
385}
386
387// Updates a list of accessible properties.
388//
389// See the [enum@Gtk.AccessibleProperty] documentation for the
390// value types of accessible properties.
391//
392// This function should be called by `GtkWidget` types whenever
393// an accessible property change must be communicated to assistive
394// technologies.
395//
396// Example:
397// ```c
398// value = gtk_adjustment_get_value (adjustment);
399// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
400//
401// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
402// -1);
403//
404// ```
405func (x *ShortcutsSection) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
406
407 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
408
409}
410
411// Updates an array of accessible properties.
412//
413// This function should be called by `GtkWidget` types whenever an accessible
414// property change must be communicated to assistive technologies.
415//
416// This function is meant to be used by language bindings.
417func (x *ShortcutsSection) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
418
419 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
420
421}
422
423// Updates a list of accessible relations.
424//
425// This function should be called by `GtkWidget` types whenever an accessible
426// relation change must be communicated to assistive technologies.
427//
428// If the [enum@Gtk.AccessibleRelation] requires a list of references,
429// you should pass each reference individually, followed by `NULL`, e.g.
430//
431// ```c
432// gtk_accessible_update_relation (accessible,
433//
434// GTK_ACCESSIBLE_RELATION_CONTROLS,
435// ref1, NULL,
436// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
437// ref1, ref2, ref3, NULL,
438// -1);
439//
440// ```
441func (x *ShortcutsSection) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
442
443 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
444
445}
446
447// Updates an array of accessible relations.
448//
449// This function should be called by `GtkWidget` types whenever an accessible
450// relation change must be communicated to assistive technologies.
451//
452// This function is meant to be used by language bindings.
453func (x *ShortcutsSection) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
454
455 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
456
457}
458
459// Updates a list of accessible states.
460//
461// See the [enum@Gtk.AccessibleState] documentation for the
462// value types of accessible states.
463//
464// This function should be called by `GtkWidget` types whenever
465// an accessible state change must be communicated to assistive
466// technologies.
467//
468// Example:
469//
470// ```c
471// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
472// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
473//
474// GTK_ACCESSIBLE_STATE_CHECKED, value,
475// -1);
476//
477// ```
478func (x *ShortcutsSection) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
479
480 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
481
482}
483
484// Updates an array of accessible states.
485//
486// This function should be called by `GtkWidget` types whenever an accessible
487// state change must be communicated to assistive technologies.
488//
489// This function is meant to be used by language bindings.
490func (x *ShortcutsSection) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
491
492 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
493
494}
495
496// Gets the ID of the @buildable object.
497//
498// `GtkBuilder` sets the name based on the ID attribute
499// of the `<object>` tag used to construct the @buildable.
500func (x *ShortcutsSection) GetBuildableId() string {
501
502 cret := XGtkBuildableGetBuildableId(x.GoPointer())
503 return cret
504}
505
506// Retrieves the orientation of the @orientable.
507func (x *ShortcutsSection) GetOrientation() Orientation {
508
509 cret := XGtkOrientableGetOrientation(x.GoPointer())
510 return cret
511}
512
513// Sets the orientation of the @orientable.
514func (x *ShortcutsSection) SetOrientation(OrientationVar Orientation) {
515
516 XGtkOrientableSetOrientation(x.GoPointer(), OrientationVar)
517
518}
519
520func init() {
521 core.SetPackageName("GTK", "gtk4")
522 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
523 var libs []uintptr
524 for _, libPath := range core.GetPaths("GTK") {
525 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
526 if err != nil {
527 panic(err)
528 }
529 libs = append(libs, lib)
530 }
531
532 core.PuregoSafeRegister(&xShortcutsSectionGLibType, libs, "gtk_shortcuts_section_get_type")
533
534 core.PuregoSafeRegister(&xShortcutsSectionAddGroup, libs, "gtk_shortcuts_section_add_group")
535
536}