grid

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package grid allows widgets to be arranged in rows and columns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateWidgets

func GenerateWidgets(w IGrid, size gowid.IRenderSize, attrs gowid.IRenderContext) (pile.IWidget, int)

Can't support RenderFixed{} because I need to know how many columns so I can roll over widgets to the next line.

func Render

func Render(w IWidget, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas

func UserInput

func UserInput(w IGrid, ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool

Scroll sequentially through the widgets on mouse scroll events or key up/down

Types

type Align

type Align struct{}

type HSepCB

type HSepCB struct{}

type IGrid

type IGrid interface {
	gowid.IFindNextSelectable
	gowid.IFocus
	SubWidgets() []gowid.IWidget
	GenerateWidgets(size gowid.IRenderSize, attrs gowid.IRenderContext) (pile.IWidget, int)
	Width() int
	HSep() int
	VSep() int
	HAlign() gowid.IHAlignment
	Wrap() bool
	KeyIsUp(*tcell.EventKey) bool
	KeyIsDown(*tcell.EventKey) bool
	KeyIsLeft(*tcell.EventKey) bool
	KeyIsRight(*tcell.EventKey) bool
}

type IWidget

type IWidget interface {
	gowid.IWidget
	IGrid
}

type Options

type Options struct {
	StartPos  int
	Wrap      bool
	DownKeys  []vim.KeyPress
	UpKeys    []vim.KeyPress
	LeftKeys  []vim.KeyPress
	RightKeys []vim.KeyPress
}

type VSepCB

type VSepCB struct{}

type Widget

type Widget struct {
	*gowid.Callbacks
	gowid.SubWidgetsCallbacks
	gowid.FocusCallbacks
	// contains filtered or unexported fields
}

align sets the alignment of the group within the leftover space in the row.

func New

func New(widgets []gowid.IWidget, width int, hSep int, vSep int, align gowid.IHAlignment, opts ...Options) *Widget

func (*Widget) FindNextSelectable

func (w *Widget) FindNextSelectable(dir gowid.Direction, wrap bool) (int, bool)

func (*Widget) Focus

func (w *Widget) Focus() int

Tries to set at required index, will choose first selectable from there

func (*Widget) GenerateWidgets

func (w *Widget) GenerateWidgets(size gowid.IRenderSize, attrs gowid.IRenderContext) (pile.IWidget, int)

func (*Widget) HAlign

func (w *Widget) HAlign() gowid.IHAlignment

func (*Widget) HSep

func (w *Widget) HSep() int

func (*Widget) KeyIsDown

func (w *Widget) KeyIsDown(evk *tcell.EventKey) bool

func (*Widget) KeyIsLeft

func (w *Widget) KeyIsLeft(evk *tcell.EventKey) bool

func (*Widget) KeyIsRight

func (w *Widget) KeyIsRight(evk *tcell.EventKey) bool

func (*Widget) KeyIsUp

func (w *Widget) KeyIsUp(evk *tcell.EventKey) bool

func (*Widget) Render

func (w *Widget) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas

func (*Widget) RenderSize

func (w *Widget) RenderSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderBox

func (*Widget) Selectable

func (w *Widget) Selectable() bool

func (*Widget) SetFocus

func (w *Widget) SetFocus(app gowid.IApp, i int)

Tries to set at required index, will choose first selectable from there

func (*Widget) SetHAlign

func (w *Widget) SetHAlign(i gowid.IHAlignment, app gowid.IApp)

func (*Widget) SetHSep

func (w *Widget) SetHSep(i int, app gowid.IApp)

func (*Widget) SetSubWidgets

func (w *Widget) SetSubWidgets(widgets []gowid.IWidget, app gowid.IApp)

func (*Widget) SetVSep

func (w *Widget) SetVSep(i int, app gowid.IApp)

func (*Widget) SetWidth

func (w *Widget) SetWidth(i int, app gowid.IApp)

func (*Widget) String

func (w *Widget) String() string

func (*Widget) SubWidgets

func (w *Widget) SubWidgets() []gowid.IWidget

func (*Widget) UserInput

func (w *Widget) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool

func (*Widget) VSep

func (w *Widget) VSep() int

func (*Widget) Width

func (w *Widget) Width() int

func (*Widget) Wrap

func (w *Widget) Wrap() bool

type Width

type Width struct{}

Jump to

Keyboard shortcuts

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