// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gio import ( "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) // `GBytesIcon` specifies an image held in memory in a common format (usually // PNG) to be used as icon. type BytesIcon struct { gobject.Object } var xBytesIconGLibType func() types.GType func BytesIconGLibType() types.GType { return xBytesIconGLibType() } func BytesIconNewFromInternalPtr(ptr uintptr) *BytesIcon { cls := &BytesIcon{} cls.Ptr = ptr return cls } var xNewBytesIcon func(*glib.Bytes) uintptr // Creates a new icon for a bytes. // // This cannot fail, but loading and interpreting the bytes may fail later on // (for example, if g_loadable_icon_load() is called) if the image is invalid. func NewBytesIcon(BytesVar *glib.Bytes) *BytesIcon { var cls *BytesIcon cret := xNewBytesIcon(BytesVar) if cret == 0 { return nil } cls = &BytesIcon{} cls.Ptr = cret return cls } var xBytesIconGetBytes func(uintptr) *glib.Bytes // Gets the #GBytes associated with the given @icon. func (x *BytesIcon) GetBytes() *glib.Bytes { cret := xBytesIconGetBytes(x.GoPointer()) return cret } func (c *BytesIcon) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *BytesIcon) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyBytes sets the "bytes" property. // The bytes containing the icon. func (x *BytesIcon) SetPropertyBytes(value uintptr) { var v gobject.Value v.Init(gobject.TypePointerVal) v.SetPointer(value) x.SetProperty("bytes", &v) } // GetPropertyBytes gets the "bytes" property. // The bytes containing the icon. func (x *BytesIcon) GetPropertyBytes() uintptr { var v gobject.Value x.GetProperty("bytes", &v) return v.GetPointer() } // Checks if two icons are equal. func (x *BytesIcon) Equal(Icon2Var Icon) bool { cret := XGIconEqual(x.GoPointer(), Icon2Var.GoPointer()) return cret } // Gets a hash for an icon. func (x *BytesIcon) Hash() uint { cret := XGIconHash(x.GoPointer()) return cret } // Serializes a #GIcon into a #GVariant. An equivalent #GIcon can be retrieved // back by calling g_icon_deserialize() on the returned value. // As serialization will avoid using raw icon data when possible, it only // makes sense to transfer the #GVariant between processes on the same machine, // (as opposed to over the network), and within the same file system namespace. func (x *BytesIcon) Serialize() *glib.Variant { cret := XGIconSerialize(x.GoPointer()) return cret } // Generates a textual representation of @icon that can be used for // serialization such as when passing @icon to a different process or // saving it to persistent storage. Use g_icon_new_for_string() to // get @icon back from the returned string. // // The encoding of the returned string is proprietary to #GIcon except // in the following two cases // // - If @icon is a #GFileIcon, the returned string is a native path // (such as `/path/to/my icon.png`) without escaping // if the #GFile for @icon is a native file. If the file is not // native, the returned string is the result of g_file_get_uri() // (such as `sftp://path/to/my%20icon.png`). // // - If @icon is a #GThemedIcon with exactly one name and no fallbacks, // the encoding is simply the name (such as `network-server`). func (x *BytesIcon) ToString() string { cret := XGIconToString(x.GoPointer()) return cret } // Loads a loadable icon. For the asynchronous version of this function, // see g_loadable_icon_load_async(). func (x *BytesIcon) Load(SizeVar int, TypeVar *string, CancellableVar *Cancellable) (*InputStream, error) { var cls *InputStream var cerr *glib.Error cret := XGLoadableIconLoad(x.GoPointer(), SizeVar, TypeVar, CancellableVar.GoPointer(), &cerr) if cret == 0 { return nil, cerr } cls = &InputStream{} cls.Ptr = cret if cerr == nil { return cls, nil } return cls, cerr } // Loads an icon asynchronously. To finish this function, see // g_loadable_icon_load_finish(). For the synchronous, blocking // version of this function, see g_loadable_icon_load(). func (x *BytesIcon) LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar) } // Finishes an asynchronous icon load started in g_loadable_icon_load_async(). func (x *BytesIcon) LoadFinish(ResVar AsyncResult, TypeVar *string) (*InputStream, error) { var cls *InputStream var cerr *glib.Error cret := XGLoadableIconLoadFinish(x.GoPointer(), ResVar.GoPointer(), TypeVar, &cerr) if cret == 0 { return nil, cerr } cls = &InputStream{} cls.Ptr = cret if cerr == nil { return cls, nil } return cls, cerr } func init() { core.SetPackageName("GIO", "gio-2.0") core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("GIO") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xBytesIconGLibType, libs, "g_bytes_icon_get_type") core.PuregoSafeRegister(&xNewBytesIcon, libs, "g_bytes_icon_new") core.PuregoSafeRegister(&xBytesIconGetBytes, libs, "g_bytes_icon_get_bytes") }