v0.2.1 c0399be

adw-style-manager.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)
15
16type StyleManagerClass struct {
17	_ structs.HostLayout
18
19	ParentClass gobject.ObjectClass
20}
21
22func (x *StyleManagerClass) GoPointer() uintptr {
23	return uintptr(unsafe.Pointer(x))
24}
25
26// Application color schemes for [property@StyleManager:color-scheme].
27type ColorScheme int
28
29var xColorSchemeGLibType func() types.GType
30
31func ColorSchemeGLibType() types.GType {
32	return xColorSchemeGLibType()
33}
34
35const (
36
37	// Inherit the parent color-scheme. When set on the
38	//   `AdwStyleManager` returned by [func@StyleManager.get_default], it's
39	//   equivalent to `ADW_COLOR_SCHEME_PREFER_LIGHT`.
40	ColorSchemeDefaultValue ColorScheme = 0
41	// Always use light appearance.
42	ColorSchemeForceLightValue ColorScheme = 1
43	// Use light appearance unless the system
44	//   prefers dark colors.
45	ColorSchemePreferLightValue ColorScheme = 2
46	// Use dark appearance unless the system prefers
47	//   prefers light colors.
48	ColorSchemePreferDarkValue ColorScheme = 3
49	// Always use dark appearance.
50	ColorSchemeForceDarkValue ColorScheme = 4
51)
52
53// A class for managing application-wide styling.
54//
55// `AdwStyleManager` provides a way to query and influence the application
56// styles, such as whether to use dark style, the system accent color or high
57// contrast appearance.
58//
59// It allows to set the color scheme via the
60// [property@StyleManager:color-scheme] property, and to query the current
61// appearance, as well as whether a system-wide color scheme and accent color
62// preferences exists.
63type StyleManager struct {
64	gobject.Object
65}
66
67var xStyleManagerGLibType func() types.GType
68
69func StyleManagerGLibType() types.GType {
70	return xStyleManagerGLibType()
71}
72
73func StyleManagerNewFromInternalPtr(ptr uintptr) *StyleManager {
74	cls := &StyleManager{}
75	cls.Ptr = ptr
76	return cls
77}
78
79var xStyleManagerGetAccentColor func(uintptr) AccentColor
80
81// Gets the current system accent color.
82//
83// See also [property@StyleManager:accent-color-rgba].
84func (x *StyleManager) GetAccentColor() AccentColor {
85
86	cret := xStyleManagerGetAccentColor(x.GoPointer())
87	return cret
88}
89
90var xStyleManagerGetAccentColorRgba func(uintptr) *gdk.RGBA
91
92// Gets the current system accent color as a `GdkRGBA`.
93//
94// Equivalent to calling [func@AccentColor.to_rgba] on the value of
95// [property@StyleManager:accent-color].
96//
97// This is a background color. The matching foreground color is white.
98func (x *StyleManager) GetAccentColorRgba() *gdk.RGBA {
99
100	cret := xStyleManagerGetAccentColorRgba(x.GoPointer())
101	return cret
102}
103
104var xStyleManagerGetColorScheme func(uintptr) ColorScheme
105
106// Gets the requested application color scheme.
107func (x *StyleManager) GetColorScheme() ColorScheme {
108
109	cret := xStyleManagerGetColorScheme(x.GoPointer())
110	return cret
111}
112
113var xStyleManagerGetDark func(uintptr) bool
114
115// Gets whether the application is using dark appearance.
116//
117// This can be used to query the current appearance, as requested via
118// [property@StyleManager:color-scheme].
119func (x *StyleManager) GetDark() bool {
120
121	cret := xStyleManagerGetDark(x.GoPointer())
122	return cret
123}
124
125var xStyleManagerGetDisplay func(uintptr) uintptr
126
127// Gets the display the style manager is associated with.
128//
129// The display will be `NULL` for the style manager returned by
130// [func@StyleManager.get_default].
131func (x *StyleManager) GetDisplay() *gdk.Display {
132	var cls *gdk.Display
133
134	cret := xStyleManagerGetDisplay(x.GoPointer())
135
136	if cret == 0 {
137		return nil
138	}
139	gobject.IncreaseRef(cret)
140	cls = &gdk.Display{}
141	cls.Ptr = cret
142	return cls
143}
144
145var xStyleManagerGetDocumentFontName func(uintptr) string
146
147// Gets the system document font.
148//
149// The font is in the same format as [property@Gtk.Settings:gtk-font-name],
150// e.g. "Adwaita Sans 12".
151//
152// Use [func@Pango.FontDescription.from_string] to parse it.
153func (x *StyleManager) GetDocumentFontName() string {
154
155	cret := xStyleManagerGetDocumentFontName(x.GoPointer())
156	return cret
157}
158
159var xStyleManagerGetHighContrast func(uintptr) bool
160
161// Gets whether the application is using high contrast appearance.
162//
163// This cannot be overridden by applications.
164func (x *StyleManager) GetHighContrast() bool {
165
166	cret := xStyleManagerGetHighContrast(x.GoPointer())
167	return cret
168}
169
170var xStyleManagerGetMonospaceFontName func(uintptr) string
171
172// Gets the system monospace font.
173//
174// The font is in the same format as [property@Gtk.Settings:gtk-font-name],
175// e.g. "Adwaita Mono 11".
176//
177// Use [func@Pango.FontDescription.from_string] to parse it.
178func (x *StyleManager) GetMonospaceFontName() string {
179
180	cret := xStyleManagerGetMonospaceFontName(x.GoPointer())
181	return cret
182}
183
184var xStyleManagerGetSystemSupportsAccentColors func(uintptr) bool
185
186// Gets whether the system supports accent colors.
187//
188// This can be used to check if the current environment provides an accent color
189// preference. For example, applications might want to show a preference for
190// choosing accent color if it's set to `FALSE`.
191//
192// See [property@StyleManager:accent-color].
193func (x *StyleManager) GetSystemSupportsAccentColors() bool {
194
195	cret := xStyleManagerGetSystemSupportsAccentColors(x.GoPointer())
196	return cret
197}
198
199var xStyleManagerGetSystemSupportsColorSchemes func(uintptr) bool
200
201// Gets whether the system supports color schemes.
202//
203// This can be used to check if the current environment provides a color scheme
204// preference. For example, applications might want to show a separate
205// appearance switcher if it's set to `FALSE`.
206func (x *StyleManager) GetSystemSupportsColorSchemes() bool {
207
208	cret := xStyleManagerGetSystemSupportsColorSchemes(x.GoPointer())
209	return cret
210}
211
212var xStyleManagerSetColorScheme func(uintptr, ColorScheme)
213
214// Sets the requested application color scheme.
215//
216// The effective appearance will be decided based on the application color
217// scheme and the system preferred color scheme. The
218// [property@StyleManager:dark] property can be used to query the current
219// effective appearance.
220//
221// The `ADW_COLOR_SCHEME_PREFER_LIGHT` color scheme results in the application
222// using light appearance unless the system prefers dark colors. This is the
223// default value.
224//
225// The `ADW_COLOR_SCHEME_PREFER_DARK` color scheme results in the application
226// using dark appearance, but can still switch to the light appearance if the
227// system can prefers it, for example, when the high contrast preference is
228// enabled.
229//
230// The `ADW_COLOR_SCHEME_FORCE_LIGHT` and `ADW_COLOR_SCHEME_FORCE_DARK` values
231// ignore the system preference entirely. They are useful if the application
232// wants to match its UI to its content or to provide a separate color scheme
233// switcher.
234//
235// If a per-[class@Gdk.Display] style manager has its color scheme set to
236// `ADW_COLOR_SCHEME_DEFAULT`, it will inherit the color scheme from the
237// default style manager.
238//
239// For the default style manager, `ADW_COLOR_SCHEME_DEFAULT` is equivalent to
240// `ADW_COLOR_SCHEME_PREFER_LIGHT`.
241//
242// The [property@StyleManager:system-supports-color-schemes] property can be
243// used to check if the current environment provides a color scheme
244// preference.
245func (x *StyleManager) SetColorScheme(ColorSchemeVar ColorScheme) {
246
247	xStyleManagerSetColorScheme(x.GoPointer(), ColorSchemeVar)
248
249}
250
251func (c *StyleManager) GoPointer() uintptr {
252	if c == nil {
253		return 0
254	}
255	return c.Ptr
256}
257
258func (c *StyleManager) SetGoPointer(ptr uintptr) {
259	c.Ptr = ptr
260}
261
262// GetPropertyAccentColorRgba gets the "accent-color-rgba" property.
263// The current system accent color as a `GdkRGBA`.
264//
265// Equivalent to calling [func@AccentColor.to_rgba] on the value of
266// [property@StyleManager:accent-color].
267//
268// This is a background color. The matching foreground color is white.
269func (x *StyleManager) GetPropertyAccentColorRgba() uintptr {
270	var v gobject.Value
271	x.GetProperty("accent-color-rgba", &v)
272	return v.GetPointer()
273}
274
275// GetPropertyDark gets the "dark" property.
276// Whether the application is using dark appearance.
277//
278// This property can be used to query the current appearance, as requested via
279// [property@StyleManager:color-scheme].
280func (x *StyleManager) GetPropertyDark() bool {
281	var v gobject.Value
282	x.GetProperty("dark", &v)
283	return v.GetBoolean()
284}
285
286// GetPropertyDocumentFontName gets the "document-font-name" property.
287// The system document font.
288//
289// The font is in the same format as [property@Gtk.Settings:gtk-font-name],
290// e.g. "Adwaita Sans 12".
291//
292// Use [func@Pango.FontDescription.from_string] to parse it.
293func (x *StyleManager) GetPropertyDocumentFontName() string {
294	var v gobject.Value
295	x.GetProperty("document-font-name", &v)
296	return v.GetString()
297}
298
299// GetPropertyHighContrast gets the "high-contrast" property.
300// Whether the application is using high contrast appearance.
301//
302// This cannot be overridden by applications.
303func (x *StyleManager) GetPropertyHighContrast() bool {
304	var v gobject.Value
305	x.GetProperty("high-contrast", &v)
306	return v.GetBoolean()
307}
308
309// GetPropertyMonospaceFontName gets the "monospace-font-name" property.
310// The system monospace font.
311//
312// The font is in the same format as [property@Gtk.Settings:gtk-font-name],
313// e.g. "Adwaita Mono 11".
314//
315// Use [func@Pango.FontDescription.from_string] to parse it.
316func (x *StyleManager) GetPropertyMonospaceFontName() string {
317	var v gobject.Value
318	x.GetProperty("monospace-font-name", &v)
319	return v.GetString()
320}
321
322// GetPropertySystemSupportsAccentColors gets the "system-supports-accent-colors" property.
323// Whether the system supports accent colors.
324//
325// This property can be used to check if the current environment provides an
326// accent color preference. For example, applications might want to show a
327// preference for choosing accent color if it's set to `FALSE`.
328//
329// See [property@StyleManager:accent-color].
330func (x *StyleManager) GetPropertySystemSupportsAccentColors() bool {
331	var v gobject.Value
332	x.GetProperty("system-supports-accent-colors", &v)
333	return v.GetBoolean()
334}
335
336// GetPropertySystemSupportsColorSchemes gets the "system-supports-color-schemes" property.
337// Whether the system supports color schemes.
338//
339// This property can be used to check if the current environment provides a
340// color scheme preference. For example, applications might want to show a
341// separate appearance switcher if it's set to `FALSE`.
342//
343// See [property@StyleManager:color-scheme].
344func (x *StyleManager) GetPropertySystemSupportsColorSchemes() bool {
345	var v gobject.Value
346	x.GetProperty("system-supports-color-schemes", &v)
347	return v.GetBoolean()
348}
349
350var xStyleManagerGetDefault func() uintptr
351
352// Gets the default `AdwStyleManager` instance.
353//
354// It manages all [class@Gdk.Display] instances unless the style manager for
355// that display has an override.
356//
357// See [func@StyleManager.get_for_display].
358func StyleManagerGetDefault() *StyleManager {
359	var cls *StyleManager
360
361	cret := xStyleManagerGetDefault()
362
363	if cret == 0 {
364		return nil
365	}
366	gobject.IncreaseRef(cret)
367	cls = &StyleManager{}
368	cls.Ptr = cret
369	return cls
370}
371
372var xStyleManagerGetForDisplay func(uintptr) uintptr
373
374// Gets the `AdwStyleManager` instance managing @display.
375//
376// It can be used to override styles for that specific display instead of the
377// whole application.
378//
379// Most applications should use [func@StyleManager.get_default] instead.
380func StyleManagerGetForDisplay(DisplayVar *gdk.Display) *StyleManager {
381	var cls *StyleManager
382
383	cret := xStyleManagerGetForDisplay(DisplayVar.GoPointer())
384
385	if cret == 0 {
386		return nil
387	}
388	gobject.IncreaseRef(cret)
389	cls = &StyleManager{}
390	cls.Ptr = cret
391	return cls
392}
393
394func init() {
395	core.SetPackageName("ADW", "libadwaita-1")
396	core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
397	var libs []uintptr
398	for _, libPath := range core.GetPaths("ADW") {
399		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
400		if err != nil {
401			panic(err)
402		}
403		libs = append(libs, lib)
404	}
405
406	core.PuregoSafeRegister(&xColorSchemeGLibType, libs, "adw_color_scheme_get_type")
407
408	core.PuregoSafeRegister(&xStyleManagerGLibType, libs, "adw_style_manager_get_type")
409
410	core.PuregoSafeRegister(&xStyleManagerGetAccentColor, libs, "adw_style_manager_get_accent_color")
411	core.PuregoSafeRegister(&xStyleManagerGetAccentColorRgba, libs, "adw_style_manager_get_accent_color_rgba")
412	core.PuregoSafeRegister(&xStyleManagerGetColorScheme, libs, "adw_style_manager_get_color_scheme")
413	core.PuregoSafeRegister(&xStyleManagerGetDark, libs, "adw_style_manager_get_dark")
414	core.PuregoSafeRegister(&xStyleManagerGetDisplay, libs, "adw_style_manager_get_display")
415	core.PuregoSafeRegister(&xStyleManagerGetDocumentFontName, libs, "adw_style_manager_get_document_font_name")
416	core.PuregoSafeRegister(&xStyleManagerGetHighContrast, libs, "adw_style_manager_get_high_contrast")
417	core.PuregoSafeRegister(&xStyleManagerGetMonospaceFontName, libs, "adw_style_manager_get_monospace_font_name")
418	core.PuregoSafeRegister(&xStyleManagerGetSystemSupportsAccentColors, libs, "adw_style_manager_get_system_supports_accent_colors")
419	core.PuregoSafeRegister(&xStyleManagerGetSystemSupportsColorSchemes, libs, "adw_style_manager_get_system_supports_color_schemes")
420	core.PuregoSafeRegister(&xStyleManagerSetColorScheme, libs, "adw_style_manager_set_color_scheme")
421
422	core.PuregoSafeRegister(&xStyleManagerGetDefault, libs, "adw_style_manager_get_default")
423	core.PuregoSafeRegister(&xStyleManagerGetForDisplay, libs, "adw_style_manager_get_for_display")
424
425}

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