core

package module
v0.0.0-...-68fea93 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	Cols int
	Rows int
	// contains filtered or unexported fields
}

func (*Buffer) Get

func (buf *Buffer) Get(col, row int) *Cell

func (*Buffer) Set

func (buf *Buffer) Set(col, row int, c *Cell)

type Cell

type Cell struct {
	Rune rune
	Fore CellColor
	Back CellColor
	Attr CellAttr
}

type CellAttr

type CellAttr int
const (
	CellAttrNone CellAttr = 1 << iota
	CellAttrBold
	CellAttrUnderline
)

func (CellAttr) String

func (ca CellAttr) String() string

type CellColor

type CellColor int
const (
	CellColorDefault CellColor = iota
	CellColorBlack
	CellColorRed
	CellColorGreen
	CellColorYellow
	CellColorBlue
	CellColorMagenta
	CellColorCyan
	CellColorWhite
)

func (CellColor) String

func (cc CellColor) String() string

type Command

type Command struct {
	Name    string
	Payload map[string]interface{}
}

func (Command) String

func (cmd Command) String() string

type Context

type Context interface {
	Logger() Logger
	Quit()
	Command(Command)
	Buffer() *Buffer
	Render()
}

type Core

type Core struct {
	// contains filtered or unexported fields
}

func New

func New() *Core

func (*Core) Run

func (c *Core) Run()

func (*Core) SetExecutor

func (c *Core) SetExecutor(ex Executor)

func (*Core) SetLogger

func (c *Core) SetLogger(log Logger)

func (*Core) SetWindow

func (c *Core) SetWindow(win Window)

type Executor

type Executor interface {
	Close()
	Execute(func())
}

type Key

type Key struct {
	Code KeyCode
	Rune rune
	Mod  KeyMod
}

type KeyCode

type KeyCode int
const (
	KeyCodeRune KeyCode = iota
	KeyCodeF1
	KeyCodeF2
	KeyCodeF3
	KeyCodeF4
	KeyCodeF5
	KeyCodeF6
	KeyCodeF7
	KeyCodeF8
	KeyCodeF9
	KeyCodeF10
	KeyCodeF11
	KeyCodeF12
	KeyCodeInsert
	KeyCodeDelete
	KeyCodeHome
	KeyCodeEnd
	KeyCodePgup
	KeyCodePgdn
	KeyCodeArrowUp
	KeyCodeArrowDown
	KeyCodeArrowLeft
	KeyCodeArrowRight
	KeyCodeEsc
	KeyCodeEnter
	KeyCodeBackspace
	KeyCodeTab
	KeyCodeSpace
)

func (KeyCode) String

func (kc KeyCode) String() string

type KeyMod

type KeyMod int
const (
	KeyModNone KeyMod = 0
	KeyModCtrl KeyMod = 1 << (iota - 1)
	KeyModAlt
)

func (KeyMod) String

func (km KeyMod) String() string

type Logger

type Logger interface {
	Info(v ...interface{})
	Infof(format string, v ...interface{})
	Error(v ...interface{})
	Errorf(format string, v ...interface{})
}

type Mouse

type Mouse struct {
	Action MouseAction
	Moved  bool
	Col    int
	Row    int
}

type MouseAction

type MouseAction int
const (
	MouseButtonLeft MouseAction = iota
	MouseButtonMiddle
	MouseButtonRight
	MouseButtonRelease
	MouseWheelUp
	MouseWheelDown
)

func (MouseAction) String

func (ma MouseAction) String() string

type Window

type Window interface {
	Close(Context)
	Command(Context, Command)
	Key(Context, Key)
	Mouse(Context, Mouse)
	Resize(Context)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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