// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // Places “overlay” widgets on top of a single main child. // // <picture> // // <source srcset="overlay-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An example GtkOverlay" src="overlay.png"> // // </picture> // // The position of each overlay widget is determined by its // [property@Gtk.Widget:halign] and [property@Gtk.Widget:valign] // properties. E.g. a widget with both alignments set to %GTK_ALIGN_START // will be placed at the top left corner of the `GtkOverlay` container, // whereas an overlay with halign set to %GTK_ALIGN_CENTER and valign set // to %GTK_ALIGN_END will be placed a the bottom edge of the `GtkOverlay`, // horizontally centered. The position can be adjusted by setting the margin // properties of the child to non-zero values. // // More complicated placement of overlays is possible by connecting // to the [signal@Gtk.Overlay::get-child-position] signal. // // An overlay’s minimum and natural sizes are those of its main child. // The sizes of overlay children are not considered when measuring these // preferred sizes. // // # GtkOverlay as GtkBuildable // // The `GtkOverlay` implementation of the `GtkBuildable` interface // supports placing a child as an overlay by specifying “overlay” as // the “type” attribute of a `<child>` element. // // # CSS nodes // // `GtkOverlay` has a single CSS node with the name “overlay”. Overlay children // whose alignments cause them to be positioned at an edge get the style classes // “.left”, “.right”, “.top”, and/or “.bottom” according to their position. type Overlay struct { Widget } var xOverlayGLibType func() types.GType func OverlayGLibType() types.GType { return xOverlayGLibType() } func OverlayNewFromInternalPtr(ptr uintptr) *Overlay { cls := &Overlay{} cls.Ptr = ptr return cls } var xNewOverlay func() uintptr // Creates a new `GtkOverlay`. func NewOverlay() *Overlay { var cls *Overlay cret := xNewOverlay() if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Overlay{} cls.Ptr = cret return cls } var xOverlayAddOverlay func(uintptr, uintptr) // Adds @widget to @overlay. // // The widget will be stacked on top of the main widget // added with [method@Gtk.Overlay.set_child]. // // The position at which @widget is placed is determined // from its [property@Gtk.Widget:halign] and // [property@Gtk.Widget:valign] properties. func (x *Overlay) AddOverlay(WidgetVar *Widget) { xOverlayAddOverlay(x.GoPointer(), WidgetVar.GoPointer()) } var xOverlayGetChild func(uintptr) uintptr // Gets the child widget of @overlay. func (x *Overlay) GetChild() *Widget { var cls *Widget cret := xOverlayGetChild(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Widget{} cls.Ptr = cret return cls } var xOverlayGetClipOverlay func(uintptr, uintptr) bool // Gets whether @widget should be clipped within the parent. func (x *Overlay) GetClipOverlay(WidgetVar *Widget) bool { cret := xOverlayGetClipOverlay(x.GoPointer(), WidgetVar.GoPointer()) return cret } var xOverlayGetMeasureOverlay func(uintptr, uintptr) bool // Gets whether @widget's size is included in the measurement of // @overlay. func (x *Overlay) GetMeasureOverlay(WidgetVar *Widget) bool { cret := xOverlayGetMeasureOverlay(x.GoPointer(), WidgetVar.GoPointer()) return cret } var xOverlayRemoveOverlay func(uintptr, uintptr) // Removes an overlay that was added with gtk_overlay_add_overlay(). func (x *Overlay) RemoveOverlay(WidgetVar *Widget) { xOverlayRemoveOverlay(x.GoPointer(), WidgetVar.GoPointer()) } var xOverlaySetChild func(uintptr, uintptr) // Sets the child widget of @overlay. func (x *Overlay) SetChild(ChildVar *Widget) { xOverlaySetChild(x.GoPointer(), ChildVar.GoPointer()) } var xOverlaySetClipOverlay func(uintptr, uintptr, bool) // Sets whether @widget should be clipped within the parent. func (x *Overlay) SetClipOverlay(WidgetVar *Widget, ClipOverlayVar bool) { xOverlaySetClipOverlay(x.GoPointer(), WidgetVar.GoPointer(), ClipOverlayVar) } var xOverlaySetMeasureOverlay func(uintptr, uintptr, bool) // Sets whether @widget is included in the measured size of @overlay. // // The overlay will request the size of the largest child that has // this property set to %TRUE. Children who are not included may // be drawn outside of @overlay's allocation if they are too large. func (x *Overlay) SetMeasureOverlay(WidgetVar *Widget, MeasureVar bool) { xOverlaySetMeasureOverlay(x.GoPointer(), WidgetVar.GoPointer(), MeasureVar) } func (c *Overlay) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *Overlay) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // Emitted to determine the position and size of any overlay // child widgets. // // A handler for this signal should fill @allocation with // the desired position and size for @widget, relative to // the 'main' child of @overlay. // // The default handler for this signal uses the @widget's // halign and valign properties to determine the position // and gives the widget its natural size (except that an // alignment of %GTK_ALIGN_FILL will cause the overlay to // be full-width/height). If the main child is a // `GtkScrolledWindow`, the overlays are placed relative // to its contents. func (x *Overlay) ConnectGetChildPosition(cb *func(Overlay, uintptr, *uintptr) bool) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "get-child-position", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, WidgetVarp uintptr, AllocationVarp *uintptr) bool { fa := Overlay{} fa.Ptr = clsPtr cbFn := *cb return cbFn(fa, WidgetVarp, AllocationVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "get-child-position", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Requests the user's screen reader to announce the given message. // // This kind of notification is useful for messages that // either have only a visual representation or that are not // exposed visually at all, e.g. a notification about a // successful operation. // // Also, by using this API, you can ensure that the message // does not interrupts the user's current screen reader output. func (x *Overlay) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) { XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar) } // Retrieves the accessible parent for an accessible object. // // This function returns `NULL` for top level widgets. func (x *Overlay) GetAccessibleParent() *AccessibleBase { var cls *AccessibleBase cret := XGtkAccessibleGetAccessibleParent(x.GoPointer()) if cret == 0 { return nil } cls = &AccessibleBase{} cls.Ptr = cret return cls } // Retrieves the accessible role of an accessible object. func (x *Overlay) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *Overlay) GetAtContext() *ATContext { var cls *ATContext cret := XGtkAccessibleGetAtContext(x.GoPointer()) if cret == 0 { return nil } cls = &ATContext{} cls.Ptr = cret return cls } // Queries the coordinates and dimensions of this accessible // // This functionality can be overridden by `GtkAccessible` // implementations, e.g. to get the bounds from an ignored // child widget. func (x *Overlay) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool { cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar) return cret } // Retrieves the first accessible child of an accessible object. func (x *Overlay) GetFirstAccessibleChild() *AccessibleBase { var cls *AccessibleBase cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer()) if cret == 0 { return nil } cls = &AccessibleBase{} cls.Ptr = cret return cls } // Retrieves the next accessible sibling of an accessible object func (x *Overlay) GetNextAccessibleSibling() *AccessibleBase { var cls *AccessibleBase cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer()) if cret == 0 { return nil } cls = &AccessibleBase{} cls.Ptr = cret return cls } // Queries a platform state, such as focus. // // This functionality can be overridden by `GtkAccessible` // implementations, e.g. to get platform state from an ignored // child widget, as is the case for `GtkText` wrappers. func (x *Overlay) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *Overlay) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *Overlay) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *Overlay) ResetState(StateVar AccessibleState) { XGtkAccessibleResetState(x.GoPointer(), StateVar) } // Sets the parent and sibling of an accessible object. // // This function is meant to be used by accessible implementations that are // not part of the widget hierarchy, and but act as a logical bridge between // widgets. For instance, if a widget creates an object that holds metadata // for each child, and you want that object to implement the `GtkAccessible` // interface, you will use this function to ensure that the parent of each // child widget is the metadata object, and the parent of each metadata // object is the container widget. func (x *Overlay) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) { XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer()) } // Updates the next accessible sibling. // // That might be useful when a new child of a custom accessible // is created, and it needs to be linked to a previous child. func (x *Overlay) UpdateNextAccessibleSibling(NewSiblingVar Accessible) { XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer()) } // Informs ATs that the platform state has changed. // // This function should be used by `GtkAccessible` implementations that // have a platform state but are not widgets. Widgets handle platform // states automatically. func (x *Overlay) UpdatePlatformState(StateVar AccessiblePlatformState) { XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar) } // Updates a list of accessible properties. // // See the [enum@Gtk.AccessibleProperty] documentation for the // value types of accessible properties. // // This function should be called by `GtkWidget` types whenever // an accessible property change must be communicated to assistive // technologies. // // Example: // ```c // value = gtk_adjustment_get_value (adjustment); // gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button), // // GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value, // -1); // // ``` func (x *Overlay) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) { XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...) } // Updates an array of accessible properties. // // This function should be called by `GtkWidget` types whenever an accessible // property change must be communicated to assistive technologies. // // This function is meant to be used by language bindings. func (x *Overlay) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) { XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar) } // Updates a list of accessible relations. // // This function should be called by `GtkWidget` types whenever an accessible // relation change must be communicated to assistive technologies. // // If the [enum@Gtk.AccessibleRelation] requires a list of references, // you should pass each reference individually, followed by `NULL`, e.g. // // ```c // gtk_accessible_update_relation (accessible, // // GTK_ACCESSIBLE_RELATION_CONTROLS, // ref1, NULL, // GTK_ACCESSIBLE_RELATION_LABELLED_BY, // ref1, ref2, ref3, NULL, // -1); // // ``` func (x *Overlay) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) { XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...) } // Updates an array of accessible relations. // // This function should be called by `GtkWidget` types whenever an accessible // relation change must be communicated to assistive technologies. // // This function is meant to be used by language bindings. func (x *Overlay) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) { XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar) } // Updates a list of accessible states. // // See the [enum@Gtk.AccessibleState] documentation for the // value types of accessible states. // // This function should be called by `GtkWidget` types whenever // an accessible state change must be communicated to assistive // technologies. // // Example: // // ```c // value = GTK_ACCESSIBLE_TRISTATE_MIXED; // gtk_accessible_update_state (GTK_ACCESSIBLE (check_button), // // GTK_ACCESSIBLE_STATE_CHECKED, value, // -1); // // ``` func (x *Overlay) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) { XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...) } // Updates an array of accessible states. // // This function should be called by `GtkWidget` types whenever an accessible // state change must be communicated to assistive technologies. // // This function is meant to be used by language bindings. func (x *Overlay) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) { XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) } // Gets the ID of the @buildable object. // // `GtkBuilder` sets the name based on the ID attribute // of the `<object>` tag used to construct the @buildable. func (x *Overlay) GetBuildableId() string { cret := XGtkBuildableGetBuildableId(x.GoPointer()) return cret } func init() { core.SetPackageName("GTK", "gtk4") core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GTK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xOverlayGLibType, libs, "gtk_overlay_get_type") core.PuregoSafeRegister(&xNewOverlay, libs, "gtk_overlay_new") core.PuregoSafeRegister(&xOverlayAddOverlay, libs, "gtk_overlay_add_overlay") core.PuregoSafeRegister(&xOverlayGetChild, libs, "gtk_overlay_get_child") core.PuregoSafeRegister(&xOverlayGetClipOverlay, libs, "gtk_overlay_get_clip_overlay") core.PuregoSafeRegister(&xOverlayGetMeasureOverlay, libs, "gtk_overlay_get_measure_overlay") core.PuregoSafeRegister(&xOverlayRemoveOverlay, libs, "gtk_overlay_remove_overlay") core.PuregoSafeRegister(&xOverlaySetChild, libs, "gtk_overlay_set_child") core.PuregoSafeRegister(&xOverlaySetClipOverlay, libs, "gtk_overlay_set_clip_overlay") core.PuregoSafeRegister(&xOverlaySetMeasureOverlay, libs, "gtk_overlay_set_measure_overlay") }