ui

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(minX, minY, maxX, maxY int, fg, bg termbox.Attribute)

Clear clears the cells in the range [minX, minY], [maxX, maxY] to the specified foreground and background colors.

func DrawRunes

func DrawRunes(x, y int, text []rune, fg, bg termbox.Attribute)

func DrawText

func DrawText(x, y int, text string, fg, bg termbox.Attribute)

DrawText prints a string at a paricular position

func DrawTextPad

func DrawTextPad(x, y int, text string, pad int, fg, bg termbox.Attribute)

func InputBool

func InputBool(c Controller, msg string) (bool, bool)

func InputChoice

func InputChoice(c Controller, msg string, choices []string) (string, bool)

func InputInteger

func InputInteger(c Controller, msg string) (int, bool)

func InputString

func InputString(c Controller, msg string) (string, bool)

func Splash

func Splash(title, text string)

Splash draws a message in the center of the screen that can be dismissed with the escape key

func YesNoQuestion

func YesNoQuestion(msg string) bool

Types

type BookmarkList

type BookmarkList struct {
	List
	// contains filtered or unexported fields
}

func NewBookmarkList

func NewBookmarkList(yPos int, bm *ham.Bookmarks, maxLines int, theme Theme) *BookmarkList

func (*BookmarkList) DrawItem

func (b *BookmarkList) DrawItem(idx, yPos int, fg, bg termbox.Attribute)

func (*BookmarkList) Length

func (b *BookmarkList) Length() int

type Button

type Button struct {
	// contains filtered or unexported fields
}

func NewButton

func NewButton(xPos, yPos int, text string) *Button

func (*Button) Focus

func (b *Button) Focus(f bool)

func (*Button) HandleEvent

func (b *Button) HandleEvent(key input.Key)

func (*Button) OnClick

func (b *Button) OnClick(fn func())

func (*Button) Redraw

func (b *Button) Redraw()

func (*Button) SetController

func (b *Button) SetController(c Controller)

type ComboBox

type ComboBox struct {
	// contains filtered or unexported fields
}

func NewComboBox

func NewComboBox(xPos, yPos int) *ComboBox

func (*ComboBox) AddItem

func (c *ComboBox) AddItem(t string)

func (*ComboBox) Focus

func (c *ComboBox) Focus(b bool)

func (*ComboBox) HandleEvent

func (c *ComboBox) HandleEvent(key input.Key)

func (*ComboBox) Redraw

func (c *ComboBox) Redraw()

func (*ComboBox) SetController

func (c *ComboBox) SetController(cn Controller)

func (*ComboBox) SetSelected

func (c *ComboBox) SetSelected(text string)

func (*ComboBox) Value

func (c *ComboBox) Value() string

func (*ComboBox) Width

func (c *ComboBox) Width() int

type Command

type Command struct {
	Name    string
	Command string
}

type CommandList

type CommandList struct {
	List
	// contains filtered or unexported fields
}

func NewCommandList

func NewCommandList(yPos int, cmds []Command, maxLines int, theme Theme) *CommandList

func (*CommandList) DrawItem

func (c *CommandList) DrawItem(idx, yPos int, fg, bg termbox.Attribute)

func (*CommandList) Length

func (c *CommandList) Length() int

type Controller

type Controller interface {
	AddWidget(w Widget)
	FocusNext() bool
	FocusPrevious() bool
	Theme() Theme
}

type CustomField

type CustomField struct {
	Name  string
	Label string
	Width int

	Default string
	// contains filtered or unexported fields
}

type FocusController

type FocusController struct {
	// contains filtered or unexported fields
}

func (*FocusController) Focus

func (c *FocusController) Focus(w Focusable)

func (*FocusController) FocusNext

func (c *FocusController) FocusNext() bool

func (*FocusController) FocusPrevious

func (c *FocusController) FocusPrevious() bool

func (*FocusController) Unfocus

func (p *FocusController) Unfocus()

type Focusable

type Focusable interface {
	Focus(b bool)
	HandleEvent(key input.Key)
}

type Label

type Label struct {
	// contains filtered or unexported fields
}

func NewLabel

func NewLabel(x, y int, text string) *Label

func (*Label) GetText

func (l *Label) GetText() string

func (*Label) Redraw

func (l *Label) Redraw()

func (*Label) SetController

func (l *Label) SetController(c Controller)

func (*Label) SetText

func (l *Label) SetText(text string)

type List

