// 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/gio" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // `GtkLockButton` is a widget to obtain and revoke authorizations // needed to operate the controls. // // <picture> // // <source srcset="lockbutton-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An example GtkLockButton" src="lockbutton.png"> // // </picture> // // It is typically used in preference dialogs or control panels. // // The required authorization is represented by a `GPermission` object. // Concrete implementations of `GPermission` may use PolicyKit or some // other authorization framework. To obtain a PolicyKit-based // `GPermission`, use `polkit_permission_new()`. // // If the user is not currently allowed to perform the action, but can // obtain the permission, the widget looks like this: // // <picture> // // <source srcset="lockbutton-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An locked GtkLockButton" src="lockbutton.png"> // // </picture> // // and the user can click the button to request the permission. Depending // on the platform, this may pop up an authentication dialog or ask the user // to authenticate in some other way. Once the user has obtained the permission, // the widget changes to this: // // <picture> // // <source srcset="lockbutton-unlocked-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An unlocked GtkLockButton" src="lockbutton-unlocked.png"> // // </picture> // // and the permission can be dropped again by clicking the button. If the user // is not able to obtain the permission at all, the widget looks like this: // // <picture> // // <source srcset="lockbutton-sorry-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An unobtainable GtkLockButton" src="lockbutton-sorry.png"> // // </picture> // // If the user has the permission and cannot drop it, the button is hidden. // // The text (and tooltips) that are shown in the various cases can be adjusted // with the [property@Gtk.LockButton:text-lock], // [property@Gtk.LockButton:text-unlock], // [property@Gtk.LockButton:tooltip-lock], // [property@Gtk.LockButton:tooltip-unlock] and // [property@Gtk.LockButton:tooltip-not-authorized] properties. type LockButton struct { Button } var xLockButtonGLibType func() types.GType func LockButtonGLibType() types.GType { return xLockButtonGLibType() } func LockButtonNewFromInternalPtr(ptr uintptr) *LockButton { cls := &LockButton{} cls.Ptr = ptr return cls } var xNewLockButton func(uintptr) uintptr // Creates a new lock button which reflects the @permission. func NewLockButton(PermissionVar *gio.Permission) *LockButton { var cls *LockButton cret := xNewLockButton(PermissionVar.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &LockButton{} cls.Ptr = cret return cls } var xLockButtonGetPermission func(uintptr) uintptr // Obtains the `GPermission` object that controls @button. func (x *LockButton) GetPermission() *gio.Permission { var cls *gio.Permission cret := xLockButtonGetPermission(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &gio.Permission{} cls.Ptr = cret return cls } var xLockButtonSetPermission func(uintptr, uintptr) // Sets the `GPermission` object that controls @button. func (x *LockButton) SetPermission(PermissionVar *gio.Permission) { xLockButtonSetPermission(x.GoPointer(), PermissionVar.GoPointer()) } func (c *LockButton) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *LockButton) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyTextLock sets the "text-lock" property. // The text to display when prompting the user to lock. func (x *LockButton) SetPropertyTextLock(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("text-lock", &v) } // GetPropertyTextLock gets the "text-lock" property. // The text to display when prompting the user to lock. func (x *LockButton) GetPropertyTextLock() string { var v gobject.Value x.GetProperty("text-lock", &v) return v.GetString() } // SetPropertyTextUnlock sets the "text-unlock" property. // The text to display when prompting the user to unlock. func (x *LockButton) SetPropertyTextUnlock(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("text-unlock", &v) } // GetPropertyTextUnlock gets the "text-unlock" property. // The text to display when prompting the user to unlock. func (x *LockButton) GetPropertyTextUnlock() string { var v gobject.Value x.GetProperty("text-unlock", &v) return v.GetString() } // SetPropertyTooltipLock sets the "tooltip-lock" property. // The tooltip to display when prompting the user to lock. func (x *LockButton) SetPropertyTooltipLock(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("tooltip-lock", &v) } // GetPropertyTooltipLock gets the "tooltip-lock" property. // The tooltip to display when prompting the user to lock. func (x *LockButton) GetPropertyTooltipLock() string { var v gobject.Value x.GetProperty("tooltip-lock", &v) return v.GetString() } // SetPropertyTooltipNotAuthorized sets the "tooltip-not-authorized" property. // The tooltip to display when the user cannot obtain authorization. func (x *LockButton) SetPropertyTooltipNotAuthorized(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("tooltip-not-authorized", &v) } // GetPropertyTooltipNotAuthorized gets the "tooltip-not-authorized" property. // The tooltip to display when the user cannot obtain authorization. func (x *LockButton) GetPropertyTooltipNotAuthorized() string { var v gobject.Value x.GetProperty("tooltip-not-authorized", &v) return v.GetString() } // SetPropertyTooltipUnlock sets the "tooltip-unlock" property. // The tooltip to display when prompting the user to unlock. func (x *LockButton) SetPropertyTooltipUnlock(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("tooltip-unlock", &v) } // GetPropertyTooltipUnlock gets the "tooltip-unlock" property. // The tooltip to display when prompting the user to unlock. func (x *LockButton) GetPropertyTooltipUnlock() string { var v gobject.Value x.GetProperty("tooltip-unlock", &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 *LockButton) 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 *LockButton) 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 *LockButton) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *LockButton) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *LockButton) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) { XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar) } // Gets the action name for @actionable. func (x *LockButton) GetActionName() string { cret := XGtkActionableGetActionName(x.GoPointer()) return cret } // Gets the current target value of @actionable. func (x *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) 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 *LockButton) 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(&xLockButtonGLibType, libs, "gtk_lock_button_get_type") core.PuregoSafeRegister(&xNewLockButton, libs, "gtk_lock_button_new") core.PuregoSafeRegister(&xLockButtonGetPermission, libs, "gtk_lock_button_get_permission") core.PuregoSafeRegister(&xLockButtonSetPermission, libs, "gtk_lock_button_set_permission") }