schat

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: AGPL-3.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	// Base container of the chat section, is a stack to allow children to fill all avaliable space
	Base *fyne.Container
	// Makes child scrollable
	VScroll *container.Scroll
	// Makes child fill all avaliable space
	Stack2 *fyne.Container
	// Used to position messages at the bottom of the section when there aren't enough to fill the whole section
	Border *fyne.Container
	// Lists messages vertically
	VBox *fyne.Container
}

Wrapper struct containing all containers that compose the chat section of the screen

func NewChat

func NewChat() Chat

NewChat: Creates and returns all containers needed for the section of the GUI Returns:

ChatContainer - Wrapper struct containing all containers that compose the chat section

type ContainerTableChat

type ContainerTableChat struct {
	// Highest level container that contains all other objects in the window
	Base *fyne.Container
	// Container for objects at the bottom of the screen (like the message entry, send button, etc.)
	BottomBar *fyne.Container
	// Container for buttons at the bottom of the screen to the left of the message entry
	BottomLeftCluster *fyne.Container
	// Containers containing the messages in the chat
	Chat Chat
}

All containers to be used by chat screen

type Message

type Message struct {
	// Base VBox container for the message that contains the reply section if there is one, and the message card
	Base *fyne.Container
	// A VBox with all replied messages, added to Base first if there is any
	RepliedSection *fyne.Container
	// Surrounds message in a card, added to Base first, second if there's replies
	Card *widget.Card
	// Base VBox container for card content
	VBox *fyne.Container
	// Border container for message metadata, added to VBox first, second if there's replied messages
	Border *fyne.Container
	// Label for message content, added to VBox second, third of there are replied messages
	Content *widget.RichText
	// Label for username, added to left side of Border
	Username *widget.Label
	// Label for time, added to right side of Border
	Time *widget.Label
}

type RepliedMessage added in v0.3.0

type RepliedMessage struct {
	Base        *fyne.Container
	Icon        *widget.Icon
	MessageID   int
	UsernameLbl *widget.Label
	Text        *widget.RichText
}

A widget representing a reply to a message. Is a component of Message widgets that reply to other messages

type ScreenChat

type ScreenChat struct {
	ChatID int
	// All containers
	Containers ContainerTableChat
	// All widgets
	Widgets WidgetTableChat
	// The main window
	Window          fyne.Window
	OutgoingReqChat chan prot.ChatRequest // Connects to net.go
}

A collection of all GUI elements to be used chat screen

func InitScreenChat

func InitScreenChat(
	s *screen.ScreenManager, w fyne.Window,
	c *chat.ChatCache, u *user.UserCache, opt *options.Options,
	outgoingRequests chan prot.ChatRequest,
) *ScreenChat

func (*ScreenChat) ChatRequestAdd added in v0.5.0

func (g *ScreenChat) ChatRequestAdd(msgContent string, c *chat.ChatCache, u *user.UserCache)

func (*ScreenChat) ChatRequestDelete added in v0.5.0

func (g *ScreenChat) ChatRequestDelete(msgID int, c *chat.ChatCache, u *user.UserCache)

func (*ScreenChat) ChatRequestEdit added in v0.5.0

func (g *ScreenChat) ChatRequestEdit(msgID int, msgContent string, c *chat.ChatCache, u *user.UserCache)

func (*ScreenChat) RespAdd

func (g *ScreenChat) RespAdd(
	resp *prot.ChatResponse, c *chat.ChatCache, u *user.UserCache, opt *options.Options,
)

func (*ScreenChat) RespDel

func (g *ScreenChat) RespDel(resp *prot.ChatResponse, c *chat.ChatCache, opt *options.Options)

func (*ScreenChat) RespEdit

func (g *ScreenChat) RespEdit(resp *prot.ChatResponse, c *chat.ChatCache, u *user.UserCache)

type WidgetTableChat added in v0.3.0

type WidgetTableChat struct {
	// Button in the bottom bar that sends the contents of EntryMessage when pressed
	ButtonSend *widget.Button
	// Entry in the bottom bar used to type and send messages
	EntryMessage *widget.Entry
	// Button in the bottom left for attaching files to messages
	ButtonAttach *widget.Button
	// Button in the bottom right of the screen for opening a settings window
	ButtonOptions *widget.Button
	// Messages in the chat containers
	Messages map[int]*Message
	// Widgets that show replying to a message
	//  Key (int) - Message ID
	//  Val (*RepliedMessage) - Replied message
	RepliedMessages map[int]*RepliedMessage
}

All widgets to be used by the chat screen

Jump to

Keyboard shortcuts

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