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
17// Defines a part of a CSS document.
18//
19// Because sections are nested into one another, you can use
20// [method@CssSection.get_parent] to get the containing region.
21type CssSection struct {
22 _ structs.HostLayout
23}
24
25var xCssSectionGLibType func() types.GType
26
27func CssSectionGLibType() types.GType {
28 return xCssSectionGLibType()
29}
30
31func (x *CssSection) GoPointer() uintptr {
32 return uintptr(unsafe.Pointer(x))
33}
34
35var xNewCssSection func(uintptr, *CssLocation, *CssLocation) *CssSection
36
37// Creates a new `GtkCssSection` referring to the section
38// in the given `file` from the `start` location to the
39// `end` location.
40func NewCssSection(FileVar gio.File, StartVar *CssLocation, EndVar *CssLocation) *CssSection {
41
42 cret := xNewCssSection(FileVar.GoPointer(), StartVar, EndVar)
43 return cret
44}
45
46var xNewCssSectionWithBytes func(uintptr, *glib.Bytes, *CssLocation, *CssLocation) *CssSection
47
48// Creates a new `GtkCssSection` referring to the section
49// in the given `file` or the given `bytes` from the `start` location to the
50// `end` location.
51func NewCssSectionWithBytes(FileVar gio.File, BytesVar *glib.Bytes, StartVar *CssLocation, EndVar *CssLocation) *CssSection {
52
53 cret := xNewCssSectionWithBytes(FileVar.GoPointer(), BytesVar, StartVar, EndVar)
54 return cret
55}
56
57var xCssSectionGetBytes func(uintptr) *glib.Bytes
58
59// Gets the bytes that @section was parsed from.
60func (x *CssSection) GetBytes() *glib.Bytes {
61
62 cret := xCssSectionGetBytes(x.GoPointer())
63 return cret
64}
65
66var xCssSectionGetEndLocation func(uintptr) *CssLocation
67
68// Returns the location in the CSS document where this section ends.
69func (x *CssSection) GetEndLocation() *CssLocation {
70
71 cret := xCssSectionGetEndLocation(x.GoPointer())
72 return cret
73}
74
75var xCssSectionGetFile func(uintptr) uintptr
76
77// Gets the file that @section was parsed from.
78//
79// If no such file exists, for example because the CSS was loaded via
80// [method@Gtk.CssProvider.load_from_data], then `NULL` is returned.
81func (x *CssSection) GetFile() *gio.FileBase {
82 var cls *gio.FileBase
83
84 cret := xCssSectionGetFile(x.GoPointer())
85
86 if cret == 0 {
87 return nil
88 }
89 gobject.IncreaseRef(cret)
90 cls = &gio.FileBase{}
91 cls.Ptr = cret
92 return cls
93}
94
95var xCssSectionGetParent func(uintptr) *CssSection
96
97// Gets the parent section for the given `section`.
98//
99// The parent section is the section that contains this `section`. A special
100// case are sections of type `GTK_CSS_SECTION_DOCUMENT`. Their parent will
101// either be `NULL` if they are the original CSS document that was loaded by
102// [method@Gtk.CssProvider.load_from_file] or a section of type
103// `GTK_CSS_SECTION_IMPORT` if it was loaded with an `@import` rule from
104// a different file.
105func (x *CssSection) GetParent() *CssSection {
106
107 cret := xCssSectionGetParent(x.GoPointer())
108 return cret
109}
110
111var xCssSectionGetStartLocation func(uintptr) *CssLocation
112
113// Returns the location in the CSS document where this section starts.
114func (x *CssSection) GetStartLocation() *CssLocation {
115
116 cret := xCssSectionGetStartLocation(x.GoPointer())
117 return cret
118}
119
120var xCssSectionPrint func(uintptr, *glib.String)
121
122// Prints the `section` into `string` in a human-readable form.
123//
124// This is a form like `gtk.css:32:1-23` to denote line 32, characters
125// 1 to 23 in the file `gtk.css`.
126func (x *CssSection) Print(StringVar *glib.String) {
127
128 xCssSectionPrint(x.GoPointer(), StringVar)
129
130}
131
132var xCssSectionRef func(uintptr) *CssSection
133
134// Increments the reference count on `section`.
135func (x *CssSection) Ref() *CssSection {
136
137 cret := xCssSectionRef(x.GoPointer())
138 return cret
139}
140
141var xCssSectionToString func(uintptr) string
142
143// Prints the section into a human-readable text form using
144// [method@Gtk.CssSection.print].
145func (x *CssSection) ToString() string {
146
147 cret := xCssSectionToString(x.GoPointer())
148 return cret
149}
150
151var xCssSectionUnref func(uintptr)
152
153// Decrements the reference count on `section`, freeing the
154// structure if the reference count reaches 0.
155func (x *CssSection) Unref() {
156
157 xCssSectionUnref(x.GoPointer())
158
159}
160
161func init() {
162 core.SetPackageName("GTK", "gtk4")
163 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
164 var libs []uintptr
165 for _, libPath := range core.GetPaths("GTK") {
166 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
167 if err != nil {
168 panic(err)
169 }
170 libs = append(libs, lib)
171 }
172
173 core.PuregoSafeRegister(&xCssSectionGLibType, libs, "gtk_css_section_get_type")
174
175 core.PuregoSafeRegister(&xNewCssSection, libs, "gtk_css_section_new")
176 core.PuregoSafeRegister(&xNewCssSectionWithBytes, libs, "gtk_css_section_new_with_bytes")
177
178 core.PuregoSafeRegister(&xCssSectionGetBytes, libs, "gtk_css_section_get_bytes")
179 core.PuregoSafeRegister(&xCssSectionGetEndLocation, libs, "gtk_css_section_get_end_location")
180 core.PuregoSafeRegister(&xCssSectionGetFile, libs, "gtk_css_section_get_file")
181 core.PuregoSafeRegister(&xCssSectionGetParent, libs, "gtk_css_section_get_parent")
182 core.PuregoSafeRegister(&xCssSectionGetStartLocation, libs, "gtk_css_section_get_start_location")
183 core.PuregoSafeRegister(&xCssSectionPrint, libs, "gtk_css_section_print")
184 core.PuregoSafeRegister(&xCssSectionRef, libs, "gtk_css_section_ref")
185 core.PuregoSafeRegister(&xCssSectionToString, libs, "gtk_css_section_to_string")
186 core.PuregoSafeRegister(&xCssSectionUnref, libs, "gtk_css_section_unref")
187
188}