sneatv

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBlurBorderColor = tcell.ColorGray
View Source
const DefaultFocusedBorderColor = tcell.ColorCornflowerBlue

Variables

View Source
var RadioTabsStyle = TabsStyle{
	Radio:      true,
	Underscore: false,
	ActiveFocused: TabStyles{
		Foreground: "white",
		Background: "black",
	},
	ActiveBlur: TabStyles{
		Foreground: "lightgray",
		Background: "black",
	},
	InactiveFocused: TabStyles{
		Foreground: "lightgray",
		Background: "black",
	},
}
View Source
var UnderlineTabsStyle = TabsStyle{
	Radio:      false,
	Underscore: true,
	ActiveFocused: TabStyles{
		Foreground: "black",
		Background: "lightgray",
	},
	ActiveBlur: TabStyles{
		Foreground: "black",
		Background: "darkgray",
	},
	InactiveFocused: TabStyles{
		Foreground: "lightgray",
		Background: "black",
	},
	InactiveBlur: TabStyles{
		Foreground: "gray",
		Background: "black",
	},
}

Functions

func DefaultBorderWithPadding

func DefaultBorderWithPadding(box *tview.Box)

func DefaultBorderWithoutPadding

func DefaultBorderWithoutPadding(box *tview.Box)

func SetPanelTitle

func SetPanelTitle(box *tview.Box, title string)

func WithSeparator

func WithSeparator(separator string) func(bc *Breadcrumbs)

Types

type Breadcrumb interface {
	GetTitle() string
	SetTitle(string)
	Action() error
}

func NewBreadcrumb

func NewBreadcrumb(title string, action func() error) Breadcrumb
type Breadcrumbs struct {
	*tview.Box
	// contains filtered or unexported fields
}

func NewBreadcrumbs

func NewBreadcrumbs(root Breadcrumb, options ...func(bc *Breadcrumbs)) *Breadcrumbs
func (b *Breadcrumbs) Blur()

Blur is called when this primitive loses focus.

func (b *Breadcrumbs) Clear()
func (b *Breadcrumbs) Draw(screen tcell.Screen)
func (b *Breadcrumbs) Focus(delegate func(p tview.Primitive))

Focus is called when this primitive receives focus.

func (b *Breadcrumbs) GoHome() error
func (b *Breadcrumbs) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler handles keyboard input for navigation and activation.

func (b *Breadcrumbs) IsLastItemSelected() bool
func (b *Breadcrumbs) ItemsCount() int
func (b *Breadcrumbs) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)

MouseHandler handles selection via mouse and focusing on click.

func (b *Breadcrumbs) Push(item Breadcrumb)
func (b *Breadcrumbs) SelectedItemIndex() int
func (b *Breadcrumbs) SetNextFocusTarget(p tview.Primitive) *Breadcrumbs

SetNextFocusTarget sets the primitive to focus when Tab/Down is pressed.

func (b *Breadcrumbs) SetPrevFocusTarget(p tview.Primitive) *Breadcrumbs

SetPrevFocusTarget sets the primitive to focus when Shift+Tab/Up is pressed.

func (b *Breadcrumbs) TakeFocus()

type ButtonWithShortcut

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

func NewButtonWithShortcut

func NewButtonWithShortcut(label string, shortcut rune) *ButtonWithShortcut

func (*ButtonWithShortcut) Draw

func (b *ButtonWithShortcut) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*ButtonWithShortcut) SetShortcutStyle

func (b *ButtonWithShortcut) SetShortcutStyle(style tcell.Style) *ButtonWithShortcut

type PrimitiveWithBox

type PrimitiveWithBox interface {
	tview.Primitive
	GetBox() *tview.Box
}

type Tab

type Tab struct {
	ID       string
	Title    string
	Closable bool
	tview.Primitive
}

Tab represents a single tab.

type TabStyles

type TabStyles struct {
	Foreground string
	Background string
}

type Tabs

type Tabs struct {
	*tview.Flex

	TabsStyle

	TextView *tview.TextView // TODO(help-wanted): exported as a workaround to set focus - needs fix!
	// contains filtered or unexported fields
}

Tabs is a tab container implemented using tview.Pages.

func NewTabs

func NewTabs(app *tview.Application, style TabsStyle, options ...TabsOption) *Tabs

NewTabs creates a new tab container.

func (*Tabs) AddTabs

func (t *Tabs) AddTabs(tabs ...*Tab)

AddTabs adds new tabs.

func (*Tabs) SwitchTo

func (t *Tabs) SwitchTo(index int)

SwitchTo switches to a tab by index.

type TabsOption

type TabsOption func(*tabsOptions)

func FocusDown

func FocusDown(f func(current tview.Primitive)) TabsOption

func FocusLeft

func FocusLeft(f func(current tview.Primitive)) TabsOption

func FocusUp

func FocusUp(f func(current tview.Primitive)) TabsOption

func WithLabel

func WithLabel(label string) TabsOption

type TabsStyle

type TabsStyle struct {
	Radio      bool
	Underscore bool

	ActiveFocused   TabStyles
	ActiveBlur      TabStyles
	InactiveFocused TabStyles
	InactiveBlur    TabStyles
}

type WithBoxType

type WithBoxType[T tview.Primitive] struct {
	tview.Primitive
	Box *tview.Box
}

func PaddedBox

func PaddedBox[T tview.Primitive](
	content T,
	title string,
	paddingTop, paddingBottom, paddingLeft, paddingRight int,
) WithBoxType[*tview.Flex]

PaddedBox wraps a primitive with a border and padding. Padding is real layout padding (via Flex), not Box border padding.

func WithBordersWithoutPadding

func WithBordersWithoutPadding[T tview.Primitive](p T, box *tview.Box) WithBoxType[T]

func WithBoxWithoutBorder

func WithBoxWithoutBorder[T tview.Primitive](p T, box *tview.Box) WithBoxType[T]

func WithDefaultBorders

func WithDefaultBorders[T tview.Primitive](p T, box *tview.Box) WithBoxType[T]

func (WithBoxType[T]) GetBox

func (p WithBoxType[T]) GetBox() *tview.Box

func (WithBoxType[T]) GetPrimitive

func (p WithBoxType[T]) GetPrimitive() T

Jump to

Keyboard shortcuts

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