// 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/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type TreeExpanderClass struct { _ structs.HostLayout ParentClass WidgetClass } func (x *TreeExpanderClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // Provides an expander for a tree-like list. // // It is typically placed as a bottommost child into a `GtkListView` // to allow users to expand and collapse children in a list with a // [class@Gtk.TreeListModel]. `GtkTreeExpander` provides the common UI // elements, gestures and keybindings for this purpose. // // On top of this, the "listitem.expand", "listitem.collapse" and // "listitem.toggle-expand" actions are provided to allow adding custom // UI for managing expanded state. // // It is important to mention that you want to set the // [property@Gtk.ListItem:focusable] property to FALSE when using this // widget, as you want the keyboard focus to be in the treexpander, and not // inside the list to make use of the keybindings. // // The `GtkTreeListModel` must be set to not be passthrough. Then it // will provide [class@Gtk.TreeListRow] items which can be set via // [method@Gtk.TreeExpander.set_list_row] on the expander. // The expander will then watch that row item automatically. // [method@Gtk.TreeExpander.set_child] sets the widget that displays // the actual row contents. // // `GtkTreeExpander` can be modified with properties such as // [property@Gtk.TreeExpander:indent-for-icon], // [property@Gtk.TreeExpander:indent-for-depth], and // [property@Gtk.TreeExpander:hide-expander] to achieve a different appearance. // This can even be done to influence individual rows, for example by binding // the [property@Gtk.TreeExpander:hide-expander] property to the item count of // the model of the treelistrow, to hide the expander for rows without children, // even if the row is expandable. // // ## Shortcuts and Gestures // // `GtkTreeExpander` supports the following keyboard shortcuts: // // - <kbd>+</kbd> or <kbd>*</kbd> expands the expander. // - <kbd>-</kbd> or <kbd>/</kbd> collapses the expander. // - Left and right arrow keys, when combined with <kbd>Shift</kbd> or // <kbd>Ctrl</kbd>+<kbd>Shift</kbd>, will expand or collapse, depending on // the locale's text direction. // - <kbd>Ctrl</kbd>+<kbd>␣</kbd> toggles the expander state. // // The row can also expand on drag gestures. // // ## Actions // // `GtkTreeExpander` defines a set of built-in actions: // // - `listitem.expand` expands the expander if it can be expanded. // - `listitem.collapse` collapses the expander. // - `listitem.toggle-expand` tries to expand the expander if it was collapsed // or collapses it if it was expanded. // // ## CSS nodes // // ``` // treeexpander // ├── [indent]* // ├── [expander] // ╰── <child> // ``` // // `GtkTreeExpander` has zero or one CSS nodes with the name "expander" that // should display the expander icon. The node will be `:checked` when it // is expanded. If the node is not expandable, an "indent" node will be // displayed instead. // // For every level of depth, another "indent" node is prepended. // // ## Accessibility // // Until GTK 4.10, `GtkTreeExpander` used the [enum@Gtk.AccessibleRole.group] role. // // Since GTK 4.12, `GtkTreeExpander` uses the [enum@Gtk.AccessibleRole.button] role. // Toggling it will change the `GTK_ACCESSIBLE_STATE_EXPANDED` state. type TreeExpander struct { Widget } var xTreeExpanderGLibType func() types.GType func TreeExpanderGLibType() types.GType { return xTreeExpanderGLibType() } func TreeExpanderNewFromInternalPtr(ptr uintptr) *TreeExpander { cls := &TreeExpander{} cls.Ptr = ptr return cls } var xNewTreeExpander func() uintptr // Creates a new `GtkTreeExpander` func NewTreeExpander() *TreeExpander { var cls *TreeExpander cret := xNewTreeExpander() if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &TreeExpander{} cls.Ptr = cret return cls } var xTreeExpanderGetChild func(uintptr) uintptr // Gets the child widget displayed by @self. func (x *TreeExpander) GetChild() *Widget { var cls *Widget cret := xTreeExpanderGetChild(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Widget{} cls.Ptr = cret return cls } var xTreeExpanderGetHideExpander func(uintptr) bool // Gets whether the TreeExpander should be hidden in a GtkTreeListRow. func (x *TreeExpander) GetHideExpander() bool { cret := xTreeExpanderGetHideExpander(x.GoPointer()) return cret } var xTreeExpanderGetIndentForDepth func(uintptr) bool // TreeExpander indents each level of depth with an additional indent. func (x *TreeExpander) GetIndentForDepth() bool { cret := xTreeExpanderGetIndentForDepth(x.GoPointer()) return cret } var xTreeExpanderGetIndentForIcon func(uintptr) bool // TreeExpander indents the child by the width of an expander-icon if it is not expandable. func (x *TreeExpander) GetIndentForIcon() bool { cret := xTreeExpanderGetIndentForIcon(x.GoPointer()) return cret } var xTreeExpanderGetItem func(uintptr) uintptr // Forwards the item set on the `GtkTreeListRow` that @self is managing. // // This call is essentially equivalent to calling: // // ```c // gtk_tree_list_row_get_item (gtk_tree_expander_get_list_row (@self)); // ``` func (x *TreeExpander) GetItem() *gobject.Object { var cls *gobject.Object cret := xTreeExpanderGetItem(x.GoPointer()) if cret == 0 { return nil } cls = &gobject.Object{} cls.Ptr = cret return cls } var xTreeExpanderGetListRow func(uintptr) uintptr // Gets the list row managed by @self. func (x *TreeExpander) GetListRow() *TreeListRow { var cls *TreeListRow cret := xTreeExpanderGetListRow(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &TreeListRow{} cls.Ptr = cret return cls } var xTreeExpanderSetChild func(uintptr, uintptr) // Sets the content widget to display. func (x *TreeExpander) SetChild(ChildVar *Widget) { xTreeExpanderSetChild(x.GoPointer(), ChildVar.GoPointer()) } var xTreeExpanderSetHideExpander func(uintptr, bool) // Sets whether the expander icon should be visible in a GtkTreeListRow. func (x *TreeExpander) SetHideExpander(HideExpanderVar bool) { xTreeExpanderSetHideExpander(x.GoPointer(), HideExpanderVar) } var xTreeExpanderSetIndentForDepth func(uintptr, bool) // Sets if the TreeExpander should indent the child according to its depth. func (x *TreeExpander) SetIndentForDepth(IndentForDepthVar bool) { xTreeExpanderSetIndentForDepth(x.GoPointer(), IndentForDepthVar) } var xTreeExpanderSetIndentForIcon func(uintptr, bool) // Sets if the TreeExpander should indent the child by the width of an expander-icon when it is not expandable. func (x *TreeExpander) SetIndentForIcon(IndentForIconVar bool) { xTreeExpanderSetIndentForIcon(x.GoPointer(), IndentForIconVar) } var xTreeExpanderSetListRow func(uintptr, uintptr) // Sets the tree list row that this expander should manage. func (x *TreeExpander) SetListRow(ListRowVar *TreeListRow) { xTreeExpanderSetListRow(x.GoPointer(), ListRowVar.GoPointer()) } func (c *TreeExpander) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *TreeExpander) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyHideExpander sets the "hide-expander" property. // Whether the expander icon should be hidden in a GtkTreeListRow. // Note that this property simply hides the icon. The actions and keybinding // (i.e. collapse and expand) are not affected by this property. // // A common use for this property would be to bind to the number of children in a // GtkTreeListRow's model in order to hide the expander when a row has no children. func (x *TreeExpander) SetPropertyHideExpander(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("hide-expander", &v) } // GetPropertyHideExpander gets the "hide-expander" property. // Whether the expander icon should be hidden in a GtkTreeListRow. // Note that this property simply hides the icon. The actions and keybinding // (i.e. collapse and expand) are not affected by this property. // // A common use for this property would be to bind to the number of children in a // GtkTreeListRow's model in order to hide the expander when a row has no children. func (x *TreeExpander) GetPropertyHideExpander() bool { var v gobject.Value x.GetProperty("hide-expander", &v) return v.GetBoolean() } // SetPropertyIndentForDepth sets the "indent-for-depth" property. // TreeExpander indents the child according to its depth. func (x *TreeExpander) SetPropertyIndentForDepth(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("indent-for-depth", &v) } // GetPropertyIndentForDepth gets the "indent-for-depth" property. // TreeExpander indents the child according to its depth. func (x *TreeExpander) GetPropertyIndentForDepth() bool { var v gobject.Value x.GetProperty("indent-for-depth", &v) return v.GetBoolean() } // SetPropertyIndentForIcon sets the "indent-for-icon" property. // TreeExpander indents the child by the width of an expander-icon if it is not expandable. func (x *TreeExpander) SetPropertyIndentForIcon(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("indent-for-icon", &v) } // GetPropertyIndentForIcon gets the "indent-for-icon" property. // TreeExpander indents the child by the width of an expander-icon if it is not expandable. func (x *TreeExpander) GetPropertyIndentForIcon() bool { var v gobject.Value x.GetProperty("indent-for-icon", &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 *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *TreeExpander) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *TreeExpander) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) 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 *TreeExpander) 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(&xTreeExpanderGLibType, libs, "gtk_tree_expander_get_type") core.PuregoSafeRegister(&xNewTreeExpander, libs, "gtk_tree_expander_new") core.PuregoSafeRegister(&xTreeExpanderGetChild, libs, "gtk_tree_expander_get_child") core.PuregoSafeRegister(&xTreeExpanderGetHideExpander, libs, "gtk_tree_expander_get_hide_expander") core.PuregoSafeRegister(&xTreeExpanderGetIndentForDepth, libs, "gtk_tree_expander_get_indent_for_depth") core.PuregoSafeRegister(&xTreeExpanderGetIndentForIcon, libs, "gtk_tree_expander_get_indent_for_icon") core.PuregoSafeRegister(&xTreeExpanderGetItem, libs, "gtk_tree_expander_get_item") core.PuregoSafeRegister(&xTreeExpanderGetListRow, libs, "gtk_tree_expander_get_list_row") core.PuregoSafeRegister(&xTreeExpanderSetChild, libs, "gtk_tree_expander_set_child") core.PuregoSafeRegister(&xTreeExpanderSetHideExpander, libs, "gtk_tree_expander_set_hide_expander") core.PuregoSafeRegister(&xTreeExpanderSetIndentForDepth, libs, "gtk_tree_expander_set_indent_for_depth") core.PuregoSafeRegister(&xTreeExpanderSetIndentForIcon, libs, "gtk_tree_expander_set_indent_for_icon") core.PuregoSafeRegister(&xTreeExpanderSetListRow, libs, "gtk_tree_expander_set_list_row") }