Documentation ¶
Index ¶
- func IsGIF(url string) bool
- type ControlsBoxEnd
- type ControlsBoxStart
- type Embed
- func (e *Embed) ActivateDefault()
- func (e *Embed) NotifyImage(f func()) glib.SignalHandle
- func (e *Embed) SetFromURL(url string)
- func (e *Embed) SetHAlign(align gtk.Align)
- func (e *Embed) SetMaxSize(w, h int)
- func (e *Embed) SetName(name string)
- func (e *Embed) SetOpenURL(f func())
- func (e *Embed) SetSizeRequest(w, h int)
- func (e *Embed) ShrinkMaxSize(w, h int)
- func (e *Embed) Size() (w, h int)
- func (e *Embed) URL() string
- type EmbedType
- type Opts
- type Viewer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ControlsBoxEnd ¶
type ControlsBoxEnd struct {
*gtk.Box
}
func (*ControlsBoxEnd) AddEndButton ¶
func (ce *ControlsBoxEnd) AddEndButton(pack gtk.PositionType, button *gtk.Button)
AddEndButton adds a button into the ControlsBoxEnd.
type ControlsBoxStart ¶
type ControlsBoxStart struct { *gtk.Box Download *gtk.Button CopyURL *gtk.Button OpenOriginal *gtk.Button }
func (*ControlsBoxStart) AddStartButton ¶
func (cs *ControlsBoxStart) AddStartButton(pack gtk.PositionType, button *gtk.Button)
AddStartButton adds a button into the ControlsBoxStart.
type Embed ¶
type Embed struct { *adw.Bin Button *gtk.Button Thumbnail *onlineimage.Picture // contains filtered or unexported fields }
Embed is a user-clickable image with an open callback.
Widget hierarchy:
- Widgetter (?)
- Button
- Thumbnail
func (*Embed) ActivateDefault ¶
func (e *Embed) ActivateDefault()
ActivateDefault triggers the default function that's called by default by SetOpenURL.
func (*Embed) NotifyImage ¶
func (e *Embed) NotifyImage(f func()) glib.SignalHandle
NotifyImage calls f everytime the Embed thumbnail changes.
func (*Embed) SetFromURL ¶
SetFromURL sets the URL of the thumbnail embed.
func (*Embed) SetHAlign ¶
func (e *Embed) SetHAlign(align gtk.Align)
SetHAlign sets the horizontal alignment of the embed relative to its parent.
func (*Embed) SetMaxSize ¶
SetMaxSize sets the maximum size of the image.
func (*Embed) SetName ¶
SetName sets the given embed name into everything that's displaying the embed name.
func (*Embed) SetOpenURL ¶
func (e *Embed) SetOpenURL(f func())
SetOpenURL sets the callback to be called when the user clicks the image.
func (*Embed) SetSizeRequest ¶
SetSizeRequest sets the minimum size of a widget. The dimensions are clamped to the maximum size given during construction, if any.
func (*Embed) ShrinkMaxSize ¶
ShrinkMaxSize sets the maximum size of the image to be the smaller of the current maximum size and the given size.
type EmbedType ¶
type EmbedType uint8
EmbedType indicates the type of the Embed being constructed. The type determines how it's displayed visually to the user.
func TypeFromURL ¶
TypeFromURL returns the EmbedType from the URL.
type Opts ¶
type Opts struct { // Type is the embed type. Default is Image. Type EmbedType // Provider is the image provider to use. Default is HTTPProvider. Provider imgutil.Provider // Whole, if true, will make errors show in its full information instead of // being hidden behind an error icon. Use this for messages only. Whole bool // CanHide, if true, will make the image hide itself on error. Use this for // anything not important, like embeds. CanHide bool // IgnoreWidth, if true, will cause Embed to be initialized without ever // setting a width request. This has the benefit of allowing the Embed to be // shrunken to any width, but it will introduce letterboxing. IgnoreWidth bool // Autoplay, if true, will cause the video to autoplay. For GIFs and // GIFVs, the user won't have to hover over the image to play it. Autoplay bool // Tooltip, if true, will cause the embed to show a tooltip when hovered. // If the embed errors out, a tooltip will be shown regardless. Tooltip bool }
Opts contains options for Embed.
type Viewer ¶
type Viewer struct { *adw.Window Header *adw.HeaderBar ToastOverlay *adw.ToastOverlay Overlay *gtk.Overlay Scroll *gtk.ScrolledWindow Embed *Embed BackButton *gtk.Button ControlsStart ControlsBoxStart ControlsEnd ControlsBoxEnd // contains filtered or unexported fields }
TODO: In libadwaita 1.4 replace BackButton with `set_show_back_button“
func (*Viewer) SetShowBackButton ¶
SetShowBackButton sets whether to show back button at the start of headerbar.