columns

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: MIT Imports: 7 Imported by: 18

Documentation

Overview

Package columns provides a widget for organizing other widgets in columns.

Index

Constants

This section is empty.

Variables

View Source
var AllChildrenMaxDimension = fmt.Errorf("All columns widgets were rendered Max, so there is no max height to use.")

Functions

func Render

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

func RenderSubWidgets

func RenderSubWidgets(w IWidget, size gowid.IRenderSize, focus gowid.Selector, focusIdx int, app gowid.IApp) []gowid.ICanvas

RenderSubWidgets returns an array of canvases for each of the subwidgets, rendering them with in the context of a column with the provided size and focus.

func RenderedSubWidgetsSizes

func RenderedSubWidgetsSizes(w IWidget, size gowid.IRenderSize, focus gowid.Selector, focusIdx int, app gowid.IApp) []gowid.IRenderBox

RenderedSubWidgetsSizes returns an array of boxes that bound each of the subwidgets as they would be rendered with the given size and focus.

func Scroll

func Scroll(w IFocusSelectable, dir gowid.Direction, wrap bool, app gowid.IApp) bool

func SubWidgetSize

func SubWidgetSize(size gowid.IRenderSize, newX int, dim gowid.IWidgetDimension) gowid.IRenderSize

func UserInput

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

func WidgetWidths

func WidgetWidths(w ICompositeMultipleDimensionsExt, size gowid.IRenderSize, focus gowid.Selector, focusIdx int, app gowid.IApp) []int

Types

type ICompositeMultipleDimensionsExt

type ICompositeMultipleDimensionsExt interface {
	gowid.ICompositeMultipleDimensions
	gowid.ISelectChild
}

type IFocusSelectable

type IFocusSelectable interface {
	gowid.IFocus
	gowid.IFindNextSelectable
}

type IWidthHelper added in v1.3.0

type IWidthHelper interface {
	WidthHelpers() ([]bool, []bool)
}

type Options

type Options struct {
	StartColumn      int  // column that gets initial focus
	Wrap             bool // whether or not to wrap from last column to first with movement operations
	DoNotSetSelected bool // Whether or not to set the focus.Selected field for the selected child
	LeftKeys         []vim.KeyPress
	RightKeys        []vim.KeyPress
}

type Widget

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

func New

func New(widgets []gowid.IContainerWidget, opts ...Options) *Widget

func NewFixed

func NewFixed(ws ...interface{}) *Widget

func NewFlow

func NewFlow(ws ...interface{}) *Widget

func Simple(ws ...gowid.IWidget) *Widget {

func NewWithDim

func NewWithDim(method gowid.IWidgetDimension, ws ...interface{}) *Widget

func (*Widget) Dimensions

func (w *Widget) Dimensions() []gowid.IWidgetDimension

func (*Widget) FindNextSelectable

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

func (*Widget) Focus

func (w *Widget) Focus() int

func (*Widget) GetPreferedPosition

func (w *Widget) GetPreferedPosition() gwutil.IntOption

func (*Widget) KeyIsLeft added in v1.2.0

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

func (*Widget) KeyIsRight added in v1.2.0

func (w *Widget) KeyIsRight(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

RenderSize computes the size of this widget when it renders. This is done by computing the sizes of each subwidget, then arranging them the same way that Render() does.

func (*Widget) RenderSubWidgets

func (w *Widget) RenderSubWidgets(size gowid.IRenderSize, focus gowid.Selector, focusIdx int, app gowid.IApp) []gowid.ICanvas

func (*Widget) RenderedSubWidgetsSizes

func (w *Widget) RenderedSubWidgetsSizes(size gowid.IRenderSize, focus gowid.Selector, focusIdx int, app gowid.IApp) []gowid.IRenderBox

func (*Widget) SelectChild

func (w *Widget) SelectChild(f gowid.Selector) bool

func (*Widget) Selectable

func (w *Widget) Selectable() bool

func (*Widget) SetDimensions

func (w *Widget) SetDimensions(dimensions []gowid.IWidgetDimension, app gowid.IApp)

func (*Widget) SetFocus

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

func (*Widget) SetPreferedPosition

func (w *Widget) SetPreferedPosition(cols int, app gowid.IApp)

func (*Widget) SetSubWidgets

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

func (*Widget) String

func (w *Widget) String() string

func (*Widget) SubWidgetSize

func (w *Widget) SubWidgetSize(size gowid.IRenderSize, newX int, sub gowid.IWidget, dim gowid.IWidgetDimension) gowid.IRenderSize

Construct the context in which each subwidget will be rendered. It's important to preserve the type of context e.g. a subwidget may only support being rendered in a fixed context. The newX parameter is the width the subwidget will have within the context of the Columns widget.

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) WidgetWidths

func (w *Widget) WidgetWidths(size gowid.IRenderSize, focus gowid.Selector, focusIdx int, app gowid.IApp) []int

Return a slice of ints representing the width in columns for each of the subwidgets to be rendered in this context given the size argument.

func (*Widget) WidthHelpers added in v1.3.0

func (w *Widget) WidthHelpers() ([]bool, []bool)

func (*Widget) Wrap

func (w *Widget) Wrap() bool

Jump to

Keyboard shortcuts

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