// 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/gobject" "github.com/bnema/puregotk/v4/gobject/types" "github.com/bnema/puregotk/v4/gtk" ) type ButtonContentClass struct { _ structs.HostLayout ParentClass gtk.WidgetClass } func (x *ButtonContentClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // A helper widget for creating buttons. // // <picture> // // <source srcset="button-content-dark.png" media="(prefers-color-scheme: dark)"> // <img src="button-content.png" alt="button-content"> // // </picture> // // `AdwButtonContent` is a box-like widget with an icon and a label. // // It's intended to be used as a direct child of [class@Gtk.Button], // [class@Gtk.MenuButton] or [class@SplitButton], when they need to have both an // icon and a label, as follows: // // ```xml // <object class="GtkButton"> // // <property name="child"> // <object class="AdwButtonContent"> // <property name="icon-name">document-open-symbolic</property> // <property name="label" translatable="yes">_Open</property> // <property name="use-underline">True</property> // </object> // </property> // // </object> // ``` // // `AdwButtonContent` handles style classes and connecting the mnemonic to the // button automatically. // // ## CSS nodes // // ``` // buttoncontent // ╰── box // // ├── image // ╰── label // // ``` // // `AdwButtonContent`'s CSS node is called `buttoncontent`. It contains a `box` // subnode that serves as a container for the `image` and `label` nodes. // // When inside a `GtkButton` or `AdwSplitButton`, the button will receive the // `.image-text-button` style class. When inside a `GtkMenuButton`, the // internal `GtkButton` will receive it instead. // // ## Accessibility // // `AdwButtonContent` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role. type ButtonContent struct { gtk.Widget } var xButtonContentGLibType func() types.GType func ButtonContentGLibType() types.GType { return xButtonContentGLibType() } func ButtonContentNewFromInternalPtr(ptr uintptr) *ButtonContent { cls := &ButtonContent{} cls.Ptr = ptr return cls } var xNewButtonContent func() uintptr // Creates a new `AdwButtonContent`. func NewButtonContent() *ButtonContent { var cls *ButtonContent cret := xNewButtonContent() if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &ButtonContent{} cls.Ptr = cret return cls } var xButtonContentGetCanShrink func(uintptr) bool // gets whether the button can be smaller than the natural size of its contents. func (x *ButtonContent) GetCanShrink() bool { cret := xButtonContentGetCanShrink(x.GoPointer()) return cret } var xButtonContentGetIconName func(uintptr) string // Gets the name of the displayed icon. func (x *ButtonContent) GetIconName() string { cret := xButtonContentGetIconName(x.GoPointer()) return cret } var xButtonContentGetLabel func(uintptr) string // Gets the displayed label. func (x *ButtonContent) GetLabel() string { cret := xButtonContentGetLabel(x.GoPointer()) return cret } var xButtonContentGetUseUnderline func(uintptr) bool // Gets whether an underline in the text indicates a mnemonic. func (x *ButtonContent) GetUseUnderline() bool { cret := xButtonContentGetUseUnderline(x.GoPointer()) return cret } var xButtonContentSetCanShrink func(uintptr, bool) // Sets whether the button can be smaller than the natural size of its contents. // // If set to `TRUE`, the label will ellipsize. // // See [method@Gtk.Button.set_can_shrink]. func (x *ButtonContent) SetCanShrink(CanShrinkVar bool) { xButtonContentSetCanShrink(x.GoPointer(), CanShrinkVar) } var xButtonContentSetIconName func(uintptr, string) // Sets the name of the displayed icon. // // If empty, the icon is not shown. func (x *ButtonContent) SetIconName(IconNameVar string) { xButtonContentSetIconName(x.GoPointer(), IconNameVar) } var xButtonContentSetLabel func(uintptr, string) // Sets the displayed label. func (x *ButtonContent) SetLabel(LabelVar string) { xButtonContentSetLabel(x.GoPointer(), LabelVar) } var xButtonContentSetUseUnderline func(uintptr, bool) // Sets whether an underline in the text indicates a mnemonic. // // The mnemonic can be used to activate the parent button. // // See [property@ButtonContent:label]. func (x *ButtonContent) SetUseUnderline(UseUnderlineVar bool) { xButtonContentSetUseUnderline(x.GoPointer(), UseUnderlineVar) } func (c *ButtonContent) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *ButtonContent) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyCanShrink sets the "can-shrink" property. // Whether the button can be smaller than the natural size of its contents. // // If set to `TRUE`, the label will ellipsize. // // See [property@Gtk.Button:can-shrink]. func (x *ButtonContent) SetPropertyCanShrink(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("can-shrink", &v) } // GetPropertyCanShrink gets the "can-shrink" property. // Whether the button can be smaller than the natural size of its contents. // // If set to `TRUE`, the label will ellipsize. // // See [property@Gtk.Button:can-shrink]. func (x *ButtonContent) GetPropertyCanShrink() bool { var v gobject.Value x.GetProperty("can-shrink", &v) return v.GetBoolean() } // SetPropertyIconName sets the "icon-name" property. // The name of the displayed icon. // // If empty, the icon is not shown. func (x *ButtonContent) 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 the displayed icon. // // If empty, the icon is not shown. func (x *ButtonContent) GetPropertyIconName() string { var v gobject.Value x.GetProperty("icon-name", &v) return v.GetString() } // SetPropertyLabel sets the "label" property. // The displayed label. func (x *ButtonContent) SetPropertyLabel(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("label", &v) } // GetPropertyLabel gets the "label" property. // The displayed label. func (x *ButtonContent) GetPropertyLabel() string { var v gobject.Value x.GetProperty("label", &v) return v.GetString() } // SetPropertyUseUnderline sets the "use-underline" property. // Whether an underline in the text indicates a mnemonic. // // The mnemonic can be used to activate the parent button. // // See [property@ButtonContent:label]. func (x *ButtonContent) SetPropertyUseUnderline(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("use-underline", &v) } // GetPropertyUseUnderline gets the "use-underline" property. // Whether an underline in the text indicates a mnemonic. // // The mnemonic can be used to activate the parent button. // // See [property@ButtonContent:label]. func (x *ButtonContent) GetPropertyUseUnderline() bool { var v gobject.Value x.GetProperty("use-underline", &v) return v.GetBoolean() } // 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 *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) GetAccessibleRole() gtk.AccessibleRole { cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool { cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *ButtonContent) ResetProperty(PropertyVar gtk.AccessibleProperty) { gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *ButtonContent) ResetRelation(RelationVar gtk.AccessibleRelation) { gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) 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 *ButtonContent) 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(&xButtonContentGLibType, libs, "adw_button_content_get_type") core.PuregoSafeRegister(&xNewButtonContent, libs, "adw_button_content_new") core.PuregoSafeRegister(&xButtonContentGetCanShrink, libs, "adw_button_content_get_can_shrink") core.PuregoSafeRegister(&xButtonContentGetIconName, libs, "adw_button_content_get_icon_name") core.PuregoSafeRegister(&xButtonContentGetLabel, libs, "adw_button_content_get_label") core.PuregoSafeRegister(&xButtonContentGetUseUnderline, libs, "adw_button_content_get_use_underline") core.PuregoSafeRegister(&xButtonContentSetCanShrink, libs, "adw_button_content_set_can_shrink") core.PuregoSafeRegister(&xButtonContentSetIconName, libs, "adw_button_content_set_icon_name") core.PuregoSafeRegister(&xButtonContentSetLabel, libs, "adw_button_content_set_label") core.PuregoSafeRegister(&xButtonContentSetUseUnderline, libs, "adw_button_content_set_use_underline") }