Documentation
¶
Overview ¶
Package client provides a high-level Go client library for the Yutani Terminal Display Server.
This package offers a fluent, idiomatic Go API for creating and managing terminal UIs through the Yutani server, abstracting away the low-level gRPC details.
Example usage:
client, err := yutani.Connect("localhost:50051")
if err != nil {
log.Fatal(err)
}
defer client.Close()
// Create a list widget
list := client.NewList().
Title("Menu").
Border(true).
Build()
list.AddItem("New File", "Create a new file", "n")
list.AddItem("Open File", "Open an existing file", "o")
list.SetSelection(0)
// Handle events
client.OnEvent(func(event *Event) {
if event.Type == EventTypeWidget && event.Widget.Type == WidgetEventSelected {
fmt.Printf("Selected: %s\n", event.Widget.WidgetId)
}
})
client.Run()
Index ¶
- Constants
- Variables
- func Color(name string) *pb.Color
- func ColorRGB(r, g, b int32) *pb.Color
- func HexColor(hex string) *pb.Color
- func IndexColor(index int) *pb.Color
- func NamedColor(name string) *pb.Color
- func NewTableCell(text string) *pb.TableCell
- func NewTableCellWithColor(text string, color *pb.Color) *pb.TableCell
- func NewTreeNode(text string) *pb.TreeNode
- func RGBColor(r, g, b int) *pb.Color
- func TreeNodeWithColor(text string, color *pb.Color) *pb.TreeNode
- func TreeNodeWithOptions(text string, color *pb.Color, selectable, expanded bool, reference string) *pb.TreeNode
- type BackoffStrategy
- type Box
- type BoxBuilder
- type Button
- func (w *Button) Delete() error
- func (btn *Button) GetLabel() (string, error)
- func (w *Button) GetProperties() (*pb.WidgetProperties, error)
- func (w *Button) ID() string
- func (w *Button) SetBorder(border bool) error
- func (w *Button) SetFocus() error
- func (btn *Button) SetLabel(label string) error
- func (w *Button) SetTitle(title string) error
- type ButtonBuilder
- func (b *ButtonBuilder) ActivatedColor(color *pb.Color) *ButtonBuilder
- func (b *ButtonBuilder) BackgroundColor(color *pb.Color) *ButtonBuilder
- func (b *ButtonBuilder) Border(border bool) *ButtonBuilder
- func (b *ButtonBuilder) Build() (*Button, error)
- func (b *ButtonBuilder) Label(label string) *ButtonBuilder
- func (b *ButtonBuilder) LabelColor(color *pb.Color) *ButtonBuilder
- func (b *ButtonBuilder) Title(title string) *ButtonBuilder
- type Checkbox
- func (w *Checkbox) Delete() error
- func (cb *Checkbox) GetLabel() (string, error)
- func (w *Checkbox) GetProperties() (*pb.WidgetProperties, error)
- func (w *Checkbox) ID() string
- func (cb *Checkbox) IsChecked() (bool, error)
- func (w *Checkbox) SetBorder(border bool) error
- func (cb *Checkbox) SetChecked(checked bool) error
- func (w *Checkbox) SetFocus() error
- func (cb *Checkbox) SetLabel(label string) error
- func (w *Checkbox) SetTitle(title string) error
- type CheckboxBuilder
- func (b *CheckboxBuilder) Border(border bool) *CheckboxBuilder
- func (b *CheckboxBuilder) Build() (*Checkbox, error)
- func (b *CheckboxBuilder) Checked(checked bool) *CheckboxBuilder
- func (b *CheckboxBuilder) CheckedColor(color *pb.Color) *CheckboxBuilder
- func (b *CheckboxBuilder) Label(label string) *CheckboxBuilder
- func (b *CheckboxBuilder) LabelColor(color *pb.Color) *CheckboxBuilder
- func (b *CheckboxBuilder) Title(title string) *CheckboxBuilder
- type Client
- func Connect(address string) (*Client, error)
- func ConnectWithConn(conn *grpc.ClientConn) (*Client, error)
- func ConnectWithOptions(address string, opts ...grpc.DialOption) (*Client, error)
- func ConnectWithRetry(address string, opts RetryOptions) (*Client, error)
- func ConnectWithRetryAndOptions(address string, retryOpts RetryOptions, grpcOpts ...grpc.DialOption) (*Client, error)
- func (c *Client) AddEventMiddleware(middleware EventMiddleware)
- func (c *Client) ClearScreen() error
- func (c *Client) Close() error
- func (c *Client) Context() context.Context
- func (c *Client) EnableEventRecording(maxEvents int)
- func (c *Client) GetConnectionState() ConnectionState
- func (c *Client) GetEventRecorder() *EventRecorder
- func (c *Client) GetScreenSize() (width, height int, err error)
- func (c *Client) GetWidget(widgetID string) (Widget, bool)
- func (c *Client) IsConnected() bool
- func (c *Client) IsHealthy() bool
- func (c *Client) NewBox() *BoxBuilder
- func (c *Client) NewButton() *ButtonBuilder
- func (c *Client) NewCheckbox() *CheckboxBuilder
- func (c *Client) NewDropdown() *DropdownBuilder
- func (c *Client) NewFlex() *FlexBuilder
- func (c *Client) NewForm() *FormBuilder
- func (c *Client) NewGrid() *GridBuilder
- func (c *Client) NewImage() *ImageBuilder
- func (c *Client) NewInputField() *InputFieldBuilder
- func (c *Client) NewList() *ListBuilder
- func (c *Client) NewMenu() *MenuBuilder
- func (c *Client) NewMenuBar() *MenuBarBuilder
- func (c *Client) NewMenuItem() *MenuItemBuilder
- func (c *Client) NewModal() *ModalBuilder
- func (c *Client) NewPages() *PagesBuilder
- func (c *Client) NewProgressBar() *ProgressBarBuilder
- func (c *Client) NewTable() *TableBuilder
- func (c *Client) NewTextArea() *TextAreaBuilder
- func (c *Client) NewTextView() *TextViewBuilder
- func (c *Client) NewTreeView() *TreeViewBuilder
- func (c *Client) NewWindow() *WindowBuilder
- func (c *Client) NewWindowManager() *WindowManagerBuilder
- func (c *Client) OnConnectionStateChange(callback ConnectionStateCallback)
- func (c *Client) OnEvent(handler EventHandler)
- func (c *Client) OnEventFiltered(handler EventHandler, filter *EventFilter)
- func (c *Client) OnEventType(eventType EventType, handler EventHandler)
- func (c *Client) OnWidgetEvent(widgetID string, handler EventHandler)
- func (c *Client) Reconnect() error
- func (c *Client) SessionID() *pb.SessionId
- func (c *Client) SetRoot(widget Widget) error
- func (c *Client) SetServerEventFilter(filter *pb.EventFilter) error
- func (c *Client) SetServerEventFilterSimple(key, mouse, resize, focus, widget bool) error
- func (c *Client) SetServerWidgetFilter(widgetIDs []string) error
- func (c *Client) StartEventStream() error
- func (c *Client) StartHealthCheck(interval time.Duration)
- func (c *Client) StopHealthCheck()
- func (c *Client) Sync() error
- type ConnectionState
- type ConnectionStateCallback
- type CursorPosition
- type Dropdown
- func (w *Dropdown) Delete() error
- func (dd *Dropdown) GetLabel() (string, error)
- func (dd *Dropdown) GetOptions() ([]string, error)
- func (w *Dropdown) GetProperties() (*pb.WidgetProperties, error)
- func (dd *Dropdown) GetSelectedIndex() (int, error)
- func (dd *Dropdown) GetSelectedText() (string, error)
- func (w *Dropdown) ID() string
- func (w *Dropdown) SetBorder(border bool) error
- func (w *Dropdown) SetFocus() error
- func (dd *Dropdown) SetLabel(label string) error
- func (dd *Dropdown) SetOptions(options []string) error
- func (dd *Dropdown) SetSelectedIndex(index int) error
- func (w *Dropdown) SetTitle(title string) error
- type DropdownBuilder
- func (b *DropdownBuilder) Border(border bool) *DropdownBuilder
- func (b *DropdownBuilder) Build() (*Dropdown, error)
- func (b *DropdownBuilder) FieldBackgroundColor(color *pb.Color) *DropdownBuilder
- func (b *DropdownBuilder) FieldTextColor(color *pb.Color) *DropdownBuilder
- func (b *DropdownBuilder) FieldWidth(width int) *DropdownBuilder
- func (b *DropdownBuilder) Label(label string) *DropdownBuilder
- func (b *DropdownBuilder) LabelColor(color *pb.Color) *DropdownBuilder
- func (b *DropdownBuilder) Options(options []string) *DropdownBuilder
- func (b *DropdownBuilder) SelectedIndex(index int) *DropdownBuilder
- func (b *DropdownBuilder) Title(title string) *DropdownBuilder
- type Event
- type EventBatcher
- type EventFilter
- type EventHandler
- type EventMiddleware
- type EventRecorder
- func (r *EventRecorder) Clear()
- func (r *EventRecorder) GetEvents() []*RecordedEvent
- func (r *EventRecorder) GetEventsSince(since time.Time) []*RecordedEvent
- func (r *EventRecorder) IsRecording() bool
- func (r *EventRecorder) Record(event *Event)
- func (r *EventRecorder) Replay(handler EventHandler, realtime bool)
- func (r *EventRecorder) Start()
- func (r *EventRecorder) Stop()
- type EventType
- type Flex
- func (f *Flex) AddItem(widget Widget, proportion, fixedSize int, focus bool) error
- func (w *Flex) Delete() error
- func (w *Flex) GetProperties() (*pb.WidgetProperties, error)
- func (w *Flex) ID() string
- func (f *Flex) RemoveItem(widget Widget) error
- func (w *Flex) SetBorder(border bool) error
- func (f *Flex) SetDirection(direction pb.FlexDirection) error
- func (w *Flex) SetFocus() error
- func (w *Flex) SetTitle(title string) error
- type FlexBuilder
- type FocusEvent
- type Form
- func (f *Form) AddButton(label string) error
- func (f *Form) AddCheckbox(label string, initialValue bool) (int, error)
- func (f *Form) AddDropdown(label string, options []string, initialValue string) (int, error)
- func (f *Form) AddInputField(label string, fieldWidth int, initialValue string) (int, error)
- func (f *Form) AddPasswordField(label string, fieldWidth int) (int, error)
- func (f *Form) Clear() error
- func (w *Form) Delete() error
- func (f *Form) GetFieldValue(fieldIndex int) (string, error)
- func (f *Form) GetItemCount() (int, error)
- func (w *Form) GetProperties() (*pb.WidgetProperties, error)
- func (w *Form) ID() string
- func (w *Form) SetBorder(border bool) error
- func (f *Form) SetFieldValue(fieldIndex int, value string) error
- func (w *Form) SetFocus() error
- func (w *Form) SetTitle(title string) error
- type FormBuilder
- type Grid
- func (g *Grid) AddItem(widget Widget, row, column, rowSpan, columnSpan, minWidth, minHeight int, ...) error
- func (w *Grid) Delete() error
- func (w *Grid) GetProperties() (*pb.WidgetProperties, error)
- func (w *Grid) ID() string
- func (g *Grid) RemoveItem(widget Widget) error
- func (w *Grid) SetBorder(border bool) error
- func (g *Grid) SetColumns(columnSizes []int32) error
- func (w *Grid) SetFocus() error
- func (g *Grid) SetRows(rowSizes []int32) error
- func (w *Grid) SetTitle(title string) error
- type GridBuilder
- func (b *GridBuilder) Border(border bool) *GridBuilder
- func (b *GridBuilder) Build() (*Grid, error)
- func (b *GridBuilder) Columns(columns int) *GridBuilder
- func (b *GridBuilder) MinHeight(height int) *GridBuilder
- func (b *GridBuilder) MinWidth(width int) *GridBuilder
- func (b *GridBuilder) Rows(rows int) *GridBuilder
- func (b *GridBuilder) Title(title string) *GridBuilder
- type Image
- func (w *Image) Delete() error
- func (img *Image) GetColors() (int, error)
- func (w *Image) GetProperties() (*pb.WidgetProperties, error)
- func (w *Image) ID() string
- func (w *Image) SetBorder(border bool) error
- func (img *Image) SetColors(colors int) error
- func (img *Image) SetDithering(enabled bool) error
- func (w *Image) SetFocus() error
- func (img *Image) SetImageData(data []byte) error
- func (w *Image) SetTitle(title string) error
- type ImageBuilder
- func (b *ImageBuilder) AspectRatio(ratio pb.ImageAspectRatio) *ImageBuilder
- func (b *ImageBuilder) Border(border bool) *ImageBuilder
- func (b *ImageBuilder) Build() (*Image, error)
- func (b *ImageBuilder) Colors(colors int) *ImageBuilder
- func (b *ImageBuilder) Dithering(enabled bool) *ImageBuilder
- func (b *ImageBuilder) ImageData(data []byte) *ImageBuilder
- func (b *ImageBuilder) ImagePath(path string) *ImageBuilder
- func (b *ImageBuilder) Title(title string) *ImageBuilder
- type InputField
- func (w *InputField) Delete() error
- func (i *InputField) GetLabel() (string, error)
- func (w *InputField) GetProperties() (*pb.WidgetProperties, error)
- func (i *InputField) GetText() (string, error)
- func (w *InputField) ID() string
- func (w *InputField) SetBorder(border bool) error
- func (w *InputField) SetFocus() error
- func (i *InputField) SetLabel(label string) error
- func (i *InputField) SetText(text string) error
- func (w *InputField) SetTitle(title string) error
- type InputFieldBuilder
- func (b *InputFieldBuilder) Border(border bool) *InputFieldBuilder
- func (b *InputFieldBuilder) Build() (*InputField, error)
- func (b *InputFieldBuilder) FieldBackgroundColor(color *pb.Color) *InputFieldBuilder
- func (b *InputFieldBuilder) FieldTextColor(color *pb.Color) *InputFieldBuilder
- func (b *InputFieldBuilder) FieldWidth(width int) *InputFieldBuilder
- func (b *InputFieldBuilder) Label(label string) *InputFieldBuilder
- func (b *InputFieldBuilder) LabelColor(color *pb.Color) *InputFieldBuilder
- func (b *InputFieldBuilder) Masked(masked bool) *InputFieldBuilder
- func (b *InputFieldBuilder) Placeholder(placeholder string) *InputFieldBuilder
- func (b *InputFieldBuilder) Text(text string) *InputFieldBuilder
- func (b *InputFieldBuilder) Title(title string) *InputFieldBuilder
- type KeyEvent
- type List
- func (l *List) AddItem(mainText, secondaryText string, shortcut *string) (int, error)
- func (l *List) Clear() error
- func (w *List) Delete() error
- func (l *List) GetItem(index int) (mainText, secondaryText, shortcut string, err error)
- func (l *List) GetItemCount() (int, error)
- func (w *List) GetProperties() (*pb.WidgetProperties, error)
- func (l *List) GetSelection() (int, error)
- func (w *List) ID() string
- func (l *List) RemoveItem(index int) error
- func (w *List) SetBorder(border bool) error
- func (w *List) SetFocus() error
- func (l *List) SetSelection(index int) error
- func (w *List) SetTitle(title string) error
- type ListBuilder
- func (b *ListBuilder) BackgroundColor(color *pb.Color) *ListBuilder
- func (b *ListBuilder) Border(border bool) *ListBuilder
- func (b *ListBuilder) BorderColor(color *pb.Color) *ListBuilder
- func (b *ListBuilder) Build() (*List, error)
- func (b *ListBuilder) Title(title string) *ListBuilder
- func (b *ListBuilder) TitleColor(color *pb.Color) *ListBuilder
- type Menu
- func (m *Menu) AddItem(item *MenuItem) error
- func (w *Menu) Delete() error
- func (w *Menu) GetProperties() (*pb.WidgetProperties, error)
- func (w *Menu) ID() string
- func (m *Menu) RemoveItem(item *MenuItem) error
- func (w *Menu) SetBorder(border bool) error
- func (w *Menu) SetFocus() error
- func (w *Menu) SetTitle(title string) error
- type MenuBar
- func (mb *MenuBar) AddMenu(menu *Menu) error
- func (w *MenuBar) Delete() error
- func (w *MenuBar) GetProperties() (*pb.WidgetProperties, error)
- func (w *MenuBar) ID() string
- func (w *MenuBar) SetBorder(border bool) error
- func (w *MenuBar) SetFocus() error
- func (w *MenuBar) SetTitle(title string) error
- type MenuBarBuilder
- func (b *MenuBarBuilder) ActiveBackgroundColor(color *pb.Color) *MenuBarBuilder
- func (b *MenuBarBuilder) ActiveTextColor(color *pb.Color) *MenuBarBuilder
- func (b *MenuBarBuilder) BackgroundColor(color *pb.Color) *MenuBarBuilder
- func (b *MenuBarBuilder) Build() (*MenuBar, error)
- func (b *MenuBarBuilder) TextColor(color *pb.Color) *MenuBarBuilder
- func (b *MenuBarBuilder) Title(title string) *MenuBarBuilder
- type MenuBuilder
- type MenuItem
- type MenuItemBuilder
- func (b *MenuItemBuilder) Build() (*MenuItem, error)
- func (b *MenuItemBuilder) Disabled() *MenuItemBuilder
- func (b *MenuItemBuilder) Label(label string) *MenuItemBuilder
- func (b *MenuItemBuilder) Separator() *MenuItemBuilder
- func (b *MenuItemBuilder) ShortcutDisplay(shortcut string) *MenuItemBuilder
- type Modal
- func (w *Modal) Delete() error
- func (m *Modal) GetButtons() ([]string, error)
- func (w *Modal) GetProperties() (*pb.WidgetProperties, error)
- func (m *Modal) GetText() (string, error)
- func (w *Modal) ID() string
- func (w *Modal) SetBorder(border bool) error
- func (m *Modal) SetButtons(buttons ...string) error
- func (w *Modal) SetFocus() error
- func (m *Modal) SetText(text string) error
- func (w *Modal) SetTitle(title string) error
- type ModalBuilder
- func (b *ModalBuilder) BackgroundColor(color *pb.Color) *ModalBuilder
- func (b *ModalBuilder) Border(border bool) *ModalBuilder
- func (b *ModalBuilder) Build() (*Modal, error)
- func (b *ModalBuilder) ButtonBackgroundColor(color *pb.Color) *ModalBuilder
- func (b *ModalBuilder) ButtonTextColor(color *pb.Color) *ModalBuilder
- func (b *ModalBuilder) Buttons(buttons ...string) *ModalBuilder
- func (b *ModalBuilder) Text(text string) *ModalBuilder
- func (b *ModalBuilder) TextColor(color *pb.Color) *ModalBuilder
- func (b *ModalBuilder) Title(title string) *ModalBuilder
- type MouseEvent
- type Pages
- func (p *Pages) AddPage(pageName string, widget Widget, resize, visible bool) error
- func (w *Pages) Delete() error
- func (p *Pages) GetCurrentPage() (string, error)
- func (w *Pages) GetProperties() (*pb.WidgetProperties, error)
- func (w *Pages) ID() string
- func (p *Pages) RemovePage(pageName string) error
- func (w *Pages) SetBorder(border bool) error
- func (w *Pages) SetFocus() error
- func (w *Pages) SetTitle(title string) error
- func (p *Pages) ShowPage(pageName string) error
- type PagesBuilder
- type ProgressBar
- func (w *ProgressBar) Delete() error
- func (pbar *ProgressBar) GetLabel() (string, error)
- func (pbar *ProgressBar) GetMax() (int, error)
- func (pbar *ProgressBar) GetProgress() (int, error)
- func (w *ProgressBar) GetProperties() (*pb.WidgetProperties, error)
- func (w *ProgressBar) ID() string
- func (w *ProgressBar) SetBorder(border bool) error
- func (w *ProgressBar) SetFocus() error
- func (pbar *ProgressBar) SetLabel(label string) error
- func (pbar *ProgressBar) SetMax(max int) error
- func (pbar *ProgressBar) SetProgress(progress int) error
- func (pbar *ProgressBar) SetShowPercentage(show bool) error
- func (w *ProgressBar) SetTitle(title string) error
- type ProgressBarBuilder
- func (b *ProgressBarBuilder) Border(border bool) *ProgressBarBuilder
- func (b *ProgressBarBuilder) Build() (*ProgressBar, error)
- func (b *ProgressBarBuilder) EmptyChar(char string) *ProgressBarBuilder
- func (b *ProgressBarBuilder) EmptyColor(color *pb.Color) *ProgressBarBuilder
- func (b *ProgressBarBuilder) FilledChar(char string) *ProgressBarBuilder
- func (b *ProgressBarBuilder) FilledColor(color *pb.Color) *ProgressBarBuilder
- func (b *ProgressBarBuilder) Label(label string) *ProgressBarBuilder
- func (b *ProgressBarBuilder) Max(max int) *ProgressBarBuilder
- func (b *ProgressBarBuilder) Progress(progress int) *ProgressBarBuilder
- func (b *ProgressBarBuilder) ShowPercentage(show bool) *ProgressBarBuilder
- func (b *ProgressBarBuilder) Title(title string) *ProgressBarBuilder
- type RecordedEvent
- type ResizeEvent
- type RetryOptions
- type Selection
- type Table
- func (t *Table) Clear() error
- func (w *Table) Delete() error
- func (t *Table) GetCell(row, column int) (*pb.TableCell, error)
- func (t *Table) GetDimensions() (rows, columns int, err error)
- func (w *Table) GetProperties() (*pb.WidgetProperties, error)
- func (t *Table) GetSelection() (row, column int, err error)
- func (w *Table) ID() string
- func (w *Table) SetBorder(border bool) error
- func (t *Table) SetCell(row, column int, cell *pb.TableCell) error
- func (t *Table) SetCells(cells []*pb.TableCellUpdate) (int, error)
- func (t *Table) SetFixed(fixedRows, fixedColumns int) error
- func (w *Table) SetFocus() error
- func (t *Table) SetSelection(row, column int) error
- func (w *Table) SetTitle(title string) error
- type TableBuilder
- type TextArea
- func (w *TextArea) Delete() error
- func (ta *TextArea) GetCursorPosition() (*CursorPosition, error)
- func (ta *TextArea) GetPlaceholder() (string, error)
- func (w *TextArea) GetProperties() (*pb.WidgetProperties, error)
- func (ta *TextArea) GetSelectedText() (string, error)
- func (ta *TextArea) GetSelection() (*Selection, error)
- func (ta *TextArea) GetText() (string, error)
- func (ta *TextArea) HasSelection() (bool, error)
- func (w *TextArea) ID() string
- func (ta *TextArea) InsertTextAtCursor(text string) error
- func (w *TextArea) SetBorder(border bool) error
- func (ta *TextArea) SetCursorPosition(row, column int) error
- func (w *TextArea) SetFocus() error
- func (ta *TextArea) SetPlaceholder(placeholder string) error
- func (ta *TextArea) SetSelection(start, end int) error
- func (ta *TextArea) SetSuppressedKeys(keys []string) error
- func (ta *TextArea) SetText(text string) error
- func (w *TextArea) SetTitle(title string) error
- type TextAreaBuilder
- func (b *TextAreaBuilder) Border(border bool) *TextAreaBuilder
- func (b *TextAreaBuilder) Build() (*TextArea, error)
- func (b *TextAreaBuilder) MaxLength(maxLength int) *TextAreaBuilder
- func (b *TextAreaBuilder) Placeholder(placeholder string) *TextAreaBuilder
- func (b *TextAreaBuilder) PlaceholderColor(color *pb.Color) *TextAreaBuilder
- func (b *TextAreaBuilder) SuppressedKeys(keys ...string) *TextAreaBuilder
- func (b *TextAreaBuilder) Text(text string) *TextAreaBuilder
- func (b *TextAreaBuilder) TextColor(color *pb.Color) *TextAreaBuilder
- func (b *TextAreaBuilder) Title(title string) *TextAreaBuilder
- func (b *TextAreaBuilder) WordWrap(wrap bool) *TextAreaBuilder
- type TextView
- func (w *TextView) Delete() error
- func (w *TextView) GetProperties() (*pb.WidgetProperties, error)
- func (tv *TextView) GetText() (string, error)
- func (w *TextView) ID() string
- func (w *TextView) SetBorder(border bool) error
- func (w *TextView) SetFocus() error
- func (tv *TextView) SetText(text string) error
- func (w *TextView) SetTitle(title string) error
- type TextViewBuilder
- func (b *TextViewBuilder) Border(border bool) *TextViewBuilder
- func (b *TextViewBuilder) Build() (*TextView, error)
- func (b *TextViewBuilder) DynamicColors(enabled bool) *TextViewBuilder
- func (b *TextViewBuilder) Text(text string) *TextViewBuilder
- func (b *TextViewBuilder) Title(title string) *TextViewBuilder
- func (b *TextViewBuilder) WordWrap(wrap bool) *TextViewBuilder
- type Theme
- type TreeView
- func (tv *TreeView) AddChild(parentID *pb.TreeNodeId, node *pb.TreeNode) (*pb.TreeNodeId, error)
- func (w *TreeView) Delete() error
- func (tv *TreeView) GetChildren(nodeID *pb.TreeNodeId) ([]*pb.TreeNodeInfo, error)
- func (w *TreeView) GetProperties() (*pb.WidgetProperties, error)
- func (tv *TreeView) GetSelection() (*pb.TreeNodeId, string, string, error)
- func (w *TreeView) ID() string
- func (tv *TreeView) RemoveNode(nodeID *pb.TreeNodeId) error
- func (w *TreeView) SetBorder(border bool) error
- func (tv *TreeView) SetExpanded(nodeID *pb.TreeNodeId, expanded bool) error
- func (w *TreeView) SetFocus() error
- func (tv *TreeView) SetRoot(node *pb.TreeNode) (*pb.TreeNodeId, error)
- func (tv *TreeView) SetSelection(nodeID *pb.TreeNodeId) error
- func (w *TreeView) SetTitle(title string) error
- type TreeViewBuilder
- func (b *TreeViewBuilder) Border(border bool) *TreeViewBuilder
- func (b *TreeViewBuilder) Build() (*TreeView, error)
- func (b *TreeViewBuilder) NodeTextColor(color *pb.Color) *TreeViewBuilder
- func (b *TreeViewBuilder) SelectedBackgroundColor(color *pb.Color) *TreeViewBuilder
- func (b *TreeViewBuilder) SelectedTextColor(color *pb.Color) *TreeViewBuilder
- func (b *TreeViewBuilder) ShowGraphics(show bool) *TreeViewBuilder
- func (b *TreeViewBuilder) Title(title string) *TreeViewBuilder
- func (b *TreeViewBuilder) TopLevelPrefix(prefix string) *TreeViewBuilder
- type Widget
- type WidgetEvent
- type Window
- func (w *Window) Delete() error
- func (w *Window) GetProperties() (*pb.WidgetProperties, error)
- func (w *Window) GetState() (*pb.WindowGetStateResponse, error)
- func (w *Window) ID() string
- func (w *Window) Maximize() error
- func (w *Window) Minimize() error
- func (w *Window) Move(x, y int32) error
- func (w *Window) Resize(width, height int32) error
- func (w *Window) Restore() error
- func (w *Window) SetBorder(border bool) error
- func (w *Window) SetConstraints(constraints *pb.WindowConstraints) error
- func (w *Window) SetContent(child *baseWidget) error
- func (w *Window) SetFocus() error
- func (w *Window) SetTitle(title string) error
- type WindowBuilder
- func (b *WindowBuilder) ActiveBorderColor(color *pb.Color) *WindowBuilder
- func (b *WindowBuilder) Build() (*Window, error)
- func (b *WindowBuilder) Closable(v bool) *WindowBuilder
- func (b *WindowBuilder) InactiveBorderColor(color *pb.Color) *WindowBuilder
- func (b *WindowBuilder) MaxSize(width, height int32) *WindowBuilder
- func (b *WindowBuilder) Maximizable(v bool) *WindowBuilder
- func (b *WindowBuilder) MinSize(width, height int32) *WindowBuilder
- func (b *WindowBuilder) Minimizable(v bool) *WindowBuilder
- func (b *WindowBuilder) Movable(v bool) *WindowBuilder
- func (b *WindowBuilder) Rect(x, y, width, height int32) *WindowBuilder
- func (b *WindowBuilder) Resizable(v bool) *WindowBuilder
- func (b *WindowBuilder) Title(title string) *WindowBuilder
- func (b *WindowBuilder) TitleBarColor(color *pb.Color) *WindowBuilder
- func (b *WindowBuilder) TitleBarTextColor(color *pb.Color) *WindowBuilder
- type WindowManager
- func (wm *WindowManager) AddWindow(win *Window) error
- func (wm *WindowManager) BringToFront(win *Window) error
- func (w *WindowManager) Delete() error
- func (w *WindowManager) GetProperties() (*pb.WidgetProperties, error)
- func (wm *WindowManager) GetZOrder() ([]string, error)
- func (w *WindowManager) ID() string
- func (wm *WindowManager) RemoveWindow(win *Window) error
- func (wm *WindowManager) SendToBack(win *Window) error
- func (w *WindowManager) SetBorder(border bool) error
- func (w *WindowManager) SetFocus() error
- func (w *WindowManager) SetTitle(title string) error
- type WindowManagerBuilder
Constants ¶
const ( WidgetEventSelected = "WIDGET_SELECTED" WidgetEventChanged = "WIDGET_CHANGED" WidgetEventSubmitted = "WIDGET_SUBMITTED" WidgetEventCancelled = "WIDGET_CANCELLED" WidgetEventDone = "WIDGET_DONE" WidgetEventWindowMoved = "WIDGET_WINDOW_MOVED" WidgetEventWindowResized = "WIDGET_WINDOW_RESIZED" WidgetEventWindowStateChanged = "WIDGET_WINDOW_STATE_CHANGED" WidgetEventWindowClosed = "WIDGET_WINDOW_CLOSED" WidgetEventWindowActivated = "WIDGET_WINDOW_ACTIVATED" )
Widget event type string constants for convenience.
Variables ¶
var DefaultTheme = &Theme{ PrimaryColor: NamedColor("blue"), SecondaryColor: NamedColor("cyan"), BackgroundColor: NamedColor("black"), SurfaceColor: IndexColor(235), TextColor: NamedColor("white"), TextSecondaryColor: NamedColor("gray"), TextDisabledColor: IndexColor(242), ButtonColor: NamedColor("blue"), ButtonTextColor: NamedColor("white"), InputBackground: IndexColor(236), InputText: NamedColor("white"), SuccessColor: NamedColor("green"), WarningColor: NamedColor("yellow"), ErrorColor: NamedColor("red"), InfoColor: NamedColor("blue"), BorderColor: NamedColor("white"), DividerColor: IndexColor(238), SelectionColor: NamedColor("blue"), HighlightColor: NamedColor("yellow"), }
DefaultTheme provides a standard dark theme.
var ForestTheme = &Theme{ PrimaryColor: HexColor("#2E7D32"), SecondaryColor: HexColor("#558B2F"), BackgroundColor: HexColor("#1B2B1B"), SurfaceColor: HexColor("#2A3D2A"), TextColor: HexColor("#E8F5E9"), TextSecondaryColor: HexColor("#A5D6A7"), TextDisabledColor: HexColor("#4CAF50"), ButtonColor: HexColor("#2E7D32"), ButtonTextColor: NamedColor("white"), InputBackground: HexColor("#2A3D2A"), InputText: HexColor("#E8F5E9"), SuccessColor: HexColor("#66BB6A"), WarningColor: HexColor("#FFCA28"), ErrorColor: HexColor("#EF5350"), InfoColor: HexColor("#42A5F5"), BorderColor: HexColor("#388E3C"), DividerColor: HexColor("#1B5E20"), SelectionColor: HexColor("#2E7D32"), HighlightColor: HexColor("#FFCA28"), }
ForestTheme provides a green nature theme.
var LightTheme = &Theme{ PrimaryColor: HexColor("#1976D2"), SecondaryColor: HexColor("#00796B"), BackgroundColor: NamedColor("white"), SurfaceColor: IndexColor(255), TextColor: NamedColor("black"), TextSecondaryColor: IndexColor(240), TextDisabledColor: IndexColor(245), ButtonColor: HexColor("#1976D2"), ButtonTextColor: NamedColor("white"), InputBackground: IndexColor(254), InputText: NamedColor("black"), SuccessColor: HexColor("#388E3C"), WarningColor: HexColor("#F57C00"), ErrorColor: HexColor("#D32F2F"), InfoColor: HexColor("#1976D2"), BorderColor: IndexColor(240), DividerColor: IndexColor(250), SelectionColor: HexColor("#1976D2"), HighlightColor: HexColor("#FFC107"), }
LightTheme provides a light color scheme.
var MonochromeTheme = &Theme{ PrimaryColor: NamedColor("white"), SecondaryColor: NamedColor("gray"), BackgroundColor: NamedColor("black"), SurfaceColor: NamedColor("black"), TextColor: NamedColor("white"), TextSecondaryColor: NamedColor("gray"), TextDisabledColor: NamedColor("darkgray"), ButtonColor: NamedColor("white"), ButtonTextColor: NamedColor("black"), InputBackground: NamedColor("black"), InputText: NamedColor("white"), SuccessColor: NamedColor("white"), WarningColor: NamedColor("white"), ErrorColor: NamedColor("white"), InfoColor: NamedColor("white"), BorderColor: NamedColor("white"), DividerColor: NamedColor("gray"), SelectionColor: NamedColor("white"), HighlightColor: NamedColor("white"), }
MonochromeTheme provides a black and white theme.
var OceanTheme = &Theme{ PrimaryColor: HexColor("#0288D1"), SecondaryColor: HexColor("#00ACC1"), BackgroundColor: HexColor("#0D1B2A"), SurfaceColor: HexColor("#1B2838"), TextColor: HexColor("#E0E0E0"), TextSecondaryColor: HexColor("#90A4AE"), TextDisabledColor: HexColor("#546E7A"), ButtonColor: HexColor("#0288D1"), ButtonTextColor: NamedColor("white"), InputBackground: HexColor("#1B2838"), InputText: HexColor("#E0E0E0"), SuccessColor: HexColor("#00C853"), WarningColor: HexColor("#FFB300"), ErrorColor: HexColor("#FF5252"), InfoColor: HexColor("#29B6F6"), BorderColor: HexColor("#37474F"), DividerColor: HexColor("#263238"), SelectionColor: HexColor("#0288D1"), HighlightColor: HexColor("#FFB300"), }
OceanTheme provides a cool blue theme.
var SunsetTheme = &Theme{ PrimaryColor: HexColor("#E65100"), SecondaryColor: HexColor("#FF6D00"), BackgroundColor: HexColor("#1A0F0A"), SurfaceColor: HexColor("#2D1810"), TextColor: HexColor("#FFF3E0"), TextSecondaryColor: HexColor("#FFCC80"), TextDisabledColor: HexColor("#A1887F"), ButtonColor: HexColor("#E65100"), ButtonTextColor: NamedColor("white"), InputBackground: HexColor("#2D1810"), InputText: HexColor("#FFF3E0"), SuccessColor: HexColor("#66BB6A"), WarningColor: HexColor("#FFA726"), ErrorColor: HexColor("#EF5350"), InfoColor: HexColor("#42A5F5"), BorderColor: HexColor("#BF360C"), DividerColor: HexColor("#3E2723"), SelectionColor: HexColor("#E65100"), HighlightColor: HexColor("#FFD54F"), }
SunsetTheme provides a warm orange/red theme.
Functions ¶
func IndexColor ¶
IndexColor creates a color from a 256-color palette index.
func NamedColor ¶
NamedColor creates a color from a named color string.
func NewTableCell ¶
NewTableCell creates a new table cell with text.
func NewTableCellWithColor ¶
NewTableCellWithColor creates a new table cell with text and color.
func NewTreeNode ¶
NewTreeNode creates a new tree node with the given text.
func TreeNodeWithColor ¶
TreeNodeWithColor creates a new tree node with text and color.
Types ¶
type BackoffStrategy ¶
type BackoffStrategy int
BackoffStrategy defines how to calculate retry delays.
const ( // ConstantBackoff uses a constant delay between retries. ConstantBackoff BackoffStrategy = iota // LinearBackoff increases delay linearly with each retry. LinearBackoff // ExponentialBackoff doubles delay with each retry. ExponentialBackoff )
type Box ¶
type Box struct {
// contains filtered or unexported fields
}
Box represents a box widget.
func (*Box) GetProperties ¶
func (w *Box) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
type BoxBuilder ¶
type BoxBuilder struct {
// contains filtered or unexported fields
}
BoxBuilder provides a fluent interface for creating box widgets.
func (*BoxBuilder) BackgroundColor ¶
func (b *BoxBuilder) BackgroundColor(color *pb.Color) *BoxBuilder
BackgroundColor sets the background color.
func (*BoxBuilder) Border ¶
func (b *BoxBuilder) Border(border bool) *BoxBuilder
Border sets whether the box has a border.
func (*BoxBuilder) Build ¶
func (b *BoxBuilder) Build() (*Box, error)
Build creates the box widget on the server.
func (*BoxBuilder) Title ¶
func (b *BoxBuilder) Title(title string) *BoxBuilder
Title sets the box title.
type Button ¶
type Button struct {
// contains filtered or unexported fields
}
Button represents a button widget.
func (*Button) GetProperties ¶
func (w *Button) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
type ButtonBuilder ¶
type ButtonBuilder struct {
// contains filtered or unexported fields
}
ButtonBuilder provides a fluent interface for creating button widgets.
func (*ButtonBuilder) ActivatedColor ¶
func (b *ButtonBuilder) ActivatedColor(color *pb.Color) *ButtonBuilder
ActivatedColor sets the button color when activated.
func (*ButtonBuilder) BackgroundColor ¶
func (b *ButtonBuilder) BackgroundColor(color *pb.Color) *ButtonBuilder
BackgroundColor sets the button background color.
func (*ButtonBuilder) Border ¶
func (b *ButtonBuilder) Border(border bool) *ButtonBuilder
Border sets whether the button has a border.
func (*ButtonBuilder) Build ¶
func (b *ButtonBuilder) Build() (*Button, error)
Build creates the button widget on the server.
func (*ButtonBuilder) Label ¶
func (b *ButtonBuilder) Label(label string) *ButtonBuilder
Label sets the button label text.
func (*ButtonBuilder) LabelColor ¶
func (b *ButtonBuilder) LabelColor(color *pb.Color) *ButtonBuilder
LabelColor sets the button label color.
func (*ButtonBuilder) Title ¶
func (b *ButtonBuilder) Title(title string) *ButtonBuilder
Title sets the button's title (border title).
type Checkbox ¶
type Checkbox struct {
// contains filtered or unexported fields
}
Checkbox represents a checkbox widget.
func (*Checkbox) Delete ¶
func (w *Checkbox) Delete() error
Delete removes the widget from the server.
func (*Checkbox) GetProperties ¶
func (w *Checkbox) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*Checkbox) SetChecked ¶
SetChecked sets the checkbox checked state.
type CheckboxBuilder ¶
type CheckboxBuilder struct {
// contains filtered or unexported fields
}
CheckboxBuilder provides a fluent interface for creating checkbox widgets.
func (*CheckboxBuilder) Border ¶
func (b *CheckboxBuilder) Border(border bool) *CheckboxBuilder
Border sets whether the checkbox has a border.
func (*CheckboxBuilder) Build ¶
func (b *CheckboxBuilder) Build() (*Checkbox, error)
Build creates the checkbox widget on the server.
func (*CheckboxBuilder) Checked ¶
func (b *CheckboxBuilder) Checked(checked bool) *CheckboxBuilder
Checked sets the initial checked state.
func (*CheckboxBuilder) CheckedColor ¶
func (b *CheckboxBuilder) CheckedColor(color *pb.Color) *CheckboxBuilder
CheckedColor sets the checkbox color when checked.
func (*CheckboxBuilder) Label ¶
func (b *CheckboxBuilder) Label(label string) *CheckboxBuilder
Label sets the checkbox label text.
func (*CheckboxBuilder) LabelColor ¶
func (b *CheckboxBuilder) LabelColor(color *pb.Color) *CheckboxBuilder
LabelColor sets the checkbox label color.
func (*CheckboxBuilder) Title ¶
func (b *CheckboxBuilder) Title(title string) *CheckboxBuilder
Title sets the checkbox's title (border title).
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a connection to the Yutani server.
func ConnectWithConn ¶
func ConnectWithConn(conn *grpc.ClientConn) (*Client, error)
ConnectWithConn creates a new client using an existing gRPC connection. This is useful for testing with a test server.
func ConnectWithOptions ¶
func ConnectWithOptions(address string, opts ...grpc.DialOption) (*Client, error)
ConnectWithOptions creates a new client connection with custom gRPC dial options.
func ConnectWithRetry ¶
func ConnectWithRetry(address string, opts RetryOptions) (*Client, error)
ConnectWithRetry creates a client connection with automatic retry.
func ConnectWithRetryAndOptions ¶
func ConnectWithRetryAndOptions(address string, retryOpts RetryOptions, grpcOpts ...grpc.DialOption) (*Client, error)
ConnectWithRetryAndOptions creates a client connection with retry and custom gRPC options.
func (*Client) AddEventMiddleware ¶
func (c *Client) AddEventMiddleware(middleware EventMiddleware)
AddEventMiddleware adds middleware to the event processing pipeline.
func (*Client) EnableEventRecording ¶
EnableEventRecording enables event recording with the specified max events.
func (*Client) GetConnectionState ¶
func (c *Client) GetConnectionState() ConnectionState
GetConnectionState returns the current connection state.
func (*Client) GetEventRecorder ¶
func (c *Client) GetEventRecorder() *EventRecorder
GetEventRecorder returns the event recorder if enabled.
func (*Client) GetScreenSize ¶
GetScreenSize returns the current screen dimensions.
func (*Client) IsConnected ¶
IsConnected returns true if the client is connected.
func (*Client) NewButton ¶
func (c *Client) NewButton() *ButtonBuilder
NewButton creates a new button builder.
func (*Client) NewCheckbox ¶
func (c *Client) NewCheckbox() *CheckboxBuilder
NewCheckbox creates a new checkbox builder.
func (*Client) NewDropdown ¶
func (c *Client) NewDropdown() *DropdownBuilder
NewDropdown creates a new dropdown builder.
func (*Client) NewFlex ¶
func (c *Client) NewFlex() *FlexBuilder
NewFlex creates a new flex builder.
func (*Client) NewForm ¶
func (c *Client) NewForm() *FormBuilder
NewForm creates a new form builder.
func (*Client) NewGrid ¶
func (c *Client) NewGrid() *GridBuilder
NewGrid creates a new grid builder.
func (*Client) NewImage ¶
func (c *Client) NewImage() *ImageBuilder
NewImage creates a new image builder.
func (*Client) NewInputField ¶
func (c *Client) NewInputField() *InputFieldBuilder
NewInputField creates a new input field builder.
func (*Client) NewList ¶
func (c *Client) NewList() *ListBuilder
NewList creates a new list builder.
func (*Client) NewMenu ¶
func (c *Client) NewMenu() *MenuBuilder
NewMenu creates a new menu builder.
func (*Client) NewMenuBar ¶
func (c *Client) NewMenuBar() *MenuBarBuilder
NewMenuBar creates a new menu bar builder.
func (*Client) NewMenuItem ¶
func (c *Client) NewMenuItem() *MenuItemBuilder
NewMenuItem creates a new menu item builder.
func (*Client) NewModal ¶
func (c *Client) NewModal() *ModalBuilder
NewModal creates a new modal builder.
func (*Client) NewPages ¶
func (c *Client) NewPages() *PagesBuilder
NewPages creates a new pages builder.
func (*Client) NewProgressBar ¶
func (c *Client) NewProgressBar() *ProgressBarBuilder
NewProgressBar creates a new progress bar builder.
func (*Client) NewTable ¶
func (c *Client) NewTable() *TableBuilder
NewTable creates a new table builder.
func (*Client) NewTextArea ¶
func (c *Client) NewTextArea() *TextAreaBuilder
NewTextArea creates a new text area builder.
func (*Client) NewTextView ¶
func (c *Client) NewTextView() *TextViewBuilder
NewTextView creates a new text view builder.
func (*Client) NewTreeView ¶
func (c *Client) NewTreeView() *TreeViewBuilder
NewTreeView creates a new tree view builder.
func (*Client) NewWindow ¶
func (c *Client) NewWindow() *WindowBuilder
NewWindow creates a new window builder.
func (*Client) NewWindowManager ¶
func (c *Client) NewWindowManager() *WindowManagerBuilder
NewWindowManager creates a new window manager builder.
func (*Client) OnConnectionStateChange ¶
func (c *Client) OnConnectionStateChange(callback ConnectionStateCallback)
OnConnectionStateChange registers a callback for connection state changes.
func (*Client) OnEvent ¶
func (c *Client) OnEvent(handler EventHandler)
OnEvent registers an event handler.
func (*Client) OnEventFiltered ¶
func (c *Client) OnEventFiltered(handler EventHandler, filter *EventFilter)
OnEventFiltered registers an event handler with a filter.
func (*Client) OnEventType ¶
func (c *Client) OnEventType(eventType EventType, handler EventHandler)
OnEventType registers a handler for specific event types.
func (*Client) OnWidgetEvent ¶
func (c *Client) OnWidgetEvent(widgetID string, handler EventHandler)
OnWidgetEvent registers a handler for events from a specific widget.
func (*Client) SetRoot ¶
SetRoot sets a widget as the root widget displayed on the server. This makes the widget visible on the server's terminal.
func (*Client) SetServerEventFilter ¶
func (c *Client) SetServerEventFilter(filter *pb.EventFilter) error
SetServerEventFilter updates the server-side event filter. This controls which events are sent from the server to the client.
func (*Client) SetServerEventFilterSimple ¶
SetServerEventFilterSimple is a convenience method to set basic event type filters.
func (*Client) SetServerWidgetFilter ¶
SetServerWidgetFilter sets the server to only send events for specific widgets.
func (*Client) StartEventStream ¶
StartEventStream starts listening for events from the server.
func (*Client) StartHealthCheck ¶
StartHealthCheck starts periodic health checks.
func (*Client) StopHealthCheck ¶
func (c *Client) StopHealthCheck()
StopHealthCheck stops periodic health checks.
type ConnectionState ¶
type ConnectionState int
ConnectionState represents the current connection state.
const ( // StateConnected indicates the client is connected. StateConnected ConnectionState = iota // StateDisconnected indicates the client is disconnected. StateDisconnected // StateReconnecting indicates the client is attempting to reconnect. StateReconnecting )
func (ConnectionState) String ¶
func (s ConnectionState) String() string
String returns the string representation of the connection state.
type ConnectionStateCallback ¶
type ConnectionStateCallback func(oldState, newState ConnectionState)
ConnectionStateCallback is called when connection state changes.
type CursorPosition ¶
CursorPosition holds cursor and optional selection endpoint coordinates.
type Dropdown ¶
type Dropdown struct {
// contains filtered or unexported fields
}
Dropdown represents a dropdown widget.
func (*Dropdown) Delete ¶
func (w *Dropdown) Delete() error
Delete removes the widget from the server.
func (*Dropdown) GetOptions ¶
GetOptions returns the dropdown options.
func (*Dropdown) GetProperties ¶
func (w *Dropdown) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*Dropdown) GetSelectedIndex ¶
GetSelectedIndex returns the currently selected index.
func (*Dropdown) GetSelectedText ¶
GetSelectedText returns the currently selected text.
func (*Dropdown) SetOptions ¶
SetOptions sets the dropdown options.
func (*Dropdown) SetSelectedIndex ¶
SetSelectedIndex sets the selected index.
type DropdownBuilder ¶
type DropdownBuilder struct {
// contains filtered or unexported fields
}
DropdownBuilder provides a fluent interface for creating dropdown widgets.
func (*DropdownBuilder) Border ¶
func (b *DropdownBuilder) Border(border bool) *DropdownBuilder
Border sets whether the dropdown has a border.
func (*DropdownBuilder) Build ¶
func (b *DropdownBuilder) Build() (*Dropdown, error)
Build creates the dropdown widget on the server.
func (*DropdownBuilder) FieldBackgroundColor ¶
func (b *DropdownBuilder) FieldBackgroundColor(color *pb.Color) *DropdownBuilder
FieldBackgroundColor sets the field background color.
func (*DropdownBuilder) FieldTextColor ¶
func (b *DropdownBuilder) FieldTextColor(color *pb.Color) *DropdownBuilder
FieldTextColor sets the field text color.
func (*DropdownBuilder) FieldWidth ¶
func (b *DropdownBuilder) FieldWidth(width int) *DropdownBuilder
FieldWidth sets the field width.
func (*DropdownBuilder) Label ¶
func (b *DropdownBuilder) Label(label string) *DropdownBuilder
Label sets the dropdown label text.
func (*DropdownBuilder) LabelColor ¶
func (b *DropdownBuilder) LabelColor(color *pb.Color) *DropdownBuilder
LabelColor sets the label color.
func (*DropdownBuilder) Options ¶
func (b *DropdownBuilder) Options(options []string) *DropdownBuilder
Options sets the dropdown options.
func (*DropdownBuilder) SelectedIndex ¶
func (b *DropdownBuilder) SelectedIndex(index int) *DropdownBuilder
SelectedIndex sets the initially selected index.
func (*DropdownBuilder) Title ¶
func (b *DropdownBuilder) Title(title string) *DropdownBuilder
Title sets the dropdown's title (border title).
type Event ¶
type Event struct {
Type EventType
Key *KeyEvent
Mouse *MouseEvent
Resize *ResizeEvent
Focus *FocusEvent
Widget *WidgetEvent
}
Event represents an event from the server.
func (*Event) IsWidgetEvent ¶
IsWidgetEvent returns true if this is a widget event for the specified widget.
func (*Event) IsWidgetEventType ¶
IsWidgetEventType returns true if this is a widget event of the specified type.
type EventBatcher ¶
type EventBatcher struct {
// contains filtered or unexported fields
}
EventBatcher batches high-frequency events.
func NewEventBatcher ¶
func NewEventBatcher(interval time.Duration, handler EventHandler) *EventBatcher
NewEventBatcher creates a new event batcher.
type EventFilter ¶
type EventFilter struct {
// Filter by event type
Types []EventType
// Filter by widget ID
WidgetIDs []string
// Filter by widget event type
WidgetEventTypes []string
// Custom filter function
CustomFilter func(*Event) bool
}
EventFilter provides advanced filtering for events.
func (*EventFilter) Matches ¶
func (f *EventFilter) Matches(event *Event) bool
Matches returns true if the event passes this filter.
type EventHandler ¶
type EventHandler func(*Event)
EventHandler is a function that handles events from the server.
type EventMiddleware ¶
EventMiddleware is a function that can intercept and modify events.
type EventRecorder ¶
type EventRecorder struct {
// contains filtered or unexported fields
}
EventRecorder records events for replay and debugging.
func NewEventRecorder ¶
func NewEventRecorder(maxEvents int) *EventRecorder
NewEventRecorder creates a new event recorder.
func (*EventRecorder) GetEvents ¶
func (r *EventRecorder) GetEvents() []*RecordedEvent
GetEvents returns all recorded events.
func (*EventRecorder) GetEventsSince ¶
func (r *EventRecorder) GetEventsSince(since time.Time) []*RecordedEvent
GetEventsSince returns events since a specific time.
func (*EventRecorder) IsRecording ¶
func (r *EventRecorder) IsRecording() bool
IsRecording returns true if currently recording.
func (*EventRecorder) Record ¶
func (r *EventRecorder) Record(event *Event)
Record records an event.
func (*EventRecorder) Replay ¶
func (r *EventRecorder) Replay(handler EventHandler, realtime bool)
Replay replays recorded events to a handler.
type Flex ¶
type Flex struct {
// contains filtered or unexported fields
}
Flex represents a flex layout widget.
func (*Flex) GetProperties ¶
func (w *Flex) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*Flex) RemoveItem ¶
RemoveItem removes a widget from the flex layout.
func (*Flex) SetDirection ¶
func (f *Flex) SetDirection(direction pb.FlexDirection) error
SetDirection sets the flex direction.
type FlexBuilder ¶
type FlexBuilder struct {
// contains filtered or unexported fields
}
FlexBuilder provides a fluent interface for creating flex widgets.
func (*FlexBuilder) Border ¶
func (b *FlexBuilder) Border(border bool) *FlexBuilder
Border sets whether the flex has a border.
func (*FlexBuilder) Build ¶
func (b *FlexBuilder) Build() (*Flex, error)
Build creates the flex widget on the server.
func (*FlexBuilder) Direction ¶
func (b *FlexBuilder) Direction(direction pb.FlexDirection) *FlexBuilder
Direction sets the flex direction (row or column).
func (*FlexBuilder) FullScreen ¶
func (b *FlexBuilder) FullScreen(fullScreen bool) *FlexBuilder
FullScreen sets whether the flex is full screen.
func (*FlexBuilder) Title ¶
func (b *FlexBuilder) Title(title string) *FlexBuilder
Title sets the flex title.
type FocusEvent ¶
type FocusEvent struct {
Focused bool
}
FocusEvent represents a focus change event.
type Form ¶
type Form struct {
// contains filtered or unexported fields
}
Form represents a form widget.
func (*Form) AddCheckbox ¶
AddCheckbox adds a checkbox to the form.
func (*Form) AddDropdown ¶
AddDropdown adds a dropdown to the form.
func (*Form) AddInputField ¶
AddInputField adds an input field to the form.
func (*Form) AddPasswordField ¶
AddPasswordField adds a password field to the form.
func (*Form) GetFieldValue ¶
GetFieldValue gets a field's current value.
func (*Form) GetItemCount ¶
GetItemCount returns the number of form items.
func (*Form) GetProperties ¶
func (w *Form) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*Form) SetFieldValue ¶
SetFieldValue sets a field's value.
type FormBuilder ¶
type FormBuilder struct {
// contains filtered or unexported fields
}
FormBuilder provides a fluent interface for creating form widgets.
func (*FormBuilder) Border ¶
func (b *FormBuilder) Border(border bool) *FormBuilder
Border sets whether the form has a border.
func (*FormBuilder) Build ¶
func (b *FormBuilder) Build() (*Form, error)
Build creates the form widget on the server.
func (*FormBuilder) Title ¶
func (b *FormBuilder) Title(title string) *FormBuilder
Title sets the form title.
type Grid ¶
type Grid struct {
// contains filtered or unexported fields
}
Grid represents a grid layout widget.
func (*Grid) AddItem ¶
func (g *Grid) AddItem(widget Widget, row, column, rowSpan, columnSpan, minWidth, minHeight int, focus bool) error
AddItem adds a widget to the grid layout.
func (*Grid) GetProperties ¶
func (w *Grid) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*Grid) RemoveItem ¶
RemoveItem removes a widget from the grid layout.
func (*Grid) SetColumns ¶
SetColumns sets the column sizes (negative for proportional, positive for fixed).
type GridBuilder ¶
type GridBuilder struct {
// contains filtered or unexported fields
}
GridBuilder provides a fluent interface for creating grid widgets.
func (*GridBuilder) Border ¶
func (b *GridBuilder) Border(border bool) *GridBuilder
Border sets whether the grid has a border.
func (*GridBuilder) Build ¶
func (b *GridBuilder) Build() (*Grid, error)
Build creates the grid widget on the server.
func (*GridBuilder) Columns ¶
func (b *GridBuilder) Columns(columns int) *GridBuilder
Columns sets the number of columns.
func (*GridBuilder) MinHeight ¶
func (b *GridBuilder) MinHeight(height int) *GridBuilder
MinHeight sets the minimum height.
func (*GridBuilder) MinWidth ¶
func (b *GridBuilder) MinWidth(width int) *GridBuilder
MinWidth sets the minimum width.
func (*GridBuilder) Rows ¶
func (b *GridBuilder) Rows(rows int) *GridBuilder
Rows sets the number of rows.
func (*GridBuilder) Title ¶
func (b *GridBuilder) Title(title string) *GridBuilder
Title sets the grid title.
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image represents an image display widget.
func (*Image) GetProperties ¶
func (w *Image) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*Image) SetDithering ¶
SetDithering enables or disables dithering.
func (*Image) SetImageData ¶
SetImageData sets the image data.
type ImageBuilder ¶
type ImageBuilder struct {
// contains filtered or unexported fields
}
ImageBuilder provides a fluent interface for creating image widgets.
func (*ImageBuilder) AspectRatio ¶
func (b *ImageBuilder) AspectRatio(ratio pb.ImageAspectRatio) *ImageBuilder
AspectRatio sets how aspect ratio is handled.
func (*ImageBuilder) Border ¶
func (b *ImageBuilder) Border(border bool) *ImageBuilder
Border sets whether the image has a border.
func (*ImageBuilder) Build ¶
func (b *ImageBuilder) Build() (*Image, error)
Build creates the image widget on the server.
func (*ImageBuilder) Colors ¶
func (b *ImageBuilder) Colors(colors int) *ImageBuilder
Colors sets the number of colors to use for rendering.
func (*ImageBuilder) Dithering ¶
func (b *ImageBuilder) Dithering(enabled bool) *ImageBuilder
Dithering enables or disables dithering.
func (*ImageBuilder) ImageData ¶
func (b *ImageBuilder) ImageData(data []byte) *ImageBuilder
ImageData sets the image data (raw bytes).
func (*ImageBuilder) ImagePath ¶
func (b *ImageBuilder) ImagePath(path string) *ImageBuilder
ImagePath sets the path to an image file.
func (*ImageBuilder) Title ¶
func (b *ImageBuilder) Title(title string) *ImageBuilder
Title sets the image's title (border title).
type InputField ¶
type InputField struct {
// contains filtered or unexported fields
}
InputField represents an input field widget.
func (*InputField) Delete ¶
func (w *InputField) Delete() error
Delete removes the widget from the server.
func (*InputField) GetLabel ¶
func (i *InputField) GetLabel() (string, error)
GetLabel returns the current label of the input field.
func (*InputField) GetProperties ¶
func (w *InputField) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*InputField) GetText ¶
func (i *InputField) GetText() (string, error)
GetText returns the current text content of the input field.
func (*InputField) SetFocus ¶
func (w *InputField) SetFocus() error
SetFocus sets focus to this widget.
func (*InputField) SetLabel ¶
func (i *InputField) SetLabel(label string) error
SetLabel sets the input field label.
func (*InputField) SetText ¶
func (i *InputField) SetText(text string) error
SetText sets the input field text.
type InputFieldBuilder ¶
type InputFieldBuilder struct {
// contains filtered or unexported fields
}
InputFieldBuilder provides a fluent interface for creating input field widgets.
func (*InputFieldBuilder) Border ¶
func (b *InputFieldBuilder) Border(border bool) *InputFieldBuilder
Border sets whether the input field has a border.
func (*InputFieldBuilder) Build ¶
func (b *InputFieldBuilder) Build() (*InputField, error)
Build creates the input field widget on the server.
func (*InputFieldBuilder) FieldBackgroundColor ¶
func (b *InputFieldBuilder) FieldBackgroundColor(color *pb.Color) *InputFieldBuilder
FieldBackgroundColor sets the field background color.
func (*InputFieldBuilder) FieldTextColor ¶
func (b *InputFieldBuilder) FieldTextColor(color *pb.Color) *InputFieldBuilder
FieldTextColor sets the field text color.
func (*InputFieldBuilder) FieldWidth ¶
func (b *InputFieldBuilder) FieldWidth(width int) *InputFieldBuilder
FieldWidth sets the field width.
func (*InputFieldBuilder) Label ¶
func (b *InputFieldBuilder) Label(label string) *InputFieldBuilder
Label sets the input field label text.
func (*InputFieldBuilder) LabelColor ¶
func (b *InputFieldBuilder) LabelColor(color *pb.Color) *InputFieldBuilder
LabelColor sets the label color.
func (*InputFieldBuilder) Masked ¶
func (b *InputFieldBuilder) Masked(masked bool) *InputFieldBuilder
Masked sets whether the input is masked (password field).
func (*InputFieldBuilder) Placeholder ¶
func (b *InputFieldBuilder) Placeholder(placeholder string) *InputFieldBuilder
Placeholder sets the placeholder text.
func (*InputFieldBuilder) Text ¶
func (b *InputFieldBuilder) Text(text string) *InputFieldBuilder
Text sets the initial text content.
func (*InputFieldBuilder) Title ¶
func (b *InputFieldBuilder) Title(title string) *InputFieldBuilder
Title sets the input field's title (border title).
type List ¶
type List struct {
// contains filtered or unexported fields
}
List represents a list widget.
func (*List) GetItemCount ¶
GetItemCount returns the number of items in the list.
func (*List) GetProperties ¶
func (w *List) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*List) GetSelection ¶
GetSelection returns the index of the currently selected item.
func (*List) RemoveItem ¶
RemoveItem removes an item from the list by index.
func (*List) SetSelection ¶
SetSelection sets the selected item by index.
type ListBuilder ¶
type ListBuilder struct {
// contains filtered or unexported fields
}
ListBuilder provides a fluent interface for creating list widgets.
func (*ListBuilder) BackgroundColor ¶
func (b *ListBuilder) BackgroundColor(color *pb.Color) *ListBuilder
BackgroundColor sets the background color.
func (*ListBuilder) Border ¶
func (b *ListBuilder) Border(border bool) *ListBuilder
Border sets whether the list has a border.
func (*ListBuilder) BorderColor ¶
func (b *ListBuilder) BorderColor(color *pb.Color) *ListBuilder
BorderColor sets the border color.
func (*ListBuilder) Build ¶
func (b *ListBuilder) Build() (*List, error)
Build creates the list widget on the server.
func (*ListBuilder) Title ¶
func (b *ListBuilder) Title(title string) *ListBuilder
Title sets the list title.
func (*ListBuilder) TitleColor ¶
func (b *ListBuilder) TitleColor(color *pb.Color) *ListBuilder
TitleColor sets the title color.
type Menu ¶
type Menu struct {
// contains filtered or unexported fields
}
Menu represents a menu widget (container for menu items).
func (*Menu) GetProperties ¶
func (w *Menu) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*Menu) RemoveItem ¶
RemoveItem removes a menu item from the menu.
type MenuBar ¶
type MenuBar struct {
// contains filtered or unexported fields
}
MenuBar represents a menu bar widget.
func (*MenuBar) Delete ¶
func (w *MenuBar) Delete() error
Delete removes the widget from the server.
func (*MenuBar) GetProperties ¶
func (w *MenuBar) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
type MenuBarBuilder ¶
type MenuBarBuilder struct {
// contains filtered or unexported fields
}
MenuBarBuilder provides a fluent interface for creating menu bar widgets.
func (*MenuBarBuilder) ActiveBackgroundColor ¶
func (b *MenuBarBuilder) ActiveBackgroundColor(color *pb.Color) *MenuBarBuilder
ActiveBackgroundColor sets the active menu title background.
func (*MenuBarBuilder) ActiveTextColor ¶
func (b *MenuBarBuilder) ActiveTextColor(color *pb.Color) *MenuBarBuilder
ActiveTextColor sets the active menu title text color.
func (*MenuBarBuilder) BackgroundColor ¶
func (b *MenuBarBuilder) BackgroundColor(color *pb.Color) *MenuBarBuilder
BackgroundColor sets the menu bar background color.
func (*MenuBarBuilder) Build ¶
func (b *MenuBarBuilder) Build() (*MenuBar, error)
Build creates the menu bar widget on the server.
func (*MenuBarBuilder) TextColor ¶
func (b *MenuBarBuilder) TextColor(color *pb.Color) *MenuBarBuilder
TextColor sets the menu bar text color.
func (*MenuBarBuilder) Title ¶
func (b *MenuBarBuilder) Title(title string) *MenuBarBuilder
Title sets the menu bar title.
type MenuBuilder ¶
type MenuBuilder struct {
// contains filtered or unexported fields
}
MenuBuilder provides a fluent interface for creating menu widgets.
func (*MenuBuilder) Build ¶
func (b *MenuBuilder) Build() (*Menu, error)
Build creates the menu widget on the server.
func (*MenuBuilder) Title ¶
func (b *MenuBuilder) Title(title string) *MenuBuilder
Title sets the menu title (displayed in the menu bar).
type MenuItem ¶
type MenuItem struct {
// contains filtered or unexported fields
}
MenuItem represents a menu item widget.
func (*MenuItem) Delete ¶
func (w *MenuItem) Delete() error
Delete removes the widget from the server.
func (*MenuItem) GetProperties ¶
func (w *MenuItem) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
type MenuItemBuilder ¶
type MenuItemBuilder struct {
// contains filtered or unexported fields
}
MenuItemBuilder provides a fluent interface for creating menu item widgets.
func (*MenuItemBuilder) Build ¶
func (b *MenuItemBuilder) Build() (*MenuItem, error)
Build creates the menu item widget on the server.
func (*MenuItemBuilder) Disabled ¶
func (b *MenuItemBuilder) Disabled() *MenuItemBuilder
Disabled marks this item as disabled.
func (*MenuItemBuilder) Label ¶
func (b *MenuItemBuilder) Label(label string) *MenuItemBuilder
Label sets the menu item label.
func (*MenuItemBuilder) Separator ¶
func (b *MenuItemBuilder) Separator() *MenuItemBuilder
Separator marks this item as a separator.
func (*MenuItemBuilder) ShortcutDisplay ¶
func (b *MenuItemBuilder) ShortcutDisplay(shortcut string) *MenuItemBuilder
ShortcutDisplay sets the shortcut display text (cosmetic only).
type Modal ¶
type Modal struct {
// contains filtered or unexported fields
}
Modal represents a modal dialog widget.
func (*Modal) GetButtons ¶
GetButtons returns the current modal buttons.
func (*Modal) GetProperties ¶
func (w *Modal) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*Modal) SetButtons ¶
SetButtons sets the modal buttons.
type ModalBuilder ¶
type ModalBuilder struct {
// contains filtered or unexported fields
}
ModalBuilder provides a fluent interface for creating modal widgets.
func (*ModalBuilder) BackgroundColor ¶
func (b *ModalBuilder) BackgroundColor(color *pb.Color) *ModalBuilder
BackgroundColor sets the modal background color.
func (*ModalBuilder) Border ¶
func (b *ModalBuilder) Border(border bool) *ModalBuilder
Border sets whether the modal has a border.
func (*ModalBuilder) Build ¶
func (b *ModalBuilder) Build() (*Modal, error)
Build creates the modal widget on the server.
func (*ModalBuilder) ButtonBackgroundColor ¶
func (b *ModalBuilder) ButtonBackgroundColor(color *pb.Color) *ModalBuilder
ButtonBackgroundColor sets the button background color.
func (*ModalBuilder) ButtonTextColor ¶
func (b *ModalBuilder) ButtonTextColor(color *pb.Color) *ModalBuilder
ButtonTextColor sets the button text color.
func (*ModalBuilder) Buttons ¶
func (b *ModalBuilder) Buttons(buttons ...string) *ModalBuilder
Buttons sets the modal buttons.
func (*ModalBuilder) Text ¶
func (b *ModalBuilder) Text(text string) *ModalBuilder
Text sets the modal message text.
func (*ModalBuilder) TextColor ¶
func (b *ModalBuilder) TextColor(color *pb.Color) *ModalBuilder
TextColor sets the modal text color.
func (*ModalBuilder) Title ¶
func (b *ModalBuilder) Title(title string) *ModalBuilder
Title sets the modal's title (border title).
type MouseEvent ¶
MouseEvent represents a mouse event.
type Pages ¶
type Pages struct {
// contains filtered or unexported fields
}
Pages represents a pages layout widget.
func (*Pages) GetCurrentPage ¶
GetCurrentPage gets the currently visible page name.
func (*Pages) GetProperties ¶
func (w *Pages) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*Pages) RemovePage ¶
RemovePage removes a page from the pages widget.
type PagesBuilder ¶
type PagesBuilder struct {
// contains filtered or unexported fields
}
PagesBuilder provides a fluent interface for creating pages widgets.
func (*PagesBuilder) Border ¶
func (b *PagesBuilder) Border(border bool) *PagesBuilder
Border sets whether the pages has a border.
func (*PagesBuilder) Build ¶
func (b *PagesBuilder) Build() (*Pages, error)
Build creates the pages widget on the server.
func (*PagesBuilder) PageNameColor ¶
func (b *PagesBuilder) PageNameColor(color *pb.Color) *PagesBuilder
PageNameColor sets the page name color.
func (*PagesBuilder) ShowPageNames ¶
func (b *PagesBuilder) ShowPageNames(show bool) *PagesBuilder
ShowPageNames sets whether to show page names.
func (*PagesBuilder) Title ¶
func (b *PagesBuilder) Title(title string) *PagesBuilder
Title sets the pages title.
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
ProgressBar represents a progress bar widget.
func (*ProgressBar) Delete ¶
func (w *ProgressBar) Delete() error
Delete removes the widget from the server.
func (*ProgressBar) GetLabel ¶
func (pbar *ProgressBar) GetLabel() (string, error)
GetLabel returns the progress bar label.
func (*ProgressBar) GetMax ¶
func (pbar *ProgressBar) GetMax() (int, error)
GetMax returns the maximum progress value.
func (*ProgressBar) GetProgress ¶
func (pbar *ProgressBar) GetProgress() (int, error)
GetProgress returns the current progress value.
func (*ProgressBar) GetProperties ¶
func (w *ProgressBar) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*ProgressBar) ID ¶
func (w *ProgressBar) ID() string
ID returns the widget's unique identifier.
func (*ProgressBar) SetFocus ¶
func (w *ProgressBar) SetFocus() error
SetFocus sets focus to this widget.
func (*ProgressBar) SetLabel ¶
func (pbar *ProgressBar) SetLabel(label string) error
SetLabel sets the progress bar label.
func (*ProgressBar) SetMax ¶
func (pbar *ProgressBar) SetMax(max int) error
SetMax sets the maximum progress value.
func (*ProgressBar) SetProgress ¶
func (pbar *ProgressBar) SetProgress(progress int) error
SetProgress sets the current progress value.
func (*ProgressBar) SetShowPercentage ¶
func (pbar *ProgressBar) SetShowPercentage(show bool) error
SetShowPercentage enables or disables percentage display.
type ProgressBarBuilder ¶
type ProgressBarBuilder struct {
// contains filtered or unexported fields
}
ProgressBarBuilder provides a fluent interface for creating progress bar widgets.
func (*ProgressBarBuilder) Border ¶
func (b *ProgressBarBuilder) Border(border bool) *ProgressBarBuilder
Border sets whether the progress bar has a border.
func (*ProgressBarBuilder) Build ¶
func (b *ProgressBarBuilder) Build() (*ProgressBar, error)
Build creates the progress bar widget on the server.
func (*ProgressBarBuilder) EmptyChar ¶
func (b *ProgressBarBuilder) EmptyChar(char string) *ProgressBarBuilder
EmptyChar sets the character used for the empty portion.
func (*ProgressBarBuilder) EmptyColor ¶
func (b *ProgressBarBuilder) EmptyColor(color *pb.Color) *ProgressBarBuilder
EmptyColor sets the color of the empty portion.
func (*ProgressBarBuilder) FilledChar ¶
func (b *ProgressBarBuilder) FilledChar(char string) *ProgressBarBuilder
FilledChar sets the character used for the filled portion.
func (*ProgressBarBuilder) FilledColor ¶
func (b *ProgressBarBuilder) FilledColor(color *pb.Color) *ProgressBarBuilder
FilledColor sets the color of the filled portion.
func (*ProgressBarBuilder) Label ¶
func (b *ProgressBarBuilder) Label(label string) *ProgressBarBuilder
Label sets the progress bar label.
func (*ProgressBarBuilder) Max ¶
func (b *ProgressBarBuilder) Max(max int) *ProgressBarBuilder
Max sets the maximum progress value.
func (*ProgressBarBuilder) Progress ¶
func (b *ProgressBarBuilder) Progress(progress int) *ProgressBarBuilder
Progress sets the current progress value.
func (*ProgressBarBuilder) ShowPercentage ¶
func (b *ProgressBarBuilder) ShowPercentage(show bool) *ProgressBarBuilder
ShowPercentage enables or disables percentage display.
func (*ProgressBarBuilder) Title ¶
func (b *ProgressBarBuilder) Title(title string) *ProgressBarBuilder
Title sets the progress bar's title (border title).
type RecordedEvent ¶
RecordedEvent is an event with timestamp.
type ResizeEvent ¶
ResizeEvent represents a screen resize event.
type RetryOptions ¶
type RetryOptions struct {
// MaxRetries is the maximum number of retry attempts (0 = infinite).
MaxRetries int
// InitialDelay is the initial delay before first retry.
InitialDelay time.Duration
// MaxDelay is the maximum delay between retries.
MaxDelay time.Duration
// BackoffStrategy determines how delays increase.
BackoffStrategy BackoffStrategy
// Multiplier for exponential/linear backoff (default: 2.0).
Multiplier float64
// JitterFactor adds randomness to delays to prevent thundering herd.
// A value of 0.2 means delays vary by ±20% (e.g., 1s becomes 0.8-1.2s).
// Default: 0.2 (20% jitter).
JitterFactor float64
// OnReconnecting is called when reconnection starts.
OnReconnecting func(attempt int, delay time.Duration)
// OnReconnected is called when reconnection succeeds.
OnReconnected func(attempt int)
// OnReconnectFailed is called when reconnection fails.
OnReconnectFailed func(attempt int, err error)
}
RetryOptions configures reconnection behavior.
func DefaultRetryOptions ¶
func DefaultRetryOptions() RetryOptions
DefaultRetryOptions returns sensible default retry options.
type Selection ¶
type Selection struct {
HasSelection bool
SelectedText string
Start int
End int
FromRow int
FromColumn int
ToRow int
ToColumn int
}
Selection holds selection state including text, byte offsets, and row/column coordinates.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table represents a table widget.
func (*Table) GetDimensions ¶
GetDimensions returns the table dimensions.
func (*Table) GetProperties ¶
func (w *Table) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*Table) GetSelection ¶
GetSelection returns the current cell selection.
func (*Table) SetCells ¶
func (t *Table) SetCells(cells []*pb.TableCellUpdate) (int, error)
SetCells sets multiple cells at once.
func (*Table) SetSelection ¶
SetSelection sets the current cell selection.
type TableBuilder ¶
type TableBuilder struct {
// contains filtered or unexported fields
}
TableBuilder provides a fluent interface for creating table widgets.
func (*TableBuilder) Border ¶
func (b *TableBuilder) Border(border bool) *TableBuilder
Border sets whether the table has a border.
func (*TableBuilder) Build ¶
func (b *TableBuilder) Build() (*Table, error)
Build creates the table widget on the server.
func (*TableBuilder) Title ¶
func (b *TableBuilder) Title(title string) *TableBuilder
Title sets the table title.
type TextArea ¶
type TextArea struct {
// contains filtered or unexported fields
}
TextArea represents a multi-line text editor widget.
func (*TextArea) Delete ¶
func (w *TextArea) Delete() error
Delete removes the widget from the server.
func (*TextArea) GetCursorPosition ¶
func (ta *TextArea) GetCursorPosition() (*CursorPosition, error)
GetCursorPosition returns the current cursor position.
func (*TextArea) GetPlaceholder ¶
GetPlaceholder returns the current placeholder text.
func (*TextArea) GetProperties ¶
func (w *TextArea) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*TextArea) GetSelectedText ¶
GetSelectedText returns the currently selected text.
func (*TextArea) GetSelection ¶
GetSelection returns the current selection range and text.
func (*TextArea) HasSelection ¶
HasSelection checks if text is currently selected.
func (*TextArea) InsertTextAtCursor ¶
InsertTextAtCursor inserts text at the current cursor position, replacing any selection.
func (*TextArea) SetCursorPosition ¶
SetCursorPosition moves the cursor to the specified row and column.
func (*TextArea) SetPlaceholder ¶
SetPlaceholder sets the placeholder text.
func (*TextArea) SetSelection ¶
SetSelection sets the selection range by byte offsets.
func (*TextArea) SetSuppressedKeys ¶
SetSuppressedKeys configures keys that are suppressed from widget processing but still emitted as events. Format: "ctrl+d", "ctrl+p", "ctrl+i", etc.
type TextAreaBuilder ¶
type TextAreaBuilder struct {
// contains filtered or unexported fields
}
TextAreaBuilder provides a fluent interface for creating text area widgets.
func (*TextAreaBuilder) Border ¶
func (b *TextAreaBuilder) Border(border bool) *TextAreaBuilder
Border sets whether the text area has a border.
func (*TextAreaBuilder) Build ¶
func (b *TextAreaBuilder) Build() (*TextArea, error)
Build creates the text area widget on the server.
func (*TextAreaBuilder) MaxLength ¶
func (b *TextAreaBuilder) MaxLength(maxLength int) *TextAreaBuilder
MaxLength sets the maximum text length.
func (*TextAreaBuilder) Placeholder ¶
func (b *TextAreaBuilder) Placeholder(placeholder string) *TextAreaBuilder
Placeholder sets the placeholder text.
func (*TextAreaBuilder) PlaceholderColor ¶
func (b *TextAreaBuilder) PlaceholderColor(color *pb.Color) *TextAreaBuilder
PlaceholderColor sets the placeholder text color.
func (*TextAreaBuilder) SuppressedKeys ¶
func (b *TextAreaBuilder) SuppressedKeys(keys ...string) *TextAreaBuilder
SuppressedKeys sets keys that are suppressed from widget processing but still emitted as events. Format: "ctrl+d", "ctrl+p", "ctrl+i", "ctrl+space", etc.
func (*TextAreaBuilder) Text ¶
func (b *TextAreaBuilder) Text(text string) *TextAreaBuilder
Text sets the initial text content.
func (*TextAreaBuilder) TextColor ¶
func (b *TextAreaBuilder) TextColor(color *pb.Color) *TextAreaBuilder
TextColor sets the text color.
func (*TextAreaBuilder) Title ¶
func (b *TextAreaBuilder) Title(title string) *TextAreaBuilder
Title sets the text area's title (border title).
func (*TextAreaBuilder) WordWrap ¶
func (b *TextAreaBuilder) WordWrap(wrap bool) *TextAreaBuilder
WordWrap sets whether text wraps at word boundaries.
type TextView ¶
type TextView struct {
// contains filtered or unexported fields
}
TextView represents a text view widget.
func (*TextView) Delete ¶
func (w *TextView) Delete() error
Delete removes the widget from the server.
func (*TextView) GetProperties ¶
func (w *TextView) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
type TextViewBuilder ¶
type TextViewBuilder struct {
// contains filtered or unexported fields
}
TextViewBuilder provides a fluent interface for creating text view widgets.
func (*TextViewBuilder) Border ¶
func (b *TextViewBuilder) Border(border bool) *TextViewBuilder
Border sets whether the text view has a border.
func (*TextViewBuilder) Build ¶
func (b *TextViewBuilder) Build() (*TextView, error)
Build creates the text view widget on the server.
func (*TextViewBuilder) DynamicColors ¶
func (b *TextViewBuilder) DynamicColors(enabled bool) *TextViewBuilder
DynamicColors enables dynamic color tags.
func (*TextViewBuilder) Text ¶
func (b *TextViewBuilder) Text(text string) *TextViewBuilder
Text sets the initial text content.
func (*TextViewBuilder) Title ¶
func (b *TextViewBuilder) Title(title string) *TextViewBuilder
Title sets the text view title.
func (*TextViewBuilder) WordWrap ¶
func (b *TextViewBuilder) WordWrap(wrap bool) *TextViewBuilder
WordWrap sets whether text wraps.
type Theme ¶
type Theme struct {
// Primary colors
PrimaryColor *pb.Color
SecondaryColor *pb.Color
BackgroundColor *pb.Color
SurfaceColor *pb.Color
// Text colors
TextColor *pb.Color
TextSecondaryColor *pb.Color
TextDisabledColor *pb.Color
// Interactive element colors
ButtonColor *pb.Color
ButtonTextColor *pb.Color
InputBackground *pb.Color
InputText *pb.Color
// Status colors
SuccessColor *pb.Color
WarningColor *pb.Color
ErrorColor *pb.Color
InfoColor *pb.Color
// Border and divider colors
BorderColor *pb.Color
DividerColor *pb.Color
// Selection colors
SelectionColor *pb.Color
HighlightColor *pb.Color
}
Theme defines a consistent color scheme for widgets.
type TreeView ¶
type TreeView struct {
// contains filtered or unexported fields
}
TreeView represents a tree view widget.
func (*TreeView) AddChild ¶
func (tv *TreeView) AddChild(parentID *pb.TreeNodeId, node *pb.TreeNode) (*pb.TreeNodeId, error)
AddChild adds a child node to a parent node.
func (*TreeView) Delete ¶
func (w *TreeView) Delete() error
Delete removes the widget from the server.
func (*TreeView) GetChildren ¶
func (tv *TreeView) GetChildren(nodeID *pb.TreeNodeId) ([]*pb.TreeNodeInfo, error)
GetChildren gets the children of a node.
func (*TreeView) GetProperties ¶
func (w *TreeView) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*TreeView) GetSelection ¶
GetSelection gets the currently selected node.
func (*TreeView) RemoveNode ¶
func (tv *TreeView) RemoveNode(nodeID *pb.TreeNodeId) error
RemoveNode removes a node from the tree.
func (*TreeView) SetExpanded ¶
func (tv *TreeView) SetExpanded(nodeID *pb.TreeNodeId, expanded bool) error
SetExpanded expands or collapses a node.
func (*TreeView) SetSelection ¶
func (tv *TreeView) SetSelection(nodeID *pb.TreeNodeId) error
SetSelection sets the currently selected node.
type TreeViewBuilder ¶
type TreeViewBuilder struct {
// contains filtered or unexported fields
}
TreeViewBuilder provides a fluent interface for creating tree view widgets.
func (*TreeViewBuilder) Border ¶
func (b *TreeViewBuilder) Border(border bool) *TreeViewBuilder
Border sets whether the tree view has a border.
func (*TreeViewBuilder) Build ¶
func (b *TreeViewBuilder) Build() (*TreeView, error)
Build creates the tree view widget on the server.
func (*TreeViewBuilder) NodeTextColor ¶
func (b *TreeViewBuilder) NodeTextColor(color *pb.Color) *TreeViewBuilder
NodeTextColor sets the node text color.
func (*TreeViewBuilder) SelectedBackgroundColor ¶
func (b *TreeViewBuilder) SelectedBackgroundColor(color *pb.Color) *TreeViewBuilder
SelectedBackgroundColor sets the selected node background color.
func (*TreeViewBuilder) SelectedTextColor ¶
func (b *TreeViewBuilder) SelectedTextColor(color *pb.Color) *TreeViewBuilder
SelectedTextColor sets the selected node text color.
func (*TreeViewBuilder) ShowGraphics ¶
func (b *TreeViewBuilder) ShowGraphics(show bool) *TreeViewBuilder
ShowGraphics sets whether to show tree graphics.
func (*TreeViewBuilder) Title ¶
func (b *TreeViewBuilder) Title(title string) *TreeViewBuilder
Title sets the tree view title.
func (*TreeViewBuilder) TopLevelPrefix ¶
func (b *TreeViewBuilder) TopLevelPrefix(prefix string) *TreeViewBuilder
TopLevelPrefix sets the prefix for top-level nodes.
type Widget ¶
type Widget interface {
// ID returns the widget's unique identifier.
ID() string
// Delete removes the widget from the server.
Delete() error
// SetTitle sets the widget's title.
SetTitle(title string) error
// SetBorder sets whether the widget has a border.
SetBorder(border bool) error
// SetFocus sets focus to this widget.
SetFocus() error
// GetProperties returns the widget's current properties.
GetProperties() (*pb.WidgetProperties, error)
}
Widget is the interface that all widgets implement.
type WidgetEvent ¶
WidgetEvent represents a widget-specific event.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window represents a window widget.
func (*Window) GetProperties ¶
func (w *Window) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*Window) GetState ¶
func (w *Window) GetState() (*pb.WindowGetStateResponse, error)
GetState returns the window state and geometry.
func (*Window) SetConstraints ¶
func (w *Window) SetConstraints(constraints *pb.WindowConstraints) error
SetConstraints sets window constraints.
func (*Window) SetContent ¶
SetContent sets the child widget content of the window.
type WindowBuilder ¶
type WindowBuilder struct {
// contains filtered or unexported fields
}
WindowBuilder provides a fluent interface for creating window widgets.
func (*WindowBuilder) ActiveBorderColor ¶
func (b *WindowBuilder) ActiveBorderColor(color *pb.Color) *WindowBuilder
ActiveBorderColor sets the border color when active.
func (*WindowBuilder) Build ¶
func (b *WindowBuilder) Build() (*Window, error)
Build creates the window widget on the server.
func (*WindowBuilder) Closable ¶
func (b *WindowBuilder) Closable(v bool) *WindowBuilder
Closable sets whether the window has a close button.
func (*WindowBuilder) InactiveBorderColor ¶
func (b *WindowBuilder) InactiveBorderColor(color *pb.Color) *WindowBuilder
InactiveBorderColor sets the border color when inactive.
func (*WindowBuilder) MaxSize ¶
func (b *WindowBuilder) MaxSize(width, height int32) *WindowBuilder
MaxSize sets the maximum window size.
func (*WindowBuilder) Maximizable ¶
func (b *WindowBuilder) Maximizable(v bool) *WindowBuilder
Maximizable sets whether the window has a maximize button.
func (*WindowBuilder) MinSize ¶
func (b *WindowBuilder) MinSize(width, height int32) *WindowBuilder
MinSize sets the minimum window size.
func (*WindowBuilder) Minimizable ¶
func (b *WindowBuilder) Minimizable(v bool) *WindowBuilder
Minimizable sets whether the window has a minimize button.
func (*WindowBuilder) Movable ¶
func (b *WindowBuilder) Movable(v bool) *WindowBuilder
Movable sets whether the window can be moved.
func (*WindowBuilder) Rect ¶
func (b *WindowBuilder) Rect(x, y, width, height int32) *WindowBuilder
Rect sets the initial window position and size.
func (*WindowBuilder) Resizable ¶
func (b *WindowBuilder) Resizable(v bool) *WindowBuilder
Resizable sets whether the window can be resized.
func (*WindowBuilder) Title ¶
func (b *WindowBuilder) Title(title string) *WindowBuilder
Title sets the window title.
func (*WindowBuilder) TitleBarColor ¶
func (b *WindowBuilder) TitleBarColor(color *pb.Color) *WindowBuilder
TitleBarColor sets the title bar background color.
func (*WindowBuilder) TitleBarTextColor ¶
func (b *WindowBuilder) TitleBarTextColor(color *pb.Color) *WindowBuilder
TitleBarTextColor sets the title bar text color.
type WindowManager ¶
type WindowManager struct {
// contains filtered or unexported fields
}
WindowManager represents a window manager widget.
func (*WindowManager) AddWindow ¶
func (wm *WindowManager) AddWindow(win *Window) error
AddWindow adds a window to the manager.
func (*WindowManager) BringToFront ¶
func (wm *WindowManager) BringToFront(win *Window) error
BringToFront brings a window to the front.
func (*WindowManager) Delete ¶
func (w *WindowManager) Delete() error
Delete removes the widget from the server.
func (*WindowManager) GetProperties ¶
func (w *WindowManager) GetProperties() (*pb.WidgetProperties, error)
GetProperties returns the widget's current properties.
func (*WindowManager) GetZOrder ¶
func (wm *WindowManager) GetZOrder() ([]string, error)
GetZOrder returns the z-order of windows (front to back).
func (*WindowManager) ID ¶
func (w *WindowManager) ID() string
ID returns the widget's unique identifier.
func (*WindowManager) RemoveWindow ¶
func (wm *WindowManager) RemoveWindow(win *Window) error
RemoveWindow removes a window from the manager.
func (*WindowManager) SendToBack ¶
func (wm *WindowManager) SendToBack(win *Window) error
SendToBack sends a window to the back.
type WindowManagerBuilder ¶
type WindowManagerBuilder struct {
// contains filtered or unexported fields
}
WindowManagerBuilder provides a fluent interface for creating window manager widgets.
func (*WindowManagerBuilder) BackgroundColor ¶
func (b *WindowManagerBuilder) BackgroundColor(color *pb.Color) *WindowManagerBuilder
BackgroundColor sets the background color.
func (*WindowManagerBuilder) Build ¶
func (b *WindowManagerBuilder) Build() (*WindowManager, error)
Build creates the window manager widget on the server.
func (*WindowManagerBuilder) Title ¶
func (b *WindowManagerBuilder) Title(title string) *WindowManagerBuilder
Title sets the window manager title.