// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "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" ) // A button with a hyperlink. // // <picture> // // <source srcset="link-button-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An example GtkLinkButton" src="link-button.png"> // // </picture> // // It is useful to show quick links to resources. // // A link button is created by calling either [ctor@Gtk.LinkButton.new] or // [ctor@Gtk.LinkButton.new_with_label]. If using the former, the URI you // pass to the constructor is used as a label for the widget. // // The URI bound to a `GtkLinkButton` can be set specifically using // [method@Gtk.LinkButton.set_uri]. // // By default, `GtkLinkButton` calls [method@Gtk.FileLauncher.launch] when the button // is clicked. This behaviour can be overridden by connecting to the // [signal@Gtk.LinkButton::activate-link] signal and returning %TRUE from // the signal handler. // // # Shortcuts and Gestures // // `GtkLinkButton` supports the following keyboard shortcuts: // // - <kbd>Shift</kbd>+<kbd>F10</kbd> or <kbd>Menu</kbd> opens the context menu. // // # Actions // // `GtkLinkButton` defines a set of built-in actions: // // - `clipboard.copy` copies the url to the clipboard. // - `menu.popup` opens the context menu. // // # CSS nodes // // `GtkLinkButton` has a single CSS node with name button. To differentiate // it from a plain `GtkButton`, it gets the .link style class. // // # Accessibility // // `GtkLinkButton` uses the [enum@Gtk.AccessibleRole.link] role. type LinkButton struct { Button } var xLinkButtonGLibType func() types.GType func LinkButtonGLibType() types.GType { return xLinkButtonGLibType() } func LinkButtonNewFromInternalPtr(ptr uintptr) *LinkButton { cls := &LinkButton{} cls.Ptr = ptr return cls } var xNewLinkButton func(string) uintptr // Creates a new `GtkLinkButton` with the URI as its text. func NewLinkButton(UriVar string) *LinkButton { var cls *LinkButton cret := xNewLinkButton(UriVar) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &LinkButton{} cls.Ptr = cret return cls } var xNewLinkButtonWithLabel func(string, uintptr) uintptr // Creates a new `GtkLinkButton` containing a label. func NewLinkButtonWithLabel(UriVar string, LabelVar *string) *LinkButton { var cls *LinkButton LabelVarPtr := core.GStrdupNullable(LabelVar) defer core.GFreeNullable(LabelVarPtr) cret := xNewLinkButtonWithLabel(UriVar, LabelVarPtr) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &LinkButton{} cls.Ptr = cret return cls } var xLinkButtonGetUri func(uintptr) string // Retrieves the URI of the `GtkLinkButton`. func (x *LinkButton) GetUri() string { cret := xLinkButtonGetUri(x.GoPointer()) return cret } var xLinkButtonGetVisited func(uintptr) bool // Retrieves the “visited” state of the `GtkLinkButton`. // // The button becomes visited when it is clicked. If the URI // is changed on the button, the “visited” state is unset again. // // The state may also be changed using [method@Gtk.LinkButton.set_visited]. func (x *LinkButton) GetVisited() bool { cret := xLinkButtonGetVisited(x.GoPointer()) return cret } var xLinkButtonSetUri func(uintptr, string) // Sets @uri as the URI where the `GtkLinkButton` points. // // As a side-effect this unsets the “visited” state of the button. func (x *LinkButton) SetUri(UriVar string) { xLinkButtonSetUri(x.GoPointer(), UriVar) } var xLinkButtonSetVisited func(uintptr, bool) // Sets the “visited” state of the `GtkLinkButton`. // // See [method@Gtk.LinkButton.get_visited] for more details. func (x *LinkButton) SetVisited(VisitedVar bool) { xLinkButtonSetVisited(x.GoPointer(), VisitedVar) } func (c *LinkButton) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *LinkButton) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyUri sets the "uri" property. // The URI bound to this button. func (x *LinkButton) SetPropertyUri(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("uri", &v) } // GetPropertyUri gets the "uri" property. // The URI bound to this button. func (x *LinkButton) GetPropertyUri() string { var v gobject.Value x.GetProperty("uri", &v) return v.GetString() } // SetPropertyVisited sets the "visited" property. // The 'visited' state of this button. // // A visited link is drawn in a different color. func (x *LinkButton) SetPropertyVisited(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("visited", &v) } // GetPropertyVisited gets the "visited" property. // The 'visited' state of this button. // // A visited link is drawn in a different color. func (x *LinkButton) GetPropertyVisited() bool { var v gobject.Value x.GetProperty("visited", &v) return v.GetBoolean() } // Emitted each time the `GtkLinkButton` is clicked. // // The default handler will call [method@Gtk.FileLauncher.launch] with the URI // stored inside the [property@Gtk.LinkButton:uri] property. // // To override the default behavior, you can connect to the // ::activate-link signal and stop the propagation of the signal // by returning %TRUE from your handler. func (x *LinkButton) ConnectActivateLink(cb *func(LinkButton) bool) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "activate-link", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr) bool { fa := LinkButton{} fa.Ptr = clsPtr cbFn := *cb return cbFn(fa) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "activate-link", 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 *LinkButton) 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 *LinkButton) 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 *LinkButton) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *LinkButton) 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 *LinkButton) 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 *LinkButton) 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 *LinkButton) 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 *LinkButton) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *LinkButton) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *LinkButton) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *LinkButton) 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 *LinkButton) 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 *LinkButton) 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 *LinkButton) 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 *LinkButton) 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 *LinkButton) 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 *LinkButton) 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 *LinkButton) 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 *LinkButton) 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 *LinkButton) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) { XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) } // Gets the action name for @actionable. func (x *LinkButton) GetActionName() string { cret := XGtkActionableGetActionName(x.GoPointer()) return cret } // Gets the current target value of @actionable. func (x *LinkButton) GetActionTargetValue() *glib.Variant { cret := XGtkActionableGetActionTargetValue(x.GoPointer()) return cret } // Specifies the name of the action with which this widget should be // associated. // // If @action_name is %NULL then the widget will be unassociated from // any previous action. // // Usually this function is used when the widget is located (or will be // located) within the hierarchy of a `GtkApplicationWindow`. // // Names are of the form “win.save” or “app.quit” for actions on the // containing [class@ApplicationWindow] or its associated [class@Application], // respectively. This is the same form used for actions in the [class@Gio.Menu] // associated with the window. func (x *LinkButton) SetActionName(ActionNameVar *string) { ActionNameVarPtr := core.GStrdupNullable(ActionNameVar) defer core.GFreeNullable(ActionNameVarPtr) XGtkActionableSetActionName(x.GoPointer(), ActionNameVarPtr) } // Sets the target of an actionable widget. // // This is a convenience function that calls [ctor@GLib.Variant.new] for // @format_string and uses the result to call // [method@Gtk.Actionable.set_action_target_value]. // // If you are setting a string-valued target and want to set // the action name at the same time, you can use // [method@Gtk.Actionable.set_detailed_action_name]. func (x *LinkButton) SetActionTarget(FormatStringVar string, varArgs ...interface{}) { XGtkActionableSetActionTarget(x.GoPointer(), FormatStringVar, varArgs...) } // Sets the target value of an actionable widget. // // If @target_value is %NULL then the target value is unset. // // The target value has two purposes. First, it is used as the parameter // to activation of the action associated with the `GtkActionable` widget. // Second, it is used to determine if the widget should be rendered as // “active” — the widget is active if the state is equal to the given target. // // Consider the example of associating a set of buttons with a [iface@Gio.Action] // with string state in a typical “radio button” situation. Each button // will be associated with the same action, but with a different target // value for that action. Clicking on a particular button will activate // the action with the target of that button, which will typically cause // the action’s state to change to that value. Since the action’s state // is now equal to the target value of the button, the button will now // be rendered as active (and the other buttons, with different targets, // rendered inactive). func (x *LinkButton) SetActionTargetValue(TargetValueVar *glib.Variant) { XGtkActionableSetActionTargetValue(x.GoPointer(), TargetValueVar) } // Sets the action-name and associated string target value of an // actionable widget. // // @detailed_action_name is a string in the format accepted by // [func@Gio.Action.parse_detailed_name]. func (x *LinkButton) SetDetailedActionName(DetailedActionNameVar string) { XGtkActionableSetDetailedActionName(x.GoPointer(), DetailedActionNameVar) } // 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 *LinkButton) 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(&xLinkButtonGLibType, libs, "gtk_link_button_get_type") core.PuregoSafeRegister(&xNewLinkButton, libs, "gtk_link_button_new") core.PuregoSafeRegister(&xNewLinkButtonWithLabel, libs, "gtk_link_button_new_with_label") core.PuregoSafeRegister(&xLinkButtonGetUri, libs, "gtk_link_button_get_uri") core.PuregoSafeRegister(&xLinkButtonGetVisited, libs, "gtk_link_button_get_visited") core.PuregoSafeRegister(&xLinkButtonSetUri, libs, "gtk_link_button_set_uri") core.PuregoSafeRegister(&xLinkButtonSetVisited, libs, "gtk_link_button_set_visited") }