Documentation
¶
Index ¶
- type Chat
- type ChatCache
- type ContainerTableChat
- type DialogTable
- type Message
- type ScreenChat
- func (g *ScreenChat) DialogConnectionIssues(err error, opt *options.Options)
- func (g *ScreenChat) DialogLogin(u *user.UserData, opt *options.Options)
- func (g *ScreenChat) NewDialog(title, content string) *dialog.CustomDialog
- func (g *ScreenChat) ReceiveMessage(rawMsg prot.MessageRaw)
- func (g *ScreenChat) RespAdd(r *prot.ChatResponse, u *user.UserData)
- func (g *ScreenChat) RespDel(r *prot.ChatResponse)
- func (g *ScreenChat) RespEdit(r *prot.ChatResponse)
- func (g *ScreenChat) SendMessage()
- type WidgetTable
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
type ChatCache ¶
type ChatCache struct {
// Key (int) - Chat ID
// Val ([]MessageRaw) - List of cached messages from that chat
CachedMessages map[int][]prot.MessageRaw
}
Messages from chats that aren't currently shown are stored here
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 DialogTable ¶
type DialogTable struct {
// Informs the user that there are issues with connecting to the server
ConnectionIssues *dialog.CustomDialog
// Asks the user for information to log in
Login *dialog.CustomDialog
}
All dialogs to be used by chat screen
type Message ¶
type Message struct {
// Surrounds message in a card
Base *widget.Card
// Base VBox container for card content
VBox *fyne.Container
// Border container for message metadata, added to VBox first
Border *fyne.Container
// Label for message content, added to VBox second
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 ScreenChat ¶
type ScreenChat struct {
// All containers
Containers ContainerTableChat
// All dialogs
Dialogs DialogTable
// All widgets
Widgets WidgetTable
// 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, u *user.UserData, opt *options.Options, ) *ScreenChat
func (*ScreenChat) DialogConnectionIssues ¶
func (g *ScreenChat) DialogConnectionIssues(err error, opt *options.Options)
DialogConnectionIssues: Creates and shows a dialog set to the default size that informs the user that there are connection issues, with a user friendly message and a technical message Parameters:
err (error) - The error that occurred. This will be used as the technical error message opt (*options.Options) - Options/settings
func (*ScreenChat) DialogLogin ¶
func (g *ScreenChat) DialogLogin(u *user.UserData, opt *options.Options)
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, u *user.UserData)
func (*ScreenChat) RespDel ¶
func (g *ScreenChat) RespDel(r *prot.ChatResponse)
func (*ScreenChat) RespEdit ¶
func (g *ScreenChat) RespEdit(r *prot.ChatResponse)
type WidgetTable ¶
type WidgetTable 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
}
All widget to be used by Ping