1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/gio"
9 "github.com/bnema/puregotk/v4/gobject"
10 "github.com/bnema/puregotk/v4/gobject/types"
11)
12
13// Presents a horizontal bar of items that pop up menus when clicked.
14//
15// <picture>
16//
17// <source srcset="menubar-dark.png" media="(prefers-color-scheme: dark)">
18// <img alt="An example GtkPopoverMenuBar" src="menubar.png">
19//
20// </picture>
21//
22// The only way to create instances of `GtkPopoverMenuBar` is
23// from a `GMenuModel`.
24//
25// # CSS nodes
26//
27// ```
28// menubar
29// ├── item[.active]
30// ┊ ╰── popover
31// ╰── item
32//
33// ╰── popover
34//
35// ```
36//
37// `GtkPopoverMenuBar` has a single CSS node with name menubar, below which
38// each item has its CSS node, and below that the corresponding popover.
39//
40// The item whose popover is currently open gets the .active
41// style class.
42//
43// # Accessibility
44//
45// `GtkPopoverMenuBar` uses the [enum@Gtk.AccessibleRole.menu_bar] role,
46// the menu items use the [enum@Gtk.AccessibleRole.menu_item] role and
47// the menus use the [enum@Gtk.AccessibleRole.menu] role.
48type PopoverMenuBar struct {
49 Widget
50}
51
52var xPopoverMenuBarGLibType func() types.GType
53
54func PopoverMenuBarGLibType() types.GType {
55 return xPopoverMenuBarGLibType()
56}
57
58func PopoverMenuBarNewFromInternalPtr(ptr uintptr) *PopoverMenuBar {
59 cls := &PopoverMenuBar{}
60 cls.Ptr = ptr
61 return cls
62}
63
64var xNewPopoverMenuBarFromModel func(uintptr) uintptr
65
66// Creates a `GtkPopoverMenuBar` from a `GMenuModel`.
67func NewPopoverMenuBarFromModel(ModelVar *gio.MenuModel) *PopoverMenuBar {
68 var cls *PopoverMenuBar
69
70 cret := xNewPopoverMenuBarFromModel(ModelVar.GoPointer())
71
72 if cret == 0 {
73 return nil
74 }
75 gobject.IncreaseRef(cret)
76 cls = &PopoverMenuBar{}
77 cls.Ptr = cret
78 return cls
79}
80
81var xPopoverMenuBarAddChild func(uintptr, uintptr, string) bool
82
83// Adds a custom widget to a generated menubar.
84//
85// For this to work, the menu model of @bar must have an
86// item with a `custom` attribute that matches @id.
87func (x *PopoverMenuBar) AddChild(ChildVar *Widget, IdVar string) bool {
88
89 cret := xPopoverMenuBarAddChild(x.GoPointer(), ChildVar.GoPointer(), IdVar)
90 return cret
91}
92
93var xPopoverMenuBarGetMenuModel func(uintptr) uintptr
94
95// Returns the model from which the contents of @bar are taken.
96func (x *PopoverMenuBar) GetMenuModel() *gio.MenuModel {
97 var cls *gio.MenuModel
98
99 cret := xPopoverMenuBarGetMenuModel(x.GoPointer())
100
101 if cret == 0 {
102 return nil
103 }
104 gobject.IncreaseRef(cret)
105 cls = &gio.MenuModel{}
106 cls.Ptr = cret
107 return cls
108}
109
110var xPopoverMenuBarRemoveChild func(uintptr, uintptr) bool
111
112// Removes a widget that has previously been added with
113// gtk_popover_menu_bar_add_child().
114func (x *PopoverMenuBar) RemoveChild(ChildVar *Widget) bool {
115
116 cret := xPopoverMenuBarRemoveChild(x.GoPointer(), ChildVar.GoPointer())
117 return cret
118}
119
120var xPopoverMenuBarSetMenuModel func(uintptr, uintptr)
121
122// Sets a menu model from which @bar should take
123// its contents.
124func (x *PopoverMenuBar) SetMenuModel(ModelVar *gio.MenuModel) {
125
126 xPopoverMenuBarSetMenuModel(x.GoPointer(), ModelVar.GoPointer())
127
128}
129
130func (c *PopoverMenuBar) GoPointer() uintptr {
131 if c == nil {
132 return 0
133 }
134 return c.Ptr
135}
136
137func (c *PopoverMenuBar) SetGoPointer(ptr uintptr) {
138 c.Ptr = ptr
139}
140
141// Requests the user's screen reader to announce the given message.
142//
143// This kind of notification is useful for messages that
144// either have only a visual representation or that are not
145// exposed visually at all, e.g. a notification about a
146// successful operation.
147//
148// Also, by using this API, you can ensure that the message
149// does not interrupts the user's current screen reader output.
150func (x *PopoverMenuBar) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
151
152 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
153
154}
155
156// Retrieves the accessible parent for an accessible object.
157//
158// This function returns `NULL` for top level widgets.
159func (x *PopoverMenuBar) GetAccessibleParent() *AccessibleBase {
160 var cls *AccessibleBase
161
162 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
163
164 if cret == 0 {
165 return nil
166 }
167 cls = &AccessibleBase{}
168 cls.Ptr = cret
169 return cls
170}
171
172// Retrieves the accessible role of an accessible object.
173func (x *PopoverMenuBar) GetAccessibleRole() AccessibleRole {
174
175 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
176 return cret
177}
178
179// Retrieves the implementation for the given accessible object.
180func (x *PopoverMenuBar) GetAtContext() *ATContext {
181 var cls *ATContext
182
183 cret := XGtkAccessibleGetAtContext(x.GoPointer())
184
185 if cret == 0 {
186 return nil
187 }
188 cls = &ATContext{}
189 cls.Ptr = cret
190 return cls
191}
192
193// Queries the coordinates and dimensions of this accessible
194//
195// This functionality can be overridden by `GtkAccessible`
196// implementations, e.g. to get the bounds from an ignored
197// child widget.
198func (x *PopoverMenuBar) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
199
200 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
201 return cret
202}
203
204// Retrieves the first accessible child of an accessible object.
205func (x *PopoverMenuBar) GetFirstAccessibleChild() *AccessibleBase {
206 var cls *AccessibleBase
207
208 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
209
210 if cret == 0 {
211 return nil
212 }
213 cls = &AccessibleBase{}
214 cls.Ptr = cret
215 return cls
216}
217
218// Retrieves the next accessible sibling of an accessible object
219func (x *PopoverMenuBar) GetNextAccessibleSibling() *AccessibleBase {
220 var cls *AccessibleBase
221
222 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
223
224 if cret == 0 {
225 return nil
226 }
227 cls = &AccessibleBase{}
228 cls.Ptr = cret
229 return cls
230}
231
232// Queries a platform state, such as focus.
233//
234// This functionality can be overridden by `GtkAccessible`
235// implementations, e.g. to get platform state from an ignored
236// child widget, as is the case for `GtkText` wrappers.
237func (x *PopoverMenuBar) GetPlatformState(StateVar AccessiblePlatformState) bool {
238
239 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
240 return cret
241}
242
243// Resets the accessible property to its default value.
244func (x *PopoverMenuBar) ResetProperty(PropertyVar AccessibleProperty) {
245
246 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
247
248}
249
250// Resets the accessible relation to its default value.
251func (x *PopoverMenuBar) ResetRelation(RelationVar AccessibleRelation) {
252
253 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
254
255}
256
257// Resets the accessible state to its default value.
258func (x *PopoverMenuBar) ResetState(StateVar AccessibleState) {
259
260 XGtkAccessibleResetState(x.GoPointer(), StateVar)
261
262}
263
264// Sets the parent and sibling of an accessible object.
265//
266// This function is meant to be used by accessible implementations that are
267// not part of the widget hierarchy, and but act as a logical bridge between
268// widgets. For instance, if a widget creates an object that holds metadata
269// for each child, and you want that object to implement the `GtkAccessible`
270// interface, you will use this function to ensure that the parent of each
271// child widget is the metadata object, and the parent of each metadata
272// object is the container widget.
273func (x *PopoverMenuBar) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
274
275 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
276
277}
278
279// Updates the next accessible sibling.
280//
281// That might be useful when a new child of a custom accessible
282// is created, and it needs to be linked to a previous child.
283func (x *PopoverMenuBar) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
284
285 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
286
287}
288
289// Informs ATs that the platform state has changed.
290//
291// This function should be used by `GtkAccessible` implementations that
292// have a platform state but are not widgets. Widgets handle platform
293// states automatically.
294func (x *PopoverMenuBar) UpdatePlatformState(StateVar AccessiblePlatformState) {
295
296 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
297
298}
299
300// Updates a list of accessible properties.
301//
302// See the [enum@Gtk.AccessibleProperty] documentation for the
303// value types of accessible properties.
304//
305// This function should be called by `GtkWidget` types whenever
306// an accessible property change must be communicated to assistive
307// technologies.
308//
309// Example:
310// ```c
311// value = gtk_adjustment_get_value (adjustment);
312// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
313//
314// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
315// -1);
316//
317// ```
318func (x *PopoverMenuBar) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
319
320 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
321
322}
323
324// Updates an array of accessible properties.
325//
326// This function should be called by `GtkWidget` types whenever an accessible
327// property change must be communicated to assistive technologies.
328//
329// This function is meant to be used by language bindings.
330func (x *PopoverMenuBar) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
331
332 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
333
334}
335
336// Updates a list of accessible relations.
337//
338// This function should be called by `GtkWidget` types whenever an accessible
339// relation change must be communicated to assistive technologies.
340//
341// If the [enum@Gtk.AccessibleRelation] requires a list of references,
342// you should pass each reference individually, followed by `NULL`, e.g.
343//
344// ```c
345// gtk_accessible_update_relation (accessible,
346//
347// GTK_ACCESSIBLE_RELATION_CONTROLS,
348// ref1, NULL,
349// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
350// ref1, ref2, ref3, NULL,
351// -1);
352//
353// ```
354func (x *PopoverMenuBar) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
355
356 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
357
358}
359
360// Updates an array of accessible relations.
361//
362// This function should be called by `GtkWidget` types whenever an accessible
363// relation change must be communicated to assistive technologies.
364//
365// This function is meant to be used by language bindings.
366func (x *PopoverMenuBar) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
367
368 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
369
370}
371
372// Updates a list of accessible states.
373//
374// See the [enum@Gtk.AccessibleState] documentation for the
375// value types of accessible states.
376//
377// This function should be called by `GtkWidget` types whenever
378// an accessible state change must be communicated to assistive
379// technologies.
380//
381// Example:
382//
383// ```c
384// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
385// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
386//
387// GTK_ACCESSIBLE_STATE_CHECKED, value,
388// -1);
389//
390// ```
391func (x *PopoverMenuBar) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
392
393 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
394
395}
396
397// Updates an array of accessible states.
398//
399// This function should be called by `GtkWidget` types whenever an accessible
400// state change must be communicated to assistive technologies.
401//
402// This function is meant to be used by language bindings.
403func (x *PopoverMenuBar) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
404
405 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
406
407}
408
409// Gets the ID of the @buildable object.
410//
411// `GtkBuilder` sets the name based on the ID attribute
412// of the `<object>` tag used to construct the @buildable.
413func (x *PopoverMenuBar) GetBuildableId() string {
414
415 cret := XGtkBuildableGetBuildableId(x.GoPointer())
416 return cret
417}
418
419func init() {
420 core.SetPackageName("GTK", "gtk4")
421 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
422 var libs []uintptr
423 for _, libPath := range core.GetPaths("GTK") {
424 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
425 if err != nil {
426 panic(err)
427 }
428 libs = append(libs, lib)
429 }
430
431 core.PuregoSafeRegister(&xPopoverMenuBarGLibType, libs, "gtk_popover_menu_bar_get_type")
432
433 core.PuregoSafeRegister(&xNewPopoverMenuBarFromModel, libs, "gtk_popover_menu_bar_new_from_model")
434
435 core.PuregoSafeRegister(&xPopoverMenuBarAddChild, libs, "gtk_popover_menu_bar_add_child")
436 core.PuregoSafeRegister(&xPopoverMenuBarGetMenuModel, libs, "gtk_popover_menu_bar_get_menu_model")
437 core.PuregoSafeRegister(&xPopoverMenuBarRemoveChild, libs, "gtk_popover_menu_bar_remove_child")
438 core.PuregoSafeRegister(&xPopoverMenuBarSetMenuModel, libs, "gtk_popover_menu_bar_set_menu_model")
439
440}