Documentation
¶
Overview ¶
Package app implements a terminal user interface (tui)
Index ¶
- Constants
- func NewChatBox(palette map[string]string, title string) *tview.TextView
- func NewChatForm(palette map[string]string, title string, acceptFn func(text string), ...) *tview.Form
- func NewChatInput(palette map[string]string, title string, handler InputHandler) *tview.InputField
- func SetTerminalTitle(format string, args ...interface{})
- type App
- type InputHandler
- type MessageDialog
- func (d *MessageDialog) Draw(screen tcell.Screen)
- func (d *MessageDialog) Focus(delegate func(p tview.Primitive))
- func (d *MessageDialog) HasFocus() bool
- func (d *MessageDialog) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (d *MessageDialog) MouseHandler() ...
- func (d *MessageDialog) SetBackgroundColor(color tcell.Color)
- func (d *MessageDialog) SetBorder(status bool)
- func (d *MessageDialog) SetDoneFunc(handler func()) *MessageDialog
- func (d *MessageDialog) SetMessage(message string)
- func (d *MessageDialog) SetRect(x, y, width, height int)
- func (d *MessageDialog) SetTextColor(color tcell.Color)
- func (d *MessageDialog) SetTitle(title string)
- func (d *MessageDialog) SetType(dtype int)
Constants ¶
const ( // InfoDialog is an information dialog type InfoDialog = 0 + iota // ErrorDialog is an error dialog type ErrorDialog )
Variables ¶
This section is empty.
Functions ¶
func NewChatBox ¶
NewChatBox initializes and returns a 'chatBox' to display incoming chat messages.
func NewChatForm ¶
func NewChatForm(palette map[string]string, title string, acceptFn func(text string), cancelFn func()) *tview.Form
NewChatForm initializes and returns a 'chatForm' component that handles user input and creates a new chat with another user.
func NewChatInput ¶
func NewChatInput(palette map[string]string, title string, handler InputHandler) *tview.InputField
NewChatInput initializes and returns a 'chatInput' component that handles user inputs and forwards chat messages.
func SetTerminalTitle ¶
func SetTerminalTitle(format string, args ...interface{})
SetTerminalTitle sets the Terminal/Console's title
Types ¶
type App ¶
type App struct { sync.RWMutex *tview.Application // contains filtered or unexported fields }
App is a terminal user inerface (TUI) using tview/tcell to provide an interface for a saltyim.Client (cli) client and provides a multi-chat experience allowing the user to switch between active chats.
type InputHandler ¶
type InputHandler func(message string)
InputHandler handles input from tview.InputField.
type MessageDialog ¶
MessageDialog represents message dialog primitive.
func NewMessageDialog ¶
func NewMessageDialog(dtype int) *MessageDialog
NewMessageDialog returns a new message dialog primitive.
func (*MessageDialog) Draw ¶
func (d *MessageDialog) Draw(screen tcell.Screen)
Draw draws this primitive onto the screen.
func (*MessageDialog) Focus ¶
func (d *MessageDialog) Focus(delegate func(p tview.Primitive))
Focus is called when this primitive receives focus.
func (*MessageDialog) HasFocus ¶
func (d *MessageDialog) HasFocus() bool
HasFocus returns whether or not this primitive has focus.
func (*MessageDialog) InputHandler ¶
func (d *MessageDialog) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
InputHandler returns input handler function for this primitive.
func (*MessageDialog) MouseHandler ¶
func (d *MessageDialog) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)
MouseHandler returns the mouse handler for this primitive.
func (*MessageDialog) SetBackgroundColor ¶
func (d *MessageDialog) SetBackgroundColor(color tcell.Color)
SetBackgroundColor sets dialog background color.
func (*MessageDialog) SetBorder ¶
func (d *MessageDialog) SetBorder(status bool)
SetBorder sets dialogs border - no effect always true.
func (*MessageDialog) SetDoneFunc ¶
func (d *MessageDialog) SetDoneFunc(handler func()) *MessageDialog
SetDoneFunc sets callback function for when user clicked on the the button or presses "enter" or "esc".
func (*MessageDialog) SetMessage ¶
func (d *MessageDialog) SetMessage(message string)
SetMessage sets the dialog message to display.
func (*MessageDialog) SetRect ¶
func (d *MessageDialog) SetRect(x, y, width, height int)
SetRect sets rect for this primitive.
func (*MessageDialog) SetTextColor ¶
func (d *MessageDialog) SetTextColor(color tcell.Color)
SetTextColor sets dialog's message text color.
func (*MessageDialog) SetTitle ¶
func (d *MessageDialog) SetTitle(title string)
SetTitle sets title for this primitive.
func (*MessageDialog) SetType ¶
func (d *MessageDialog) SetType(dtype int)
SetType sets dialog type to info or error.