controls

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	Execute(runtime base.Runtime, cp *CommandPalette)
	GetLabel() string
}

type CommandPalette

type CommandPalette struct {
	Width, Height int
	// contains filtered or unexported fields
}

func NewCommandPalette

func NewCommandPalette(commands []Command) *CommandPalette

func (*CommandPalette) Draw

func (cp *CommandPalette) Draw(g *base.Graphics)

func (*CommandPalette) Focus

func (cp *CommandPalette) Focus(on bool)

func (*CommandPalette) GetLabels

func (cp *CommandPalette) GetLabels() []string

func (*CommandPalette) Handle

func (cp *CommandPalette) Handle(ev base.Event)

func (*CommandPalette) Init

func (cp *CommandPalette) Init(commands []Command)

func (*CommandPalette) IsFlexibleHeight

func (cp *CommandPalette) IsFlexibleHeight() bool

func (*CommandPalette) IsFlexibleWidth

func (cp *CommandPalette) IsFlexibleWidth() bool

func (*CommandPalette) IsFocusable

func (cp *CommandPalette) IsFocusable() bool

func (*CommandPalette) Layout

func (cp *CommandPalette) Layout(width, height int)

func (*CommandPalette) MinimumSize

func (cp *CommandPalette) MinimumSize(width, height int) (int, int)

func (*CommandPalette) Move

func (cp *CommandPalette) Move(x, y int)

func (*CommandPalette) SubFocusFirst

func (cp *CommandPalette) SubFocusFirst()

func (*CommandPalette) SubFocusLast

func (cp *CommandPalette) SubFocusLast()

func (*CommandPalette) SubFocusNext

func (cp *CommandPalette) SubFocusNext() bool

func (*CommandPalette) SubFocusPrev

func (cp *CommandPalette) SubFocusPrev() bool

func (*CommandPalette) Traverse

func (cp *CommandPalette) Traverse(fm *tui.FocusManager)

func (*CommandPalette) Update

func (cp *CommandPalette) Update()

type ConfirmationDialog

type ConfirmationDialog struct {
	Width, Height int
	// contains filtered or unexported fields
}

func NewConfirmationDialog

func NewConfirmationDialog(title, message string, onYes, onNo func(base.Runtime)) *ConfirmationDialog

func (*ConfirmationDialog) Draw

func (cd *ConfirmationDialog) Draw(g *base.Graphics)

func (*ConfirmationDialog) Focus

func (cd *ConfirmationDialog) Focus(on bool)

func (*ConfirmationDialog) GetSelectedButton

func (cd *ConfirmationDialog) GetSelectedButton() int

GetSelectedButton returns the currently selected button (0: Yes, 1: No)

func (*ConfirmationDialog) Handle

func (cd *ConfirmationDialog) Handle(ev base.Event)

func (*ConfirmationDialog) Init

func (cd *ConfirmationDialog) Init(title, message string)

func (*ConfirmationDialog) IsFlexibleHeight

func (cd *ConfirmationDialog) IsFlexibleHeight() bool

func (*ConfirmationDialog) IsFlexibleWidth

func (cd *ConfirmationDialog) IsFlexibleWidth() bool

func (*ConfirmationDialog) IsFocusable

func (cd *ConfirmationDialog) IsFocusable() bool

func (*ConfirmationDialog) Layout

func (cd *ConfirmationDialog) Layout(width, height int)

func (*ConfirmationDialog) MinimumSize

func (cd *ConfirmationDialog) MinimumSize(width, height int) (int, int)

func (*ConfirmationDialog) Move

func (cd *ConfirmationDialog) Move(x, y int)

func (*ConfirmationDialog) SetMessage

func (cd *ConfirmationDialog) SetMessage(message string)

SetMessage updates the dialog message

func (*ConfirmationDialog) SetSelectedButton

func (cd *ConfirmationDialog) SetSelectedButton(button int)

SetSelectedButton sets the selected button (0: Yes, 1: No)

func (*ConfirmationDialog) SetTitle

func (cd *ConfirmationDialog) SetTitle(title string)

SetTitle updates the dialog title

func (*ConfirmationDialog) SubFocusFirst

func (cd *ConfirmationDialog) SubFocusFirst()

func (*ConfirmationDialog) SubFocusLast

func (cd *ConfirmationDialog) SubFocusLast()

func (*ConfirmationDialog) SubFocusNext

func (cd *ConfirmationDialog) SubFocusNext() bool

func (*ConfirmationDialog) SubFocusPrev

func (cd *ConfirmationDialog) SubFocusPrev() bool

func (*ConfirmationDialog) Traverse

func (cd *ConfirmationDialog) Traverse(fm *tui.FocusManager)

func (*ConfirmationDialog) Update

func (cd *ConfirmationDialog) Update()

type DelegateCommand

type DelegateCommand struct {
	Label string
	Func  func(runtime base.Runtime, cp *CommandPalette)
}

func (DelegateCommand) Execute

func (dc DelegateCommand) Execute(runtime base.Runtime, cp *CommandPalette)

func (DelegateCommand) GetLabel

func (dc DelegateCommand) GetLabel() string

type FileChooser

type FileChooser struct {
	Width, Height int
	// contains filtered or unexported fields
}

func NewFileChooser

func NewFileChooser(initialPath string, onFileSelect func(base.Runtime, string), onCancel func(base.Runtime)) *FileChooser

func (*FileChooser) Draw

func (fc *FileChooser) Draw(g *base.Graphics)

func (*FileChooser) Focus

func (fc *FileChooser) Focus(on bool)

func (*FileChooser) GetCurrentPath

func (fc *FileChooser) GetCurrentPath() string

GetCurrentPath returns the current directory path

func (*FileChooser) GetSelectedEntry

func (fc *FileChooser) GetSelectedEntry() *FileEntry

GetSelectedEntry returns the currently selected file entry

func (*FileChooser) Handle

func (fc *FileChooser) Handle(ev base.Event)

func (*FileChooser) Init

func (fc *FileChooser) Init()

func (*FileChooser) IsFlexibleHeight

func (fc *FileChooser) IsFlexibleHeight() bool

func (*FileChooser) IsFlexibleWidth

func (fc *FileChooser) IsFlexibleWidth() bool

func (*FileChooser) IsFocusable

func (fc *FileChooser) IsFocusable() bool

func (*FileChooser) Layout

func (fc *FileChooser) Layout(width, height int)

func (*FileChooser) MinimumSize

func (fc *FileChooser) MinimumSize(width, height int) (int, int)

func (*FileChooser) Move

func (fc *FileChooser) Move(x, y int)

func (*FileChooser) Refresh

func (fc *FileChooser) Refresh()

Refresh reloads the current directory

func (*FileChooser) SetPath

func (fc *FileChooser) SetPath(path string)

SetPath changes the current directory path

func (*FileChooser) SubFocusFirst

func (fc *FileChooser) SubFocusFirst()

func (*FileChooser) SubFocusLast

func (fc *FileChooser) SubFocusLast()

func (*FileChooser) SubFocusNext

func (fc *FileChooser) SubFocusNext() bool

func (*FileChooser) SubFocusPrev

func (fc *FileChooser) SubFocusPrev() bool

func (*FileChooser) Traverse

func (fc *FileChooser) Traverse(fm *tui.FocusManager)

func (*FileChooser) Update

func (fc *FileChooser) Update()

type FileEntry

type FileEntry struct {
	Name  string
	Path  string
	IsDir bool
	Size  int64
}

type FolderChooser

type FolderChooser struct {
	Width, Height int
	// contains filtered or unexported fields
}

func NewFolderChooser

func NewFolderChooser(initialPath string, onFolderSelect func(base.Runtime, string), onCancel func(base.Runtime)) *FolderChooser

func (*FolderChooser) Draw

func (fc *FolderChooser) Draw(g *base.Graphics)

func (*FolderChooser) Focus

func (fc *FolderChooser) Focus(on bool)

func (*FolderChooser) GetCurrentPath

func (fc *FolderChooser) GetCurrentPath() string

GetCurrentPath returns the current directory path

func (*FolderChooser) GetSelectedFolder

func (fc *FolderChooser) GetSelectedFolder() *FolderEntry

GetSelectedFolder returns the currently selected folder entry

func (*FolderChooser) Handle

func (fc *FolderChooser) Handle(ev base.Event)

func (*FolderChooser) Init

func (fc *FolderChooser) Init()

func (*FolderChooser) IsFlexibleHeight

func (fc *FolderChooser) IsFlexibleHeight() bool

func (*FolderChooser) IsFlexibleWidth

func (fc *FolderChooser) IsFlexibleWidth() bool

func (*FolderChooser) IsFocusable

func (fc *FolderChooser) IsFocusable() bool

func (*FolderChooser) Layout

func (fc *FolderChooser) Layout(width, height int)

func (*FolderChooser) MinimumSize

func (fc *FolderChooser) MinimumSize(width, height int) (int, int)

func (*FolderChooser) Move

func (fc *FolderChooser) Move(x, y int)

func (*FolderChooser) Refresh

func (fc *FolderChooser) Refresh()

Refresh reloads the current directory

func (*FolderChooser) SelectCurrentFolder

func (fc *FolderChooser) SelectCurrentFolder()

SelectCurrentFolder selects the current directory (useful for "select current folder" functionality)

func (*FolderChooser) SetPath

func (fc *FolderChooser) SetPath(path string)

SetPath changes the current directory path

func (*FolderChooser) SubFocusFirst

func (fc *FolderChooser) SubFocusFirst()

func (*FolderChooser) SubFocusLast

func (fc *FolderChooser) SubFocusLast()

func (*FolderChooser) SubFocusNext

func (fc *FolderChooser) SubFocusNext() bool

func (*FolderChooser) SubFocusPrev

func (fc *FolderChooser) SubFocusPrev() bool

func (*FolderChooser) Traverse

func (fc *FolderChooser) Traverse(fm *tui.FocusManager)

func (*FolderChooser) Update

func (fc *FolderChooser) Update()

type FolderEntry

type FolderEntry struct {
	Name string
	Path string
}

type InputDialog

type InputDialog struct {
	Width, Height int
	// contains filtered or unexported fields
}

func NewInputDialog

func NewInputDialog(title, prompt, initialValue string, onOK func(base.Runtime, string), onCancel func(base.Runtime)) *InputDialog

func (*InputDialog) ClearInput

func (id *InputDialog) ClearInput()

ClearInput clears the input field

func (*InputDialog) Draw

func (id *InputDialog) Draw(g *base.Graphics)

func (*InputDialog) Focus

func (id *InputDialog) Focus(on bool)

func (*InputDialog) GetInputValue

func (id *InputDialog) GetInputValue() string

GetInputValue returns the current input field value

func (*InputDialog) Handle

func (id *InputDialog) Handle(ev base.Event)

func (*InputDialog) Init

func (id *InputDialog) Init(title, prompt string)

func (*InputDialog) IsFlexibleHeight

func (id *InputDialog) IsFlexibleHeight() bool

func (*InputDialog) IsFlexibleWidth

func (id *InputDialog) IsFlexibleWidth() bool

func (*InputDialog) IsFocusable

func (id *InputDialog) IsFocusable() bool

func (*InputDialog) Layout

func (id *InputDialog) Layout(width, height int)

func (*InputDialog) MinimumSize

func (id *InputDialog) MinimumSize(width, height int) (int, int)

func (*InputDialog) Move

func (id *InputDialog) Move(x, y int)

func (*InputDialog) SetInputValue

func (id *InputDialog) SetInputValue(value string)

SetInputValue sets the input field value

func (*InputDialog) SetPrompt

func (id *InputDialog) SetPrompt(prompt string)

SetPrompt updates the dialog prompt

func (*InputDialog) SetTitle

func (id *InputDialog) SetTitle(title string)

SetTitle updates the dialog title

func (*InputDialog) SubFocusFirst

func (id *InputDialog) SubFocusFirst()

func (*InputDialog) SubFocusLast

func (id *InputDialog) SubFocusLast()

func (*InputDialog) SubFocusNext

func (id *InputDialog) SubFocusNext() bool

func (*InputDialog) SubFocusPrev

func (id *InputDialog) SubFocusPrev() bool

func (*InputDialog) Traverse

func (id *InputDialog) Traverse(fm *tui.FocusManager)

func (*InputDialog) Update

func (id *InputDialog) Update()

type MessageDialog

type MessageDialog struct {
	Width, Height int
	// contains filtered or unexported fields
}

func NewMessageDialog

func NewMessageDialog(title, message string, onOK func(base.Runtime)) *MessageDialog

func (*MessageDialog) Draw

func (md *MessageDialog) Draw(g *base.Graphics)

func (*MessageDialog) ExecuteOK

func (md *MessageDialog) ExecuteOK(runtime base.Runtime)

ExecuteOK manually executes the OK callback

func (*MessageDialog) Focus

func (md *MessageDialog) Focus(on bool)

func (*MessageDialog) Handle

func (md *MessageDialog) Handle(ev base.Event)

func (*MessageDialog) Init

func (md *MessageDialog) Init(title, message string)

func (*MessageDialog) IsFlexibleHeight

func (md *MessageDialog) IsFlexibleHeight() bool

func (*MessageDialog) IsFlexibleWidth

func (md *MessageDialog) IsFlexibleWidth() bool

func (*MessageDialog) IsFocusable

func (md *MessageDialog) IsFocusable() bool

func (*MessageDialog) Layout

func (md *MessageDialog) Layout(width, height int)

func (*MessageDialog) MinimumSize

func (md *MessageDialog) MinimumSize(width, height int) (int, int)

func (*MessageDialog) Move

func (md *MessageDialog) Move(x, y int)

func (*MessageDialog) SetButtonText

func (md *MessageDialog) SetButtonText(text string)

SetButtonText updates the OK button text

func (*MessageDialog) SetMessage

func (md *MessageDialog) SetMessage(message string)

SetMessage updates the dialog message

func (*MessageDialog) SetTitle

func (md *MessageDialog) SetTitle(title string)

SetTitle updates the dialog title

func (*MessageDialog) SubFocusFirst

func (md *MessageDialog) SubFocusFirst()

func (*MessageDialog) SubFocusLast

func (md *MessageDialog) SubFocusLast()

func (*MessageDialog) SubFocusNext

func (md *MessageDialog) SubFocusNext() bool

func (*MessageDialog) SubFocusPrev

func (md *MessageDialog) SubFocusPrev() bool

func (*MessageDialog) Traverse

func (md *MessageDialog) Traverse(fm *tui.FocusManager)

func (*MessageDialog) Update

func (md *MessageDialog) Update()

Jump to

Keyboard shortcuts

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