type List struct {
	// contains filtered or unexported fields
}

func NewList

func NewList(yPos int, maxLines int, src ListSource, theme Theme) *List

func (*List) Focus

func (d *List) Focus(b bool)

func (*List) HandleEvent

func (d *List) HandleEvent(key input.Key)

func (*List) Redraw

func (d *List) Redraw()

func (*List) Selected

func (d *List) Selected() int

func (*List) SetController

func (d *List) SetController(c Controller)

type ListSource

type ListSource interface {
	Length() int
	DrawItem(idx, yPos int, fg, bg termbox.Attribute)
}

type MainController

type MainController struct {
	FocusController
	// contains filtered or unexported fields
}

func NewController

func NewController(thm Theme) *MainController

func (*MainController) AddCommand

func (c *MainController) AddCommand(key input.Key, fn func())

func (*MainController) AddWidget

func (c *MainController) AddWidget(w Widget)

func (*MainController) HandleEvent

func (c *MainController) HandleEvent(key input.Key) bool

func (*MainController) Redraw

func (c *MainController) Redraw()

func (*MainController) RefreshEvery

func (c *MainController) RefreshEvery(duration time.Duration)

func (*MainController) Shutdown

func (c *MainController) Shutdown()

func (*MainController) Theme

func (c *MainController) Theme() Theme
type MenuBar struct {
}

func NewMenuBar

func NewMenuBar() *MenuBar
func (m *MenuBar) Redraw()

type Messages

type Messages struct {
	// contains filtered or unexported fields
}

func NewMessages

func NewMessages(yPos int, maxLines int, theme Theme) *Messages

func (*Messages) AddError

func (m *Messages) AddError(text string)

func (*Messages) AddMessage

func (m *Messages) AddMessage(text string)

func (*Messages) Focus

func (m *Messages) Focus(b bool)

func (*Messages) HandleEvent

func (m *Messages) HandleEvent(key input.Key)

func (*Messages) Redraw

func (m *Messages) Redraw()

func (*Messages) SetController

func (m *Messages) SetController(cn Controller)

type PanelController

type PanelController struct {
	FocusController
	// contains filtered or unexported fields
}

func NewPanelController

func NewPanelController(theme Theme) *PanelController

func (*PanelController) AddWidget

func (p *PanelController) AddWidget(w Widget)

func (*PanelController) FocusIndex

func (p *PanelController) FocusIndex(idx int)

func (*PanelController) HandleEvent

func (p *PanelController) HandleEvent(key input.Key)

func (*PanelController) Redraw

func (p *PanelController) Redraw()

func (*PanelController) Theme

func (c *PanelController) Theme() Theme

type QSO

type QSO struct {
	// contains filtered or unexported fields
}

QSO is the qso editor

func NewQSO

func NewQSO(yPos int, theme Theme, lookup callsigns.Lookup, customFields []CustomField, rig *rig.RigCache) *QSO

NewQSO constructs a new QSO editor

func (*QSO) Band

func (q *QSO) Band() string

func (*QSO) Call

func (q *QSO) Call() string

func (*QSO) Focus

func (q *QSO) Focus(b bool)

func (*QSO) Frequency

func (q *QSO) Frequency() string

func (*QSO) FrequencyValue

func (q *QSO) FrequencyValue() float64

func (*QSO) GetRecord

func (q *QSO) GetRecord() adif.Record

func (*QSO) Grid

func (q *QSO) Grid() string

func (*QSO) HandleEvent

func (q *QSO) HandleEvent(key input.Key)

func (*QSO) HasRig

func (q *QSO) HasRig() bool

func (*QSO) Height

func (q *QSO) Height() int

func (*QSO) IsValid

func (q *QSO) IsValid() bool

func (*QSO) Mode

func (q *QSO) Mode() string

func (*QSO) Name

func (q *QSO) Name() string

func (*QSO) Redraw

func (q *QSO) Redraw()

func (*QSO) ResetDateTime

func (q *QSO) ResetDateTime()

func (*QSO) SetController

func (q *QSO) SetController(c Controller)

func (*QSO) SetDefaults

func (q *QSO) SetDefaults()

func (*QSO) SetFrequency

func (q *QSO) SetFrequency(f float64)

func (*QSO) SetOperatorGrid

func (q *QSO) SetOperatorGrid(grid string)

func (*QSO) SetRecord

func (q *QSO) SetRecord(r adif.Record)

type QSOList

type QSOList struct {
	// contains filtered or unexported fields
}

