gtk3_import

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAnimationImage

func GetAnimationImage(varPath interface{}) (gifImage *gtk.Image, err error)

GetAnimationImage: Retrieve *gtk.Image animation 'gif' from []byte or filename.

func GetBytesFromVarAsset

func GetBytesFromVarAsset(varPath interface{}) (outBytes []byte, err error)

*************************************

Embedded data conversion functions
Used to make variable content
available in go-source

********************************* GetBytesFromVarAsset: Get []byte representation from file or asset, depending on type

func GetPixBuf

func GetPixBuf(varPath interface{}, options ...interface{}) (outPixbuf *gdk.Pixbuf, err error)

GetPixBuf: Get gdk.PixBuf from stock, filename or []byte, depending on type. For an explanation of the options, see above, OptPict{}. note: If stock-icons-theme does not exist, the asset/filename icon is used.

func GetPixBufAnimation

func GetPixBufAnimation(varPath interface{}) (outPixbufAnimation *gdk.PixbufAnimation, err error)

GetPixBufAnimation: Get gdk.PixBufAnimation from filename or []byte, depending on type

func HexToBytes

func HexToBytes(varPath string, gzipData []byte) (outByte []byte)

HexToBytes: Convert Gzip Hex to []byte used for embedded binary in source code

func NormalizeSize

func NormalizeSize(oldWidth, oldHeight int, options ...interface{}) (outWidth, outHeight int)

NormalizeSize: compute new size with kept proportions based on defined format. formats: 0 = limit height, 1 = limit width, 2 = percents, 3 = limit height or width depending on MaxSize value.

func SetPict

func SetPict(iObject, varPath interface{}, options ...interface{}) (err error)

SetPic: Assign image to an Object depending on type, accept stock-icons-theme, filename or []byte. Use OptPict{} struct to set options, size can be applied directly as int or be nil. The options are described below:

  • Load a gif animated image and specify using animation (true), resizing not allowed with animations. SetPict(GtkImage, "linearProgressHorzBlue.gif", OptPict{Animated: true})
  • Resize to 32 pixels height, keep porportions & assign image to GtkButton. SetPict(GtkButton, "stillImage.png", 32) or SetPict(GtkButton, "stillImage.png", OptPict{Size: 32})
  • With default size, resizing not allowed for GtkSpinButton position at right-end. SetPict(GtkSpinButton, "stillImage.png", OptPict{Position: gtk.ENTRY_ICON_SECONDARY})
  • Load a stock-icons-theme or an asset/filename icon to a GtkMenuButton where stock not available. SetPict(gtk.MenuButton, TryStockIcon("open-menu-symbolic", "stillImage.png"), 18) or SetPict(gtk.MenuButton, TryStockIcon("open-menu-symbolic", "stillImage.png"), OptPict{Size: 18})
  • Rotate upsidedown, resize 14px: SetPict(gtk.MenuButton, TryStockIcon("open-menu-symbolic", "stillImage.png"), OptPict{Size: 14, Rotate: gdk.PIXBUF_ROTATE_UPSIDEDOWN})

func TryStockIcon

func TryStockIcon(iconLookupFlag gtk.IconLookupFlags, stockName, assetName interface{}) (names []interface{})

TryStockIcon: Convenience function to combine a stock-icons-theme and an asset/filename icon to send to "GetPixBuf()" function.

Types

type OptPict

type OptPict struct {
	Size int
	// 0 = limit height, 1 = limit width, 2 = percents,
	// 3 = limit height or width depending on MaxSize value.
	ResizeMethode int
	// Rotate image / icon
	Rotate gdk.PixbufRotation
	// SpinButton / Entry ... icon positions
	Position gtk.EntryIconPosition
	// Opacity [0.01 to 1.0] work with: Box, ToggleButton, ToolButton, MenuButton, Button
	// a value of 0 means 1.0; 0.01 means 0
	Opacity float64
	// Ask for a GdkPixbufAnimation image
	Animated bool
	// Max size accepted relative to "ResizeMethode" = 3
	MaxSize int
}

OptPict: hold options for SetPict(), you can use OptPictStructNew() to set defaults values.

func OptPictStructNew

func OptPictStructNew(values ...interface{}) OptPict

OptPictStructNew: 'values' options can be nil, ther is no obligation to use this function to create the structure because functions are designed to handle defaults options automatically, this is a convenient use. The options (each values can be nil) order (if used) must be: Size, ResizeMethode, Rotate, Position, Opacity, Animated, MaxSize.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL