core

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetCommonStyle

func SetCommonStyle(s Styler, style *config.Styles)

SetCommonStyle applies common styling to any component implementing the Styler interface

Types

type App

type App struct {
	*tview.Application

	Pages *Pages
	// contains filtered or unexported fields
}

App is a main application struct

func NewApp

func NewApp(appConfig *config.Config) *App

func (*App) FocusChanged

func (a *App) FocusChanged(p tview.Primitive)

FocusChanged is a callback that is called when the focus is changed it is used to update the keys

func (*App) GetConfig

func (a *App) GetConfig() *config.Config

func (*App) GetDao

func (a *App) GetDao() *mongo.Dao

func (*App) GetKeys

func (a *App) GetKeys() *config.KeyBindings

func (*App) GetManager

func (a *App) GetManager() *manager.ElementManager

func (*App) GetStyles

func (a *App) GetStyles() *config.Styles

func (*App) GiveBackFocus

func (a *App) GiveBackFocus()

func (*App) SetDao

func (a *App) SetDao(dao *mongo.Dao)

func (*App) SetFocus

func (a *App) SetFocus(p tview.Primitive)

func (*App) SetPreviousFocus

func (a *App) SetPreviousFocus()

func (*App) SetStyle

func (a *App) SetStyle(styleName string) error

type BaseElement

type BaseElement struct {

	// App is a pointer to the main App.
	// It's used for accessing App focus, root page etc.
	App *App

	// dao is a pointer to the mongo dao.
	Dao *mongo.Dao

	// Listener is a channel that is used to receive events from the app.
	Listener chan manager.EventMsg
	// contains filtered or unexported fields
}

BaseElement is a base struct for all visable elements. It contains all the basic fields and functions that are used by all visable elements.

func NewBaseElement

func NewBaseElement() *BaseElement

NewBaseElement is a constructor for the BaseElement struct.

func (*BaseElement) BroadcastEvent

func (c *BaseElement) BroadcastEvent(event manager.EventMsg)

Broadcast sends an event to all listeners.

func (*BaseElement) Disable

func (c *BaseElement) Disable()

Disable unsets the enabled flag.

func (*BaseElement) Enable

func (c *BaseElement) Enable()

Enable sets the enabled flag.

func (*BaseElement) HandleEvents

func (c *BaseElement) HandleEvents(identifier tview.Identifier, handler func(event manager.EventMsg))

HandleEvents handles events from the manager

func (*BaseElement) Init

func (c *BaseElement) Init(app *App) error

Init is a function that is called when the view is initialized. If custom initialization is needed, this function should be overriden.

func (*BaseElement) IsEnabled

func (c *BaseElement) IsEnabled() bool

IsEnabled returns the enabled flag.

func (*BaseElement) SendToElement

func (c *BaseElement) SendToElement(element tview.Identifier, event manager.EventMsg)

SendToElement sends an event to the element.

func (*BaseElement) SetAfterInitFunc

func (c *BaseElement) SetAfterInitFunc(afterInitFunc func() error)

SetAfterInitFunc sets the optional function that will be run at the end of the Init function.

func (*BaseElement) Subscribe

func (c *BaseElement) Subscribe(identifier tview.Identifier)

Subscribe subscribes to the view events.

func (*BaseElement) Toggle

func (c *BaseElement) Toggle()

Toggle toggles the enabled flag.

func (*BaseElement) UpdateDao

func (c *BaseElement) UpdateDao(dao *mongo.Dao)

UpdateDao updates the dao in the element

type Flex

type Flex struct {
	*tview.Flex
}

Define structs for each component type

func NewFlex

func NewFlex() *Flex

Constructor functions

func (*Flex) SetStyle

func (f *Flex) SetStyle(style *config.Styles)

type Form

type Form struct {
	*tview.Form
}

Define structs for each component type

func NewForm

func NewForm() *Form

func (*Form) SetStyle

func (f *Form) SetStyle(style *config.Styles)

type FormModal added in v0.1.10

type FormModal struct {
	*primitives.FormModal
}

Define structs for each component type

func NewFormModal added in v0.1.10

func NewFormModal() *FormModal

func (*FormModal) SetStyle added in v0.1.10

func (f *FormModal) SetStyle(style *config.Styles)

