v0.2.1 c0399be

gtkiconpaintable.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/gio"
13	"github.com/bnema/puregotk/v4/gobject"
14	"github.com/bnema/puregotk/v4/gobject/types"
15)
16
17type IconPaintableClass struct {
18	_ structs.HostLayout
19
20	ParentClass gobject.ObjectClass
21}
22
23func (x *IconPaintableClass) GoPointer() uintptr {
24	return uintptr(unsafe.Pointer(x))
25}
26
27// Contains information found when looking up an icon in `GtkIconTheme`
28// or loading it from a file.
29//
30// `GtkIconPaintable` implements `GdkPaintable` and `GtkSymbolicPaintable`.
31type IconPaintable struct {
32	gobject.Object
33}
34
35var xIconPaintableGLibType func() types.GType
36
37func IconPaintableGLibType() types.GType {
38	return xIconPaintableGLibType()
39}
40
41func IconPaintableNewFromInternalPtr(ptr uintptr) *IconPaintable {
42	cls := &IconPaintable{}
43	cls.Ptr = ptr
44	return cls
45}
46
47var xNewIconPaintableForFile func(uintptr, int, int) uintptr
48
49// Creates a `GtkIconPaintable` for a file with a given size and scale.
50//
51// The icon can then be rendered by using it as a `GdkPaintable`.
52func NewIconPaintableForFile(FileVar gio.File, SizeVar int, ScaleVar int) *IconPaintable {
53	var cls *IconPaintable
54
55	cret := xNewIconPaintableForFile(FileVar.GoPointer(), SizeVar, ScaleVar)
56
57	if cret == 0 {
58		return nil
59	}
60	cls = &IconPaintable{}
61	cls.Ptr = cret
62	return cls
63}
64
65var xIconPaintableGetFile func(uintptr) uintptr
66
67// Gets the `GFile` that was used to load the icon.
68//
69// Returns %NULL if the icon was not loaded from a file.
70func (x *IconPaintable) GetFile() *gio.FileBase {
71	var cls *gio.FileBase
72
73	cret := xIconPaintableGetFile(x.GoPointer())
74
75	if cret == 0 {
76		return nil
77	}
78	cls = &gio.FileBase{}
79	cls.Ptr = cret
80	return cls
81}
82
83var xIconPaintableGetIconName func(uintptr) string
84
85// Get the icon name being used for this icon.
86//
87// When an icon looked up in the icon theme was not available, the
88// icon theme may use fallback icons - either those specified to
89// gtk_icon_theme_lookup_icon() or the always-available
90// "image-missing". The icon chosen is returned by this function.
91//
92// If the icon was created without an icon theme, this function
93// returns %NULL.
94func (x *IconPaintable) GetIconName() string {
95
96	cret := xIconPaintableGetIconName(x.GoPointer())
97	return cret
98}
99
100var xIconPaintableIsSymbolic func(uintptr) bool
101
102// Checks if the icon is symbolic or not.
103//
104// This currently uses only the file name and not the file contents
105// for determining this. This behaviour may change in the future.
106func (x *IconPaintable) IsSymbolic() bool {
107
108	cret := xIconPaintableIsSymbolic(x.GoPointer())
109	return cret
110}
111
112func (c *IconPaintable) GoPointer() uintptr {
113	if c == nil {
114		return 0
115	}
116	return c.Ptr
117}
118
119func (c *IconPaintable) SetGoPointer(ptr uintptr) {
120	c.Ptr = ptr
121}
122
123// SetPropertyIconName sets the "icon-name" property.
124// The icon name that was chosen during lookup.
125func (x *IconPaintable) SetPropertyIconName(value string) {
126	var v gobject.Value
127	v.Init(gobject.TypeStringVal)
128	v.SetString(&value)
129	x.SetProperty("icon-name", &v)
130}
131
132// GetPropertyIconName gets the "icon-name" property.
133// The icon name that was chosen during lookup.
134func (x *IconPaintable) GetPropertyIconName() string {
135	var v gobject.Value
136	x.GetProperty("icon-name", &v)
137	return v.GetString()
138}
139
140// SetPropertyIsSymbolic sets the "is-symbolic" property.
141// Whether the icon is symbolic or not.
142func (x *IconPaintable) SetPropertyIsSymbolic(value bool) {
143	var v gobject.Value
144	v.Init(gobject.TypeBooleanVal)
145	v.SetBoolean(value)
146	x.SetProperty("is-symbolic", &v)
147}
148
149// GetPropertyIsSymbolic gets the "is-symbolic" property.
150// Whether the icon is symbolic or not.
151func (x *IconPaintable) GetPropertyIsSymbolic() bool {
152	var v gobject.Value
153	x.GetProperty("is-symbolic", &v)
154	return v.GetBoolean()
155}
156
157// SetPropertyScale sets the "scale" property.
158func (x *IconPaintable) SetPropertyScale(value int) {
159	var v gobject.Value
160	v.Init(gobject.TypeIntVal)
161	v.SetInt(value)
162	x.SetProperty("scale", &v)
163}
164
165// GetPropertyScale gets the "scale" property.
166func (x *IconPaintable) GetPropertyScale() int {
167	var v gobject.Value
168	x.GetProperty("scale", &v)
169	return v.GetInt()
170}
171
172// SetPropertySize sets the "size" property.
173func (x *IconPaintable) SetPropertySize(value int) {
174	var v gobject.Value
175	v.Init(gobject.TypeIntVal)
176	v.SetInt(value)
177	x.SetProperty("size", &v)
178}
179
180// GetPropertySize gets the "size" property.
181func (x *IconPaintable) GetPropertySize() int {
182	var v gobject.Value
183	x.GetProperty("size", &v)
184	return v.GetInt()
185}
186
187// Compute a concrete size for the `GdkPaintable`.
188//
189// Applies the sizing algorithm outlined in the
190// [CSS Image spec](https://drafts.csswg.org/css-images-3/#default-sizing)
191// to the given @paintable. See that link for more details.
192//
193// It is not necessary to call this function when both @specified_width
194// and @specified_height are known, but it is useful to call this
195// function in GtkWidget:measure implementations to compute the
196// other dimension when only one dimension is given.
197func (x *IconPaintable) ComputeConcreteSize(SpecifiedWidthVar float64, SpecifiedHeightVar float64, DefaultWidthVar float64, DefaultHeightVar float64, ConcreteWidthVar *float64, ConcreteHeightVar *float64) {
198
199	gdk.XGdkPaintableComputeConcreteSize(x.GoPointer(), SpecifiedWidthVar, SpecifiedHeightVar, DefaultWidthVar, DefaultHeightVar, ConcreteWidthVar, ConcreteHeightVar)
200
201}
202
203// Gets an immutable paintable for the current contents displayed by @paintable.
204//
205// This is useful when you want to retain the current state of an animation,
206// for example to take a screenshot of a running animation.
207//
208// If the @paintable is already immutable, it will return itself.
209func (x *IconPaintable) GetCurrentImage() *gdk.PaintableBase {
210	var cls *gdk.PaintableBase
211
212	cret := gdk.XGdkPaintableGetCurrentImage(x.GoPointer())
213
214	if cret == 0 {
215		return nil
216	}
217	cls = &gdk.PaintableBase{}
218	cls.Ptr = cret
219	return cls
220}
221
222// Get flags for the paintable.
223//
224// This is oftentimes useful for optimizations.
225//
226// See [flags@Gdk.PaintableFlags] for the flags and what they mean.
227func (x *IconPaintable) GetFlags() gdk.PaintableFlags {
228
229	cret := gdk.XGdkPaintableGetFlags(x.GoPointer())
230	return cret
231}
232
233// Gets the preferred aspect ratio the @paintable would like to be displayed at.
234//
235// The aspect ratio is the width divided by the height, so a value of 0.5
236// means that the @paintable prefers to be displayed twice as high as it
237// is wide. Consumers of this interface can use this to preserve aspect
238// ratio when displaying the paintable.
239//
240// This is a purely informational value and does not in any way limit the
241// values that may be passed to [method@Gdk.Paintable.snapshot].
242//
243// Usually when a @paintable returns nonzero values from
244// [method@Gdk.Paintable.get_intrinsic_width] and
245// [method@Gdk.Paintable.get_intrinsic_height] the aspect ratio
246// should conform to those values, though that is not required.
247//
248// If the @paintable does not have a preferred aspect ratio,
249// it returns 0. Negative values are never returned.
250func (x *IconPaintable) GetIntrinsicAspectRatio() float64 {
251
252	cret := gdk.XGdkPaintableGetIntrinsicAspectRatio(x.GoPointer())
253	return cret
254}
255
256// Gets the preferred height the @paintable would like to be displayed at.
257//
258// Consumers of this interface can use this to reserve enough space to draw
259// the paintable.
260//
261// This is a purely informational value and does not in any way limit the
262// values that may be passed to [method@Gdk.Paintable.snapshot].
263//
264// If the @paintable does not have a preferred height, it returns 0.
265// Negative values are never returned.
266func (x *IconPaintable) GetIntrinsicHeight() int {
267
268	cret := gdk.XGdkPaintableGetIntrinsicHeight(x.GoPointer())
269	return cret
270}
271
272// Gets the preferred width the @paintable would like to be displayed at.
273//
274// Consumers of this interface can use this to reserve enough space to draw
275// the paintable.
276//
277// This is a purely informational value and does not in any way limit the
278// values that may be passed to [method@Gdk.Paintable.snapshot].
279//
280// If the @paintable does not have a preferred width, it returns 0.
281// Negative values are never returned.
282func (x *IconPaintable) GetIntrinsicWidth() int {
283
284	cret := gdk.XGdkPaintableGetIntrinsicWidth(x.GoPointer())
285	return cret
286}
287
288// Called by implementations of `GdkPaintable` to invalidate their contents.
289//
290// Unless the contents are invalidated, implementations must guarantee that
291// multiple calls of [method@Gdk.Paintable.snapshot] produce the same output.
292//
293// This function will emit the [signal@Gdk.Paintable::invalidate-contents]
294// signal.
295//
296// If a @paintable reports the %GDK_PAINTABLE_STATIC_CONTENTS flag,
297// it must not call this function.
298func (x *IconPaintable) InvalidateContents() {
299
300	gdk.XGdkPaintableInvalidateContents(x.GoPointer())
301
302}
303
304// Called by implementations of `GdkPaintable` to invalidate their size.
305//
306// As long as the size is not invalidated, @paintable must return the same
307// values for its intrinsic width, height and aspect ratio.
308//
309// This function will emit the [signal@Gdk.Paintable::invalidate-size]
310// signal.
311//
312// If a @paintable reports the %GDK_PAINTABLE_STATIC_SIZE flag,
313// it must not call this function.
314func (x *IconPaintable) InvalidateSize() {
315
316	gdk.XGdkPaintableInvalidateSize(x.GoPointer())
317
318}
319
320// Snapshots the given paintable with the given @width and @height.
321//
322// The paintable is drawn at the current (0,0) offset of the @snapshot.
323// If @width and @height are not larger than zero, this function will
324// do nothing.
325func (x *IconPaintable) Snapshot(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64) {
326
327	gdk.XGdkPaintableSnapshot(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar)
328
329}
330
331// Snapshots the paintable with the given colors.
332//
333// If less than 4 colors are provided, GTK will pad the array with default
334// colors.
335func (x *IconPaintable) SnapshotSymbolic(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64, ColorsVar []gdk.RGBA, NColorsVar uint) {
336
337	XGtkSymbolicPaintableSnapshotSymbolic(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar, ColorsVar, NColorsVar)
338
339}
340
341func init() {
342	core.SetPackageName("GTK", "gtk4")
343	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
344	var libs []uintptr
345	for _, libPath := range core.GetPaths("GTK") {
346		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
347		if err != nil {
348			panic(err)
349		}
350		libs = append(libs, lib)
351	}
352
353	core.PuregoSafeRegister(&xIconPaintableGLibType, libs, "gtk_icon_paintable_get_type")
354
355	core.PuregoSafeRegister(&xNewIconPaintableForFile, libs, "gtk_icon_paintable_new_for_file")
356
357	core.PuregoSafeRegister(&xIconPaintableGetFile, libs, "gtk_icon_paintable_get_file")
358	core.PuregoSafeRegister(&xIconPaintableGetIconName, libs, "gtk_icon_paintable_get_icon_name")
359	core.PuregoSafeRegister(&xIconPaintableIsSymbolic, libs, "gtk_icon_paintable_is_symbolic")
360
361}

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