v0.2.1 c0399be

gtkcssprovider.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/gio"
12	"github.com/bnema/puregotk/v4/glib"
13	"github.com/bnema/puregotk/v4/gobject"
14	"github.com/bnema/puregotk/v4/gobject/types"
15)
16
17type CssProviderClass struct {
18	_ structs.HostLayout
19}
20
21func (x *CssProviderClass) GoPointer() uintptr {
22	return uintptr(unsafe.Pointer(x))
23}
24
25type CssProviderPrivate struct {
26	_ structs.HostLayout
27}
28
29func (x *CssProviderPrivate) GoPointer() uintptr {
30	return uintptr(unsafe.Pointer(x))
31}
32
33// A style provider for CSS.
34//
35// It is able to parse CSS-like input in order to style widgets.
36//
37// An application can make GTK parse a specific CSS style sheet by calling
38// [method@Gtk.CssProvider.load_from_file] or
39// [method@Gtk.CssProvider.load_from_resource]
40// and adding the provider with [method@Gtk.StyleContext.add_provider] or
41// [func@Gtk.StyleContext.add_provider_for_display].
42//
43// In addition, certain files will be read when GTK is initialized.
44// First, the file `$XDG_CONFIG_HOME/gtk-4.0/gtk.css` is loaded if it
45// exists. Then, GTK loads the first existing file among
46// `XDG_DATA_HOME/themes/THEME/gtk-VERSION/gtk-VARIANT.css`,
47// `$HOME/.themes/THEME/gtk-VERSION/gtk-VARIANT.css`,
48// `$XDG_DATA_DIRS/themes/THEME/gtk-VERSION/gtk-VARIANT.css` and
49// `DATADIR/share/themes/THEME/gtk-VERSION/gtk-VARIANT.css`,
50// where `THEME` is the name of the current theme (see the
51// [property@Gtk.Settings:gtk-theme-name] setting), `VARIANT` is the
52// variant to load (see the
53// [property@Gtk.Settings:gtk-application-prefer-dark-theme] setting),
54// `DATADIR` is the prefix configured when GTK was compiled (unless
55// overridden by the `GTK_DATA_PREFIX` environment variable), and
56// `VERSION` is the GTK version number. If no file is found for the
57// current version, GTK tries older versions all the way back to 4.0.
58//
59// To track errors while loading CSS, connect to the
60// [signal@Gtk.CssProvider::parsing-error] signal.
61type CssProvider struct {
62	gobject.Object
63}
64
65var xCssProviderGLibType func() types.GType
66
67func CssProviderGLibType() types.GType {
68	return xCssProviderGLibType()
69}
70
71func CssProviderNewFromInternalPtr(ptr uintptr) *CssProvider {
72	cls := &CssProvider{}
73	cls.Ptr = ptr
74	return cls
75}
76
77var xNewCssProvider func() uintptr
78
79// Returns a newly created `GtkCssProvider`.
80func NewCssProvider() *CssProvider {
81	var cls *CssProvider
82
83	cret := xNewCssProvider()
84
85	if cret == 0 {
86		return nil
87	}
88	cls = &CssProvider{}
89	cls.Ptr = cret
90	return cls
91}
92
93var xCssProviderLoadFromBytes func(uintptr, *glib.Bytes)
94
95// Loads @data into @css_provider.
96//
97// This clears any previously loaded information.
98func (x *CssProvider) LoadFromBytes(DataVar *glib.Bytes) {
99
100	xCssProviderLoadFromBytes(x.GoPointer(), DataVar)
101
102}
103
104var xCssProviderLoadFromData func(uintptr, string, int)
105
106// Loads @data into @css_provider.
107//
108// This clears any previously loaded information.
109func (x *CssProvider) LoadFromData(DataVar string, LengthVar int) {
110
111	xCssProviderLoadFromData(x.GoPointer(), DataVar, LengthVar)
112
113}
114
115var xCssProviderLoadFromFile func(uintptr, uintptr)
116
117// Loads the data contained in @file into @css_provider.
118//
119// This clears any previously loaded information.
120func (x *CssProvider) LoadFromFile(FileVar gio.File) {
121
122	xCssProviderLoadFromFile(x.GoPointer(), FileVar.GoPointer())
123
124}
125
126var xCssProviderLoadFromPath func(uintptr, string)
127
128// Loads the data contained in @path into @css_provider.
129//
130// This clears any previously loaded information.
131func (x *CssProvider) LoadFromPath(PathVar string) {
132
133	xCssProviderLoadFromPath(x.GoPointer(), PathVar)
134
135}
136
137var xCssProviderLoadFromResource func(uintptr, string)
138
139// Loads the data contained in the resource at @resource_path into
140// the @css_provider.
141//
142// This clears any previously loaded information.
143func (x *CssProvider) LoadFromResource(ResourcePathVar string) {
144
145	xCssProviderLoadFromResource(x.GoPointer(), ResourcePathVar)
146
147}
148
149var xCssProviderLoadFromString func(uintptr, string)
150
151// Loads @string into @css_provider.
152//
153// This clears any previously loaded information.
154func (x *CssProvider) LoadFromString(StringVar string) {
155
156	xCssProviderLoadFromString(x.GoPointer(), StringVar)
157
158}
159
160var xCssProviderLoadNamed func(uintptr, string, uintptr)
161
162// Loads a theme from the usual theme paths.
163//
164// The actual process of finding the theme might change between
165// releases, but it is guaranteed that this function uses the same
166// mechanism to load the theme that GTK uses for loading its own theme.
167func (x *CssProvider) LoadNamed(NameVar string, VariantVar *string) {
168
169	VariantVarPtr := core.GStrdupNullable(VariantVar)
170	defer core.GFreeNullable(VariantVarPtr)
171
172	xCssProviderLoadNamed(x.GoPointer(), NameVar, VariantVarPtr)
173
174}
175
176var xCssProviderToString func(uintptr) string
177
178// Converts the @provider into a string representation in CSS
179// format.
180//
181// Using [method@Gtk.CssProvider.load_from_string] with the return
182// value from this function on a new provider created with
183// [ctor@Gtk.CssProvider.new] will basically create a duplicate
184// of this @provider.
185func (x *CssProvider) ToString() string {
186
187	cret := xCssProviderToString(x.GoPointer())
188	return cret
189}
190
191func (c *CssProvider) GoPointer() uintptr {
192	if c == nil {
193		return 0
194	}
195	return c.Ptr
196}
197
198func (c *CssProvider) SetGoPointer(ptr uintptr) {
199	c.Ptr = ptr
200}
201
202// Signals that a parsing error occurred.
203//
204// The expected error values are in the [error@Gtk.CssParserError]
205// and [enum@Gtk.CssParserWarning] enumerations.
206//
207// The @path, @line and @position describe the actual location of
208// the error as accurately as possible.
209//
210// Parsing errors are never fatal, so the parsing will resume after
211// the error. Errors may however cause parts of the given data or
212// even all of it to not be parsed at all. So it is a useful idea
213// to check that the parsing succeeds by connecting to this signal.
214//
215// Errors in the [enum@Gtk.CssParserWarning] enumeration should not
216// be treated as fatal errors.
217//
218// Note that this signal may be emitted at any time as the css provider
219// may opt to defer parsing parts or all of the input to a later time
220// than when a loading function was called.
221func (x *CssProvider) ConnectParsingError(cb *func(CssProvider, uintptr, *glib.Error)) uint {
222	cbPtr := uintptr(unsafe.Pointer(cb))
223	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
224		handlerID := gobject.SignalConnect(x.GoPointer(), "parsing-error", cbRefPtr)
225		glib.SaveHandlerMapping(handlerID, cbPtr)
226		return handlerID
227	}
228
229	fcb := func(clsPtr uintptr, SectionVarp uintptr, ErrorVarp uintptr) {
230		fa := CssProvider{}
231		fa.Ptr = clsPtr
232		cbFn := *cb
233
234		cbFn(fa, SectionVarp, (*glib.Error)(unsafe.Pointer(ErrorVarp)))
235
236	}
237	cbRefPtr := purego.NewCallback(fcb)
238	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
239	handlerID := gobject.SignalConnect(x.GoPointer(), "parsing-error", cbRefPtr)
240	glib.SaveHandlerMapping(handlerID, cbPtr)
241	return handlerID
242}
243
244func init() {
245	core.SetPackageName("GTK", "gtk4")
246	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
247	var libs []uintptr
248	for _, libPath := range core.GetPaths("GTK") {
249		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
250		if err != nil {
251			panic(err)
252		}
253		libs = append(libs, lib)
254	}
255
256	core.PuregoSafeRegister(&xCssProviderGLibType, libs, "gtk_css_provider_get_type")
257
258	core.PuregoSafeRegister(&xNewCssProvider, libs, "gtk_css_provider_new")
259
260	core.PuregoSafeRegister(&xCssProviderLoadFromBytes, libs, "gtk_css_provider_load_from_bytes")
261	core.PuregoSafeRegister(&xCssProviderLoadFromData, libs, "gtk_css_provider_load_from_data")
262	core.PuregoSafeRegister(&xCssProviderLoadFromFile, libs, "gtk_css_provider_load_from_file")
263	core.PuregoSafeRegister(&xCssProviderLoadFromPath, libs, "gtk_css_provider_load_from_path")
264	core.PuregoSafeRegister(&xCssProviderLoadFromResource, libs, "gtk_css_provider_load_from_resource")
265	core.PuregoSafeRegister(&xCssProviderLoadFromString, libs, "gtk_css_provider_load_from_string")
266	core.PuregoSafeRegister(&xCssProviderLoadNamed, libs, "gtk_css_provider_load_named")
267	core.PuregoSafeRegister(&xCssProviderToString, libs, "gtk_css_provider_to_string")
268
269}

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