// 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/gdk" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" "github.com/bnema/puregotk/v4/gsk" ) // A `GtkShortcutsWindow` shows information about the keyboard shortcuts // and gestures of an application. // // The shortcuts can be grouped, and you can have multiple sections in this // window, corresponding to the major modes of your application. // // Additionally, the shortcuts can be filtered by the current view, to avoid // showing information that is not relevant in the current application context. // // The recommended way to construct a `GtkShortcutsWindow` is with // [class@Gtk.Builder], by using the `<child>` tag to populate a // `GtkShortcutsWindow` with one or more [class@Gtk.ShortcutsSection] objects, // which contain one or more [class@Gtk.ShortcutsGroup] instances, which, in turn, // contain [class@Gtk.ShortcutsShortcut] instances. // // If you need to add a section programmatically, use [method@Gtk.ShortcutsWindow.add_section] // instead of [method@Gtk.Window.set_child], as the shortcuts window manages // its children directly. // // # A simple example: // // <picture> // // <source srcset="gedit-shortcuts-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="A simple example" src="gedit-shortcuts.png"> // // </picture> // // This example has as single section. As you can see, the shortcut groups // are arranged in columns, and spread across several pages if there are too // many to find on a single page. // // The .ui file for this example can be found [here](https://gitlab.gnome.org/GNOME/gtk/tree/main/demos/gtk-demo/shortcuts-gedit.ui). // // # An example with multiple views: // // <picture> // // <source srcset="clocks-shortcuts-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An example with multiple views" src="clocks-shortcuts.png"> // // </picture> // // This example shows a `GtkShortcutsWindow` that has been configured to show only // the shortcuts relevant to the “Stopwatch” view. // // The .ui file for this example can be found [here](https://gitlab.gnome.org/GNOME/gtk/tree/main/demos/gtk-demo/shortcuts-clocks.ui). // // # An example with multiple sections: // // <picture> // // <source srcset="builder-shortcuts-dark.png" media="(prefers-color-scheme: dark)"> // <img alt="An example with multiple sections" src="builder-shortcuts.png"> // // </picture> // // This example shows a `GtkShortcutsWindow` with two sections, “Editor Shortcuts” // and “Terminal Shortcuts”. // // The .ui file for this example can be found [here](https://gitlab.gnome.org/GNOME/gtk/tree/main/demos/gtk-demo/shortcuts-builder.ui). // // # Shortcuts and Gestures // // The following signals have default keybindings: // // - [signal@Gtk.ShortcutsWindow::close] // - [signal@Gtk.ShortcutsWindow::search] // // # CSS nodes // // `GtkShortcutsWindow` has a single CSS node with the name `window` and style // class `.shortcuts`. type ShortcutsWindow struct { Window } var xShortcutsWindowGLibType func() types.GType func ShortcutsWindowGLibType() types.GType { return xShortcutsWindowGLibType() } func ShortcutsWindowNewFromInternalPtr(ptr uintptr) *ShortcutsWindow { cls := &ShortcutsWindow{} cls.Ptr = ptr return cls } var xShortcutsWindowAddSection func(uintptr, uintptr) // Adds a section to the shortcuts window. // // This is the programmatic equivalent to using [class@Gtk.Builder] and a // `<child>` tag to add the child. // // Using [method@Gtk.Window.set_child] is not appropriate as the shortcuts // window manages its children internally. func (x *ShortcutsWindow) AddSection(SectionVar *ShortcutsSection) { xShortcutsWindowAddSection(x.GoPointer(), SectionVar.GoPointer()) } func (c *ShortcutsWindow) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *ShortcutsWindow) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertySectionName sets the "section-name" property. // The name of the section to show. // // This should be the section-name of one of the `GtkShortcutsSection` // objects that are in this shortcuts window. func (x *ShortcutsWindow) SetPropertySectionName(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("section-name", &v) } // GetPropertySectionName gets the "section-name" property. // The name of the section to show. // // This should be the section-name of one of the `GtkShortcutsSection` // objects that are in this shortcuts window. func (x *ShortcutsWindow) GetPropertySectionName() string { var v gobject.Value x.GetProperty("section-name", &v) return v.GetString() } // SetPropertyViewName sets the "view-name" property. // The view name by which to filter the contents. // // This should correspond to the [property@Gtk.ShortcutsGroup:view] // property of some of the [class@Gtk.ShortcutsGroup] objects that // are inside this shortcuts window. // // Set this to %NULL to show all groups. func (x *ShortcutsWindow) SetPropertyViewName(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("view-name", &v) } // GetPropertyViewName gets the "view-name" property. // The view name by which to filter the contents. // // This should correspond to the [property@Gtk.ShortcutsGroup:view] // property of some of the [class@Gtk.ShortcutsGroup] objects that // are inside this shortcuts window. // // Set this to %NULL to show all groups. func (x *ShortcutsWindow) GetPropertyViewName() string { var v gobject.Value x.GetProperty("view-name", &v) return v.GetString() } // Emitted when the user uses a keybinding to close the window. // // This is a [keybinding signal](class.SignalAction.html). // // The default binding for this signal is the <kbd>Escape</kbd> key. func (x *ShortcutsWindow) ConnectClose(cb *func(ShortcutsWindow)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr) { fa := ShortcutsWindow{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } // Emitted when the user uses a keybinding to start a search. // // This is a [keybinding signal](class.SignalAction.html). // // The default binding for this signal is <kbd>Control</kbd>+<kbd>F</kbd>. func (x *ShortcutsWindow) ConnectSearch(cb *func(ShortcutsWindow)) uint { cbPtr := uintptr(unsafe.Pointer(cb)) if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { handlerID := gobject.SignalConnect(x.GoPointer(), "search", cbRefPtr) glib.SaveHandlerMapping(handlerID, cbPtr) return handlerID } fcb := func(clsPtr uintptr) { fa := ShortcutsWindow{} fa.Ptr = clsPtr cbFn := *cb cbFn(fa) } cbRefPtr := purego.NewCallback(fcb) glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb) handlerID := gobject.SignalConnect(x.GoPointer(), "search", 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 *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) GetAccessibleRole() AccessibleRole { cret := XGtkAccessibleGetAccessibleRole(x.GoPointer()) return cret } // Retrieves the implementation for the given accessible object. func (x *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) GetPlatformState(StateVar AccessiblePlatformState) bool { cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar) return cret } // Resets the accessible property to its default value. func (x *ShortcutsWindow) ResetProperty(PropertyVar AccessibleProperty) { XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar) } // Resets the accessible relation to its default value. func (x *ShortcutsWindow) ResetRelation(RelationVar AccessibleRelation) { XGtkAccessibleResetRelation(x.GoPointer(), RelationVar) } // Resets the accessible state to its default value. func (x *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) 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 *ShortcutsWindow) GetBuildableId() string { cret := XGtkBuildableGetBuildableId(x.GoPointer()) return cret } // Returns the renderer that is used for this `GtkNative`. func (x *ShortcutsWindow) GetRenderer() *gsk.Renderer { var cls *gsk.Renderer cret := XGtkNativeGetRenderer(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &gsk.Renderer{} cls.Ptr = cret return cls } // Returns the surface of this `GtkNative`. func (x *ShortcutsWindow) GetSurface() *gdk.Surface { var cls *gdk.Surface cret := XGtkNativeGetSurface(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &gdk.Surface{} cls.Ptr = cret return cls } // Retrieves the surface transform of @self. // // This is the translation from @self's surface coordinates into // @self's widget coordinates. func (x *ShortcutsWindow) GetSurfaceTransform(XVar *float64, YVar *float64) { XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar) } // Realizes a `GtkNative`. // // This should only be used by subclasses. func (x *ShortcutsWindow) Realize() { XGtkNativeRealize(x.GoPointer()) } // Unrealizes a `GtkNative`. // // This should only be used by subclasses. func (x *ShortcutsWindow) Unrealize() { XGtkNativeUnrealize(x.GoPointer()) } // Returns the display that this `GtkRoot` is on. func (x *ShortcutsWindow) GetDisplay() *gdk.Display { var cls *gdk.Display cret := XGtkRootGetDisplay(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &gdk.Display{} cls.Ptr = cret return cls } // Retrieves the current focused widget within the root. // // Note that this is the widget that would have the focus // if the root is active; if the root is not focused then // `gtk_widget_has_focus (widget)` will be %FALSE for the // widget. func (x *ShortcutsWindow) GetFocus() *Widget { var cls *Widget cret := XGtkRootGetFocus(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &Widget{} cls.Ptr = cret return cls } // If @focus is not the current focus widget, and is focusable, sets // it as the focus widget for the root. // // If @focus is %NULL, unsets the focus widget for the root. // // To set the focus to a particular widget in the root, it is usually // more convenient to use [method@Gtk.Widget.grab_focus] instead of // this function. func (x *ShortcutsWindow) SetFocus(FocusVar *Widget) { XGtkRootSetFocus(x.GoPointer(), FocusVar.GoPointer()) } 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(&xShortcutsWindowGLibType, libs, "gtk_shortcuts_window_get_type") core.PuregoSafeRegister(&xShortcutsWindowAddSection, libs, "gtk_shortcuts_window_add_section") }