// Package adw was automatically generated by github.com/bnema/puregotk DO NOT EDIT package adw import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gdk" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" "github.com/bnema/puregotk/v4/gtk" ) type AvatarClass struct { _ structs.HostLayout ParentClass gtk.WidgetClass } func (x *AvatarClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // A widget displaying an image, with a generated fallback. // // <picture> // // <source srcset="avatar-dark.png" media="(prefers-color-scheme: dark)"> // <img src="avatar.png" alt="avatar"> // // </picture> // // `AdwAvatar` is a widget that shows a round avatar. // // `AdwAvatar` generates an avatar with the initials of the // [property@Avatar:text] on top of a colored background. // // The color is picked based on the hash of the [property@Avatar:text]. // // If [property@Avatar:show-initials] is set to `FALSE`, // [property@Avatar:icon-name] or `avatar-default-symbolic` is shown instead of // the initials. // // Use [property@Avatar:custom-image] to set a custom image. // // ## CSS nodes // // `AdwAvatar` has a single CSS node with name `avatar`. // // ## Accessibility // // `AdwAvatar` uses the `GTK_ACCESSIBLE_ROLE_IMG` role. type Avatar struct { gtk.Widget } var xAvatarGLibType func() types.GType func AvatarGLibType() types.GType { return xAvatarGLibType() } func AvatarNewFromInternalPtr(ptr uintptr) *Avatar { cls := &Avatar{} cls.Ptr = ptr return cls } var xNewAvatar func(int, uintptr, bool) uintptr // Creates a new `AdwAvatar`. func NewAvatar(SizeVar int, TextVar *string, ShowInitialsVar bool) *Avatar { var cls *Avatar TextVarPtr := core.GStrdupNullable(TextVar) defer core.GFreeNullable(TextVarPtr) cret := xNewAvatar(SizeVar, TextVarPtr, ShowInitialsVar) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Avatar{} cls.Ptr = cret return cls } var xAvatarDrawToTexture func(uintptr, int) uintptr // Renders @self into a [class@Gdk.Texture] at @scale_factor. // // This can be used to export the fallback avatar. func (x *Avatar) DrawToTexture(ScaleFactorVar int) *gdk.Texture { var cls *gdk.Texture cret := xAvatarDrawToTexture(x.GoPointer(), ScaleFactorVar) if cret == 0 { return nil } cls = &gdk.Texture{} cls.Ptr = cret return cls } var xAvatarGetCustomImage func(uintptr) uintptr // Gets the custom image paintable. func (x *Avatar) GetCustomImage() *gdk.PaintableBase { var cls *gdk.PaintableBase cret := xAvatarGetCustomImage(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &gdk.PaintableBase{} cls.Ptr = cret return cls } var xAvatarGetIconName func(uintptr) string // Gets the name of an icon to use as a fallback. func (x *Avatar) GetIconName() string { cret := xAvatarGetIconName(x.GoPointer()) return cret } var xAvatarGetShowInitials func(uintptr) bool // Gets whether initials are used instead of an icon on the fallback avatar. func (x *Avatar) GetShowInitials() bool { cret := xAvatarGetShowInitials(x.GoPointer()) return cret } var xAvatarGetSize func(uintptr) int // Gets the size of the avatar. func (x *Avatar) GetSize() int { cret := xAvatarGetSize(x.GoPointer()) return cret } var xAvatarGetText func(uintptr) string // Gets the text used to generate the fallback initials and color. func (x *Avatar) GetText() string { cret := xAvatarGetText(x.GoPointer()) return cret } var xAvatarSetCustomImage func(uintptr, uintptr) // Sets the custom image paintable. // // Custom image is displayed instead of initials or icon. func (x *Avatar) SetCustomImage(CustomImageVar gdk.Paintable) { xAvatarSetCustomImage(x.GoPointer(), CustomImageVar.GoPointer()) } var xAvatarSetIconName func(uintptr, uintptr) // Sets the name of an icon to use as a fallback. // // If no name is set, `avatar-default-symbolic` will be used. func (x *Avatar) SetIconName(IconNameVar *string) { IconNameVarPtr := core.GStrdupNullable(IconNameVar) defer core.GFreeNullable(IconNameVarPtr) xAvatarSetIconName(x.GoPointer(), IconNameVarPtr) } var xAvatarSetShowInitials func(uintptr, bool) // Sets whether to use initials instead of an icon on the fallback avatar. // // See [property@Avatar:icon-name] for how to change the fallback icon. func (x *Avatar) SetShowInitials(ShowInitialsVar bool) { xAvatarSetShowInitials(x.GoPointer(), ShowInitialsVar) } var xAvatarSetSize func(uintptr, int) // Sets the size of the avatar. func (x *Avatar) SetSize(SizeVar int) { xAvatarSetSize(x.GoPointer(), SizeVar) } var xAvatarSetText func(uintptr, uintptr) // Sets the text used to generate the fallback initials and color. // // It's only used to generate the color if [property@Avatar:show-initials] is // `FALSE`. func (x *Avatar) SetText(TextVar *string) { TextVarPtr := core.GStrdupNullable(TextVar) defer core.GFreeNullable(TextVarPtr) xAvatarSetText(x.GoPointer(), TextVarPtr) } func (c *Avatar) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *Avatar) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyIconName sets the "icon-name" property. // The name of an icon to use as a fallback. // // If no name is set, `avatar-default-symbolic` will be used. func (x *Avatar) SetPropertyIconName(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("icon-name", &v) } // GetPropertyIconName gets the "icon-name" property. // The name of an icon to use as a fallback. // // If no name is set, `avatar-default-symbolic` will be used. func (x *Avatar) GetPropertyIconName() string { var v gobject.Value x.GetProperty("icon-name", &v) return v.GetString() } // SetPropertyShowInitials sets the "show-initials" property. // Whether initials are used instead of an icon on the fallback avatar. // // See [property@Avatar:icon-name] for how to change the fallback icon. func (x *Avatar) SetPropertyShowInitials(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("show-initials", &v) } // GetPropertyShowInitials gets the "show-initials" property. // Whether initials are used instead of an icon on the fallback avatar. // // See [property@Avatar:icon-name] for how to change the fallback icon. func (x *Avatar) GetPropertyShowInitials() bool { var v gobject.Value x.GetProperty("show-initials", &v) return v.GetBoolean() } // SetPropertySize sets the "size" property. // The size of the avatar. func (x *Avatar) SetPropertySize(value int) { var v gobject.Value v.Init(gobject.TypeIntVal) v.SetInt(value) x.SetProperty("size", &v) } // GetPropertySize gets the "size" property. // The size of the avatar. func (x *Avatar) GetPropertySize() int { var v gobject.Value x.GetProperty("size", &v) return v.GetInt() } // SetPropertyText sets the "text" property. // Sets the text used to generate the fallback initials and color. // // It's only used to generate the color if [property@Avatar:show-initials] is // `FALSE`. func (x *Avatar) SetPropertyText(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("text", &v) } // GetPropertyText gets the "text" property. // Sets the text used to generate the fallback initials and color. // // It's only used to generate the color if [property@Avatar:show-initials] is // `FALSE`. func (x *Avatar) GetPropertyText() string { var v gobject.Value x.GetProperty("text", &v) return v.GetString() } // 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 *Avatar) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) { gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar) } // Retrieves the accessible parent for an accessible object. // // This function returns `NULL` for top level widgets. func (x *Avatar) GetAccessibleParent() *gtk.AccessibleBase { var cls *gtk.AccessibleBase cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer()) if cret == 0 { return nil } cls = >k.AccessibleBase{} cls.Ptr = cret return cls } // Retrieves the accessible role of an accessible object. func (x *Avatar) GetAccessibleRole() gtk.AccessibleRole { cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *Avatar) GetAtContext() *gtk.ATContext { var cls *gtk.ATContext cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer()) if cret == 0 { return nil } cls = >k.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 *Avatar) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool { cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar) return cret } // Retrieves the first accessible child of an accessible object. func (x *Avatar) GetFirstAccessibleChild() *gtk.AccessibleBase { var cls *gtk.AccessibleBase cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer()) if cret == 0 { return nil } cls = >k.AccessibleBase{} cls.Ptr = cret return cls } // Retrieves the next accessible sibling of an accessible object func (x *Avatar) GetNextAccessibleSibling() *gtk.AccessibleBase { var cls *gtk.AccessibleBase cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer()) if cret == 0 { return nil } cls = >k.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 *Avatar) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool { cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *Avatar) ResetProperty(PropertyVar gtk.AccessibleProperty) { gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *Avatar) ResetRelation(RelationVar gtk.AccessibleRelation) { gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *Avatar) ResetState(StateVar gtk.AccessibleState) { gtk.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 *Avatar) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) { gtk.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 *Avatar) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) { gtk.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 *Avatar) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) { gtk.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 *Avatar) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) { gtk.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 *Avatar) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) { gtk.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 *Avatar) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) { gtk.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 *Avatar) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) { gtk.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 *Avatar) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) { gtk.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 *Avatar) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) { gtk.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 *Avatar) GetBuildableId() string { cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer()) return cret } func init() { core.SetPackageName("ADW", "libadwaita-1") core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("ADW") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xAvatarGLibType, libs, "adw_avatar_get_type") core.PuregoSafeRegister(&xNewAvatar, libs, "adw_avatar_new") core.PuregoSafeRegister(&xAvatarDrawToTexture, libs, "adw_avatar_draw_to_texture") core.PuregoSafeRegister(&xAvatarGetCustomImage, libs, "adw_avatar_get_custom_image") core.PuregoSafeRegister(&xAvatarGetIconName, libs, "adw_avatar_get_icon_name") core.PuregoSafeRegister(&xAvatarGetShowInitials, libs, "adw_avatar_get_show_initials") core.PuregoSafeRegister(&xAvatarGetSize, libs, "adw_avatar_get_size") core.PuregoSafeRegister(&xAvatarGetText, libs, "adw_avatar_get_text") core.PuregoSafeRegister(&xAvatarSetCustomImage, libs, "adw_avatar_set_custom_image") core.PuregoSafeRegister(&xAvatarSetIconName, libs, "adw_avatar_set_icon_name") core.PuregoSafeRegister(&xAvatarSetShowInitials, libs, "adw_avatar_set_show_initials") core.PuregoSafeRegister(&xAvatarSetSize, libs, "adw_avatar_set_size") core.PuregoSafeRegister(&xAvatarSetText, libs, "adw_avatar_set_text") }