// 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/gdk" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type ColorDialogButtonClass struct { _ structs.HostLayout ParentClass WidgetClass } func (x *ColorDialogButtonClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // Opens a color chooser dialog to select a color. // // <picture> // // <source srcset="color-button-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An example GtkColorDialogButton" src="color-button.png"> // // </picture> // // It is suitable widget for selecting a color in a preference dialog. // // # CSS nodes // // ``` // colorbutton // ╰── button.color // // ╰── [content] // // ``` // // `GtkColorDialogButton` has a single CSS node with name colorbutton which // contains a button node. To differentiate it from a plain `GtkButton`, // it gets the .color style class. type ColorDialogButton struct { Widget } var xColorDialogButtonGLibType func() types.GType func ColorDialogButtonGLibType() types.GType { return xColorDialogButtonGLibType() } func ColorDialogButtonNewFromInternalPtr(ptr uintptr) *ColorDialogButton { cls := &ColorDialogButton{} cls.Ptr = ptr return cls } var xNewColorDialogButton func(uintptr) uintptr // Creates a new `GtkColorDialogButton` with the // given `GtkColorDialog`. // // You can pass `NULL` to this function and set a `GtkColorDialog` // later. The button will be insensitive until that happens. func NewColorDialogButton(DialogVar *ColorDialog) *ColorDialogButton { var cls *ColorDialogButton cret := xNewColorDialogButton(DialogVar.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &ColorDialogButton{} cls.Ptr = cret return cls } var xColorDialogButtonGetDialog func(uintptr) uintptr // Returns the `GtkColorDialog` of @self. func (x *ColorDialogButton) GetDialog() *ColorDialog { var cls *ColorDialog cret := xColorDialogButtonGetDialog(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &ColorDialog{} cls.Ptr = cret return cls } var xColorDialogButtonGetRgba func(uintptr) *gdk.RGBA // Returns the color of the button. // // This function is what should be used to obtain // the color that was chosen by the user. To get // informed about changes, listen to "notify::rgba". func (x *ColorDialogButton) GetRgba() *gdk.RGBA { cret := xColorDialogButtonGetRgba(x.GoPointer()) return cret } var xColorDialogButtonSetDialog func(uintptr, uintptr) // Sets a `GtkColorDialog` object to use for // creating the color chooser dialog that is // presented when the user clicks the button. func (x *ColorDialogButton) SetDialog(DialogVar *ColorDialog) { xColorDialogButtonSetDialog(x.GoPointer(), DialogVar.GoPointer()) } var xColorDialogButtonSetRgba func(uintptr, *gdk.RGBA) // Sets the color of the button. func (x *ColorDialogButton) SetRgba(ColorVar *gdk.RGBA) { xColorDialogButtonSetRgba(x.GoPointer(), ColorVar) } func (c *ColorDialogButton) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *ColorDialogButton) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyRgba sets the "rgba" property. // The selected color. // // This property can be set to give the button its initial // color, and it will be updated to reflect the users choice // in the color chooser dialog. // // Listen to `notify::rgba` to get informed about changes // to the buttons color. func (x *ColorDialogButton) SetPropertyRgba(value uintptr) { var v gobject.Value v.Init(gobject.TypePointerVal) v.SetPointer(value) x.SetProperty("rgba", &v) } // GetPropertyRgba gets the "rgba" property. // The selected color. // // This property can be set to give the button its initial // color, and it will be updated to reflect the users choice // in the color chooser dialog. // // Listen to `notify::rgba` to get informed about changes // to the buttons color. func (x *ColorDialogButton) GetPropertyRgba() uintptr { var v gobject.Value x.GetProperty("rgba", &v) return v.GetPointer() } // Emitted when the color dialog button is activated. // // The `::activate` signal on `GtkColorDialogButton` is an action signal // and emitting it causes the button to pop up its dialog. func (x *ColorDialogButton) ConnectActivate(cb *func(ColorDialogButton)) 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 := ColorDialogButton{} 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 *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *ColorDialogButton) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *ColorDialogButton) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) 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 *ColorDialogButton) 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(&xColorDialogButtonGLibType, libs, "gtk_color_dialog_button_get_type") core.PuregoSafeRegister(&xNewColorDialogButton, libs, "gtk_color_dialog_button_new") core.PuregoSafeRegister(&xColorDialogButtonGetDialog, libs, "gtk_color_dialog_button_get_dialog") core.PuregoSafeRegister(&xColorDialogButtonGetRgba, libs, "gtk_color_dialog_button_get_rgba") core.PuregoSafeRegister(&xColorDialogButtonSetDialog, libs, "gtk_color_dialog_button_set_dialog") core.PuregoSafeRegister(&xColorDialogButtonSetRgba, libs, "gtk_color_dialog_button_set_rgba") }