// 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" ) // Allows the user to reveal or conceal a child widget. // // <picture> // // <source srcset="expander-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An example GtkExpander" src="expander.png"> // // </picture> // // This is similar to the triangles used in a `GtkTreeView`. // // Normally you use an expander as you would use a frame; you create // the child widget and use [method@Gtk.Expander.set_child] to add it // to the expander. When the expander is toggled, it will take care of // showing and hiding the child automatically. // // # Special Usage // // There are situations in which you may prefer to show and hide the // expanded widget yourself, such as when you want to actually create // the widget at expansion time. In this case, create a `GtkExpander` // but do not add a child to it. The expander widget has an // [property@Gtk.Expander:expanded] property which can be used to // monitor its expansion state. You should watch this property with // a signal connection as follows: // // ```c // static void // expander_callback (GObject *object, // // GParamSpec *param_spec, // gpointer user_data) // // { // GtkExpander *expander; // // expander = GTK_EXPANDER (object); // // if (gtk_expander_get_expanded (expander)) // { // // Show or create widgets // } // else // { // // Hide or destroy widgets // } // } // // static void // create_expander (void) // // { // GtkWidget *expander = gtk_expander_new_with_mnemonic ("_More Options"); // g_signal_connect (expander, "notify::expanded", // G_CALLBACK (expander_callback), NULL); // // // ... // } // // ``` // // # GtkExpander as GtkBuildable // // An example of a UI definition fragment with GtkExpander: // // ```xml // <object class="GtkExpander"> // // <property name="label-widget"> // <object class="GtkLabel" id="expander-label"/> // </property> // <property name="child"> // <object class="GtkEntry" id="expander-content"/> // </property> // // </object> // ``` // // # CSS nodes // // ``` // expander-widget // ╰── box // // ├── title // │ ├── expander // │ ╰── <label widget> // ╰── <child> // // ``` // // `GtkExpander` has a main node `expander-widget`, and subnode `box` containing // the title and child widget. The box subnode `title` contains node `expander`, // i.e. the expand/collapse arrow; then the label widget if any. The arrow of an // expander that is showing its child gets the `:checked` pseudoclass set on it. // // # Accessibility // // `GtkExpander` uses the [enum@Gtk.AccessibleRole.button] role. type Expander struct { Widget } var xExpanderGLibType func() types.GType func ExpanderGLibType() types.GType { return xExpanderGLibType() } func ExpanderNewFromInternalPtr(ptr uintptr) *Expander { cls := &Expander{} cls.Ptr = ptr return cls } var xNewExpander func(uintptr) uintptr // Creates a new expander using @label as the text of the label. func NewExpander(LabelVar *string) *Expander { var cls *Expander LabelVarPtr := core.GStrdupNullable(LabelVar) defer core.GFreeNullable(LabelVarPtr) cret := xNewExpander(LabelVarPtr) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Expander{} cls.Ptr = cret return cls } var xNewExpanderWithMnemonic func(uintptr) uintptr // Creates a new expander using @label as the text of the label. // // If characters in @label are preceded by an underscore, they are // underlined. If you need a literal underscore character in a label, // use “__” (two underscores). The first underlined character represents // a keyboard accelerator called a mnemonic. // // Pressing Alt and that key activates the button. func NewExpanderWithMnemonic(LabelVar *string) *Expander { var cls *Expander LabelVarPtr := core.GStrdupNullable(LabelVar) defer core.GFreeNullable(LabelVarPtr) cret := xNewExpanderWithMnemonic(LabelVarPtr) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Expander{} cls.Ptr = cret return cls } var xExpanderGetChild func(uintptr) uintptr // Gets the child widget of @expander. func (x *Expander) GetChild() *Widget { var cls *Widget cret := xExpanderGetChild(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Widget{} cls.Ptr = cret return cls } var xExpanderGetExpanded func(uintptr) bool // Queries a `GtkExpander` and returns its current state. // // Returns %TRUE if the child widget is revealed. func (x *Expander) GetExpanded() bool { cret := xExpanderGetExpanded(x.GoPointer()) return cret } var xExpanderGetLabel func(uintptr) string // Fetches the text from a label widget. // // This is including any embedded underlines indicating mnemonics and // Pango markup, as set by [method@Gtk.Expander.set_label]. If the label // text has not been set the return value will be %NULL. This will be the // case if you create an empty button with gtk_button_new() to use as a // container. func (x *Expander) GetLabel() string { cret := xExpanderGetLabel(x.GoPointer()) return cret } var xExpanderGetLabelWidget func(uintptr) uintptr // Retrieves the label widget for the frame. func (x *Expander) GetLabelWidget() *Widget { var cls *Widget cret := xExpanderGetLabelWidget(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Widget{} cls.Ptr = cret return cls } var xExpanderGetResizeToplevel func(uintptr) bool // Returns whether the expander will resize the toplevel widget // containing the expander upon resizing and collapsing. func (x *Expander) GetResizeToplevel() bool { cret := xExpanderGetResizeToplevel(x.GoPointer()) return cret } var xExpanderGetUseMarkup func(uintptr) bool // Returns whether the label’s text is interpreted as Pango markup. func (x *Expander) GetUseMarkup() bool { cret := xExpanderGetUseMarkup(x.GoPointer()) return cret } var xExpanderGetUseUnderline func(uintptr) bool // Returns whether an underline in the text indicates a mnemonic. func (x *Expander) GetUseUnderline() bool { cret := xExpanderGetUseUnderline(x.GoPointer()) return cret } var xExpanderSetChild func(uintptr, uintptr) // Sets the child widget of @expander. func (x *Expander) SetChild(ChildVar *Widget) { xExpanderSetChild(x.GoPointer(), ChildVar.GoPointer()) } var xExpanderSetExpanded func(uintptr, bool) // Sets the state of the expander. // // Set to %TRUE, if you want the child widget to be revealed, // and %FALSE if you want the child widget to be hidden. func (x *Expander) SetExpanded(ExpandedVar bool) { xExpanderSetExpanded(x.GoPointer(), ExpandedVar) } var xExpanderSetLabel func(uintptr, uintptr) // Sets the text of the label of the expander to @label. // // This will also clear any previously set labels. func (x *Expander) SetLabel(LabelVar *string) { LabelVarPtr := core.GStrdupNullable(LabelVar) defer core.GFreeNullable(LabelVarPtr) xExpanderSetLabel(x.GoPointer(), LabelVarPtr) } var xExpanderSetLabelWidget func(uintptr, uintptr) // Set the label widget for the expander. // // This is the widget that will appear embedded alongside // the expander arrow. func (x *Expander) SetLabelWidget(LabelWidgetVar *Widget) { xExpanderSetLabelWidget(x.GoPointer(), LabelWidgetVar.GoPointer()) } var xExpanderSetResizeToplevel func(uintptr, bool) // Sets whether the expander will resize the toplevel widget // containing the expander upon resizing and collapsing. func (x *Expander) SetResizeToplevel(ResizeToplevelVar bool) { xExpanderSetResizeToplevel(x.GoPointer(), ResizeToplevelVar) } var xExpanderSetUseMarkup func(uintptr, bool) // Sets whether the text of the label contains Pango markup. func (x *Expander) SetUseMarkup(UseMarkupVar bool) { xExpanderSetUseMarkup(x.GoPointer(), UseMarkupVar) } var xExpanderSetUseUnderline func(uintptr, bool) // If true, an underline in the text indicates a mnemonic. func (x *Expander) SetUseUnderline(UseUnderlineVar bool) { xExpanderSetUseUnderline(x.GoPointer(), UseUnderlineVar) } func (c *Expander) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *Expander) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyExpanded sets the "expanded" property. // Whether the expander has been opened to reveal the child. func (x *Expander) SetPropertyExpanded(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("expanded", &v) } // GetPropertyExpanded gets the "expanded" property. // Whether the expander has been opened to reveal the child. func (x *Expander) GetPropertyExpanded() bool { var v gobject.Value x.GetProperty("expanded", &v) return v.GetBoolean() } // SetPropertyLabel sets the "label" property. // The text of the expanders label. func (x *Expander) SetPropertyLabel(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("label", &v) } // GetPropertyLabel gets the "label" property. // The text of the expanders label. func (x *Expander) GetPropertyLabel() string { var v gobject.Value x.GetProperty("label", &v) return v.GetString() } // SetPropertyResizeToplevel sets the "resize-toplevel" property. // When this property is %TRUE, the expander will resize the toplevel // widget containing the expander upon expanding and collapsing. func (x *Expander) SetPropertyResizeToplevel(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("resize-toplevel", &v) } // GetPropertyResizeToplevel gets the "resize-toplevel" property. // When this property is %TRUE, the expander will resize the toplevel // widget containing the expander upon expanding and collapsing. func (x *Expander) GetPropertyResizeToplevel() bool { var v gobject.Value x.GetProperty("resize-toplevel", &v) return v.GetBoolean() } // SetPropertyUseMarkup sets the "use-markup" property. // Whether the text in the label is Pango markup. func (x *Expander) SetPropertyUseMarkup(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("use-markup", &v) } // GetPropertyUseMarkup gets the "use-markup" property. // Whether the text in the label is Pango markup. func (x *Expander) GetPropertyUseMarkup() bool { var v gobject.Value x.GetProperty("use-markup", &v) return v.GetBoolean() } // SetPropertyUseUnderline sets the "use-underline" property. // Whether an underline in the text indicates a mnemonic. func (x *Expander) 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. func (x *Expander) GetPropertyUseUnderline() bool { var v gobject.Value x.GetProperty("use-underline", &v) return v.GetBoolean() } // Activates the `GtkExpander`. func (x *Expander) ConnectActivate(cb *func(Expander)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr) { fa := Expander{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "activate", 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 *Expander) 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 *Expander) 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 *Expander) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *Expander) 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 *Expander) 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 *Expander) 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 *Expander) 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 *Expander) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *Expander) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *Expander) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *Expander) 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 *Expander) 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 *Expander) 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 *Expander) 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 *Expander) 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 *Expander) 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 *Expander) 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 *Expander) 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 *Expander) 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 *Expander) 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 *Expander) 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(&xExpanderGLibType, libs, "gtk_expander_get_type") core.PuregoSafeRegister(&xNewExpander, libs, "gtk_expander_new") core.PuregoSafeRegister(&xNewExpanderWithMnemonic, libs, "gtk_expander_new_with_mnemonic") core.PuregoSafeRegister(&xExpanderGetChild, libs, "gtk_expander_get_child") core.PuregoSafeRegister(&xExpanderGetExpanded, libs, "gtk_expander_get_expanded") core.PuregoSafeRegister(&xExpanderGetLabel, libs, "gtk_expander_get_label") core.PuregoSafeRegister(&xExpanderGetLabelWidget, libs, "gtk_expander_get_label_widget") core.PuregoSafeRegister(&xExpanderGetResizeToplevel, libs, "gtk_expander_get_resize_toplevel") core.PuregoSafeRegister(&xExpanderGetUseMarkup, libs, "gtk_expander_get_use_markup") core.PuregoSafeRegister(&xExpanderGetUseUnderline, libs, "gtk_expander_get_use_underline") core.PuregoSafeRegister(&xExpanderSetChild, libs, "gtk_expander_set_child") core.PuregoSafeRegister(&xExpanderSetExpanded, libs, "gtk_expander_set_expanded") core.PuregoSafeRegister(&xExpanderSetLabel, libs, "gtk_expander_set_label") core.PuregoSafeRegister(&xExpanderSetLabelWidget, libs, "gtk_expander_set_label_widget") core.PuregoSafeRegister(&xExpanderSetResizeToplevel, libs, "gtk_expander_set_resize_toplevel") core.PuregoSafeRegister(&xExpanderSetUseMarkup, libs, "gtk_expander_set_use_markup") core.PuregoSafeRegister(&xExpanderSetUseUnderline, libs, "gtk_expander_set_use_underline") }