channels

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const ChannelsWidth = bannerWidth

Variables

This section is empty.

Functions

This section is empty.

Types

type Banner struct {
	*gtk.Overlay
	Shadows *gtk.Box
	Picture *onlineimage.Picture
	// contains filtered or unexported fields
}

Banner is the guild banner display on top of the channel view.

func NewBanner

func NewBanner(ctx context.Context, guildID discord.GuildID) *Banner

NewBanner creates a new Banner.

func (*Banner) HasBanner

func (b *Banner) HasBanner() bool

HasBanner returns true if the banner is visible.

func (*Banner) Invalidate

func (b *Banner) Invalidate()

Invalidate invalidates and updates the Banner image.

func (*Banner) SetScrollOpacity

func (b *Banner) SetScrollOpacity(scrollY float64) (scrolled bool)

SetScrollOpacity sets the opacity of the shadow depending on the scroll level. If the scroll goes past the banner, then scrolled is true.

func (*Banner) SetURL

func (b *Banner) SetURL(url string)

type ChannelIcon added in v0.0.25

type ChannelIcon struct {
	*gtk.Widget
	Icon *gtk.Image
}

ChannelIcon is a widget that displays a channel's icon. This does not handle DM channels, as it does not display avatars. It is only for displaying the channel icon.

func NewChannelIcon added in v0.0.25

func NewChannelIcon(ch *discord.Channel, overrides ...ChannelIconOverrideFunc) *ChannelIcon

NewChannelIcon creates a new ChannelIcon. If ch is nil, the icon will be a special unknown icon.

type ChannelIconOverrideFunc added in v0.0.25

type ChannelIconOverrideFunc func(t discord.ChannelType) (string, bool)

type View

type View struct {
	*adw.ToolbarView

	Header struct {
		*adw.HeaderBar
		Name *gtk.Label
	}

	Scroll *gtk.ScrolledWindow
	Child  struct {
		*gtk.Box
		Banner *Banner
		View   *gtk.ListView
	}
	// contains filtered or unexported fields
}

View holds the entire channel sidebar containing all the categories, channels and threads.

func NewView

func NewView(ctx context.Context, guildID discord.GuildID) *View

NewView creates a new View.

func (*View) GuildID

func (v *View) GuildID() discord.GuildID

GuildID returns the view's guild ID.

func (*View) InvalidateHeader

func (v *View) InvalidateHeader()

InvalidateHeader invalidates the guild name and banner.

func (*View) SelectChannel

func (v *View) SelectChannel(selectID discord.ChannelID) bool

SelectChannel selects a known channel. If none is known, then it is selected later when the list is changed or never selected if the user selects something else.

Jump to

Keyboard shortcuts

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