// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "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" ) // A `GtkComboBoxText` is a simple variant of `GtkComboBox` for text-only // use cases. // // <picture> // // <source srcset="combo-box-text-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An example GtkComboBoxText" src="combo-box-text.png"> // // </picture> // // `GtkComboBoxText` hides the model-view complexity of `GtkComboBox`. // // To create a `GtkComboBoxText`, use [ctor@Gtk.ComboBoxText.new] or // [ctor@Gtk.ComboBoxText.new_with_entry]. // // You can add items to a `GtkComboBoxText` with // [method@Gtk.ComboBoxText.append_text], // [method@Gtk.ComboBoxText.insert_text] or // [method@Gtk.ComboBoxText.prepend_text] and remove options with // [method@Gtk.ComboBoxText.remove]. // // If the `GtkComboBoxText` contains an entry (via the // [property@Gtk.ComboBox:has-entry] property), its contents can be retrieved // using [method@Gtk.ComboBoxText.get_active_text]. // // You should not call [method@Gtk.ComboBox.set_model] or attempt to pack more // cells into this combo box via its [iface@Gtk.CellLayout] interface. // // ## GtkComboBoxText as GtkBuildable // // The `GtkComboBoxText` implementation of the `GtkBuildable` interface supports // adding items directly using the `<items>` element and specifying `<item>` // elements for each item. Each `<item>` element can specify the “id” // corresponding to the appended text and also supports the regular // translation attributes “translatable”, “context” and “comments”. // // Here is a UI definition fragment specifying `GtkComboBoxText` items: // ```xml // <object class="GtkComboBoxText"> // // <items> // <item translatable="yes" id="factory">Factory</item> // <item translatable="yes" id="home">Home</item> // <item translatable="yes" id="subway">Subway</item> // </items> // // </object> // ``` // // ## CSS nodes // // ``` // combobox // ╰── box.linked // // ├── entry.combo // ├── button.combo // ╰── window.popup // // ``` // // `GtkComboBoxText` has a single CSS node with name combobox. It adds // the style class .combo to the main CSS nodes of its entry and button // children, and the .linked class to the node of its internal box. type ComboBoxText struct { ComboBox } var xComboBoxTextGLibType func() types.GType func ComboBoxTextGLibType() types.GType { return xComboBoxTextGLibType() } func ComboBoxTextNewFromInternalPtr(ptr uintptr) *ComboBoxText { cls := &ComboBoxText{} cls.Ptr = ptr return cls } var xNewComboBoxText func() uintptr // Creates a new `GtkComboBoxText`. func NewComboBoxText() *ComboBoxText { var cls *ComboBoxText cret := xNewComboBoxText() if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &ComboBoxText{} cls.Ptr = cret return cls } var xNewComboBoxTextWithEntry func() uintptr // Creates a new `GtkComboBoxText` with an entry. func NewComboBoxTextWithEntry() *ComboBoxText { var cls *ComboBoxText cret := xNewComboBoxTextWithEntry() if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &ComboBoxText{} cls.Ptr = cret return cls } var xComboBoxTextAppend func(uintptr, uintptr, string) // Appends @text to the list of strings stored in @combo_box. // // If @id is non-%NULL then it is used as the ID of the row. // // This is the same as calling [method@Gtk.ComboBoxText.insert] // with a position of -1. func (x *ComboBoxText) Append(IdVar *string, TextVar string) { IdVarPtr := core.GStrdupNullable(IdVar) defer core.GFreeNullable(IdVarPtr) xComboBoxTextAppend(x.GoPointer(), IdVarPtr, TextVar) } var xComboBoxTextAppendText func(uintptr, string) // Appends @text to the list of strings stored in @combo_box. // // This is the same as calling [method@Gtk.ComboBoxText.insert_text] // with a position of -1. func (x *ComboBoxText) AppendText(TextVar string) { xComboBoxTextAppendText(x.GoPointer(), TextVar) } var xComboBoxTextGetActiveText func(uintptr) string // Returns the currently active string in @combo_box. // // If no row is currently selected, %NULL is returned. // If @combo_box contains an entry, this function will // return its contents (which will not necessarily // be an item from the list). func (x *ComboBoxText) GetActiveText() string { cret := xComboBoxTextGetActiveText(x.GoPointer()) return cret } var xComboBoxTextInsert func(uintptr, int, uintptr, string) // Inserts @text at @position in the list of strings stored in @combo_box. // // If @id is non-%NULL then it is used as the ID of the row. // See [property@Gtk.ComboBox:id-column]. // // If @position is negative then @text is appended. func (x *ComboBoxText) Insert(PositionVar int, IdVar *string, TextVar string) { IdVarPtr := core.GStrdupNullable(IdVar) defer core.GFreeNullable(IdVarPtr) xComboBoxTextInsert(x.GoPointer(), PositionVar, IdVarPtr, TextVar) } var xComboBoxTextInsertText func(uintptr, int, string) // Inserts @text at @position in the list of strings stored in @combo_box. // // If @position is negative then @text is appended. // // This is the same as calling [method@Gtk.ComboBoxText.insert] // with a %NULL ID string. func (x *ComboBoxText) InsertText(PositionVar int, TextVar string) { xComboBoxTextInsertText(x.GoPointer(), PositionVar, TextVar) } var xComboBoxTextPrepend func(uintptr, uintptr, string) // Prepends @text to the list of strings stored in @combo_box. // // If @id is non-%NULL then it is used as the ID of the row. // // This is the same as calling [method@Gtk.ComboBoxText.insert] // with a position of 0. func (x *ComboBoxText) Prepend(IdVar *string, TextVar string) { IdVarPtr := core.GStrdupNullable(IdVar) defer core.GFreeNullable(IdVarPtr) xComboBoxTextPrepend(x.GoPointer(), IdVarPtr, TextVar) } var xComboBoxTextPrependText func(uintptr, string) // Prepends @text to the list of strings stored in @combo_box. // // This is the same as calling [method@Gtk.ComboBoxText.insert_text] // with a position of 0. func (x *ComboBoxText) PrependText(TextVar string) { xComboBoxTextPrependText(x.GoPointer(), TextVar) } var xComboBoxTextRemove func(uintptr, int) // Removes the string at @position from @combo_box. func (x *ComboBoxText) Remove(PositionVar int) { xComboBoxTextRemove(x.GoPointer(), PositionVar) } var xComboBoxTextRemoveAll func(uintptr) // Removes all the text entries from the combo box. func (x *ComboBoxText) RemoveAll() { xComboBoxTextRemoveAll(x.GoPointer()) } func (c *ComboBoxText) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *ComboBoxText) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // 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 *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *ComboBoxText) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *ComboBoxText) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) 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 *ComboBoxText) GetBuildableId() string { cret := XGtkBuildableGetBuildableId(x.GoPointer()) return cret } // Emits the `GtkCellEditable::editing-done` signal. func (x *ComboBoxText) EditingDone() { XGtkCellEditableEditingDone(x.GoPointer()) } // Emits the `GtkCellEditable::remove-widget` signal. func (x *ComboBoxText) RemoveWidget() { XGtkCellEditableRemoveWidget(x.GoPointer()) } // Begins editing on a @cell_editable. // // The `GtkCellRenderer` for the cell creates and returns a `GtkCellEditable` from // gtk_cell_renderer_start_editing(), configured for the `GtkCellRenderer` type. // // gtk_cell_editable_start_editing() can then set up @cell_editable suitably for // editing a cell, e.g. making the Esc key emit `GtkCellEditable::editing-done`. // // Note that the @cell_editable is created on-demand for the current edit; its // lifetime is temporary and does not persist across other edits and/or cells. func (x *ComboBoxText) StartEditing(EventVar *gdk.Event) { XGtkCellEditableStartEditing(x.GoPointer(), EventVar.GoPointer()) } // Adds an attribute mapping to the list in @cell_layout. // // The @column is the column of the model to get a value from, and the // @attribute is the property on @cell to be set from that value. So for // example if column 2 of the model contains strings, you could have the // “text” attribute of a `GtkCellRendererText` get its values from column 2. // In this context "attribute" and "property" are used interchangeably. func (x *ComboBoxText) AddAttribute(CellVar *CellRenderer, AttributeVar string, ColumnVar int) { XGtkCellLayoutAddAttribute(x.GoPointer(), CellVar.GoPointer(), AttributeVar, ColumnVar) } // Unsets all the mappings on all renderers on @cell_layout and // removes all renderers from @cell_layout. func (x *ComboBoxText) Clear() { XGtkCellLayoutClear(x.GoPointer()) } // Clears all existing attributes previously set with // gtk_cell_layout_set_attributes(). func (x *ComboBoxText) ClearAttributes(CellVar *CellRenderer) { XGtkCellLayoutClearAttributes(x.GoPointer(), CellVar.GoPointer()) } // Returns the underlying `GtkCellArea` which might be @cell_layout // if called on a `GtkCellArea` or might be %NULL if no `GtkCellArea` // is used by @cell_layout. func (x *ComboBoxText) GetArea() *CellArea { var cls *CellArea cret := XGtkCellLayoutGetArea(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &CellArea{} cls.Ptr = cret return cls } // Returns the cell renderers which have been added to @cell_layout. func (x *ComboBoxText) GetCells() *glib.List { cret := XGtkCellLayoutGetCells(x.GoPointer()) return cret } // Adds the @cell to the end of @cell_layout. If @expand is %FALSE, then the // @cell is allocated no more space than it needs. Any unused space is // divided evenly between cells for which @expand is %TRUE. // // Note that reusing the same cell renderer is not supported. func (x *ComboBoxText) PackEnd(CellVar *CellRenderer, ExpandVar bool) { XGtkCellLayoutPackEnd(x.GoPointer(), CellVar.GoPointer(), ExpandVar) } // Packs the @cell into the beginning of @cell_layout. If @expand is %FALSE, // then the @cell is allocated no more space than it needs. Any unused space // is divided evenly between cells for which @expand is %TRUE. // // Note that reusing the same cell renderer is not supported. func (x *ComboBoxText) PackStart(CellVar *CellRenderer, ExpandVar bool) { XGtkCellLayoutPackStart(x.GoPointer(), CellVar.GoPointer(), ExpandVar) } // Re-inserts @cell at @position. // // Note that @cell has already to be packed into @cell_layout // for this to function properly. func (x *ComboBoxText) Reorder(CellVar *CellRenderer, PositionVar int) { XGtkCellLayoutReorder(x.GoPointer(), CellVar.GoPointer(), PositionVar) } // Sets the attributes in the parameter list as the attributes // of @cell_layout. // // See [method@Gtk.CellLayout.add_attribute] for more details. // // The attributes should be in attribute/column order, as in // gtk_cell_layout_add_attribute(). All existing attributes are // removed, and replaced with the new attributes. func (x *ComboBoxText) SetAttributes(CellVar *CellRenderer, varArgs ...interface{}) { XGtkCellLayoutSetAttributes(x.GoPointer(), CellVar.GoPointer(), varArgs...) } // Sets the `GtkCellLayout`DataFunc to use for @cell_layout. // // This function is used instead of the standard attributes mapping // for setting the column value, and should set the value of @cell_layout’s // cell renderer(s) as appropriate. // // @func may be %NULL to remove a previously set function. func (x *ComboBoxText) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) { XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallbackNullable(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar)) } 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(&xComboBoxTextGLibType, libs, "gtk_combo_box_text_get_type") core.PuregoSafeRegister(&xNewComboBoxText, libs, "gtk_combo_box_text_new") core.PuregoSafeRegister(&xNewComboBoxTextWithEntry, libs, "gtk_combo_box_text_new_with_entry") core.PuregoSafeRegister(&xComboBoxTextAppend, libs, "gtk_combo_box_text_append") core.PuregoSafeRegister(&xComboBoxTextAppendText, libs, "gtk_combo_box_text_append_text") core.PuregoSafeRegister(&xComboBoxTextGetActiveText, libs, "gtk_combo_box_text_get_active_text") core.PuregoSafeRegister(&xComboBoxTextInsert, libs, "gtk_combo_box_text_insert") core.PuregoSafeRegister(&xComboBoxTextInsertText, libs, "gtk_combo_box_text_insert_text") core.PuregoSafeRegister(&xComboBoxTextPrepend, libs, "gtk_combo_box_text_prepend") core.PuregoSafeRegister(&xComboBoxTextPrependText, libs, "gtk_combo_box_text_prepend_text") core.PuregoSafeRegister(&xComboBoxTextRemove, libs, "gtk_combo_box_text_remove") core.PuregoSafeRegister(&xComboBoxTextRemoveAll, libs, "gtk_combo_box_text_remove_all") }