sidebutton

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button struct {
	*gtk.Overlay
	Button *gtk.Button

	IconOverlay *gtk.Overlay
	Icon        *onlineimage.Avatar
	Mentions    *MentionsIndicator

	Pill *Pill
	// contains filtered or unexported fields
}

Button is a widget showing a single guild icon.

func NewButton

func NewButton(ctx context.Context, open func()) *Button

NewButton creates a new button.

func (*Button) Activate

func (g *Button) Activate() bool

Activate activates the button.

func (*Button) Context

func (g *Button) Context() context.Context

Context returns the context of the button that was passed in during construction.

func (*Button) IsSelected

func (g *Button) IsSelected() bool

IsSelected returns true if the guild is selected.

func (*Button) SetIndicator

func (g *Button) SetIndicator(indicator ningen.UnreadIndication)

SetIndicator sets the button's unread indicator.

func (*Button) SetMentions

func (g *Button) SetMentions(mentions int)

SetMentions sets the button's mention indicator.

func (*Button) SetSelected

func (g *Button) SetSelected(selected bool)

SetSelected sets the button's selected state.

func (*Button) Unselect

func (g *Button) Unselect()

Unselect unselects the guild visually. This is mostly used by the parent widget for list-keeping.

type MentionsIndicator

type MentionsIndicator struct {
	*gtk.Revealer
	Label *gtk.Label
	// contains filtered or unexported fields
}

MentionsIndicator is a small indicator that shows the mention count.

func NewMentionsIndicator

func NewMentionsIndicator() *MentionsIndicator

NewMentionsIndicator creates a new mention indicator.

func (*MentionsIndicator) Count

func (m *MentionsIndicator) Count() int

Count returns the mention count.

func (*MentionsIndicator) SetCount

func (m *MentionsIndicator) SetCount(count int)

SetCount sets the mention count.

func (*MentionsIndicator) SetRevealChild

func (m *MentionsIndicator) SetRevealChild(reveal bool)

SetRevealChild sets whether the indicator should be revealed. This lets the user hide the indicator even if there are mentions.

type Pill

type Pill struct {
	*gtk.Box // width IconPadding

	State PillState
	Attrs PillAttributes
	// contains filtered or unexported fields
}

func NewPill

func NewPill() *Pill

func (*Pill) Invalidate

func (r *Pill) Invalidate()

Invalidate reads the 2 fields inside Pill and updates the widget accordingly.

type PillAttributes

type PillAttributes uint8
const (
	PillUnread PillAttributes = 1 << iota
	PillMentioned
)

Additional pill attributes.

func PillAttrsFromUnread

func PillAttrsFromUnread(state ningen.UnreadIndication) PillAttributes

PillAttrsFromUnread creates a new PillAttributes reflecting the correct unread indication state.

func (PillAttributes) CSSClasses

func (a PillAttributes) CSSClasses() []string

CSSClasses returns the CSS classes that corresponds to the current state of the pill.

func (PillAttributes) Has

func (a PillAttributes) Has(these PillAttributes) bool

Has returns true if a has these in its bits.

type PillState

type PillState uint8
const (
	PillInactive PillState = iota
	PillDisabled
	PillActive
	PillOpened
)

Pill state enums.

func (PillState) CSSClass

func (s PillState) CSSClass() string

CSSClass returns the CSS class for the current state.

Jump to

Keyboard shortcuts

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