v0.2.1 c0399be

gtksearchbar.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5	"github.com/ebitengine/purego"
6
7	"github.com/bnema/puregotk/pkg/core"
8	"github.com/bnema/puregotk/v4/gobject"
9	"github.com/bnema/puregotk/v4/gobject/types"
10)
11
12// Reveals a search entry when search is started.
13//
14// <picture>
15//
16//	<source srcset="search-bar-dark.png" media="(prefers-color-scheme: dark)">
17//	<img alt="An example GtkSearchBar" src="search-bar.png">
18//
19// </picture>
20//
21// It can also contain additional widgets, such as drop-down menus,
22// or buttons.  The search bar would appear when a search is started
23// through typing on the keyboard, or the application’s search mode
24// is toggled on.
25//
26// For keyboard presses to start a search, the search bar must be told
27// of a widget to capture key events from through
28// [method@Gtk.SearchBar.set_key_capture_widget]. This widget will
29// typically be the top-level window, or a parent container of the
30// search bar. Common shortcuts such as Ctrl+F should be handled as an
31// application action, or through the menu items.
32//
33// You will also need to tell the search bar about which entry you
34// are using as your search entry using [method@Gtk.SearchBar.connect_entry].
35//
36// ## Creating a search bar
37//
38// The following example shows you how to create a more complex search
39// entry.
40//
41// [A simple example](https://gitlab.gnome.org/GNOME/gtk/tree/main/examples/search-bar.c)
42//
43// # Shortcuts and Gestures
44//
45// `GtkSearchBar` supports the following keyboard shortcuts:
46//
47// - <kbd>Escape</kbd> hides the search bar.
48//
49// # CSS nodes
50//
51// ```
52// searchbar
53// ╰── revealer
54//
55//	╰── box
56//	     ├── [child]
57//	     ╰── [button.close]
58//
59// ```
60//
61// `GtkSearchBar` has a main CSS node with name searchbar. It has a child
62// node with name revealer that contains a node with name box. The box node
63// contains both the CSS node of the child widget as well as an optional button
64// node which gets the .close style class applied.
65//
66// # Accessibility
67//
68// `GtkSearchBar` uses the [enum@Gtk.AccessibleRole.search] role.
69type SearchBar struct {
70	Widget
71}
72
73var xSearchBarGLibType func() types.GType
74
75func SearchBarGLibType() types.GType {
76	return xSearchBarGLibType()
77}
78
79func SearchBarNewFromInternalPtr(ptr uintptr) *SearchBar {
80	cls := &SearchBar{}
81	cls.Ptr = ptr
82	return cls
83}
84
85var xNewSearchBar func() uintptr
86
87// Creates a `GtkSearchBar`.
88//
89// You will need to tell it about which widget is going to be your text
90// entry using [method@Gtk.SearchBar.connect_entry].
91func NewSearchBar() *SearchBar {
92	var cls *SearchBar
93
94	cret := xNewSearchBar()
95
96	if cret == 0 {
97		return nil
98	}
99	gobject.IncreaseRef(cret)
100	cls = &SearchBar{}
101	cls.Ptr = cret
102	return cls
103}
104
105var xSearchBarConnectEntry func(uintptr, uintptr)
106
107// Connects the `GtkEditable` widget passed as the one to be used in
108// this search bar.
109//
110// The entry should be a descendant of the search bar. Calling this
111// function manually is only required if the entry isn’t the direct
112// child of the search bar (as in our main example).
113func (x *SearchBar) ConnectEntry(EntryVar Editable) {
114
115	xSearchBarConnectEntry(x.GoPointer(), EntryVar.GoPointer())
116
117}
118
119var xSearchBarGetChild func(uintptr) uintptr
120
121// Gets the child widget of @bar.
122func (x *SearchBar) GetChild() *Widget {
123	var cls *Widget
124
125	cret := xSearchBarGetChild(x.GoPointer())
126
127	if cret == 0 {
128		return nil
129	}
130	gobject.IncreaseRef(cret)
131	cls = &Widget{}
132	cls.Ptr = cret
133	return cls
134}
135
136var xSearchBarGetKeyCaptureWidget func(uintptr) uintptr
137
138// Gets the widget that @bar is capturing key events from.
139func (x *SearchBar) GetKeyCaptureWidget() *Widget {
140	var cls *Widget
141
142	cret := xSearchBarGetKeyCaptureWidget(x.GoPointer())
143
144	if cret == 0 {
145		return nil
146	}
147	gobject.IncreaseRef(cret)
148	cls = &Widget{}
149	cls.Ptr = cret
150	return cls
151}
152
153var xSearchBarGetSearchMode func(uintptr) bool
154
155// Returns whether the search mode is on or off.
156func (x *SearchBar) GetSearchMode() bool {
157
158	cret := xSearchBarGetSearchMode(x.GoPointer())
159	return cret
160}
161
162var xSearchBarGetShowCloseButton func(uintptr) bool
163
164// Returns whether the close button is shown.
165func (x *SearchBar) GetShowCloseButton() bool {
166
167	cret := xSearchBarGetShowCloseButton(x.GoPointer())
168	return cret
169}
170
171var xSearchBarSetChild func(uintptr, uintptr)
172
173// Sets the child widget of @bar.
174func (x *SearchBar) SetChild(ChildVar *Widget) {
175
176	xSearchBarSetChild(x.GoPointer(), ChildVar.GoPointer())
177
178}
179
180var xSearchBarSetKeyCaptureWidget func(uintptr, uintptr)
181
182// Sets @widget as the widget that @bar will capture key events
183// from.
184//
185// If key events are handled by the search bar, the bar will
186// be shown, and the entry populated with the entered text.
187//
188// Note that despite the name of this function, the events
189// are only 'captured' in the bubble phase, which means that
190// editable child widgets of @widget will receive text input
191// before it gets captured. If that is not desired, you can
192// capture and forward the events yourself with
193// [method@Gtk.EventControllerKey.forward].
194func (x *SearchBar) SetKeyCaptureWidget(WidgetVar *Widget) {
195
196	xSearchBarSetKeyCaptureWidget(x.GoPointer(), WidgetVar.GoPointer())
197
198}
199
200var xSearchBarSetSearchMode func(uintptr, bool)
201
202// Switches the search mode on or off.
203func (x *SearchBar) SetSearchMode(SearchModeVar bool) {
204
205	xSearchBarSetSearchMode(x.GoPointer(), SearchModeVar)
206
207}
208
209var xSearchBarSetShowCloseButton func(uintptr, bool)
210
211// Shows or hides the close button.
212//
213// Applications that already have a “search” toggle button should not
214// show a close button in their search bar, as it duplicates the role
215// of the toggle button.
216func (x *SearchBar) SetShowCloseButton(VisibleVar bool) {
217
218	xSearchBarSetShowCloseButton(x.GoPointer(), VisibleVar)
219
220}
221
222func (c *SearchBar) GoPointer() uintptr {
223	if c == nil {
224		return 0
225	}
226	return c.Ptr
227}
228
229func (c *SearchBar) SetGoPointer(ptr uintptr) {
230	c.Ptr = ptr
231}
232
233// SetPropertySearchModeEnabled sets the "search-mode-enabled" property.
234// Whether the search mode is on and the search bar shown.
235func (x *SearchBar) SetPropertySearchModeEnabled(value bool) {
236	var v gobject.Value
237	v.Init(gobject.TypeBooleanVal)
238	v.SetBoolean(value)
239	x.SetProperty("search-mode-enabled", &v)
240}
241
242// GetPropertySearchModeEnabled gets the "search-mode-enabled" property.
243// Whether the search mode is on and the search bar shown.
244func (x *SearchBar) GetPropertySearchModeEnabled() bool {
245	var v gobject.Value
246	x.GetProperty("search-mode-enabled", &v)
247	return v.GetBoolean()
248}
249
250// SetPropertyShowCloseButton sets the "show-close-button" property.
251// Whether to show the close button in the search bar.
252func (x *SearchBar) SetPropertyShowCloseButton(value bool) {
253	var v gobject.Value
254	v.Init(gobject.TypeBooleanVal)
255	v.SetBoolean(value)
256	x.SetProperty("show-close-button", &v)
257}
258
259// GetPropertyShowCloseButton gets the "show-close-button" property.
260// Whether to show the close button in the search bar.
261func (x *SearchBar) GetPropertyShowCloseButton() bool {
262	var v gobject.Value
263	x.GetProperty("show-close-button", &v)
264	return v.GetBoolean()
265}
266
267// Requests the user's screen reader to announce the given message.
268//
269// This kind of notification is useful for messages that
270// either have only a visual representation or that are not
271// exposed visually at all, e.g. a notification about a
272// successful operation.
273//
274// Also, by using this API, you can ensure that the message
275// does not interrupts the user's current screen reader output.
276func (x *SearchBar) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
277
278	XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
279
280}
281
282// Retrieves the accessible parent for an accessible object.
283//
284// This function returns `NULL` for top level widgets.
285func (x *SearchBar) GetAccessibleParent() *AccessibleBase {
286	var cls *AccessibleBase
287
288	cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
289
290	if cret == 0 {
291		return nil
292	}
293	cls = &AccessibleBase{}
294	cls.Ptr = cret
295	return cls
296}
297
298// Retrieves the accessible role of an accessible object.
299func (x *SearchBar) GetAccessibleRole() AccessibleRole {
300
301	cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
302	return cret
303}
304
305// Retrieves the implementation for the given accessible object.
306func (x *SearchBar) GetAtContext() *ATContext {
307	var cls *ATContext
308
309	cret := XGtkAccessibleGetAtContext(x.GoPointer())
310
311	if cret == 0 {
312		return nil
313	}
314	cls = &ATContext{}
315	cls.Ptr = cret
316	return cls
317}
318
319// Queries the coordinates and dimensions of this accessible
320//
321// This functionality can be overridden by `GtkAccessible`
322// implementations, e.g. to get the bounds from an ignored
323// child widget.
324func (x *SearchBar) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
325
326	cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
327	return cret
328}
329
330// Retrieves the first accessible child of an accessible object.
331func (x *SearchBar) GetFirstAccessibleChild() *AccessibleBase {
332	var cls *AccessibleBase
333
334	cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
335
336	if cret == 0 {
337		return nil
338	}
339	cls = &AccessibleBase{}
340	cls.Ptr = cret
341	return cls
342}
343
344// Retrieves the next accessible sibling of an accessible object
345func (x *SearchBar) GetNextAccessibleSibling() *AccessibleBase {
346	var cls *AccessibleBase
347
348	cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
349
350	if cret == 0 {
351		return nil
352	}
353	cls = &AccessibleBase{}
354	cls.Ptr = cret
355	return cls
356}
357
358// Queries a platform state, such as focus.
359//
360// This functionality can be overridden by `GtkAccessible`
361// implementations, e.g. to get platform state from an ignored
362// child widget, as is the case for `GtkText` wrappers.
363func (x *SearchBar) GetPlatformState(StateVar AccessiblePlatformState) bool {
364
365	cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
366	return cret
367}
368
369// Resets the accessible property to its default value.
370func (x *SearchBar) ResetProperty(PropertyVar AccessibleProperty) {
371
372	XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
373
374}
375
376// Resets the accessible relation to its default value.
377func (x *SearchBar) ResetRelation(RelationVar AccessibleRelation) {
378
379	XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
380
381}
382
383// Resets the accessible state to its default value.
384func (x *SearchBar) ResetState(StateVar AccessibleState) {
385
386	XGtkAccessibleResetState(x.GoPointer(), StateVar)
387
388}
389
390// Sets the parent and sibling of an accessible object.
391//
392// This function is meant to be used by accessible implementations that are
393// not part of the widget hierarchy, and but act as a logical bridge between
394// widgets. For instance, if a widget creates an object that holds metadata
395// for each child, and you want that object to implement the `GtkAccessible`
396// interface, you will use this function to ensure that the parent of each
397// child widget is the metadata object, and the parent of each metadata
398// object is the container widget.
399func (x *SearchBar) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
400
401	XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
402
403}
404
405// Updates the next accessible sibling.
406//
407// That might be useful when a new child of a custom accessible
408// is created, and it needs to be linked to a previous child.
409func (x *SearchBar) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
410
411	XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
412
413}
414
415// Informs ATs that the platform state has changed.
416//
417// This function should be used by `GtkAccessible` implementations that
418// have a platform state but are not widgets. Widgets handle platform
419// states automatically.
420func (x *SearchBar) UpdatePlatformState(StateVar AccessiblePlatformState) {
421
422	XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
423
424}
425
426// Updates a list of accessible properties.
427//
428// See the [enum@Gtk.AccessibleProperty] documentation for the
429// value types of accessible properties.
430//
431// This function should be called by `GtkWidget` types whenever
432// an accessible property change must be communicated to assistive
433// technologies.
434//
435// Example:
436// ```c
437// value = gtk_adjustment_get_value (adjustment);
438// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
439//
440//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
441//	-1);
442//
443// ```
444func (x *SearchBar) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
445
446	XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
447
448}
449
450// Updates an array of accessible properties.
451//
452// This function should be called by `GtkWidget` types whenever an accessible
453// property change must be communicated to assistive technologies.
454//
455// This function is meant to be used by language bindings.
456func (x *SearchBar) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
457
458	XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
459
460}
461
462// Updates a list of accessible relations.
463//
464// This function should be called by `GtkWidget` types whenever an accessible
465// relation change must be communicated to assistive technologies.
466//
467// If the [enum@Gtk.AccessibleRelation] requires a list of references,
468// you should pass each reference individually, followed by `NULL`, e.g.
469//
470// ```c
471// gtk_accessible_update_relation (accessible,
472//
473//	GTK_ACCESSIBLE_RELATION_CONTROLS,
474//	  ref1, NULL,
475//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
476//	  ref1, ref2, ref3, NULL,
477//	-1);
478//
479// ```
480func (x *SearchBar) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
481
482	XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
483
484}
485
486// Updates an array of accessible relations.
487//
488// This function should be called by `GtkWidget` types whenever an accessible
489// relation change must be communicated to assistive technologies.
490//
491// This function is meant to be used by language bindings.
492func (x *SearchBar) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
493
494	XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
495
496}
497
498// Updates a list of accessible states.
499//
500// See the [enum@Gtk.AccessibleState] documentation for the
501// value types of accessible states.
502//
503// This function should be called by `GtkWidget` types whenever
504// an accessible state change must be communicated to assistive
505// technologies.
506//
507// Example:
508//
509// ```c
510// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
511// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
512//
513//	GTK_ACCESSIBLE_STATE_CHECKED, value,
514//	-1);
515//
516// ```
517func (x *SearchBar) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
518
519	XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
520
521}
522
523// Updates an array of accessible states.
524//
525// This function should be called by `GtkWidget` types whenever an accessible
526// state change must be communicated to assistive technologies.
527//
528// This function is meant to be used by language bindings.
529func (x *SearchBar) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
530
531	XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
532
533}
534
535// Gets the ID of the @buildable object.
536//
537// `GtkBuilder` sets the name based on the ID attribute
538// of the `<object>` tag used to construct the @buildable.
539func (x *SearchBar) GetBuildableId() string {
540
541	cret := XGtkBuildableGetBuildableId(x.GoPointer())
542	return cret
543}
544
545func init() {
546	core.SetPackageName("GTK", "gtk4")
547	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
548	var libs []uintptr
549	for _, libPath := range core.GetPaths("GTK") {
550		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
551		if err != nil {
552			panic(err)
553		}
554		libs = append(libs, lib)
555	}
556
557	core.PuregoSafeRegister(&xSearchBarGLibType, libs, "gtk_search_bar_get_type")
558
559	core.PuregoSafeRegister(&xNewSearchBar, libs, "gtk_search_bar_new")
560
561	core.PuregoSafeRegister(&xSearchBarConnectEntry, libs, "gtk_search_bar_connect_entry")
562	core.PuregoSafeRegister(&xSearchBarGetChild, libs, "gtk_search_bar_get_child")
563	core.PuregoSafeRegister(&xSearchBarGetKeyCaptureWidget, libs, "gtk_search_bar_get_key_capture_widget")
564	core.PuregoSafeRegister(&xSearchBarGetSearchMode, libs, "gtk_search_bar_get_search_mode")
565	core.PuregoSafeRegister(&xSearchBarGetShowCloseButton, libs, "gtk_search_bar_get_show_close_button")
566	core.PuregoSafeRegister(&xSearchBarSetChild, libs, "gtk_search_bar_set_child")
567	core.PuregoSafeRegister(&xSearchBarSetKeyCaptureWidget, libs, "gtk_search_bar_set_key_capture_widget")
568	core.PuregoSafeRegister(&xSearchBarSetSearchMode, libs, "gtk_search_bar_set_search_mode")
569	core.PuregoSafeRegister(&xSearchBarSetShowCloseButton, libs, "gtk_search_bar_set_show_close_button")
570
571}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close