// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gdk" "github.com/bnema/puregotk/v4/gio" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type IconPaintableClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass } func (x *IconPaintableClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // Contains information found when looking up an icon in `GtkIconTheme` // or loading it from a file. // // `GtkIconPaintable` implements `GdkPaintable` and `GtkSymbolicPaintable`. type IconPaintable struct { gobject.Object } var xIconPaintableGLibType func() types.GType func IconPaintableGLibType() types.GType { return xIconPaintableGLibType() } func IconPaintableNewFromInternalPtr(ptr uintptr) *IconPaintable { cls := &IconPaintable{} cls.Ptr = ptr return cls } var xNewIconPaintableForFile func(uintptr, int, int) uintptr // Creates a `GtkIconPaintable` for a file with a given size and scale. // // The icon can then be rendered by using it as a `GdkPaintable`. func NewIconPaintableForFile(FileVar gio.File, SizeVar int, ScaleVar int) *IconPaintable { var cls *IconPaintable cret := xNewIconPaintableForFile(FileVar.GoPointer(), SizeVar, ScaleVar) if cret == 0 { return nil } cls = &IconPaintable{} cls.Ptr = cret return cls } var xIconPaintableGetFile func(uintptr) uintptr // Gets the `GFile` that was used to load the icon. // // Returns %NULL if the icon was not loaded from a file. func (x *IconPaintable) GetFile() *gio.FileBase { var cls *gio.FileBase cret := xIconPaintableGetFile(x.GoPointer()) if cret == 0 { return nil } cls = &gio.FileBase{} cls.Ptr = cret return cls } var xIconPaintableGetIconName func(uintptr) string // Get the icon name being used for this icon. // // When an icon looked up in the icon theme was not available, the // icon theme may use fallback icons - either those specified to // gtk_icon_theme_lookup_icon() or the always-available // "image-missing". The icon chosen is returned by this function. // // If the icon was created without an icon theme, this function // returns %NULL. func (x *IconPaintable) GetIconName() string { cret := xIconPaintableGetIconName(x.GoPointer()) return cret } var xIconPaintableIsSymbolic func(uintptr) bool // Checks if the icon is symbolic or not. // // This currently uses only the file name and not the file contents // for determining this. This behaviour may change in the future. func (x *IconPaintable) IsSymbolic() bool { cret := xIconPaintableIsSymbolic(x.GoPointer()) return cret } func (c *IconPaintable) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *IconPaintable) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyIconName sets the "icon-name" property. // The icon name that was chosen during lookup. func (x *IconPaintable) SetPropertyIconName(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("icon-name", &v) } // GetPropertyIconName gets the "icon-name" property. // The icon name that was chosen during lookup. func (x *IconPaintable) GetPropertyIconName() string { var v gobject.Value x.GetProperty("icon-name", &v) return v.GetString() } // SetPropertyIsSymbolic sets the "is-symbolic" property. // Whether the icon is symbolic or not. func (x *IconPaintable) SetPropertyIsSymbolic(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("is-symbolic", &v) } // GetPropertyIsSymbolic gets the "is-symbolic" property. // Whether the icon is symbolic or not. func (x *IconPaintable) GetPropertyIsSymbolic() bool { var v gobject.Value x.GetProperty("is-symbolic", &v) return v.GetBoolean() } // SetPropertyScale sets the "scale" property. func (x *IconPaintable) SetPropertyScale(value int) { var v gobject.Value v.Init(gobject.TypeIntVal) v.SetInt(value) x.SetProperty("scale", &v) } // GetPropertyScale gets the "scale" property. func (x *IconPaintable) GetPropertyScale() int { var v gobject.Value x.GetProperty("scale", &v) return v.GetInt() } // SetPropertySize sets the "size" property. func (x *IconPaintable) SetPropertySize(value int) { var v gobject.Value v.Init(gobject.TypeIntVal) v.SetInt(value) x.SetProperty("size", &v) } // GetPropertySize gets the "size" property. func (x *IconPaintable) GetPropertySize() int { var v gobject.Value x.GetProperty("size", &v) return v.GetInt() } // Compute a concrete size for the `GdkPaintable`. // // Applies the sizing algorithm outlined in the // [CSS Image spec](https://drafts.csswg.org/css-images-3/#default-sizing) // to the given @paintable. See that link for more details. // // It is not necessary to call this function when both @specified_width // and @specified_height are known, but it is useful to call this // function in GtkWidget:measure implementations to compute the // other dimension when only one dimension is given. func (x *IconPaintable) ComputeConcreteSize(SpecifiedWidthVar float64, SpecifiedHeightVar float64, DefaultWidthVar float64, DefaultHeightVar float64, ConcreteWidthVar *float64, ConcreteHeightVar *float64) { gdk.XGdkPaintableComputeConcreteSize(x.GoPointer(), SpecifiedWidthVar, SpecifiedHeightVar, DefaultWidthVar, DefaultHeightVar, ConcreteWidthVar, ConcreteHeightVar) } // Gets an immutable paintable for the current contents displayed by @paintable. // // This is useful when you want to retain the current state of an animation, // for example to take a screenshot of a running animation. // // If the @paintable is already immutable, it will return itself. func (x *IconPaintable) GetCurrentImage() *gdk.PaintableBase { var cls *gdk.PaintableBase cret := gdk.XGdkPaintableGetCurrentImage(x.GoPointer()) if cret == 0 { return nil } cls = &gdk.PaintableBase{} cls.Ptr = cret return cls } // Get flags for the paintable. // // This is oftentimes useful for optimizations. // // See [flags@Gdk.PaintableFlags] for the flags and what they mean. func (x *IconPaintable) GetFlags() gdk.PaintableFlags { cret := gdk.XGdkPaintableGetFlags(x.GoPointer()) return cret } // Gets the preferred aspect ratio the @paintable would like to be displayed at. // // The aspect ratio is the width divided by the height, so a value of 0.5 // means that the @paintable prefers to be displayed twice as high as it // is wide. Consumers of this interface can use this to preserve aspect // ratio when displaying the paintable. // // This is a purely informational value and does not in any way limit the // values that may be passed to [method@Gdk.Paintable.snapshot]. // // Usually when a @paintable returns nonzero values from // [method@Gdk.Paintable.get_intrinsic_width] and // [method@Gdk.Paintable.get_intrinsic_height] the aspect ratio // should conform to those values, though that is not required. // // If the @paintable does not have a preferred aspect ratio, // it returns 0. Negative values are never returned. func (x *IconPaintable) GetIntrinsicAspectRatio() float64 { cret := gdk.XGdkPaintableGetIntrinsicAspectRatio(x.GoPointer()) return cret } // Gets the preferred height the @paintable would like to be displayed at. // // Consumers of this interface can use this to reserve enough space to draw // the paintable. // // This is a purely informational value and does not in any way limit the // values that may be passed to [method@Gdk.Paintable.snapshot]. // // If the @paintable does not have a preferred height, it returns 0. // Negative values are never returned. func (x *IconPaintable) GetIntrinsicHeight() int { cret := gdk.XGdkPaintableGetIntrinsicHeight(x.GoPointer()) return cret } // Gets the preferred width the @paintable would like to be displayed at. // // Consumers of this interface can use this to reserve enough space to draw // the paintable. // // This is a purely informational value and does not in any way limit the // values that may be passed to [method@Gdk.Paintable.snapshot]. // // If the @paintable does not have a preferred width, it returns 0. // Negative values are never returned. func (x *IconPaintable) GetIntrinsicWidth() int { cret := gdk.XGdkPaintableGetIntrinsicWidth(x.GoPointer()) return cret } // Called by implementations of `GdkPaintable` to invalidate their contents. // // Unless the contents are invalidated, implementations must guarantee that // multiple calls of [method@Gdk.Paintable.snapshot] produce the same output. // // This function will emit the [signal@Gdk.Paintable::invalidate-contents] // signal. // // If a @paintable reports the %GDK_PAINTABLE_STATIC_CONTENTS flag, // it must not call this function. func (x *IconPaintable) InvalidateContents() { gdk.XGdkPaintableInvalidateContents(x.GoPointer()) } // Called by implementations of `GdkPaintable` to invalidate their size. // // As long as the size is not invalidated, @paintable must return the same // values for its intrinsic width, height and aspect ratio. // // This function will emit the [signal@Gdk.Paintable::invalidate-size] // signal. // // If a @paintable reports the %GDK_PAINTABLE_STATIC_SIZE flag, // it must not call this function. func (x *IconPaintable) InvalidateSize() { gdk.XGdkPaintableInvalidateSize(x.GoPointer()) } // Snapshots the given paintable with the given @width and @height. // // The paintable is drawn at the current (0,0) offset of the @snapshot. // If @width and @height are not larger than zero, this function will // do nothing. func (x *IconPaintable) Snapshot(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64) { gdk.XGdkPaintableSnapshot(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar) } // Snapshots the paintable with the given colors. // // If less than 4 colors are provided, GTK will pad the array with default // colors. func (x *IconPaintable) SnapshotSymbolic(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64, ColorsVar []gdk.RGBA, NColorsVar uint) { XGtkSymbolicPaintableSnapshotSymbolic(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar, ColorsVar, NColorsVar) } func init() { core.SetPackageName("GTK", "gtk4") core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GTK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xIconPaintableGLibType, libs, "gtk_icon_paintable_get_type") core.PuregoSafeRegister(&xNewIconPaintableForFile, libs, "gtk_icon_paintable_new_for_file") core.PuregoSafeRegister(&xIconPaintableGetFile, libs, "gtk_icon_paintable_get_file") core.PuregoSafeRegister(&xIconPaintableGetIconName, libs, "gtk_icon_paintable_get_icon_name") core.PuregoSafeRegister(&xIconPaintableIsSymbolic, libs, "gtk_icon_paintable_is_symbolic") }