v0.2.1 c0399be

gtkstylecontext.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
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 StyleContextClass struct {
17	_ structs.HostLayout
18
19	ParentClass gobject.ObjectClass
20
21	xChanged uintptr
22
23	xGtkReserved1 uintptr
24
25	xGtkReserved2 uintptr
26
27	xGtkReserved3 uintptr
28
29	xGtkReserved4 uintptr
30}
31
32func (x *StyleContextClass) GoPointer() uintptr {
33	return uintptr(unsafe.Pointer(x))
34}
35
36// OverrideChanged sets the "changed" callback function.
37func (x *StyleContextClass) OverrideChanged(cb func(*StyleContext)) {
38	if cb == nil {
39		x.xChanged = 0
40	} else {
41		x.xChanged = purego.NewCallback(func(ContextVarp uintptr) {
42			cb(StyleContextNewFromInternalPtr(ContextVarp))
43		})
44	}
45}
46
47// GetChanged gets the "changed" callback function.
48func (x *StyleContextClass) GetChanged() func(*StyleContext) {
49	if x.xChanged == 0 {
50		return nil
51	}
52	var rawCallback func(ContextVarp uintptr)
53	purego.RegisterFunc(&rawCallback, x.xChanged)
54	return func(ContextVar *StyleContext) {
55		rawCallback(ContextVar.GoPointer())
56	}
57}
58
59// OverrideGtkReserved1 sets the "_gtk_reserved1" callback function.
60func (x *StyleContextClass) OverrideGtkReserved1(cb func()) {
61	if cb == nil {
62		x.xGtkReserved1 = 0
63	} else {
64		x.xGtkReserved1 = purego.NewCallback(func() {
65			cb()
66		})
67	}
68}
69
70// GetGtkReserved1 gets the "_gtk_reserved1" callback function.
71func (x *StyleContextClass) GetGtkReserved1() func() {
72	if x.xGtkReserved1 == 0 {
73		return nil
74	}
75	var rawCallback func()
76	purego.RegisterFunc(&rawCallback, x.xGtkReserved1)
77	return func() {
78		rawCallback()
79	}
80}
81
82// OverrideGtkReserved2 sets the "_gtk_reserved2" callback function.
83func (x *StyleContextClass) OverrideGtkReserved2(cb func()) {
84	if cb == nil {
85		x.xGtkReserved2 = 0
86	} else {
87		x.xGtkReserved2 = purego.NewCallback(func() {
88			cb()
89		})
90	}
91}
92
93// GetGtkReserved2 gets the "_gtk_reserved2" callback function.
94func (x *StyleContextClass) GetGtkReserved2() func() {
95	if x.xGtkReserved2 == 0 {
96		return nil
97	}
98	var rawCallback func()
99	purego.RegisterFunc(&rawCallback, x.xGtkReserved2)
100	return func() {
101		rawCallback()
102	}
103}
104
105// OverrideGtkReserved3 sets the "_gtk_reserved3" callback function.
106func (x *StyleContextClass) OverrideGtkReserved3(cb func()) {
107	if cb == nil {
108		x.xGtkReserved3 = 0
109	} else {
110		x.xGtkReserved3 = purego.NewCallback(func() {
111			cb()
112		})
113	}
114}
115
116// GetGtkReserved3 gets the "_gtk_reserved3" callback function.
117func (x *StyleContextClass) GetGtkReserved3() func() {
118	if x.xGtkReserved3 == 0 {
119		return nil
120	}
121	var rawCallback func()
122	purego.RegisterFunc(&rawCallback, x.xGtkReserved3)
123	return func() {
124		rawCallback()
125	}
126}
127
128// OverrideGtkReserved4 sets the "_gtk_reserved4" callback function.
129func (x *StyleContextClass) OverrideGtkReserved4(cb func()) {
130	if cb == nil {
131		x.xGtkReserved4 = 0
132	} else {
133		x.xGtkReserved4 = purego.NewCallback(func() {
134			cb()
135		})
136	}
137}
138
139// GetGtkReserved4 gets the "_gtk_reserved4" callback function.
140func (x *StyleContextClass) GetGtkReserved4() func() {
141	if x.xGtkReserved4 == 0 {
142		return nil
143	}
144	var rawCallback func()
145	purego.RegisterFunc(&rawCallback, x.xGtkReserved4)
146	return func() {
147		rawCallback()
148	}
149}
150
151// Flags that modify the behavior of gtk_style_context_to_string().
152//
153// New values may be added to this enumeration.
154type StyleContextPrintFlags int
155
156var xStyleContextPrintFlagsGLibType func() types.GType
157
158func StyleContextPrintFlagsGLibType() types.GType {
159	return xStyleContextPrintFlagsGLibType()
160}
161
162const (
163
164	// Default value.
165	StyleContextPrintNoneValue StyleContextPrintFlags = 0
166	// Print the entire tree of
167	//   CSS nodes starting at the style context's node
168	StyleContextPrintRecurseValue StyleContextPrintFlags = 1
169	// Show the values of the
170	//   CSS properties for each node
171	StyleContextPrintShowStyleValue StyleContextPrintFlags = 2
172	// Show information about
173	//   what changes affect the styles
174	StyleContextPrintShowChangeValue StyleContextPrintFlags = 4
175)
176
177// `GtkStyleContext` stores styling information affecting a widget.
178//
179// In order to construct the final style information, `GtkStyleContext`
180// queries information from all attached `GtkStyleProviders`. Style
181// providers can be either attached explicitly to the context through
182// [method@Gtk.StyleContext.add_provider], or to the display through
183// [func@Gtk.StyleContext.add_provider_for_display]. The resulting
184// style is a combination of all providers’ information in priority order.
185//
186// For GTK widgets, any `GtkStyleContext` returned by
187// [method@Gtk.Widget.get_style_context] will already have a `GdkDisplay`
188// and RTL/LTR information set. The style context will also be updated
189// automatically if any of these settings change on the widget.
190//
191// ## Style Classes
192//
193// Widgets can add style classes to their context, which can be used to associate
194// different styles by class. The documentation for individual widgets lists
195// which style classes it uses itself, and which style classes may be added by
196// applications to affect their appearance.
197//
198// # Custom styling in UI libraries and applications
199//
200// If you are developing a library with custom widgets that render differently
201// than standard components, you may need to add a `GtkStyleProvider` yourself
202// with the %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority, either a
203// `GtkCssProvider` or a custom object implementing the `GtkStyleProvider`
204// interface. This way themes may still attempt to style your UI elements in
205// a different way if needed so.
206//
207// If you are using custom styling on an applications, you probably want then
208// to make your style information prevail to the theme’s, so you must use
209// a `GtkStyleProvider` with the %GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
210// priority, keep in mind that the user settings in
211// `XDG_CONFIG_HOME/gtk-4.0/gtk.css` will
212// still take precedence over your changes, as it uses the
213// %GTK_STYLE_PROVIDER_PRIORITY_USER priority.
214type StyleContext struct {
215	gobject.Object
216}
217
218var xStyleContextGLibType func() types.GType
219
220func StyleContextGLibType() types.GType {
221	return xStyleContextGLibType()
222}
223
224func StyleContextNewFromInternalPtr(ptr uintptr) *StyleContext {
225	cls := &StyleContext{}
226	cls.Ptr = ptr
227	return cls
228}
229
230var xStyleContextAddClass func(uintptr, string)
231
232// Adds a style class to @context, so later uses of the
233// style context will make use of this new class for styling.
234//
235// In the CSS file format, a `GtkEntry` defining a “search”
236// class, would be matched by:
237//
238// ```css
239// entry.search { ... }
240// ```
241//
242// While any widget defining a “search” class would be
243// matched by:
244// ```css
245// .search { ... }
246// ```
247func (x *StyleContext) AddClass(ClassNameVar string) {
248
249	xStyleContextAddClass(x.GoPointer(), ClassNameVar)
250
251}
252
253var xStyleContextAddProvider func(uintptr, uintptr, uint)
254
255// Adds a style provider to @context, to be used in style construction.
256//
257// Note that a style provider added by this function only affects
258// the style of the widget to which @context belongs. If you want
259// to affect the style of all widgets, use
260// [func@Gtk.StyleContext.add_provider_for_display].
261//
262// Note: If both priorities are the same, a `GtkStyleProvider`
263// added through this function takes precedence over another added
264// through [func@Gtk.StyleContext.add_provider_for_display].
265func (x *StyleContext) AddProvider(ProviderVar StyleProvider, PriorityVar uint) {
266
267	xStyleContextAddProvider(x.GoPointer(), ProviderVar.GoPointer(), PriorityVar)
268
269}
270
271var xStyleContextGetBorder func(uintptr, *Border)
272
273// Gets the border for a given state as a `GtkBorder`.
274func (x *StyleContext) GetBorder(BorderVar *Border) {
275
276	xStyleContextGetBorder(x.GoPointer(), BorderVar)
277
278}
279
280var xStyleContextGetColor func(uintptr, *gdk.RGBA)
281
282// Gets the foreground color for a given state.
283func (x *StyleContext) GetColor(ColorVar *gdk.RGBA) {
284
285	xStyleContextGetColor(x.GoPointer(), ColorVar)
286
287}
288
289var xStyleContextGetDisplay func(uintptr) uintptr
290
291// Returns the `GdkDisplay` to which @context is attached.
292func (x *StyleContext) GetDisplay() *gdk.Display {
293	var cls *gdk.Display
294
295	cret := xStyleContextGetDisplay(x.GoPointer())
296
297	if cret == 0 {
298		return nil
299	}
300	gobject.IncreaseRef(cret)
301	cls = &gdk.Display{}
302	cls.Ptr = cret
303	return cls
304}
305
306var xStyleContextGetMargin func(uintptr, *Border)
307
308// Gets the margin for a given state as a `GtkBorder`.
309func (x *StyleContext) GetMargin(MarginVar *Border) {
310
311	xStyleContextGetMargin(x.GoPointer(), MarginVar)
312
313}
314
315var xStyleContextGetPadding func(uintptr, *Border)
316
317// Gets the padding for a given state as a `GtkBorder`.
318func (x *StyleContext) GetPadding(PaddingVar *Border) {
319
320	xStyleContextGetPadding(x.GoPointer(), PaddingVar)
321
322}
323
324var xStyleContextGetScale func(uintptr) int
325
326// Returns the scale used for assets.
327func (x *StyleContext) GetScale() int {
328
329	cret := xStyleContextGetScale(x.GoPointer())
330	return cret
331}
332
333var xStyleContextGetState func(uintptr) StateFlags
334
335// Returns the state used for style matching.
336//
337// This method should only be used to retrieve the `GtkStateFlags`
338// to pass to `GtkStyleContext` methods, like
339// [method@Gtk.StyleContext.get_padding].
340// If you need to retrieve the current state of a `GtkWidget`, use
341// [method@Gtk.Widget.get_state_flags].
342func (x *StyleContext) GetState() StateFlags {
343
344	cret := xStyleContextGetState(x.GoPointer())
345	return cret
346}
347
348var xStyleContextHasClass func(uintptr, string) bool
349
350// Returns %TRUE if @context currently has defined the
351// given class name.
352func (x *StyleContext) HasClass(ClassNameVar string) bool {
353
354	cret := xStyleContextHasClass(x.GoPointer(), ClassNameVar)
355	return cret
356}
357
358var xStyleContextLookupColor func(uintptr, string, *gdk.RGBA) bool
359
360// Looks up and resolves a color name in the @context color map.
361func (x *StyleContext) LookupColor(ColorNameVar string, ColorVar *gdk.RGBA) bool {
362
363	cret := xStyleContextLookupColor(x.GoPointer(), ColorNameVar, ColorVar)
364	return cret
365}
366
367var xStyleContextRemoveClass func(uintptr, string)
368
369// Removes @class_name from @context.
370func (x *StyleContext) RemoveClass(ClassNameVar string) {
371
372	xStyleContextRemoveClass(x.GoPointer(), ClassNameVar)
373
374}
375
376var xStyleContextRemoveProvider func(uintptr, uintptr)
377
378// Removes @provider from the style providers list in @context.
379func (x *StyleContext) RemoveProvider(ProviderVar StyleProvider) {
380
381	xStyleContextRemoveProvider(x.GoPointer(), ProviderVar.GoPointer())
382
383}
384
385var xStyleContextRestore func(uintptr)
386
387// Restores @context state to a previous stage.
388//
389// See [method@Gtk.StyleContext.save].
390func (x *StyleContext) Restore() {
391
392	xStyleContextRestore(x.GoPointer())
393
394}
395
396var xStyleContextSave func(uintptr)
397
398// Saves the @context state.
399//
400// This allows temporary modifications done through
401// [method@Gtk.StyleContext.add_class],
402// [method@Gtk.StyleContext.remove_class],
403// [method@Gtk.StyleContext.set_state] to be quickly
404// reverted in one go through [method@Gtk.StyleContext.restore].
405//
406// The matching call to [method@Gtk.StyleContext.restore]
407// must be done before GTK returns to the main loop.
408func (x *StyleContext) Save() {
409
410	xStyleContextSave(x.GoPointer())
411
412}
413
414var xStyleContextSetDisplay func(uintptr, uintptr)
415
416// Attaches @context to the given display.
417//
418// The display is used to add style information from “global”
419// style providers, such as the display's `GtkSettings` instance.
420//
421// If you are using a `GtkStyleContext` returned from
422// [method@Gtk.Widget.get_style_context], you do not need to
423// call this yourself.
424func (x *StyleContext) SetDisplay(DisplayVar *gdk.Display) {
425
426	xStyleContextSetDisplay(x.GoPointer(), DisplayVar.GoPointer())
427
428}
429
430var xStyleContextSetScale func(uintptr, int)
431
432// Sets the scale to use when getting image assets for the style.
433func (x *StyleContext) SetScale(ScaleVar int) {
434
435	xStyleContextSetScale(x.GoPointer(), ScaleVar)
436
437}
438
439var xStyleContextSetState func(uintptr, StateFlags)
440
441// Sets the state to be used for style matching.
442func (x *StyleContext) SetState(FlagsVar StateFlags) {
443
444	xStyleContextSetState(x.GoPointer(), FlagsVar)
445
446}
447
448var xStyleContextToString func(uintptr, StyleContextPrintFlags) string
449
450// Converts the style context into a string representation.
451//
452// The string representation always includes information about
453// the name, state, id, visibility and style classes of the CSS
454// node that is backing @context. Depending on the flags, more
455// information may be included.
456//
457// This function is intended for testing and debugging of the
458// CSS implementation in GTK. There are no guarantees about
459// the format of the returned string, it may change.
460func (x *StyleContext) ToString(FlagsVar StyleContextPrintFlags) string {
461
462	cret := xStyleContextToString(x.GoPointer(), FlagsVar)
463	return cret
464}
465
466func (c *StyleContext) GoPointer() uintptr {
467	if c == nil {
468		return 0
469	}
470	return c.Ptr
471}
472
473func (c *StyleContext) SetGoPointer(ptr uintptr) {
474	c.Ptr = ptr
475}
476
477var xStyleContextAddProviderForDisplay func(uintptr, uintptr, uint)
478
479// Adds a global style provider to @display, which will be used
480// in style construction for all `GtkStyleContexts` under @display.
481//
482// GTK uses this to make styling information from `GtkSettings`
483// available.
484//
485// Note: If both priorities are the same, A `GtkStyleProvider`
486// added through [method@Gtk.StyleContext.add_provider] takes
487// precedence over another added through this function.
488func StyleContextAddProviderForDisplay(DisplayVar *gdk.Display, ProviderVar StyleProvider, PriorityVar uint) {
489
490	xStyleContextAddProviderForDisplay(DisplayVar.GoPointer(), ProviderVar.GoPointer(), PriorityVar)
491
492}
493
494var xStyleContextRemoveProviderForDisplay func(uintptr, uintptr)
495
496// Removes @provider from the global style providers list in @display.
497func StyleContextRemoveProviderForDisplay(DisplayVar *gdk.Display, ProviderVar StyleProvider) {
498
499	xStyleContextRemoveProviderForDisplay(DisplayVar.GoPointer(), ProviderVar.GoPointer())
500
501}
502
503func init() {
504	core.SetPackageName("GTK", "gtk4")
505	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
506	var libs []uintptr
507	for _, libPath := range core.GetPaths("GTK") {
508		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
509		if err != nil {
510			panic(err)
511		}
512		libs = append(libs, lib)
513	}
514
515	core.PuregoSafeRegister(&xStyleContextPrintFlagsGLibType, libs, "gtk_style_context_print_flags_get_type")
516
517	core.PuregoSafeRegister(&xStyleContextGLibType, libs, "gtk_style_context_get_type")
518
519	core.PuregoSafeRegister(&xStyleContextAddClass, libs, "gtk_style_context_add_class")
520	core.PuregoSafeRegister(&xStyleContextAddProvider, libs, "gtk_style_context_add_provider")
521	core.PuregoSafeRegister(&xStyleContextGetBorder, libs, "gtk_style_context_get_border")
522	core.PuregoSafeRegister(&xStyleContextGetColor, libs, "gtk_style_context_get_color")
523	core.PuregoSafeRegister(&xStyleContextGetDisplay, libs, "gtk_style_context_get_display")
524	core.PuregoSafeRegister(&xStyleContextGetMargin, libs, "gtk_style_context_get_margin")
525	core.PuregoSafeRegister(&xStyleContextGetPadding, libs, "gtk_style_context_get_padding")
526	core.PuregoSafeRegister(&xStyleContextGetScale, libs, "gtk_style_context_get_scale")
527	core.PuregoSafeRegister(&xStyleContextGetState, libs, "gtk_style_context_get_state")
528	core.PuregoSafeRegister(&xStyleContextHasClass, libs, "gtk_style_context_has_class")
529	core.PuregoSafeRegister(&xStyleContextLookupColor, libs, "gtk_style_context_lookup_color")
530	core.PuregoSafeRegister(&xStyleContextRemoveClass, libs, "gtk_style_context_remove_class")
531	core.PuregoSafeRegister(&xStyleContextRemoveProvider, libs, "gtk_style_context_remove_provider")
532	core.PuregoSafeRegister(&xStyleContextRestore, libs, "gtk_style_context_restore")
533	core.PuregoSafeRegister(&xStyleContextSave, libs, "gtk_style_context_save")
534	core.PuregoSafeRegister(&xStyleContextSetDisplay, libs, "gtk_style_context_set_display")
535	core.PuregoSafeRegister(&xStyleContextSetScale, libs, "gtk_style_context_set_scale")
536	core.PuregoSafeRegister(&xStyleContextSetState, libs, "gtk_style_context_set_state")
537	core.PuregoSafeRegister(&xStyleContextToString, libs, "gtk_style_context_to_string")
538
539	core.PuregoSafeRegister(&xStyleContextAddProviderForDisplay, libs, "gtk_style_context_add_provider_for_display")
540	core.PuregoSafeRegister(&xStyleContextRemoveProviderForDisplay, libs, "gtk_style_context_remove_provider_for_display")
541
542}

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