schat

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

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.Label
	// 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
	Text      *canvas.Text
}

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
	OutgoingMessages 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,
) *ScreenChat

func (*ScreenChat) NewDialog

func (g *ScreenChat) NewDialog(title, content string) *dialog.CustomDialog

NewDialog: Creates a new custom dialog with the specified title and content set to the default dialog size Parameters:

title (string) - Title of the dialog
content (string) - Text to be set as the dialog content

Returns:

*dialog.CustomDialog - The new dialog

func (*ScreenChat) ReceiveMessage

func (g *ScreenChat) ReceiveMessage(rawMsg prot.MessageRaw)

func (*ScreenChat) RespAdd

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

func (*ScreenChat) RespDel

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

func (*ScreenChat) RespEdit

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

func (*ScreenChat) SendMessage

func (g *ScreenChat) SendMessage()

oopie :P - entie

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