func NewQSOList

func NewQSOList(yPos int, log *adif.Log, maxLines int, theme Theme) *QSOList

func (*QSOList) Focus

func (q *QSOList) Focus(b bool)

func (*QSOList) HandleEvent

func (q *QSOList) HandleEvent(key input.Key)

func (*QSOList) OnSelect

func (q *QSOList) OnSelect(fn func(r adif.Record))

func (*QSOList) Redraw

func (q *QSOList) Redraw()

func (*QSOList) SelectedIndex

func (q *QSOList) SelectedIndex() int

func (*QSOList) SelectedRecord

func (q *QSOList) SelectedRecord() adif.Record

func (*QSOList) SetController

func (q *QSOList) SetController(c Controller)

func (*QSOList) SetMaxLines

func (q *QSOList) SetMaxLines(m int)

func (*QSOList) SetOperatorGrid

func (q *QSOList) SetOperatorGrid(grid string)

type SpotRecord

type SpotRecord struct {
	Source    string
	Frequency float64
	Station   string
	Comment   string
	Time      time.Time
	Location  string
}

type SpottingList

type SpottingList struct {
	// contains filtered or unexported fields
}

func NewSpottingList

func NewSpottingList(yPos int, maxLines int, expiration time.Duration, theme Theme) *SpottingList

func (*SpottingList) AddSpot

func (d *SpottingList) AddSpot(msg SpotRecord)

func (*SpottingList) Focus

func (d *SpottingList) Focus(b bool)

func (*SpottingList) HandleEvent

func (d *SpottingList) HandleEvent(key input.Key)

func (*SpottingList) OnTune

func (d *SpottingList) OnTune(fn func(freq float64))

func (*SpottingList) Redraw

func (d *SpottingList) Redraw()

func (*SpottingList) SetController

func (d *SpottingList) SetController(c Controller)

type StatusBar

type StatusBar struct {
	// contains filtered or unexported fields
}

func NewStatusBar

func NewStatusBar(y int) *StatusBar

NewStatusBar constructs a new status bar at a given y position. If Y is negative, it represents lines from the bottom of the screen so -1 means the very last line onscreen

func (*StatusBar) AddClock

func (s *StatusBar) AddClock(name string) error

func (*StatusBar) AddFunction

func (s *StatusBar) AddFunction(fn func() string, width int)

func (*StatusBar) AddText

func (s *StatusBar) AddText(text string)

func (*StatusBar) HandleEvent

func (s *StatusBar) HandleEvent(ev termbox.Event)

func (*StatusBar) Redraw

func (s *StatusBar) Redraw()

func (*StatusBar) SetController

func (s *StatusBar) SetController(c Controller)

type TextEdit

type TextEdit struct {
	// contains filtered or unexported fields
}

func NewTextEdit

func NewTextEdit(xPos, yPos int) *TextEdit

func (*TextEdit) Focus

func (t *TextEdit) Focus(b bool)

func (*TextEdit) HandleEvent

func (t *TextEdit) HandleEvent(key input.Key)

func (*TextEdit) OnChange

func (t *TextEdit) OnChange(fn func(t string))

func (*TextEdit) OnLostFocus

func (t *TextEdit) OnLostFocus(f func())

func (*TextEdit) Redraw

func (t *TextEdit) Redraw()

func (*TextEdit) SetAllowedCharacterSet

func (t *TextEdit) SetAllowedCharacterSet(regex string)

func (*TextEdit) SetController

func (t *TextEdit) SetController(c Controller)

func (*TextEdit) SetForceUpperCase

func (t *TextEdit) SetForceUpperCase(b bool)

func (*TextEdit) SetValue

func (t *TextEdit) SetValue(s string)

func (*TextEdit) SetWidth

func (t *TextEdit) SetWidth(n int)

func (*TextEdit) Value

func (t *TextEdit) Value() string

func (*TextEdit) Width

func (t *TextEdit) Width() int

type Theme

type Theme struct {
	StatusFg termbox.Attribute
	StatusBg termbox.Attribute

	TextEditFg termbox.Attribute
	TextEditBg termbox.Attribute

	ComboBoxFg termbox.Attribute
	ComboBoxBg termbox.Attribute

	QSOListHeaderFG termbox.Attribute
	QSOListHeaderBG termbox.Attribute
}

type Widget

type Widget interface {
	Redraw()
	SetController(c Controller)
}

Jump to

Keyboard shortcuts

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