// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gdk" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type ATContextClass struct { _ structs.HostLayout } func (x *ATContextClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // Communicates with platform-specific assistive technologies API. // // Each platform supported by GTK implements a `GtkATContext` subclass, and // is responsible for updating the accessible state in response to state // changes in `GtkAccessible`. type ATContext struct { gobject.Object } var xATContextGLibType func() types.GType func ATContextGLibType() types.GType { return xATContextGLibType() } func ATContextNewFromInternalPtr(ptr uintptr) *ATContext { cls := &ATContext{} cls.Ptr = ptr return cls } var xATContextCreate func(AccessibleRole, uintptr, uintptr) uintptr // Creates a new `GtkATContext` instance for the given accessible role, // accessible instance, and display connection. // // The `GtkATContext` implementation being instantiated will depend on the // platform. func ATContextCreate(AccessibleRoleVar AccessibleRole, AccessibleVar Accessible, DisplayVar *gdk.Display) *ATContext { var cls *ATContext cret := xATContextCreate(AccessibleRoleVar, AccessibleVar.GoPointer(), DisplayVar.GoPointer()) if cret == 0 { return nil } cls = &ATContext{} cls.Ptr = cret return cls } var xATContextGetAccessible func(uintptr) uintptr // Retrieves the `GtkAccessible` using this context. func (x *ATContext) GetAccessible() *AccessibleBase { var cls *AccessibleBase cret := xATContextGetAccessible(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &AccessibleBase{} cls.Ptr = cret return cls } var xATContextGetAccessibleRole func(uintptr) AccessibleRole // Retrieves the accessible role of this context. func (x *ATContext) GetAccessibleRole() AccessibleRole { cret := xATContextGetAccessibleRole(x.GoPointer()) return cret } func (c *ATContext) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *ATContext) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // Emitted when the attributes of the accessible for the // `GtkATContext` instance change. func (x *ATContext) ConnectStateChange(cb *func(ATContext)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "state-change", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr) { fa := ATContext{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "state-change", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } 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(&xATContextGLibType, libs, "gtk_at_context_get_type") core.PuregoSafeRegister(&xATContextCreate, libs, "gtk_at_context_create") core.PuregoSafeRegister(&xATContextGetAccessible, libs, "gtk_at_context_get_accessible") core.PuregoSafeRegister(&xATContextGetAccessibleRole, libs, "gtk_at_context_get_accessible_role") }