palettemap

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: MIT Imports: 2 Imported by: 3

Documentation

Overview

Package palettemap provides a widget that can change the color and style of an inner widget.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

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

Types

type IPaletteMap

type IPaletteMap interface {
	FocusMap() IPaletteMapper
	NotFocusMap() IPaletteMapper
}

type IPaletteMapper

type IPaletteMapper interface {
	GetMappedColor(string) (string, bool)
}

type IWidget

type IWidget interface {
	gowid.ICompositeWidget
	IPaletteMap
}

type Map

type Map map[string]string

func (Map) GetMappedColor

func (p Map) GetMappedColor(key string) (x string, y bool)

type PaletteOverride

type PaletteOverride struct {
	gowid.IApp
	Palette gowid.IPalette
}

func NewOverride

func NewOverride(app gowid.IApp, newattrs gowid.IPalette) *PaletteOverride

func (*PaletteOverride) CellStyler

func (a *PaletteOverride) CellStyler(name string) (gowid.ICellStyler, bool)

func (*PaletteOverride) RangeOverPalette

func (a *PaletteOverride) RangeOverPalette(f func(k string, v gowid.ICellStyler) bool)

type Widget

type Widget struct {
	gowid.IWidget

	*gowid.Callbacks
	gowid.SubWidgetCallbacks
	// contains filtered or unexported fields
}

Widget that adjusts the palette used - if the rendering context provides for a foreground color of red (when focused), this widget can provide a map from red -> green to change its display

func New

func New(inner gowid.IWidget, focusMap Map, notFocusMap Map) *Widget

func (*Widget) FocusMap

func (w *Widget) FocusMap() IPaletteMapper

func (*Widget) NotFocusMap

func (w *Widget) NotFocusMap() IPaletteMapper

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

func (w *Widget) SetSubWidget(inner gowid.IWidget, app gowid.IApp)

func (*Widget) String

func (w *Widget) String() string

func (*Widget) SubWidget

func (w *Widget) SubWidget() gowid.IWidget

func (*Widget) SubWidgetSize

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

func (*Widget) UserInput

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

Jump to

Keyboard shortcuts

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