// 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/gobject" "github.com/bnema/puregotk/v4/gobject/types" "github.com/bnema/puregotk/v4/pango" ) // Displays the progress of a long-running operation. // // `GtkProgressBar` provides a visual clue that processing is underway. // It can be used in two different modes: percentage mode and activity mode. // // <picture> // // <source srcset="progressbar-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An example GtkProgressBar" src="progressbar.png"> // // </picture> // // When an application can determine how much work needs to take place // (e.g. read a fixed number of bytes from a file) and can monitor its // progress, it can use the `GtkProgressBar` in percentage mode and the // user sees a growing bar indicating the percentage of the work that // has been completed. In this mode, the application is required to call // [method@Gtk.ProgressBar.set_fraction] periodically to update the progress bar. // // When an application has no accurate way of knowing the amount of work // to do, it can use the `GtkProgressBar` in activity mode, which shows // activity by a block moving back and forth within the progress area. In // this mode, the application is required to call [method@Gtk.ProgressBar.pulse] // periodically to update the progress bar. // // There is quite a bit of flexibility provided to control the appearance // of the `GtkProgressBar`. Functions are provided to control the orientation // of the bar, optional text can be displayed along with the bar, and the // step size used in activity mode can be set. // // # CSS nodes // // ``` // progressbar[.osd] // ├── [text] // ╰── trough[.empty][.full] // // ╰── progress[.pulse] // // ``` // // `GtkProgressBar` has a main CSS node with name progressbar and subnodes with // names text and trough, of which the latter has a subnode named progress. The // text subnode is only present if text is shown. The progress subnode has the // style class .pulse when in activity mode. It gets the style classes .left, // .right, .top or .bottom added when the progress 'touches' the corresponding // end of the GtkProgressBar. The .osd class on the progressbar node is for use // in overlays like the one Epiphany has for page loading progress. // // # Accessibility // // `GtkProgressBar` uses the [enum@Gtk.AccessibleRole.progress_bar] role // and sets the [enum@Gtk.AccessibleProperty.value_min], [enum@Gtk.AccessibleProperty.value_max] and [enum@Gtk.AccessibleProperty.value_now] properties to reflect // the progress. type ProgressBar struct { Widget } var xProgressBarGLibType func() types.GType func ProgressBarGLibType() types.GType { return xProgressBarGLibType() } func ProgressBarNewFromInternalPtr(ptr uintptr) *ProgressBar { cls := &ProgressBar{} cls.Ptr = ptr return cls } var xNewProgressBar func() uintptr // Creates a new `GtkProgressBar`. func NewProgressBar() *ProgressBar { var cls *ProgressBar cret := xNewProgressBar() if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &ProgressBar{} cls.Ptr = cret return cls } var xProgressBarGetEllipsize func(uintptr) pango.EllipsizeMode // Returns the ellipsizing position of the progress bar. // // See [method@Gtk.ProgressBar.set_ellipsize]. func (x *ProgressBar) GetEllipsize() pango.EllipsizeMode { cret := xProgressBarGetEllipsize(x.GoPointer()) return cret } var xProgressBarGetFraction func(uintptr) float64 // Returns the current fraction of the task that’s been completed. func (x *ProgressBar) GetFraction() float64 { cret := xProgressBarGetFraction(x.GoPointer()) return cret } var xProgressBarGetInverted func(uintptr) bool // Returns whether the progress bar is inverted. func (x *ProgressBar) GetInverted() bool { cret := xProgressBarGetInverted(x.GoPointer()) return cret } var xProgressBarGetPulseStep func(uintptr) float64 // Retrieves the pulse step. // // See [method@Gtk.ProgressBar.set_pulse_step]. func (x *ProgressBar) GetPulseStep() float64 { cret := xProgressBarGetPulseStep(x.GoPointer()) return cret } var xProgressBarGetShowText func(uintptr) bool // Returns whether the `GtkProgressBar` shows text. // // See [method@Gtk.ProgressBar.set_show_text]. func (x *ProgressBar) GetShowText() bool { cret := xProgressBarGetShowText(x.GoPointer()) return cret } var xProgressBarGetText func(uintptr) string // Retrieves the text that is displayed with the progress bar. // // The return value is a reference to the text, not a copy of it, // so will become invalid if you change the text in the progress bar. func (x *ProgressBar) GetText() string { cret := xProgressBarGetText(x.GoPointer()) return cret } var xProgressBarPulse func(uintptr) // Indicates that some progress has been made, but you don’t know how much. // // Causes the progress bar to enter “activity mode,” where a block // bounces back and forth. Each call to [method@Gtk.ProgressBar.pulse] // causes the block to move by a little bit (the amount of movement // per pulse is determined by [method@Gtk.ProgressBar.set_pulse_step]). func (x *ProgressBar) Pulse() { xProgressBarPulse(x.GoPointer()) } var xProgressBarSetEllipsize func(uintptr, pango.EllipsizeMode) // Sets the mode used to ellipsize the text. // // The text is ellipsized if there is not enough space // to render the entire string. func (x *ProgressBar) SetEllipsize(ModeVar pango.EllipsizeMode) { xProgressBarSetEllipsize(x.GoPointer(), ModeVar) } var xProgressBarSetFraction func(uintptr, float64) // Causes the progress bar to “fill in” the given fraction // of the bar. // // The fraction should be between 0.0 and 1.0, inclusive. func (x *ProgressBar) SetFraction(FractionVar float64) { xProgressBarSetFraction(x.GoPointer(), FractionVar) } var xProgressBarSetInverted func(uintptr, bool) // Sets whether the progress bar is inverted. // // Progress bars normally grow from top to bottom or left to right. // Inverted progress bars grow in the opposite direction. func (x *ProgressBar) SetInverted(InvertedVar bool) { xProgressBarSetInverted(x.GoPointer(), InvertedVar) } var xProgressBarSetPulseStep func(uintptr, float64) // Sets the fraction of total progress bar length to move the // bouncing block. // // The bouncing block is moved when [method@Gtk.ProgressBar.pulse] // is called. func (x *ProgressBar) SetPulseStep(FractionVar float64) { xProgressBarSetPulseStep(x.GoPointer(), FractionVar) } var xProgressBarSetShowText func(uintptr, bool) // Sets whether the progress bar will show text next to the bar. // // The shown text is either the value of the [property@Gtk.ProgressBar:text] // property or, if that is %NULL, the [property@Gtk.ProgressBar:fraction] value, // as a percentage. // // To make a progress bar that is styled and sized suitably for containing // text (even if the actual text is blank), set [property@Gtk.ProgressBar:show-text] // to %TRUE and [property@Gtk.ProgressBar:text] to the empty string (not %NULL). func (x *ProgressBar) SetShowText(ShowTextVar bool) { xProgressBarSetShowText(x.GoPointer(), ShowTextVar) } var xProgressBarSetText func(uintptr, uintptr) // Causes the given @text to appear next to the progress bar. // // If @text is %NULL and [property@Gtk.ProgressBar:show-text] is %TRUE, // the current value of [property@Gtk.ProgressBar:fraction] will be displayed // as a percentage. // // If @text is non-%NULL and [property@Gtk.ProgressBar:show-text] is %TRUE, // the text will be displayed. In this case, it will not display the progress // percentage. If @text is the empty string, the progress bar will still // be styled and sized suitably for containing text, as long as // [property@Gtk.ProgressBar:show-text] is %TRUE. func (x *ProgressBar) SetText(TextVar *string) { TextVarPtr := core.GStrdupNullable(TextVar) defer core.GFreeNullable(TextVarPtr) xProgressBarSetText(x.GoPointer(), TextVarPtr) } func (c *ProgressBar) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *ProgressBar) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyFraction sets the "fraction" property. // The fraction of total work that has been completed. func (x *ProgressBar) SetPropertyFraction(value float64) { var v gobject.Value v.Init(gobject.TypeDoubleVal) v.SetDouble(value) x.SetProperty("fraction", &v) } // GetPropertyFraction gets the "fraction" property. // The fraction of total work that has been completed. func (x *ProgressBar) GetPropertyFraction() float64 { var v gobject.Value x.GetProperty("fraction", &v) return v.GetDouble() } // SetPropertyInverted sets the "inverted" property. // Invert the direction in which the progress bar grows. func (x *ProgressBar) SetPropertyInverted(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("inverted", &v) } // GetPropertyInverted gets the "inverted" property. // Invert the direction in which the progress bar grows. func (x *ProgressBar) GetPropertyInverted() bool { var v gobject.Value x.GetProperty("inverted", &v) return v.GetBoolean() } // SetPropertyPulseStep sets the "pulse-step" property. // The fraction of total progress to move the bounding block when pulsed. func (x *ProgressBar) SetPropertyPulseStep(value float64) { var v gobject.Value v.Init(gobject.TypeDoubleVal) v.SetDouble(value) x.SetProperty("pulse-step", &v) } // GetPropertyPulseStep gets the "pulse-step" property. // The fraction of total progress to move the bounding block when pulsed. func (x *ProgressBar) GetPropertyPulseStep() float64 { var v gobject.Value x.GetProperty("pulse-step", &v) return v.GetDouble() } // SetPropertyShowText sets the "show-text" property. // Sets whether the progress bar will show a text in addition // to the bar itself. // // The shown text is either the value of the [property@Gtk.ProgressBar:text] // property or, if that is %NULL, the [property@Gtk.ProgressBar:fraction] // value, as a percentage. // // To make a progress bar that is styled and sized suitably for showing text // (even if the actual text is blank), set [property@Gtk.ProgressBar:show-text] // to %TRUE and [property@Gtk.ProgressBar:text] to the empty string (not %NULL). func (x *ProgressBar) SetPropertyShowText(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("show-text", &v) } // GetPropertyShowText gets the "show-text" property. // Sets whether the progress bar will show a text in addition // to the bar itself. // // The shown text is either the value of the [property@Gtk.ProgressBar:text] // property or, if that is %NULL, the [property@Gtk.ProgressBar:fraction] // value, as a percentage. // // To make a progress bar that is styled and sized suitably for showing text // (even if the actual text is blank), set [property@Gtk.ProgressBar:show-text] // to %TRUE and [property@Gtk.ProgressBar:text] to the empty string (not %NULL). func (x *ProgressBar) GetPropertyShowText() bool { var v gobject.Value x.GetProperty("show-text", &v) return v.GetBoolean() } // SetPropertyText sets the "text" property. // Text to be displayed in the progress bar. func (x *ProgressBar) SetPropertyText(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("text", &v) } // GetPropertyText gets the "text" property. // Text to be displayed in the progress bar. func (x *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *ProgressBar) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *ProgressBar) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) 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 *ProgressBar) GetBuildableId() string { cret := XGtkBuildableGetBuildableId(x.GoPointer()) return cret } // Retrieves the orientation of the @orientable. func (x *ProgressBar) GetOrientation() Orientation { cret := XGtkOrientableGetOrientation(x.GoPointer()) return cret } // Sets the orientation of the @orientable. func (x *ProgressBar) SetOrientation(OrientationVar Orientation) { XGtkOrientableSetOrientation(x.GoPointer(), OrientationVar) } 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(&xProgressBarGLibType, libs, "gtk_progress_bar_get_type") core.PuregoSafeRegister(&xNewProgressBar, libs, "gtk_progress_bar_new") core.PuregoSafeRegister(&xProgressBarGetEllipsize, libs, "gtk_progress_bar_get_ellipsize") core.PuregoSafeRegister(&xProgressBarGetFraction, libs, "gtk_progress_bar_get_fraction") core.PuregoSafeRegister(&xProgressBarGetInverted, libs, "gtk_progress_bar_get_inverted") core.PuregoSafeRegister(&xProgressBarGetPulseStep, libs, "gtk_progress_bar_get_pulse_step") core.PuregoSafeRegister(&xProgressBarGetShowText, libs, "gtk_progress_bar_get_show_text") core.PuregoSafeRegister(&xProgressBarGetText, libs, "gtk_progress_bar_get_text") core.PuregoSafeRegister(&xProgressBarPulse, libs, "gtk_progress_bar_pulse") core.PuregoSafeRegister(&xProgressBarSetEllipsize, libs, "gtk_progress_bar_set_ellipsize") core.PuregoSafeRegister(&xProgressBarSetFraction, libs, "gtk_progress_bar_set_fraction") core.PuregoSafeRegister(&xProgressBarSetInverted, libs, "gtk_progress_bar_set_inverted") core.PuregoSafeRegister(&xProgressBarSetPulseStep, libs, "gtk_progress_bar_set_pulse_step") core.PuregoSafeRegister(&xProgressBarSetShowText, libs, "gtk_progress_bar_set_show_text") core.PuregoSafeRegister(&xProgressBarSetText, libs, "gtk_progress_bar_set_text") }