type InputField

type InputField struct {
	*tview.InputField
}

Define structs for each component type

func NewInputField

func NewInputField() *InputField

func (*InputField) SetStyle

func (i *InputField) SetStyle(style *config.Styles)

type List

type List struct {
	*tview.List
}

Define structs for each component type

func NewList

func NewList() *List

func (*List) SetStyle

func (l *List) SetStyle(style *config.Styles)

type ListModal

type ListModal struct {
	*primitives.ListModal
}

Define structs for each component type

func NewListModal

func NewListModal() *ListModal

func (*ListModal) SetStyle

func (l *ListModal) SetStyle(style *config.Styles)
type Modal struct {
	*tview.Modal
}

Define structs for each component type

func NewModal added in v0.1.4

func NewModal() *Modal

func (*Modal) SetStyle added in v0.1.4

func (m *Modal) SetStyle(style *config.Styles)

type Pages

type Pages struct {
	*tview.Pages
	// contains filtered or unexported fields
}

func NewPages

func NewPages(manager *manager.ElementManager, app *App) *Pages

func (*Pages) AddPage

func (r *Pages) AddPage(view tview.Identifier, page tview.Primitive, resize, visable bool) *tview.Pages

AddPage is a wrapper for tview.Pages.AddPage

func (*Pages) HasPage

func (r *Pages) HasPage(view tview.Identifier) bool

HasPage is a wrapper for tview.Pages.HasPage

func (*Pages) RemovePage

func (r *Pages) RemovePage(view tview.Identifier) *tview.Pages

RemovePage is a wrapper for tview.Pages.RemovePage

func (*Pages) SetStyle

func (p *Pages) SetStyle(style *config.Styles)

type Styler

type Styler interface {
	SetBackgroundColor(tcell.Color) *tview.Box
	SetBorderColor(tcell.Color) *tview.Box
	SetTitleColor(tcell.Color) *tview.Box
	SetFocusStyle(tcell.Style) *tview.Box
}

Styler is an interface for components that can be styled

type Table

type Table struct {
	*tview.Table
}

func NewTable

func NewTable() *Table

func (*Table) GetCellAboveThatMatch

func (t *Table) GetCellAboveThatMatch(row, col int, condition func(cell *tview.TableCell) bool) *tview.TableCell

GetCellAboveThatMatch returns the cell above the current selection that matches the given condition

func (*Table) GetCellBelowThatMatch

func (t *Table) GetCellBelowThatMatch(row, col int, condition func(cell *tview.TableCell) bool) *tview.TableCell

GetCellBelowThatMatch returns the cell below the current selection that matches the given condition

func (*Table) GetContentFromRows

func (t *Table) GetContentFromRows(rows []int) []string

GetContentFromRows returns the content of the table from the selected rows

func (*Table) ImproveScrolling

func (t *Table) ImproveScrolling()

ImproveScrolling allows to scroll to the beginning and end of the table while moving up and down when reaching the end of selectable area but there are rows non selectable that we like to see TODO: Implement

func (*Table) MoveDownUntil

func (t *Table) MoveDownUntil(row, col int, condition func(cell *tview.TableCell) bool)

MoveDownUntil moves the selection down until a condition is met

func (*Table) MoveUpUntil

func (t *Table) MoveUpUntil(row, col int, condition func(cell *tview.TableCell) bool)

MoveUpUntil moves the selection up until a condition is met

func (*Table) SetStyle

func (t *Table) SetStyle(style *config.Styles)

type TextView

type TextView struct {
	*tview.TextView
}

Define structs for each component type

func NewTextView

func NewTextView() *TextView

func (*TextView) SetStyle

func (t *TextView) SetStyle(style *config.Styles)

type TreeView

type TreeView struct {
	*tview.TreeView
}

Define structs for each component type

func NewTreeView

func NewTreeView() *TreeView

func (*TreeView) SetStyle

func (t *TreeView) SetStyle(style *config.Styles)

type ViewModal

type ViewModal struct {
	*primitives.ViewModal
}

Define structs for each component type

func NewViewModal

func NewViewModal() *ViewModal

func (*ViewModal) SetStyle

func (v *ViewModal) SetStyle(style *config.Styles)

Jump to

Keyboard shortcuts

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