// 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/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type ScaleButtonClass struct { _ structs.HostLayout ParentClass WidgetClass xValueChanged uintptr Padding [8]uintptr } func (x *ScaleButtonClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideValueChanged sets the "value_changed" callback function. func (x *ScaleButtonClass) OverrideValueChanged(cb func(*ScaleButton, float64)) { if cb == nil { x.xValueChanged = 0 } else { x.xValueChanged = purego.NewCallback(func(ButtonVarp uintptr, ValueVarp float64) { cb(ScaleButtonNewFromInternalPtr(ButtonVarp), ValueVarp) }) } } // GetValueChanged gets the "value_changed" callback function. func (x *ScaleButtonClass) GetValueChanged() func(*ScaleButton, float64) { if x.xValueChanged == 0 { return nil } var rawCallback func(ButtonVarp uintptr, ValueVarp float64) purego.RegisterFunc(&rawCallback, x.xValueChanged) return func(ButtonVar *ScaleButton, ValueVar float64) { rawCallback(ButtonVar.GoPointer(), ValueVar) } } // Provides a button which pops up a scale widget. // // This kind of widget is commonly used for volume controls in multimedia // applications, and GTK provides a [class@Gtk.VolumeButton] subclass that // is tailored for this use case. // // # Shortcuts and Gestures // // The following signals have default keybindings: // // - [signal@Gtk.ScaleButton::popup] // // # CSS nodes // // ``` // scalebutton.scale // ╰── button.toggle // // ╰── <icon> // // ``` // // `GtkScaleButton` has a single CSS node with name scalebutton and `.scale` // style class, and contains a `button` node with a `.toggle` style class. type ScaleButton struct { Widget } var xScaleButtonGLibType func() types.GType func ScaleButtonGLibType() types.GType { return xScaleButtonGLibType() } func ScaleButtonNewFromInternalPtr(ptr uintptr) *ScaleButton { cls := &ScaleButton{} cls.Ptr = ptr return cls } var xNewScaleButton func(float64, float64, float64, []string) uintptr // Creates a `GtkScaleButton`. // // The new scale button has a range between @min and @max, // with a stepping of @step. func NewScaleButton(MinVar float64, MaxVar float64, StepVar float64, IconsVar []string) *ScaleButton { var cls *ScaleButton cret := xNewScaleButton(MinVar, MaxVar, StepVar, IconsVar) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &ScaleButton{} cls.Ptr = cret return cls } var xScaleButtonGetActive func(uintptr) bool // Queries a `GtkScaleButton` and returns its current state. // // Returns %TRUE if the scale button is pressed in and %FALSE // if it is raised. func (x *ScaleButton) GetActive() bool { cret := xScaleButtonGetActive(x.GoPointer()) return cret } var xScaleButtonGetAdjustment func(uintptr) uintptr // Gets the `GtkAdjustment` associated with the `GtkScaleButton`’s scale. // // See [method@Gtk.Range.get_adjustment] for details. func (x *ScaleButton) GetAdjustment() *Adjustment { var cls *Adjustment cret := xScaleButtonGetAdjustment(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Adjustment{} cls.Ptr = cret return cls } var xScaleButtonGetHasFrame func(uintptr) bool // Returns whether the button has a frame. func (x *ScaleButton) GetHasFrame() bool { cret := xScaleButtonGetHasFrame(x.GoPointer()) return cret } var xScaleButtonGetMinusButton func(uintptr) uintptr // Retrieves the minus button of the `GtkScaleButton`. func (x *ScaleButton) GetMinusButton() *Button { var cls *Button cret := xScaleButtonGetMinusButton(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Button{} cls.Ptr = cret return cls } var xScaleButtonGetPlusButton func(uintptr) uintptr // Retrieves the plus button of the `GtkScaleButton.` func (x *ScaleButton) GetPlusButton() *Button { var cls *Button cret := xScaleButtonGetPlusButton(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Button{} cls.Ptr = cret return cls } var xScaleButtonGetPopup func(uintptr) uintptr // Retrieves the popup of the `GtkScaleButton`. func (x *ScaleButton) GetPopup() *Widget { var cls *Widget cret := xScaleButtonGetPopup(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Widget{} cls.Ptr = cret return cls } var xScaleButtonGetValue func(uintptr) float64 // Gets the current value of the scale button. func (x *ScaleButton) GetValue() float64 { cret := xScaleButtonGetValue(x.GoPointer()) return cret } var xScaleButtonSetAdjustment func(uintptr, uintptr) // Sets the `GtkAdjustment` to be used as a model // for the `GtkScaleButton`’s scale. // // See [method@Gtk.Range.set_adjustment] for details. func (x *ScaleButton) SetAdjustment(AdjustmentVar *Adjustment) { xScaleButtonSetAdjustment(x.GoPointer(), AdjustmentVar.GoPointer()) } var xScaleButtonSetHasFrame func(uintptr, bool) // Sets the style of the button. func (x *ScaleButton) SetHasFrame(HasFrameVar bool) { xScaleButtonSetHasFrame(x.GoPointer(), HasFrameVar) } var xScaleButtonSetIcons func(uintptr, []string) // Sets the icons to be used by the scale button. func (x *ScaleButton) SetIcons(IconsVar []string) { xScaleButtonSetIcons(x.GoPointer(), IconsVar) } var xScaleButtonSetValue func(uintptr, float64) // Sets the current value of the scale. // // If the value is outside the minimum or maximum range values, // it will be clamped to fit inside them. // // The scale button emits the [signal@Gtk.ScaleButton::value-changed] // signal if the value changes. func (x *ScaleButton) SetValue(ValueVar float64) { xScaleButtonSetValue(x.GoPointer(), ValueVar) } func (c *ScaleButton) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *ScaleButton) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // GetPropertyActive gets the "active" property. // If the scale button should be pressed in. func (x *ScaleButton) GetPropertyActive() bool { var v gobject.Value x.GetProperty("active", &v) return v.GetBoolean() } // SetPropertyHasFrame sets the "has-frame" property. // If the scale button has a frame. func (x *ScaleButton) SetPropertyHasFrame(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("has-frame", &v) } // GetPropertyHasFrame gets the "has-frame" property. // If the scale button has a frame. func (x *ScaleButton) GetPropertyHasFrame() bool { var v gobject.Value x.GetProperty("has-frame", &v) return v.GetBoolean() } // SetPropertyIcons sets the "icons" property. // The names of the icons to be used by the scale button. // // The first item in the array will be used in the button // when the current value is the lowest value, the second // item for the highest value. All the subsequent icons will // be used for all the other values, spread evenly over the // range of values. // // If there's only one icon name in the @icons array, it will // be used for all the values. If only two icon names are in // the @icons array, the first one will be used for the bottom // 50% of the scale, and the second one for the top 50%. // // It is recommended to use at least 3 icons so that the // `GtkScaleButton` reflects the current value of the scale // better for the users. func (x *ScaleButton) SetPropertyIcons(value []string) { var v gobject.Value v.Init(glib.StrvGetType()) v.SetBoxed(uintptr(unsafe.Pointer(core.ByteSlice(value)))) x.SetProperty("icons", &v) } // GetPropertyIcons gets the "icons" property. // The names of the icons to be used by the scale button. // // The first item in the array will be used in the button // when the current value is the lowest value, the second // item for the highest value. All the subsequent icons will // be used for all the other values, spread evenly over the // range of values. // // If there's only one icon name in the @icons array, it will // be used for all the values. If only two icon names are in // the @icons array, the first one will be used for the bottom // 50% of the scale, and the second one for the top 50%. // // It is recommended to use at least 3 icons so that the // `GtkScaleButton` reflects the current value of the scale // better for the users. func (x *ScaleButton) GetPropertyIcons() []string { var v gobject.Value x.GetProperty("icons", &v) return core.GoStringSlice(v.GetBoxed()) } // SetPropertyValue sets the "value" property. // The value of the scale. func (x *ScaleButton) SetPropertyValue(value float64) { var v gobject.Value v.Init(gobject.TypeDoubleVal) v.SetDouble(value) x.SetProperty("value", &v) } // GetPropertyValue gets the "value" property. // The value of the scale. func (x *ScaleButton) GetPropertyValue() float64 { var v gobject.Value x.GetProperty("value", &v) return v.GetDouble() } // Emitted to dismiss the popup. // // This is a [keybinding signal](class.SignalAction.html). // // The default binding for this signal is <kbd>Escape</kbd>. func (x *ScaleButton) ConnectPopdown(cb *func(ScaleButton)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "popdown", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr) { fa := ScaleButton{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "popdown", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted to popup the scale widget. // // This is a [keybinding signal](class.SignalAction.html). // // The default bindings for this signal are <kbd>Space</kbd>, // <kbd>Enter</kbd> and <kbd>Return</kbd>. func (x *ScaleButton) ConnectPopup(cb *func(ScaleButton)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "popup", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr) { fa := ScaleButton{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "popup", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when the value field has changed. func (x *ScaleButton) ConnectValueChanged(cb *func(ScaleButton, float64)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "value-changed", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr, ValueVarp float64) { fa := ScaleButton{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa, ValueVarp) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "value-changed", 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 *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *ScaleButton) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *ScaleButton) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) 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 *ScaleButton) GetBuildableId() string { cret := XGtkBuildableGetBuildableId(x.GoPointer()) return cret } // Retrieves the orientation of the @orientable. func (x *ScaleButton) GetOrientation() Orientation { cret := XGtkOrientableGetOrientation(x.GoPointer()) return cret } // Sets the orientation of the @orientable. func (x *ScaleButton) 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(&xScaleButtonGLibType, libs, "gtk_scale_button_get_type") core.PuregoSafeRegister(&xNewScaleButton, libs, "gtk_scale_button_new") core.PuregoSafeRegister(&xScaleButtonGetActive, libs, "gtk_scale_button_get_active") core.PuregoSafeRegister(&xScaleButtonGetAdjustment, libs, "gtk_scale_button_get_adjustment") core.PuregoSafeRegister(&xScaleButtonGetHasFrame, libs, "gtk_scale_button_get_has_frame") core.PuregoSafeRegister(&xScaleButtonGetMinusButton, libs, "gtk_scale_button_get_minus_button") core.PuregoSafeRegister(&xScaleButtonGetPlusButton, libs, "gtk_scale_button_get_plus_button") core.PuregoSafeRegister(&xScaleButtonGetPopup, libs, "gtk_scale_button_get_popup") core.PuregoSafeRegister(&xScaleButtonGetValue, libs, "gtk_scale_button_get_value") core.PuregoSafeRegister(&xScaleButtonSetAdjustment, libs, "gtk_scale_button_set_adjustment") core.PuregoSafeRegister(&xScaleButtonSetHasFrame, libs, "gtk_scale_button_set_has_frame") core.PuregoSafeRegister(&xScaleButtonSetIcons, libs, "gtk_scale_button_set_icons") core.PuregoSafeRegister(&xScaleButtonSetValue, libs, "gtk_scale_button_set_value") }