Documentation ¶
Index ¶
- func AsyncUse(r Reuser, fn AsyncUser)
- func BindRoundImage(img ImageURLSetter, state LabelStateStorer, tooltip bool)
- func MakeRed(content text.Rich) markup.RenderOutput
- func RenderSkipImages(rich text.Rich) markup.RenderOutput
- func Small(content text.Rich) markup.RenderOutput
- type AsyncUser
- type ImageURLSetter
- type Label
- type LabelImage
- type LabelRenderer
- type LabelState
- type LabelStateStorer
- type NameContainer
- type Reuser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsyncUse ¶
AsyncUse is a handler for structs that implement the Reuser primitive. The passed in function will be called asynchronously, but swap will be called in the Gtk main thread.
func BindRoundImage ¶
func BindRoundImage(img ImageURLSetter, state LabelStateStorer, tooltip bool)
BindRoundImage binds a round image to a rich label state store.
func MakeRed ¶
func MakeRed(content text.Rich) markup.RenderOutput
MakeRed is a renderer that makes the plain text red.
func RenderSkipImages ¶
func RenderSkipImages(rich text.Rich) markup.RenderOutput
RenderSkipImages is a label renderer that skips images.
Types ¶
type ImageURLSetter ¶
type ImageURLSetter interface {
SetImageURL(url string)
}
ImageURLSetter describes an image that can be set a URL.
type Label ¶
Label provides an abstraction around a regular GTK label that can be self-updated. Widgets that extend off of this (such as ToggleButton) does not need to manually
func NewLabel ¶
func NewLabel(state LabelStateStorer) *Label
NewLabel creates a self-updating label.
func NewLabelWithRenderer ¶
func NewLabelWithRenderer(state LabelStateStorer, r LabelRenderer) *Label
NewLabelWithRenderer creates a self-updating label using the given renderer.
func NewStaticLabel ¶
NewStaticLabel creates a static, non-updating label.
func (*Label) Output ¶
func (l *Label) Output() markup.RenderOutput
Output returns the rendered output.
func (*Label) SetLabel ¶
SetLabel sets the label in the current thread, meaning it's not thread-safe.
func (*Label) SetRenderer ¶
func (l *Label) SetRenderer(renderer LabelRenderer)
SetRenderer sets a custom renderer. If the given renderer is nil, then the default markup renderer is used instead. The label is automatically updated.
type LabelImage ¶
LabelImage is the first image from a label. If
func (LabelImage) HasImage ¶
func (labelImage LabelImage) HasImage() bool
HasImage returns true if the label has an image.
type LabelRenderer ¶
type LabelRenderer = func(text.Rich) markup.RenderOutput
LabelRenderer is the input/output function to render a rich text segment to Pango markup.
type LabelState ¶
type LabelState struct {
// contains filtered or unexported fields
}
LabelState provides a container for labels that allow other containers to extend upon. A zero-value instance is a valid instance.
func NewLabelState ¶
func NewLabelState(l text.Rich) *LabelState
NewLabelState creates a new label state.
func (*LabelState) Image ¶
func (state *LabelState) Image() LabelImage
Image returns the image, if any. Otherwise, an empty string is returned.
func (*LabelState) Label ¶
func (state *LabelState) Label() text.Rich
Label returns the inside label.
func (*LabelState) OnUpdate ¶
func (state *LabelState) OnUpdate(fn func()) (remove func())
OnUpdate subscribes the given callback. The returned callback removes the given callback from the registry.
func (*LabelState) SetLabel ¶
func (state *LabelState) SetLabel(label text.Rich)
SetLabel is called by cchat to update the state. The internal subscribed callbacks will be called in the main thread.
func (*LabelState) String ¶
func (state *LabelState) String() string
String returns the inside label in plain text.
type LabelStateStorer ¶
type LabelStateStorer interface { Label() text.Rich Image() LabelImage OnUpdate(func()) (remove func()) }
LabelStateStorer is an interface for LabelState.
type NameContainer ¶
type NameContainer struct { LabelState // contains filtered or unexported fields }
NameContainer contains a reusable LabelState for cchat.Namer.
func (*NameContainer) BindNamer ¶
func (namec *NameContainer) BindNamer(w primitives.Connector, sig string, namer cchat.Namer)
BindNamer binds a destructor signal to the name container to cancel a context.
func (*NameContainer) QueueNamer ¶
func (namec *NameContainer) QueueNamer(ctx context.Context, namer cchat.Namer)
QueueNamer tries using the namer in the background and queue the setter onto the next GLib loop iteration.
func (*NameContainer) Stop ¶
func (namec *NameContainer) Stop()
Stop stops the name container. Calling Stop twice when no new namers are set will do nothing.