Documentation ¶
Index ¶
- func TrySetText(imager Imager, text string)
- type Avatar
- func (a *Avatar) GetAnimation() *gdk.PixbufAnimation
- func (a *Avatar) GetImage() *gtk.Image
- func (a *Avatar) GetPixbuf() *gdk.Pixbuf
- func (a *Avatar) GetSizeRequest() (int, int)
- func (a *Avatar) GetStorageType() gtk.ImageType
- func (a *Avatar) SetFromAnimation(pa *gdk.PixbufAnimation)
- func (a *Avatar) SetFromPixbuf(pb *gdk.Pixbuf)
- func (a *Avatar) SetImageURL(url string)
- func (a *Avatar) SetRadius(float64)
- func (a *Avatar) SetSizeRequest(w, h int)
- type Button
- type Connector
- type Image
- func (i *Image) AddProcessor(procs ...imgutil.Processor)
- func (i *Image) GetImage() *gtk.Image
- func (i *Image) GetImageURL() string
- func (i *Image) SetIfNone(ifNone func(context.Context))
- func (i *Image) SetImageURL(url string)
- func (i *Image) SetImageURLInto(url string, otherImage httputil.ImageContainer)
- func (i *Image) SetPlaceholderIcon(iconName string, iconPx int)
- func (i *Image) SetRadius(r float64)
- func (i *Image) SetSize(size int)
- func (i *Image) Size() int
- func (i *Image) UpdateIfNone()
- func (i *Image) UseInitialsIfNone(initialsFn func() string)
- type Imager
- type RadiusSetter
- type StillImage
- func (s *StillImage) ConnectHandlers(connector primitives.Connector)
- func (s *StillImage) GetAnimation() *gdk.PixbufAnimation
- func (s *StillImage) SetFromAnimation(anim *gdk.PixbufAnimation)
- func (s *StillImage) SetFromPixbuf(pb *gdk.Pixbuf)
- func (s *StillImage) SetFromSurface(sf *cairo.Surface)
- func (s *StillImage) SetImageURL(url string)
- type TextSetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TrySetText ¶
Types ¶
type Avatar ¶
Avatar is a static HdyAvatar container.
func (*Avatar) GetAnimation ¶
func (a *Avatar) GetAnimation() *gdk.PixbufAnimation
GetAnimation returns nil.
func (*Avatar) GetSizeRequest ¶
GetSizeRequest returns the virtual size.
func (*Avatar) GetStorageType ¶
GetStorageType always returns IMAGE_PIXBUF.
func (*Avatar) SetFromAnimation ¶
func (a *Avatar) SetFromAnimation(pa *gdk.PixbufAnimation)
SetFromAnimation sets the first frame of the animation.
func (*Avatar) SetFromPixbuf ¶
SetFromPixbuf sets the pixbuf.
func (*Avatar) SetImageURL ¶
SetImageURL sets the avatar's source URL and reloads it asynchronously.
func (*Avatar) SetSizeRequest ¶
SetSizeRequest sets the avatar size. The actual size is min(w, h).
type Button ¶
Button implements a rounded button with a rounded image. This widget only supports a full circle for rounding.
func NewCustomButton ¶
NewCustomButton creates a new rounded button with the given Imager. If the given Imager implements the Connector interface (aka *StillImage), then the function will implicitly connect its handlers to the button.
func NewEmptyButton ¶
func NewEmptyButton() *Button
type Connector ¶
type Connector interface {
ConnectHandlers(connector primitives.Connector)
}
type Image ¶
Image represents an image with abstractions for asynchronously fetching images from a URL as well as having interchangeable fallbacks.
func NewImage ¶
NewImage creates a new round image. If radius is 0, then it will be half the dimensions. If the radius is less than 0, then nothing is rounded.
func NewSizedImage ¶
NewSizedImage creates a new square image with the given square.
func (*Image) AddProcessor ¶
AddProcessor adds image processors that will be processed on fetched images. Images generated internally, such as initials, won't use it.
func (*Image) GetImageURL ¶
GetImageURL gets the image's URL. It returns an empty string if the image does not have a URL set.
func (*Image) SetIfNone ¶
SetIfNone sets the callback to be used if an empty URL is given to the image. If nil is given, then a fallback icon is used.
func (*Image) SetImageURL ¶
SetImageURL sets the image's URL. If the URL is empty, then the placeholder icon is used, or the IfNone callback is called, or the pixbuf is cleared.
func (*Image) SetImageURLInto ¶
func (i *Image) SetImageURLInto(url string, otherImage httputil.ImageContainer)
SetImageURLInto is SetImageURL, but the image container is given as an argument. It is used by other widgets that extend on this Image.
func (*Image) SetPlaceholderIcon ¶
SetPlaceholderIcon sets the placeholder icon onto the image. The given icon size does not affect the image's physical size.
func (*Image) SetRadius ¶
SetRadius sets the radius to be drawn with. If 0 is given, then a full circle is drawn, which only works best for images guaranteed to be square. Otherwise, the radius is either the number given or the minimum of either the width or height.
func (*Image) SetSize ¶
SetSIze sets the iamge's physical size. It is a convenient function for SetSizeRequest.
func (*Image) Size ¶
Size returns the minimum side's length. This method is used when Image is supposed to be a square/circle.
func (*Image) UpdateIfNone ¶
func (i *Image) UpdateIfNone()
UpdateIfNone updates the image if the image currently does not have one fetched from the URL. It does nothing otherwise.
func (*Image) UseInitialsIfNone ¶
UseInitialsIfNone sets the given image to render an initial image if the image doesn't have a URL.
type Imager ¶
type Imager interface { gtk.IWidget RadiusSetter SetSizeRequest(w, h int) // Embed setters. httputil.ImageContainer GetPixbuf() *gdk.Pixbuf GetAnimation() *gdk.PixbufAnimation GetImage() *gtk.Image }
type RadiusSetter ¶
type RadiusSetter interface {
SetRadius(float64)
}
type StillImage ¶
type StillImage struct { *Image // contains filtered or unexported fields }
StillImage is an image that only plays a GIF if it's hovered on top of.
func NewStillImage ¶
func NewStillImage(parent primitives.Connector, radius float64) *StillImage
NewStillImage creates a new static that binds to the parent's handler so that the image only animates when parent is hovered over.
func (*StillImage) ConnectHandlers ¶
func (s *StillImage) ConnectHandlers(connector primitives.Connector)
func (*StillImage) GetAnimation ¶
func (s *StillImage) GetAnimation() *gdk.PixbufAnimation
func (*StillImage) SetFromAnimation ¶
func (s *StillImage) SetFromAnimation(anim *gdk.PixbufAnimation)
func (*StillImage) SetFromPixbuf ¶
func (s *StillImage) SetFromPixbuf(pb *gdk.Pixbuf)
func (*StillImage) SetFromSurface ¶
func (s *StillImage) SetFromSurface(sf *cairo.Surface)
func (*StillImage) SetImageURL ¶
func (s *StillImage) SetImageURL(url string)
SetImageURL sets the image's URL.
type TextSetter ¶
type TextSetter interface {
SetText(text string)
}
TextSetter is an interface for setting texts.