v0.2.1 c0399be

adw-avatar.go RawHistoryFolder

1// Package adw was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package adw
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/gdk"
12	"github.com/bnema/puregotk/v4/gobject"
13	"github.com/bnema/puregotk/v4/gobject/types"
14	"github.com/bnema/puregotk/v4/gtk"
15)
16
17type AvatarClass struct {
18	_ structs.HostLayout
19
20	ParentClass gtk.WidgetClass
21}
22
23func (x *AvatarClass) GoPointer() uintptr {
24	return uintptr(unsafe.Pointer(x))
25}
26
27// A widget displaying an image, with a generated fallback.
28//
29// <picture>
30//
31//	<source srcset="avatar-dark.png" media="(prefers-color-scheme: dark)">
32//	<img src="avatar.png" alt="avatar">
33//
34// </picture>
35//
36// `AdwAvatar` is a widget that shows a round avatar.
37//
38// `AdwAvatar` generates an avatar with the initials of  the
39// [property@Avatar:text] on top of a colored background.
40//
41// The color is picked based on the hash of the [property@Avatar:text].
42//
43// If [property@Avatar:show-initials] is set to `FALSE`,
44// [property@Avatar:icon-name] or `avatar-default-symbolic` is shown instead of
45// the initials.
46//
47// Use [property@Avatar:custom-image] to set a custom image.
48//
49// ## CSS nodes
50//
51// `AdwAvatar` has a single CSS node with name `avatar`.
52//
53// ## Accessibility
54//
55// `AdwAvatar` uses the `GTK_ACCESSIBLE_ROLE_IMG` role.
56type Avatar struct {
57	gtk.Widget
58}
59
60var xAvatarGLibType func() types.GType
61
62func AvatarGLibType() types.GType {
63	return xAvatarGLibType()
64}
65
66func AvatarNewFromInternalPtr(ptr uintptr) *Avatar {
67	cls := &Avatar{}
68	cls.Ptr = ptr
69	return cls
70}
71
72var xNewAvatar func(int, uintptr, bool) uintptr
73
74// Creates a new `AdwAvatar`.
75func NewAvatar(SizeVar int, TextVar *string, ShowInitialsVar bool) *Avatar {
76	var cls *Avatar
77
78	TextVarPtr := core.GStrdupNullable(TextVar)
79	defer core.GFreeNullable(TextVarPtr)
80
81	cret := xNewAvatar(SizeVar, TextVarPtr, ShowInitialsVar)
82
83	if cret == 0 {
84		return nil
85	}
86	gobject.IncreaseRef(cret)
87	cls = &Avatar{}
88	cls.Ptr = cret
89	return cls
90}
91
92var xAvatarDrawToTexture func(uintptr, int) uintptr
93
94// Renders @self into a [class@Gdk.Texture] at @scale_factor.
95//
96// This can be used to export the fallback avatar.
97func (x *Avatar) DrawToTexture(ScaleFactorVar int) *gdk.Texture {
98	var cls *gdk.Texture
99
100	cret := xAvatarDrawToTexture(x.GoPointer(), ScaleFactorVar)
101
102	if cret == 0 {
103		return nil
104	}
105	cls = &gdk.Texture{}
106	cls.Ptr = cret
107	return cls
108}
109
110var xAvatarGetCustomImage func(uintptr) uintptr
111
112// Gets the custom image paintable.
113func (x *Avatar) GetCustomImage() *gdk.PaintableBase {
114	var cls *gdk.PaintableBase
115
116	cret := xAvatarGetCustomImage(x.GoPointer())
117
118	if cret == 0 {
119		return nil
120	}
121	gobject.IncreaseRef(cret)
122	cls = &gdk.PaintableBase{}
123	cls.Ptr = cret
124	return cls
125}
126
127var xAvatarGetIconName func(uintptr) string
128
129// Gets the name of an icon to use as a fallback.
130func (x *Avatar) GetIconName() string {
131
132	cret := xAvatarGetIconName(x.GoPointer())
133	return cret
134}
135
136var xAvatarGetShowInitials func(uintptr) bool
137
138// Gets whether initials are used instead of an icon on the fallback avatar.
139func (x *Avatar) GetShowInitials() bool {
140
141	cret := xAvatarGetShowInitials(x.GoPointer())
142	return cret
143}
144
145var xAvatarGetSize func(uintptr) int
146
147// Gets the size of the avatar.
148func (x *Avatar) GetSize() int {
149
150	cret := xAvatarGetSize(x.GoPointer())
151	return cret
152}
153
154var xAvatarGetText func(uintptr) string
155
156// Gets the text used to generate the fallback initials and color.
157func (x *Avatar) GetText() string {
158
159	cret := xAvatarGetText(x.GoPointer())
160	return cret
161}
162
163var xAvatarSetCustomImage func(uintptr, uintptr)
164
165// Sets the custom image paintable.
166//
167// Custom image is displayed instead of initials or icon.
168func (x *Avatar) SetCustomImage(CustomImageVar gdk.Paintable) {
169
170	xAvatarSetCustomImage(x.GoPointer(), CustomImageVar.GoPointer())
171
172}
173
174var xAvatarSetIconName func(uintptr, uintptr)
175
176// Sets the name of an icon to use as a fallback.
177//
178// If no name is set, `avatar-default-symbolic` will be used.
179func (x *Avatar) SetIconName(IconNameVar *string) {
180
181	IconNameVarPtr := core.GStrdupNullable(IconNameVar)
182	defer core.GFreeNullable(IconNameVarPtr)
183
184	xAvatarSetIconName(x.GoPointer(), IconNameVarPtr)
185
186}
187
188var xAvatarSetShowInitials func(uintptr, bool)
189
190// Sets whether to use initials instead of an icon on the fallback avatar.
191//
192// See [property@Avatar:icon-name] for how to change the fallback icon.
193func (x *Avatar) SetShowInitials(ShowInitialsVar bool) {
194
195	xAvatarSetShowInitials(x.GoPointer(), ShowInitialsVar)
196
197}
198
199var xAvatarSetSize func(uintptr, int)
200
201// Sets the size of the avatar.
202func (x *Avatar) SetSize(SizeVar int) {
203
204	xAvatarSetSize(x.GoPointer(), SizeVar)
205
206}
207
208var xAvatarSetText func(uintptr, uintptr)
209
210// Sets the text used to generate the fallback initials and color.
211//
212// It's only used to generate the color if [property@Avatar:show-initials] is
213// `FALSE`.
214func (x *Avatar) SetText(TextVar *string) {
215
216	TextVarPtr := core.GStrdupNullable(TextVar)
217	defer core.GFreeNullable(TextVarPtr)
218
219	xAvatarSetText(x.GoPointer(), TextVarPtr)
220
221}
222
223func (c *Avatar) GoPointer() uintptr {
224	if c == nil {
225		return 0
226	}
227	return c.Ptr
228}
229
230func (c *Avatar) SetGoPointer(ptr uintptr) {
231	c.Ptr = ptr
232}
233
234// SetPropertyIconName sets the "icon-name" property.
235// The name of an icon to use as a fallback.
236//
237// If no name is set, `avatar-default-symbolic` will be used.
238func (x *Avatar) SetPropertyIconName(value string) {
239	var v gobject.Value
240	v.Init(gobject.TypeStringVal)
241	v.SetString(&value)
242	x.SetProperty("icon-name", &v)
243}
244
245// GetPropertyIconName gets the "icon-name" property.
246// The name of an icon to use as a fallback.
247//
248// If no name is set, `avatar-default-symbolic` will be used.
249func (x *Avatar) GetPropertyIconName() string {
250	var v gobject.Value
251	x.GetProperty("icon-name", &v)
252	return v.GetString()
253}
254
255// SetPropertyShowInitials sets the "show-initials" property.
256// Whether initials are used instead of an icon on the fallback avatar.
257//
258// See [property@Avatar:icon-name] for how to change the fallback icon.
259func (x *Avatar) SetPropertyShowInitials(value bool) {
260	var v gobject.Value
261	v.Init(gobject.TypeBooleanVal)
262	v.SetBoolean(value)
263	x.SetProperty("show-initials", &v)
264}
265
266// GetPropertyShowInitials gets the "show-initials" property.
267// Whether initials are used instead of an icon on the fallback avatar.
268//
269// See [property@Avatar:icon-name] for how to change the fallback icon.
270func (x *Avatar) GetPropertyShowInitials() bool {
271	var v gobject.Value
272	x.GetProperty("show-initials", &v)
273	return v.GetBoolean()
274}
275
276// SetPropertySize sets the "size" property.
277// The size of the avatar.
278func (x *Avatar) SetPropertySize(value int) {
279	var v gobject.Value
280	v.Init(gobject.TypeIntVal)
281	v.SetInt(value)
282	x.SetProperty("size", &v)
283}
284
285// GetPropertySize gets the "size" property.
286// The size of the avatar.
287func (x *Avatar) GetPropertySize() int {
288	var v gobject.Value
289	x.GetProperty("size", &v)
290	return v.GetInt()
291}
292
293// SetPropertyText sets the "text" property.
294// Sets the text used to generate the fallback initials and color.
295//
296// It's only used to generate the color if [property@Avatar:show-initials] is
297// `FALSE`.
298func (x *Avatar) SetPropertyText(value string) {
299	var v gobject.Value
300	v.Init(gobject.TypeStringVal)
301	v.SetString(&value)
302	x.SetProperty("text", &v)
303}
304
305// GetPropertyText gets the "text" property.
306// Sets the text used to generate the fallback initials and color.
307//
308// It's only used to generate the color if [property@Avatar:show-initials] is
309// `FALSE`.
310func (x *Avatar) GetPropertyText() string {
311	var v gobject.Value
312	x.GetProperty("text", &v)
313	return v.GetString()
314}
315
316// Requests the user's screen reader to announce the given message.
317//
318// This kind of notification is useful for messages that
319// either have only a visual representation or that are not
320// exposed visually at all, e.g. a notification about a
321// successful operation.
322//
323// Also, by using this API, you can ensure that the message
324// does not interrupts the user's current screen reader output.
325func (x *Avatar) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) {
326
327	gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
328
329}
330
331// Retrieves the accessible parent for an accessible object.
332//
333// This function returns `NULL` for top level widgets.
334func (x *Avatar) GetAccessibleParent() *gtk.AccessibleBase {
335	var cls *gtk.AccessibleBase
336
337	cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer())
338
339	if cret == 0 {
340		return nil
341	}
342	cls = &gtk.AccessibleBase{}
343	cls.Ptr = cret
344	return cls
345}
346
347// Retrieves the accessible role of an accessible object.
348func (x *Avatar) GetAccessibleRole() gtk.AccessibleRole {
349
350	cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer())
351	return cret
352}
353
354// Retrieves the implementation for the given accessible object.
355func (x *Avatar) GetAtContext() *gtk.ATContext {
356	var cls *gtk.ATContext
357
358	cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer())
359
360	if cret == 0 {
361		return nil
362	}
363	cls = &gtk.ATContext{}
364	cls.Ptr = cret
365	return cls
366}
367
368// Queries the coordinates and dimensions of this accessible
369//
370// This functionality can be overridden by `GtkAccessible`
371// implementations, e.g. to get the bounds from an ignored
372// child widget.
373func (x *Avatar) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
374
375	cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
376	return cret
377}
378
379// Retrieves the first accessible child of an accessible object.
380func (x *Avatar) GetFirstAccessibleChild() *gtk.AccessibleBase {
381	var cls *gtk.AccessibleBase
382
383	cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
384
385	if cret == 0 {
386		return nil
387	}
388	cls = &gtk.AccessibleBase{}
389	cls.Ptr = cret
390	return cls
391}
392
393// Retrieves the next accessible sibling of an accessible object
394func (x *Avatar) GetNextAccessibleSibling() *gtk.AccessibleBase {
395	var cls *gtk.AccessibleBase
396
397	cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
398
399	if cret == 0 {
400		return nil
401	}
402	cls = &gtk.AccessibleBase{}
403	cls.Ptr = cret
404	return cls
405}
406
407// Queries a platform state, such as focus.
408//
409// This functionality can be overridden by `GtkAccessible`
410// implementations, e.g. to get platform state from an ignored
411// child widget, as is the case for `GtkText` wrappers.
412func (x *Avatar) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool {
413
414	cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
415	return cret
416}
417
418// Resets the accessible property to its default value.
419func (x *Avatar) ResetProperty(PropertyVar gtk.AccessibleProperty) {
420
421	gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
422
423}
424
425// Resets the accessible relation to its default value.
426func (x *Avatar) ResetRelation(RelationVar gtk.AccessibleRelation) {
427
428	gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
429
430}
431
432// Resets the accessible state to its default value.
433func (x *Avatar) ResetState(StateVar gtk.AccessibleState) {
434
435	gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar)
436
437}
438
439// Sets the parent and sibling of an accessible object.
440//
441// This function is meant to be used by accessible implementations that are
442// not part of the widget hierarchy, and but act as a logical bridge between
443// widgets. For instance, if a widget creates an object that holds metadata
444// for each child, and you want that object to implement the `GtkAccessible`
445// interface, you will use this function to ensure that the parent of each
446// child widget is the metadata object, and the parent of each metadata
447// object is the container widget.
448func (x *Avatar) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) {
449
450	gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
451
452}
453
454// Updates the next accessible sibling.
455//
456// That might be useful when a new child of a custom accessible
457// is created, and it needs to be linked to a previous child.
458func (x *Avatar) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) {
459
460	gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
461
462}
463
464// Informs ATs that the platform state has changed.
465//
466// This function should be used by `GtkAccessible` implementations that
467// have a platform state but are not widgets. Widgets handle platform
468// states automatically.
469func (x *Avatar) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) {
470
471	gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
472
473}
474
475// Updates a list of accessible properties.
476//
477// See the [enum@Gtk.AccessibleProperty] documentation for the
478// value types of accessible properties.
479//
480// This function should be called by `GtkWidget` types whenever
481// an accessible property change must be communicated to assistive
482// technologies.
483//
484// Example:
485// ```c
486// value = gtk_adjustment_get_value (adjustment);
487// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
488//
489//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
490//	-1);
491//
492// ```
493func (x *Avatar) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) {
494
495	gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
496
497}
498
499// Updates an array of accessible properties.
500//
501// This function should be called by `GtkWidget` types whenever an accessible
502// property change must be communicated to assistive technologies.
503//
504// This function is meant to be used by language bindings.
505func (x *Avatar) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) {
506
507	gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
508
509}
510
511// Updates a list of accessible relations.
512//
513// This function should be called by `GtkWidget` types whenever an accessible
514// relation change must be communicated to assistive technologies.
515//
516// If the [enum@Gtk.AccessibleRelation] requires a list of references,
517// you should pass each reference individually, followed by `NULL`, e.g.
518//
519// ```c
520// gtk_accessible_update_relation (accessible,
521//
522//	GTK_ACCESSIBLE_RELATION_CONTROLS,
523//	  ref1, NULL,
524//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
525//	  ref1, ref2, ref3, NULL,
526//	-1);
527//
528// ```
529func (x *Avatar) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) {
530
531	gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
532
533}
534
535// Updates an array of accessible relations.
536//
537// This function should be called by `GtkWidget` types whenever an accessible
538// relation change must be communicated to assistive technologies.
539//
540// This function is meant to be used by language bindings.
541func (x *Avatar) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) {
542
543	gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
544
545}
546
547// Updates a list of accessible states.
548//
549// See the [enum@Gtk.AccessibleState] documentation for the
550// value types of accessible states.
551//
552// This function should be called by `GtkWidget` types whenever
553// an accessible state change must be communicated to assistive
554// technologies.
555//
556// Example:
557//
558// ```c
559// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
560// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
561//
562//	GTK_ACCESSIBLE_STATE_CHECKED, value,
563//	-1);
564//
565// ```
566func (x *Avatar) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) {
567
568	gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
569
570}
571
572// Updates an array of accessible states.
573//
574// This function should be called by `GtkWidget` types whenever an accessible
575// state change must be communicated to assistive technologies.
576//
577// This function is meant to be used by language bindings.
578func (x *Avatar) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) {
579
580	gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
581
582}
583
584// Gets the ID of the @buildable object.
585//
586// `GtkBuilder` sets the name based on the ID attribute
587// of the `<object>` tag used to construct the @buildable.
588func (x *Avatar) GetBuildableId() string {
589
590	cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
591	return cret
592}
593
594func init() {
595	core.SetPackageName("ADW", "libadwaita-1")
596	core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
597	var libs []uintptr
598	for _, libPath := range core.GetPaths("ADW") {
599		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
600		if err != nil {
601			panic(err)
602		}
603		libs = append(libs, lib)
604	}
605
606	core.PuregoSafeRegister(&xAvatarGLibType, libs, "adw_avatar_get_type")
607
608	core.PuregoSafeRegister(&xNewAvatar, libs, "adw_avatar_new")
609
610	core.PuregoSafeRegister(&xAvatarDrawToTexture, libs, "adw_avatar_draw_to_texture")
611	core.PuregoSafeRegister(&xAvatarGetCustomImage, libs, "adw_avatar_get_custom_image")
612	core.PuregoSafeRegister(&xAvatarGetIconName, libs, "adw_avatar_get_icon_name")
613	core.PuregoSafeRegister(&xAvatarGetShowInitials, libs, "adw_avatar_get_show_initials")
614	core.PuregoSafeRegister(&xAvatarGetSize, libs, "adw_avatar_get_size")
615	core.PuregoSafeRegister(&xAvatarGetText, libs, "adw_avatar_get_text")
616	core.PuregoSafeRegister(&xAvatarSetCustomImage, libs, "adw_avatar_set_custom_image")
617	core.PuregoSafeRegister(&xAvatarSetIconName, libs, "adw_avatar_set_icon_name")
618	core.PuregoSafeRegister(&xAvatarSetShowInitials, libs, "adw_avatar_set_show_initials")
619	core.PuregoSafeRegister(&xAvatarSetSize, libs, "adw_avatar_set_size")
620	core.PuregoSafeRegister(&xAvatarSetText, libs, "adw_avatar_set_text")
621
622}

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