1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "unsafe"
6
7 "github.com/ebitengine/purego"
8
9 "github.com/bnema/puregotk/pkg/core"
10 "github.com/bnema/puregotk/v4/gio"
11 "github.com/bnema/puregotk/v4/glib"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// User-provided callback function to create a popup for a
17// `GtkMenuButton` on demand.
18//
19// This function is called when the popup of @menu_button is shown,
20// but none has been provided via [method@Gtk.MenuButton.set_popover]
21// or [method@Gtk.MenuButton.set_menu_model].
22type MenuButtonCreatePopupFunc func(uintptr, uintptr)
23
24// Displays a popup when clicked.
25//
26// <picture>
27//
28// <source srcset="menu-button-dark.png" media="(prefers-color-scheme: dark)">
29// <img alt="An example GtkMenuButton" src="menu-button.png">
30//
31// </picture>
32//
33// This popup can be provided either as a `GtkPopover` or as an abstract
34// `GMenuModel`.
35//
36// The `GtkMenuButton` widget can show either an icon (set with the
37// [property@Gtk.MenuButton:icon-name] property) or a label (set with the
38// [property@Gtk.MenuButton:label] property). If neither is explicitly set,
39// a [class@Gtk.Image] is automatically created, using an arrow image oriented
40// according to [property@Gtk.MenuButton:direction] or the generic
41// “open-menu-symbolic” icon if the direction is not set.
42//
43// The positioning of the popup is determined by the
44// [property@Gtk.MenuButton:direction] property of the menu button.
45//
46// For menus, the [property@Gtk.Widget:halign] and [property@Gtk.Widget:valign]
47// properties of the menu are also taken into account. For example, when the
48// direction is %GTK_ARROW_DOWN and the horizontal alignment is %GTK_ALIGN_START,
49// the menu will be positioned below the button, with the starting edge
50// (depending on the text direction) of the menu aligned with the starting
51// edge of the button. If there is not enough space below the button, the
52// menu is popped up above the button instead. If the alignment would move
53// part of the menu offscreen, it is “pushed in”.
54//
55// | | start | center | end |
56// | - | --- | --- | --- |
57// | **down** |  |  |  |
58// | **up** |  |  |  |
59// | **left** |  |  |  |
60// | **right** |  |  |  |
61//
62// # CSS nodes
63//
64// ```
65// menubutton
66// ╰── button.toggle
67//
68// ╰── <content>
69// ╰── [arrow]
70//
71// ```
72//
73// `GtkMenuButton` has a single CSS node with name `menubutton`
74// which contains a `button` node with a `.toggle` style class.
75//
76// If the button contains an icon, it will have the `.image-button` style class,
77// if it contains text, it will have `.text-button` style class. If an arrow is
78// visible in addition to an icon, text or a custom child, it will also have
79// `.arrow-button` style class.
80//
81// Inside the toggle button content, there is an `arrow` node for
82// the indicator, which will carry one of the `.none`, `.up`, `.down`,
83// `.left` or `.right` style classes to indicate the direction that
84// the menu will appear in. The CSS is expected to provide a suitable
85// image for each of these cases using the `-gtk-icon-source` property.
86//
87// Optionally, the `menubutton` node can carry the `.circular` style class
88// to request a round appearance.
89//
90// # Accessibility
91//
92// `GtkMenuButton` uses the [enum@Gtk.AccessibleRole.button] role.
93type MenuButton struct {
94 Widget
95}
96
97var xMenuButtonGLibType func() types.GType
98
99func MenuButtonGLibType() types.GType {
100 return xMenuButtonGLibType()
101}
102
103func MenuButtonNewFromInternalPtr(ptr uintptr) *MenuButton {
104 cls := &MenuButton{}
105 cls.Ptr = ptr
106 return cls
107}
108
109var xNewMenuButton func() uintptr
110
111// Creates a new `GtkMenuButton` widget with downwards-pointing
112// arrow as the only child.
113//
114// You can replace the child widget with another `GtkWidget`
115// should you wish to.
116func NewMenuButton() *MenuButton {
117 var cls *MenuButton
118
119 cret := xNewMenuButton()
120
121 if cret == 0 {
122 return nil
123 }
124 gobject.IncreaseRef(cret)
125 cls = &MenuButton{}
126 cls.Ptr = cret
127 return cls
128}
129
130var xMenuButtonGetActive func(uintptr) bool
131
132// Returns whether the menu button is active.
133func (x *MenuButton) GetActive() bool {
134
135 cret := xMenuButtonGetActive(x.GoPointer())
136 return cret
137}
138
139var xMenuButtonGetAlwaysShowArrow func(uintptr) bool
140
141// Gets whether to show a dropdown arrow even when using an icon or a custom
142// child.
143func (x *MenuButton) GetAlwaysShowArrow() bool {
144
145 cret := xMenuButtonGetAlwaysShowArrow(x.GoPointer())
146 return cret
147}
148
149var xMenuButtonGetCanShrink func(uintptr) bool
150
151// Retrieves whether the button can be smaller than the natural
152// size of its contents.
153func (x *MenuButton) GetCanShrink() bool {
154
155 cret := xMenuButtonGetCanShrink(x.GoPointer())
156 return cret
157}
158
159var xMenuButtonGetChild func(uintptr) uintptr
160
161// Gets the child widget of @menu_button.
162func (x *MenuButton) GetChild() *Widget {
163 var cls *Widget
164
165 cret := xMenuButtonGetChild(x.GoPointer())
166
167 if cret == 0 {
168 return nil
169 }
170 gobject.IncreaseRef(cret)
171 cls = &Widget{}
172 cls.Ptr = cret
173 return cls
174}
175
176var xMenuButtonGetDirection func(uintptr) ArrowType
177
178// Returns the direction the popup will be pointing at when popped up.
179func (x *MenuButton) GetDirection() ArrowType {
180
181 cret := xMenuButtonGetDirection(x.GoPointer())
182 return cret
183}
184
185var xMenuButtonGetHasFrame func(uintptr) bool
186
187// Returns whether the button has a frame.
188func (x *MenuButton) GetHasFrame() bool {
189
190 cret := xMenuButtonGetHasFrame(x.GoPointer())
191 return cret
192}
193
194var xMenuButtonGetIconName func(uintptr) string
195
196// Gets the name of the icon shown in the button.
197func (x *MenuButton) GetIconName() string {
198
199 cret := xMenuButtonGetIconName(x.GoPointer())
200 return cret
201}
202
203var xMenuButtonGetLabel func(uintptr) string
204
205// Gets the label shown in the button
206func (x *MenuButton) GetLabel() string {
207
208 cret := xMenuButtonGetLabel(x.GoPointer())
209 return cret
210}
211
212var xMenuButtonGetMenuModel func(uintptr) uintptr
213
214// Returns the `GMenuModel` used to generate the popup.
215func (x *MenuButton) GetMenuModel() *gio.MenuModel {
216 var cls *gio.MenuModel
217
218 cret := xMenuButtonGetMenuModel(x.GoPointer())
219
220 if cret == 0 {
221 return nil
222 }
223 gobject.IncreaseRef(cret)
224 cls = &gio.MenuModel{}
225 cls.Ptr = cret
226 return cls
227}
228
229var xMenuButtonGetPopover func(uintptr) uintptr
230
231// Returns the `GtkPopover` that pops out of the button.
232//
233// If the button is not using a `GtkPopover`, this function
234// returns %NULL.
235func (x *MenuButton) GetPopover() *Popover {
236 var cls *Popover
237
238 cret := xMenuButtonGetPopover(x.GoPointer())
239
240 if cret == 0 {
241 return nil
242 }
243 gobject.IncreaseRef(cret)
244 cls = &Popover{}
245 cls.Ptr = cret
246 return cls
247}
248
249var xMenuButtonGetPrimary func(uintptr) bool
250
251// Returns whether the menu button acts as a primary menu.
252func (x *MenuButton) GetPrimary() bool {
253
254 cret := xMenuButtonGetPrimary(x.GoPointer())
255 return cret
256}
257
258var xMenuButtonGetUseUnderline func(uintptr) bool
259
260// Returns whether an embedded underline in the text indicates a
261// mnemonic.
262func (x *MenuButton) GetUseUnderline() bool {
263
264 cret := xMenuButtonGetUseUnderline(x.GoPointer())
265 return cret
266}
267
268var xMenuButtonPopdown func(uintptr)
269
270// Dismiss the menu.
271func (x *MenuButton) Popdown() {
272
273 xMenuButtonPopdown(x.GoPointer())
274
275}
276
277var xMenuButtonPopup func(uintptr)
278
279// Pop up the menu.
280func (x *MenuButton) Popup() {
281
282 xMenuButtonPopup(x.GoPointer())
283
284}
285
286var xMenuButtonSetActive func(uintptr, bool)
287
288// Sets whether the menu button is active.
289func (x *MenuButton) SetActive(ActiveVar bool) {
290
291 xMenuButtonSetActive(x.GoPointer(), ActiveVar)
292
293}
294
295var xMenuButtonSetAlwaysShowArrow func(uintptr, bool)
296
297// Sets whether to show a dropdown arrow even when using an icon or a custom
298// child.
299func (x *MenuButton) SetAlwaysShowArrow(AlwaysShowArrowVar bool) {
300
301 xMenuButtonSetAlwaysShowArrow(x.GoPointer(), AlwaysShowArrowVar)
302
303}
304
305var xMenuButtonSetCanShrink func(uintptr, bool)
306
307// Sets whether the button size can be smaller than the natural size of
308// its contents.
309//
310// For text buttons, setting @can_shrink to true will ellipsize the label.
311//
312// For icon buttons, this function has no effect.
313func (x *MenuButton) SetCanShrink(CanShrinkVar bool) {
314
315 xMenuButtonSetCanShrink(x.GoPointer(), CanShrinkVar)
316
317}
318
319var xMenuButtonSetChild func(uintptr, uintptr)
320
321// Sets the child widget of @menu_button.
322//
323// Setting a child resets [property@Gtk.MenuButton:label] and
324// [property@Gtk.MenuButton:icon-name].
325//
326// If [property@Gtk.MenuButton:always-show-arrow] is set to `TRUE` and
327// [property@Gtk.MenuButton:direction] is not `GTK_ARROW_NONE`, a dropdown arrow
328// will be shown next to the child.
329func (x *MenuButton) SetChild(ChildVar *Widget) {
330
331 xMenuButtonSetChild(x.GoPointer(), ChildVar.GoPointer())
332
333}
334
335var xMenuButtonSetCreatePopupFunc func(uintptr, uintptr, uintptr, uintptr)
336
337// Sets @func to be called when a popup is about to be shown.
338//
339// @func should use one of
340//
341// - [method@Gtk.MenuButton.set_popover]
342// - [method@Gtk.MenuButton.set_menu_model]
343//
344// to set a popup for @menu_button.
345// If @func is non-%NULL, @menu_button will always be sensitive.
346//
347// Using this function will not reset the menu widget attached to
348// @menu_button. Instead, this can be done manually in @func.
349func (x *MenuButton) SetCreatePopupFunc(FuncVar *MenuButtonCreatePopupFunc, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify) {
350
351 var FuncVarRef uintptr
352 if FuncVar != nil {
353 FuncVarPtr := uintptr(unsafe.Pointer(FuncVar))
354 if cbRefPtr, ok := glib.GetCallback(FuncVarPtr); ok {
355 FuncVarRef = cbRefPtr
356 } else {
357 fcb := func(arg0 uintptr, arg1 uintptr) {
358 cbFn := *FuncVar
359 cbFn(arg0, arg1)
360 }
361 FuncVarRef = purego.NewCallback(fcb)
362 glib.SaveCallbackWithClosure(FuncVarPtr, FuncVarRef, FuncVar)
363 }
364 }
365
366 var DestroyNotifyVarRef uintptr
367 if DestroyNotifyVar != nil {
368 DestroyNotifyVarPtr := uintptr(unsafe.Pointer(DestroyNotifyVar))
369 if cbRefPtr, ok := glib.GetCallback(DestroyNotifyVarPtr); ok {
370 DestroyNotifyVarRef = cbRefPtr
371 } else {
372 fcb := func(arg0 uintptr) {
373 cbFn := *DestroyNotifyVar
374 cbFn(arg0)
375 }
376 DestroyNotifyVarRef = purego.NewCallback(fcb)
377 glib.SaveCallbackWithClosure(DestroyNotifyVarPtr, DestroyNotifyVarRef, DestroyNotifyVar)
378 }
379 }
380
381 xMenuButtonSetCreatePopupFunc(x.GoPointer(), FuncVarRef, UserDataVar, DestroyNotifyVarRef)
382
383}
384
385var xMenuButtonSetDirection func(uintptr, ArrowType)
386
387// Sets the direction in which the popup will be popped up.
388//
389// If the button is automatically populated with an arrow icon,
390// its direction will be changed to match.
391//
392// If the does not fit in the available space in the given direction,
393// GTK will its best to keep it inside the screen and fully visible.
394//
395// If you pass %GTK_ARROW_NONE for a @direction, the popup will behave
396// as if you passed %GTK_ARROW_DOWN (although you won’t see any arrows).
397func (x *MenuButton) SetDirection(DirectionVar ArrowType) {
398
399 xMenuButtonSetDirection(x.GoPointer(), DirectionVar)
400
401}
402
403var xMenuButtonSetHasFrame func(uintptr, bool)
404
405// Sets the style of the button.
406func (x *MenuButton) SetHasFrame(HasFrameVar bool) {
407
408 xMenuButtonSetHasFrame(x.GoPointer(), HasFrameVar)
409
410}
411
412var xMenuButtonSetIconName func(uintptr, string)
413
414// Sets the name of an icon to show inside the menu button.
415//
416// Setting icon name resets [property@Gtk.MenuButton:label] and
417// [property@Gtk.MenuButton:child].
418//
419// If [property@Gtk.MenuButton:always-show-arrow] is set to `TRUE` and
420// [property@Gtk.MenuButton:direction] is not `GTK_ARROW_NONE`, a dropdown arrow
421// will be shown next to the icon.
422func (x *MenuButton) SetIconName(IconNameVar string) {
423
424 xMenuButtonSetIconName(x.GoPointer(), IconNameVar)
425
426}
427
428var xMenuButtonSetLabel func(uintptr, string)
429
430// Sets the label to show inside the menu button.
431//
432// Setting a label resets [property@Gtk.MenuButton:icon-name] and
433// [property@Gtk.MenuButton:child].
434//
435// If [property@Gtk.MenuButton:direction] is not `GTK_ARROW_NONE`, a dropdown
436// arrow will be shown next to the label.
437func (x *MenuButton) SetLabel(LabelVar string) {
438
439 xMenuButtonSetLabel(x.GoPointer(), LabelVar)
440
441}
442
443var xMenuButtonSetMenuModel func(uintptr, uintptr)
444
445// Sets the `GMenuModel` from which the popup will be constructed.
446//
447// If @menu_model is %NULL, the button is disabled.
448//
449// A [class@Gtk.Popover] will be created from the menu model with
450// [ctor@Gtk.PopoverMenu.new_from_model]. Actions will be connected
451// as documented for this function.
452//
453// If [property@Gtk.MenuButton:popover] is already set, it will be
454// dissociated from the @menu_button, and the property is set to %NULL.
455func (x *MenuButton) SetMenuModel(MenuModelVar *gio.MenuModel) {
456
457 xMenuButtonSetMenuModel(x.GoPointer(), MenuModelVar.GoPointer())
458
459}
460
461var xMenuButtonSetPopover func(uintptr, uintptr)
462
463// Sets the `GtkPopover` that will be popped up when the @menu_button is clicked.
464//
465// If @popover is %NULL, the button is disabled.
466//
467// If [property@Gtk.MenuButton:menu-model] is set, the menu model is dissociated
468// from the @menu_button, and the property is set to %NULL.
469func (x *MenuButton) SetPopover(PopoverVar *Popover) {
470
471 xMenuButtonSetPopover(x.GoPointer(), PopoverVar.GoPointer())
472
473}
474
475var xMenuButtonSetPrimary func(uintptr, bool)
476
477// Sets whether menu button acts as a primary menu.
478//
479// Primary menus can be opened with the <kbd>F10</kbd> key.
480func (x *MenuButton) SetPrimary(PrimaryVar bool) {
481
482 xMenuButtonSetPrimary(x.GoPointer(), PrimaryVar)
483
484}
485
486var xMenuButtonSetUseUnderline func(uintptr, bool)
487
488// If true, an underline in the text indicates a mnemonic.
489func (x *MenuButton) SetUseUnderline(UseUnderlineVar bool) {
490
491 xMenuButtonSetUseUnderline(x.GoPointer(), UseUnderlineVar)
492
493}
494
495func (c *MenuButton) GoPointer() uintptr {
496 if c == nil {
497 return 0
498 }
499 return c.Ptr
500}
501
502func (c *MenuButton) SetGoPointer(ptr uintptr) {
503 c.Ptr = ptr
504}
505
506// SetPropertyActive sets the "active" property.
507// Whether the menu button is active.
508func (x *MenuButton) SetPropertyActive(value bool) {
509 var v gobject.Value
510 v.Init(gobject.TypeBooleanVal)
511 v.SetBoolean(value)
512 x.SetProperty("active", &v)
513}
514
515// GetPropertyActive gets the "active" property.
516// Whether the menu button is active.
517func (x *MenuButton) GetPropertyActive() bool {
518 var v gobject.Value
519 x.GetProperty("active", &v)
520 return v.GetBoolean()
521}
522
523// SetPropertyAlwaysShowArrow sets the "always-show-arrow" property.
524// Whether to show a dropdown arrow even when using an icon or a custom child.
525func (x *MenuButton) SetPropertyAlwaysShowArrow(value bool) {
526 var v gobject.Value
527 v.Init(gobject.TypeBooleanVal)
528 v.SetBoolean(value)
529 x.SetProperty("always-show-arrow", &v)
530}
531
532// GetPropertyAlwaysShowArrow gets the "always-show-arrow" property.
533// Whether to show a dropdown arrow even when using an icon or a custom child.
534func (x *MenuButton) GetPropertyAlwaysShowArrow() bool {
535 var v gobject.Value
536 x.GetProperty("always-show-arrow", &v)
537 return v.GetBoolean()
538}
539
540// SetPropertyCanShrink sets the "can-shrink" property.
541// Whether the size of the button can be made smaller than the natural
542// size of its contents.
543func (x *MenuButton) SetPropertyCanShrink(value bool) {
544 var v gobject.Value
545 v.Init(gobject.TypeBooleanVal)
546 v.SetBoolean(value)
547 x.SetProperty("can-shrink", &v)
548}
549
550// GetPropertyCanShrink gets the "can-shrink" property.
551// Whether the size of the button can be made smaller than the natural
552// size of its contents.
553func (x *MenuButton) GetPropertyCanShrink() bool {
554 var v gobject.Value
555 x.GetProperty("can-shrink", &v)
556 return v.GetBoolean()
557}
558
559// SetPropertyHasFrame sets the "has-frame" property.
560// Whether the button has a frame.
561func (x *MenuButton) SetPropertyHasFrame(value bool) {
562 var v gobject.Value
563 v.Init(gobject.TypeBooleanVal)
564 v.SetBoolean(value)
565 x.SetProperty("has-frame", &v)
566}
567
568// GetPropertyHasFrame gets the "has-frame" property.
569// Whether the button has a frame.
570func (x *MenuButton) GetPropertyHasFrame() bool {
571 var v gobject.Value
572 x.GetProperty("has-frame", &v)
573 return v.GetBoolean()
574}
575
576// SetPropertyIconName sets the "icon-name" property.
577// The name of the icon used to automatically populate the button.
578func (x *MenuButton) SetPropertyIconName(value string) {
579 var v gobject.Value
580 v.Init(gobject.TypeStringVal)
581 v.SetString(&value)
582 x.SetProperty("icon-name", &v)
583}
584
585// GetPropertyIconName gets the "icon-name" property.
586// The name of the icon used to automatically populate the button.
587func (x *MenuButton) GetPropertyIconName() string {
588 var v gobject.Value
589 x.GetProperty("icon-name", &v)
590 return v.GetString()
591}
592
593// SetPropertyLabel sets the "label" property.
594// The label for the button.
595func (x *MenuButton) SetPropertyLabel(value string) {
596 var v gobject.Value
597 v.Init(gobject.TypeStringVal)
598 v.SetString(&value)
599 x.SetProperty("label", &v)
600}
601
602// GetPropertyLabel gets the "label" property.
603// The label for the button.
604func (x *MenuButton) GetPropertyLabel() string {
605 var v gobject.Value
606 x.GetProperty("label", &v)
607 return v.GetString()
608}
609
610// SetPropertyPrimary sets the "primary" property.
611// Whether the menu button acts as a primary menu.
612//
613// Primary menus can be opened using the <kbd>F10</kbd> key
614func (x *MenuButton) SetPropertyPrimary(value bool) {
615 var v gobject.Value
616 v.Init(gobject.TypeBooleanVal)
617 v.SetBoolean(value)
618 x.SetProperty("primary", &v)
619}
620
621// GetPropertyPrimary gets the "primary" property.
622// Whether the menu button acts as a primary menu.
623//
624// Primary menus can be opened using the <kbd>F10</kbd> key
625func (x *MenuButton) GetPropertyPrimary() bool {
626 var v gobject.Value
627 x.GetProperty("primary", &v)
628 return v.GetBoolean()
629}
630
631// SetPropertyUseUnderline sets the "use-underline" property.
632// If set an underscore in the text indicates a mnemonic.
633func (x *MenuButton) SetPropertyUseUnderline(value bool) {
634 var v gobject.Value
635 v.Init(gobject.TypeBooleanVal)
636 v.SetBoolean(value)
637 x.SetProperty("use-underline", &v)
638}
639
640// GetPropertyUseUnderline gets the "use-underline" property.
641// If set an underscore in the text indicates a mnemonic.
642func (x *MenuButton) GetPropertyUseUnderline() bool {
643 var v gobject.Value
644 x.GetProperty("use-underline", &v)
645 return v.GetBoolean()
646}
647
648// Emitted to when the menu button is activated.
649//
650// The `::activate` signal on `GtkMenuButton` is an action signal and
651// emitting it causes the button to pop up its menu.
652func (x *MenuButton) ConnectActivate(cb *func(MenuButton)) uint {
653 cbPtr := uintptr(unsafe.Pointer(cb))
654 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
655 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
656 glib.SaveHandlerMapping(handlerID, cbPtr)
657 return handlerID
658 }
659
660 fcb := func(clsPtr uintptr) {
661 fa := MenuButton{}
662 fa.Ptr = clsPtr
663 cbFn := *cb
664
665 cbFn(fa)
666
667 }
668 cbRefPtr := purego.NewCallback(fcb)
669 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
670 handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
671 glib.SaveHandlerMapping(handlerID, cbPtr)
672 return handlerID
673}
674
675// Requests the user's screen reader to announce the given message.
676//
677// This kind of notification is useful for messages that
678// either have only a visual representation or that are not
679// exposed visually at all, e.g. a notification about a
680// successful operation.
681//
682// Also, by using this API, you can ensure that the message
683// does not interrupts the user's current screen reader output.
684func (x *MenuButton) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
685
686 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
687
688}
689
690// Retrieves the accessible parent for an accessible object.
691//
692// This function returns `NULL` for top level widgets.
693func (x *MenuButton) GetAccessibleParent() *AccessibleBase {
694 var cls *AccessibleBase
695
696 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
697
698 if cret == 0 {
699 return nil
700 }
701 cls = &AccessibleBase{}
702 cls.Ptr = cret
703 return cls
704}
705
706// Retrieves the accessible role of an accessible object.
707func (x *MenuButton) GetAccessibleRole() AccessibleRole {
708
709 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
710 return cret
711}
712
713// Retrieves the implementation for the given accessible object.
714func (x *MenuButton) GetAtContext() *ATContext {
715 var cls *ATContext
716
717 cret := XGtkAccessibleGetAtContext(x.GoPointer())
718
719 if cret == 0 {
720 return nil
721 }
722 cls = &ATContext{}
723 cls.Ptr = cret
724 return cls
725}
726
727// Queries the coordinates and dimensions of this accessible
728//
729// This functionality can be overridden by `GtkAccessible`
730// implementations, e.g. to get the bounds from an ignored
731// child widget.
732func (x *MenuButton) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
733
734 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
735 return cret
736}
737
738// Retrieves the first accessible child of an accessible object.
739func (x *MenuButton) GetFirstAccessibleChild() *AccessibleBase {
740 var cls *AccessibleBase
741
742 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
743
744 if cret == 0 {
745 return nil
746 }
747 cls = &AccessibleBase{}
748 cls.Ptr = cret
749 return cls
750}
751
752// Retrieves the next accessible sibling of an accessible object
753func (x *MenuButton) GetNextAccessibleSibling() *AccessibleBase {
754 var cls *AccessibleBase
755
756 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
757
758 if cret == 0 {
759 return nil
760 }
761 cls = &AccessibleBase{}
762 cls.Ptr = cret
763 return cls
764}
765
766// Queries a platform state, such as focus.
767//
768// This functionality can be overridden by `GtkAccessible`
769// implementations, e.g. to get platform state from an ignored
770// child widget, as is the case for `GtkText` wrappers.
771func (x *MenuButton) GetPlatformState(StateVar AccessiblePlatformState) bool {
772
773 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
774 return cret
775}
776
777// Resets the accessible property to its default value.
778func (x *MenuButton) ResetProperty(PropertyVar AccessibleProperty) {
779
780 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
781
782}
783
784// Resets the accessible relation to its default value.
785func (x *MenuButton) ResetRelation(RelationVar AccessibleRelation) {
786
787 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
788
789}
790
791// Resets the accessible state to its default value.
792func (x *MenuButton) ResetState(StateVar AccessibleState) {
793
794 XGtkAccessibleResetState(x.GoPointer(), StateVar)
795
796}
797
798// Sets the parent and sibling of an accessible object.
799//
800// This function is meant to be used by accessible implementations that are
801// not part of the widget hierarchy, and but act as a logical bridge between
802// widgets. For instance, if a widget creates an object that holds metadata
803// for each child, and you want that object to implement the `GtkAccessible`
804// interface, you will use this function to ensure that the parent of each
805// child widget is the metadata object, and the parent of each metadata
806// object is the container widget.
807func (x *MenuButton) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
808
809 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
810
811}
812
813// Updates the next accessible sibling.
814//
815// That might be useful when a new child of a custom accessible
816// is created, and it needs to be linked to a previous child.
817func (x *MenuButton) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
818
819 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
820
821}
822
823// Informs ATs that the platform state has changed.
824//
825// This function should be used by `GtkAccessible` implementations that
826// have a platform state but are not widgets. Widgets handle platform
827// states automatically.
828func (x *MenuButton) UpdatePlatformState(StateVar AccessiblePlatformState) {
829
830 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
831
832}
833
834// Updates a list of accessible properties.
835//
836// See the [enum@Gtk.AccessibleProperty] documentation for the
837// value types of accessible properties.
838//
839// This function should be called by `GtkWidget` types whenever
840// an accessible property change must be communicated to assistive
841// technologies.
842//
843// Example:
844// ```c
845// value = gtk_adjustment_get_value (adjustment);
846// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
847//
848// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
849// -1);
850//
851// ```
852func (x *MenuButton) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
853
854 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
855
856}
857
858// Updates an array of accessible properties.
859//
860// This function should be called by `GtkWidget` types whenever an accessible
861// property change must be communicated to assistive technologies.
862//
863// This function is meant to be used by language bindings.
864func (x *MenuButton) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
865
866 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
867
868}
869
870// Updates a list of accessible relations.
871//
872// This function should be called by `GtkWidget` types whenever an accessible
873// relation change must be communicated to assistive technologies.
874//
875// If the [enum@Gtk.AccessibleRelation] requires a list of references,
876// you should pass each reference individually, followed by `NULL`, e.g.
877//
878// ```c
879// gtk_accessible_update_relation (accessible,
880//
881// GTK_ACCESSIBLE_RELATION_CONTROLS,
882// ref1, NULL,
883// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
884// ref1, ref2, ref3, NULL,
885// -1);
886//
887// ```
888func (x *MenuButton) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
889
890 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
891
892}
893
894// Updates an array of accessible relations.
895//
896// This function should be called by `GtkWidget` types whenever an accessible
897// relation change must be communicated to assistive technologies.
898//
899// This function is meant to be used by language bindings.
900func (x *MenuButton) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
901
902 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
903
904}
905
906// Updates a list of accessible states.
907//
908// See the [enum@Gtk.AccessibleState] documentation for the
909// value types of accessible states.
910//
911// This function should be called by `GtkWidget` types whenever
912// an accessible state change must be communicated to assistive
913// technologies.
914//
915// Example:
916//
917// ```c
918// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
919// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
920//
921// GTK_ACCESSIBLE_STATE_CHECKED, value,
922// -1);
923//
924// ```
925func (x *MenuButton) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
926
927 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
928
929}
930
931// Updates an array of accessible states.
932//
933// This function should be called by `GtkWidget` types whenever an accessible
934// state change must be communicated to assistive technologies.
935//
936// This function is meant to be used by language bindings.
937func (x *MenuButton) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
938
939 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
940
941}
942
943// Gets the ID of the @buildable object.
944//
945// `GtkBuilder` sets the name based on the ID attribute
946// of the `<object>` tag used to construct the @buildable.
947func (x *MenuButton) GetBuildableId() string {
948
949 cret := XGtkBuildableGetBuildableId(x.GoPointer())
950 return cret
951}
952
953func init() {
954 core.SetPackageName("GTK", "gtk4")
955 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
956 var libs []uintptr
957 for _, libPath := range core.GetPaths("GTK") {
958 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
959 if err != nil {
960 panic(err)
961 }
962 libs = append(libs, lib)
963 }
964
965 core.PuregoSafeRegister(&xMenuButtonGLibType, libs, "gtk_menu_button_get_type")
966
967 core.PuregoSafeRegister(&xNewMenuButton, libs, "gtk_menu_button_new")
968
969 core.PuregoSafeRegister(&xMenuButtonGetActive, libs, "gtk_menu_button_get_active")
970 core.PuregoSafeRegister(&xMenuButtonGetAlwaysShowArrow, libs, "gtk_menu_button_get_always_show_arrow")
971 core.PuregoSafeRegister(&xMenuButtonGetCanShrink, libs, "gtk_menu_button_get_can_shrink")
972 core.PuregoSafeRegister(&xMenuButtonGetChild, libs, "gtk_menu_button_get_child")
973 core.PuregoSafeRegister(&xMenuButtonGetDirection, libs, "gtk_menu_button_get_direction")
974 core.PuregoSafeRegister(&xMenuButtonGetHasFrame, libs, "gtk_menu_button_get_has_frame")
975 core.PuregoSafeRegister(&xMenuButtonGetIconName, libs, "gtk_menu_button_get_icon_name")
976 core.PuregoSafeRegister(&xMenuButtonGetLabel, libs, "gtk_menu_button_get_label")
977 core.PuregoSafeRegister(&xMenuButtonGetMenuModel, libs, "gtk_menu_button_get_menu_model")
978 core.PuregoSafeRegister(&xMenuButtonGetPopover, libs, "gtk_menu_button_get_popover")
979 core.PuregoSafeRegister(&xMenuButtonGetPrimary, libs, "gtk_menu_button_get_primary")
980 core.PuregoSafeRegister(&xMenuButtonGetUseUnderline, libs, "gtk_menu_button_get_use_underline")
981 core.PuregoSafeRegister(&xMenuButtonPopdown, libs, "gtk_menu_button_popdown")
982 core.PuregoSafeRegister(&xMenuButtonPopup, libs, "gtk_menu_button_popup")
983 core.PuregoSafeRegister(&xMenuButtonSetActive, libs, "gtk_menu_button_set_active")
984 core.PuregoSafeRegister(&xMenuButtonSetAlwaysShowArrow, libs, "gtk_menu_button_set_always_show_arrow")
985 core.PuregoSafeRegister(&xMenuButtonSetCanShrink, libs, "gtk_menu_button_set_can_shrink")
986 core.PuregoSafeRegister(&xMenuButtonSetChild, libs, "gtk_menu_button_set_child")
987 core.PuregoSafeRegister(&xMenuButtonSetCreatePopupFunc, libs, "gtk_menu_button_set_create_popup_func")
988 core.PuregoSafeRegister(&xMenuButtonSetDirection, libs, "gtk_menu_button_set_direction")
989 core.PuregoSafeRegister(&xMenuButtonSetHasFrame, libs, "gtk_menu_button_set_has_frame")
990 core.PuregoSafeRegister(&xMenuButtonSetIconName, libs, "gtk_menu_button_set_icon_name")
991 core.PuregoSafeRegister(&xMenuButtonSetLabel, libs, "gtk_menu_button_set_label")
992 core.PuregoSafeRegister(&xMenuButtonSetMenuModel, libs, "gtk_menu_button_set_menu_model")
993 core.PuregoSafeRegister(&xMenuButtonSetPopover, libs, "gtk_menu_button_set_popover")
994 core.PuregoSafeRegister(&xMenuButtonSetPrimary, libs, "gtk_menu_button_set_primary")
995 core.PuregoSafeRegister(&xMenuButtonSetUseUnderline, libs, "gtk_menu_button_set_use_underline")
996
997}