Documentation ¶
Index ¶
- func Close()
- func Init() error
- func NewTileTree(content Component) (t *TileTree, n *TileNode)
- func Run(root Handler) (err error)
- func RunMode(root Handler, mode termbox.InputMode) (err error)
- func SetAttr(fg, bg, highlightfg, highlightbg termbox.Attribute)
- func Size() (width int, height int)
- type Buffer
- func (b *Buffer) ConflateRow(i int) (ok bool)
- func (b *Buffer) Init(tabspaces int)
- func (b *Buffer) InsertAt(pos Coordinates, r rune) Coordinates
- func (b *Buffer) InsertRowAt(i int)
- func (b *Buffer) RawCells() [][]termbox.Cell
- func (b *Buffer) ReadFrom(r io.Reader) (n int64, err error)
- func (b *Buffer) Reset()
- func (b *Buffer) ResetAttr()
- func (b *Buffer) RowLastIdx(y int) (x int, ok bool)
- func (b *Buffer) RowLen(i int) (j int, ok bool)
- func (b *Buffer) Rows() int
- func (b *Buffer) Select(from Coordinates, to Coordinates) (res [][]termbox.Cell)
- func (b *Buffer) SelectBlock(from Coordinates, to Coordinates) (res [][]termbox.Cell)
- func (b *Buffer) SelectLine(from Coordinates, to Coordinates) (res [][]termbox.Cell)
- func (b *Buffer) SetAttr(pos Coordinates, fg, bg termbox.Attribute)
- func (b *Buffer) String() string
- func (b *Buffer) TruncateCellAt(pos Coordinates) (orig termbox.Cell, n int)
- func (b *Buffer) TruncateFrom(pos Coordinates) (ok bool)
- func (b *Buffer) TruncateLastRow()
- func (b *Buffer) TruncateRowAt(i int) (ok bool)
- func (b *Buffer) TruncateRowFrom(pos Coordinates) (ok bool)
- func (b *Buffer) WriteAt(pos Coordinates, r rune)
- func (b *Buffer) WriteRune(r rune) Coordinates
- func (b *Buffer) WriteString(p string) Coordinates
- type Component
- type Coordinates
- type Frame
- func (f *Frame) Content() Component
- func (f *Frame) ContentPosition() Coordinates
- func (f *Frame) Draw(w Writer) (err error)
- func (f *Frame) Init(content Component, fg, bg termbox.Attribute)
- func (f *Frame) Resize(width, height int)
- func (f *Frame) SetAttr(fg, bg termbox.Attribute)
- func (f *Frame) SetContent(content Component) (err error)
- type FrameProxy
- type Handler
- type KeyMap
- type Less
- func (l *Less) Draw(w Writer) (err error)
- func (l *Less) GetCursor() Coordinates
- func (l *Less) Handle(ev termbox.Event) (exit bool)
- func (l *Less) Init()
- func (l *Less) InitWithConfig(cfg *LessConfig)
- func (l *Less) Man() Manual
- func (l *Less) Mode() LessMode
- func (l *Less) Reset()
- func (l *Less) Resize(width, height int)
- func (l *Less) SetContent(text string, args ...interface{})
- func (l *Less) SetMessage(text string, args ...interface{})
- func (l *Less) SetScroll(s *Scroll) (orig *Scroll)
- type LessConfig
- type LessEvent
- type LessEventType
- type LessMode
- type List
- func (l *List) Back() *list.Element
- func (l *List) CanSeekDown() bool
- func (l *List) CanSeekUp() bool
- func (l *List) Draw(w Writer) (err error)
- func (l *List) ElementHeight() int
- func (l *List) Front() *list.Element
- func (l *List) Init(elementHeight int)
- func (l *List) InsertAfter(v *VirtualComponent, mark *list.Element) *list.Element
- func (l *List) InsertBefore(v *VirtualComponent, mark *list.Element) *list.Element
- func (l *List) Len() int
- func (l *List) MoveAfter(e, mark *list.Element)
- func (l *List) MoveBefore(e, mark *list.Element)
- func (l *List) MoveToBack(e *list.Element)
- func (l *List) MoveToFront(e *list.Element)
- func (l *List) PushBack(v *VirtualComponent) *list.Element
- func (l *List) PushBackList(other *List)
- func (l *List) PushFront(v *VirtualComponent) *list.Element
- func (l *List) PushFrontList(other *List)
- func (l *List) Remove(e *list.Element) *VirtualComponent
- func (l *List) Reset()
- func (l *List) Resize(width, height int)
- func (l *List) SeekDown()
- func (l *List) SeekEnd()
- func (l *List) SeekStart()
- func (l *List) SeekUp()
- func (l *List) SetElementHeight(height int)
- type Manual
- type Scroll
- func (s *Scroll) CanSeekDown() bool
- func (s *Scroll) CanSeekLeft() bool
- func (s *Scroll) CanSeekRight() bool
- func (s *Scroll) CanSeekUp() bool
- func (s *Scroll) Draw(writer Writer) (err error)
- func (s *Scroll) Init(tabspaces int)
- func (s *Scroll) NextResult() (pos Coordinates, ok bool)
- func (s *Scroll) Offset() Coordinates
- func (s *Scroll) PrevResult() (pos Coordinates, ok bool)
- func (s *Scroll) Reset()
- func (s *Scroll) Resize(width, height int)
- func (s *Scroll) Result() (pos Coordinates, ok bool)
- func (s *Scroll) Search(text string) int
- func (s *Scroll) SeekDown() (ok bool)
- func (s *Scroll) SeekEndFile() bool
- func (s *Scroll) SeekEndLine() bool
- func (s *Scroll) SeekHorizontal(x int) (ok bool)
- func (s *Scroll) SeekLeft() (ok bool)
- func (s *Scroll) SeekNextResult() bool
- func (s *Scroll) SeekPrevResult() bool
- func (s *Scroll) SeekRight() (ok bool)
- func (s *Scroll) SeekStartFile() bool
- func (s *Scroll) SeekStartLine() bool
- func (s *Scroll) SeekTo(pos Coordinates) bool
- func (s *Scroll) SeekUp() (ok bool)
- func (s *Scroll) SeekVertical(y int) (ok bool)
- type TileNode
- func (t *TileNode) Close()
- func (t *TileNode) Content() Component
- func (t *TileNode) Draw(w Writer) (err error)
- func (t *TileNode) Resize(width, height int)
- func (t *TileNode) Size() (size int)
- func (t *TileNode) TileDown() *TileNode
- func (t *TileNode) TileLeft() *TileNode
- func (t *TileNode) TileRight() *TileNode
- func (t *TileNode) TileUp() *TileNode
- type TileTree
- func (t *TileTree) Draw(w Writer) error
- func (t *TileTree) Init(content Component) (n *TileNode)
- func (t *TileTree) Resize(width, height int)
- func (t *TileTree) Size() (size int)
- func (t *TileTree) SplitHorizontal(node *TileNode, content Component) *TileNode
- func (t *TileTree) SplitVertical(node *TileNode, content Component) *TileNode
- func (t *TileTree) TilePosition(tile *TileNode) Coordinates
- type VirtualComponent
- type WindowManager
- func (wm *WindowManager) Focus() *TileNode
- func (wm *WindowManager) FocusDown() bool
- func (wm *WindowManager) FocusLeft() bool
- func (wm *WindowManager) FocusRight() bool
- func (wm *WindowManager) FocusUp() bool
- func (wm *WindowManager) GetCursor() Coordinates
- func (wm *WindowManager) Handle(ev termbox.Event) (exit bool)
- func (wm *WindowManager) Init(handler Handler, border bool)
- func (wm *WindowManager) Man() Manual
- func (wm *WindowManager) SetFocus(tile *TileNode) (prev *TileNode)
- func (wm *WindowManager) SplitHorizontal(h Handler) *TileNode
- func (wm *WindowManager) SplitVertical(h Handler) *TileNode
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init() error
Init initializes this library. This function should be called before any other functions. 'Close' must be called at the end to ensure graceful shutdown.
func NewTileTree ¶
NewTileTree allocates storage for a new TileTree and initializes it. It also returns the TileNode allocated to store the given content.
func Run ¶
Run takes the given root handler, renders it full-screen, and starts feeding it with termbox Events. Error is non-nil if there were any errors.
func RunMode ¶
RunMode runs the given root handler with the given termbox InputMode. See Run for more information.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
A Buffer is a variable-sized matrix of cells. The zero value for Buffer is ready to use.
func (*Buffer) ConflateRow ¶
ConflateRow will conflate row at index i with the next row
func (*Buffer) Init ¶
Init initializes this Buffer with the given tabspaces config and resets its contents.
func (*Buffer) InsertAt ¶
func (b *Buffer) InsertAt(pos Coordinates, r rune) Coordinates
InsertAt inserts a rune in the given position and shift the cells to the right
func (*Buffer) InsertRowAt ¶
InsertRowAt inserts a new row at given position. If pos is out of bounds, this method does not panic; instead, it will fill in the necessary rows such that the new row is the last row in the buffer.
func (*Buffer) RawCells ¶
func (b *Buffer) RawCells() [][]termbox.Cell
RawCells gives clients access to the underlying cell matrix.
func (*Buffer) ReadFrom ¶
ReadFrom reads data from r until EOF and appends it to the buffer, growing the buffer as needed. The return value n is the number of bytes read. Any error except io.EOF encountered during the read is also returned.
func (*Buffer) ResetAttr ¶
func (b *Buffer) ResetAttr()
ResetAttr resets all the attributes of the underlying cell matrix.
func (*Buffer) RowLastIdx ¶
RowLastIdx returns the width of row i.
func (*Buffer) Select ¶
func (b *Buffer) Select(from Coordinates, to Coordinates) (res [][]termbox.Cell)
Select returns the cells inside the given coordinates or nil if coordinates are out of bounds.
func (*Buffer) SelectBlock ¶
func (b *Buffer) SelectBlock(from Coordinates, to Coordinates) (res [][]termbox.Cell)
SelectBlock returns the block of cells inside the given coordinates or nil if coordinates are out of bounds.
func (*Buffer) SelectLine ¶
func (b *Buffer) SelectLine(from Coordinates, to Coordinates) (res [][]termbox.Cell)
SelectLine returns the lines inside the given coordinates or nil if coordinates are out of bounds.
func (*Buffer) SetAttr ¶
func (b *Buffer) SetAttr(pos Coordinates, fg, bg termbox.Attribute)
SetAttr overwrites the background and foreground attributes of cell at position.
func (*Buffer) TruncateCellAt ¶
func (b *Buffer) TruncateCellAt(pos Coordinates) (orig termbox.Cell, n int)
TruncateCellAt truncates the cell at the given position. It returns the cell truncated along with the number of cells truncated because if a tab cell was truncated the tab padding is truncated along with it.
func (*Buffer) TruncateFrom ¶
func (b *Buffer) TruncateFrom(pos Coordinates) (ok bool)
TruncateFrom truncates from the given position to the end of the buffer.
func (*Buffer) TruncateLastRow ¶
func (b *Buffer) TruncateLastRow()
TruncateLastRow truncates the last row in the buffer
func (*Buffer) TruncateRowAt ¶
TruncateRowAt truncates the row at Coordinates.Y
func (*Buffer) TruncateRowFrom ¶
func (b *Buffer) TruncateRowFrom(pos Coordinates) (ok bool)
TruncateRowFrom truncates the row at Coordinates.Y starting from Coordinates.X
func (*Buffer) WriteAt ¶
func (b *Buffer) WriteAt(pos Coordinates, r rune)
WriteAt overwrites the cell at the given position with rune
func (*Buffer) WriteRune ¶
func (b *Buffer) WriteRune(r rune) Coordinates
WriteRune writes the given rune at the end of the buffer
func (*Buffer) WriteString ¶
func (b *Buffer) WriteString(p string) Coordinates
WriteString writes the given string at the end of the buffer
type Component ¶
Component represents an element that can be drawn in a text-based user interface. It wraps the basic Draw and Resize methods.
Draw draws this component to the underlying Writer. It returns non-nil error if something went wrong in the process of writing or the writer returned an error.
Resize is used by clients to indicate what's the virtual space available for this component to be drawn in subsequent calls to Draw. When a component is initialized, its width and height is 0 until Resize is called to set the appropiate dimensions.
type Coordinates ¶
type Coordinates struct {
X, Y int
}
Coordinates represent a point in a 2-D space.
type Frame ¶
type Frame struct {
Fg, Bg termbox.Attribute
// contains filtered or unexported fields
}
Frame is a Component that simply draws a border around a nested component.
func NewFrame ¶
NewFrame allocates storage and initializes a new frame with the given border attributes and underlying component.
func (*Frame) ContentPosition ¶
func (f *Frame) ContentPosition() Coordinates
ContentPosition returns the position of the content inside this frame.
func (*Frame) Resize ¶
Resize updates this frame with a new width and height. If width or height is smaller than 3 cells, the border will not be drawn.
func (*Frame) SetAttr ¶
func (f *Frame) SetAttr(fg, bg termbox.Attribute)
SetAttr updates the border attributes of this Frame.
func (*Frame) SetContent ¶
SetContent updates the underlying component and resizes it to conform to this frame's width and height.
type FrameProxy ¶
type FrameProxy struct { Frame // contains filtered or unexported fields }
FrameProxy is a proxy handler that simply draws a frame around the underlying handler.
func NewFrameProxy ¶
func NewFrameProxy(handler Handler, fg, bg termbox.Attribute) (f *FrameProxy)
NewFrameProxy allocates storage for a new FrameProxy and initializes it.
func (*FrameProxy) GetCursor ¶
func (f *FrameProxy) GetCursor() (pos Coordinates)
GetCursor returns the underlying handler's cursor position with the frame offset.
func (*FrameProxy) Handle ¶
func (f *FrameProxy) Handle(ev termbox.Event) bool
Handle delegates the event to the underlying handler.
func (*FrameProxy) Init ¶
func (f *FrameProxy) Init(handler Handler, fg, bg termbox.Attribute)
Init initializes this FrameProxy with the given underlying handler and frame attributes.
func (*FrameProxy) Man ¶
func (f *FrameProxy) Man() Manual
Man just delegates Man call to underlying handler.
type Handler ¶
type Handler interface { Component Handle(termbox.Event) bool GetCursor() Coordinates Man() Manual }
Handler builds upon Component to add event-handling behavior. It wraps the basic Handle, GetCursor and Man methods.
Handle represents the ability to handle termbox events. These events could be key presses or other types of events. See termbox' documentation for more information. Handle returns true if a handler is done processing events.
GetCursor returns a handler's cursor coordinates. Clients can have multiple handlers in the same interface so this method will be called only when handler is in focus.
Man returns a Handler's usage manual. See Manual for more information.
func WithMapping ¶
WithMapping takes a handler and a set of event mappings to provide key and event mapping to override default handler event handler.
type Less ¶
type Less struct { *Scroll // contains filtered or unexported fields }
Less is a clone of Unix' less program.
func (*Less) Init ¶
func (l *Less) Init()
Init initializes this instance or resets it if already initialized.
func (*Less) InitWithConfig ¶
func (l *Less) InitWithConfig(cfg *LessConfig)
InitWithConfig will initialize a less handler. If config is nil this method will panic.
func (*Less) SetContent ¶
SetContent replaces the content of the underlying scroll with 'text'.
func (*Less) SetMessage ¶
SetMessage sets a message to be displayed on the bottom right corner.
type LessConfig ¶
type LessConfig struct { Tabspaces int Wrap bool ResFG termbox.Attribute ResBG termbox.Attribute Handler func(LessEvent) }
LessConfig holds configuration values for a Less instance.
func DefaultLessConfig ¶
func DefaultLessConfig() *LessConfig
DefaultLessConfig returns sane configuration defaults for a less instance.
type LessEvent ¶
type LessEvent struct { Type LessEventType Data []byte Err error }
LessEvent type represents a less event.
type LessEventType ¶
type LessEventType uint8
LessEventType represents a less event
const ( // EOF is dispatched when user has reached end of buffer EOF LessEventType = iota // Search is dispatched when user has performed a text search // `Data` field in `Event` struct will be set to the search text Search )
type LessMode ¶
type LessMode uint8
LessMode represents one of the two modes of a less Handler. See Manual for more information on how to switch between modes.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List represents a list of VirtualComponent which are drawn each one in series as a separate row.
func (*List) CanSeekDown ¶
CanSeekDown returns whether SeekUp would seek one row down.
func (*List) ElementHeight ¶
ElementHeight returns the height for each element of this list.
func (*List) InsertAfter ¶
InsertAfter inserts a new element e with value v immediately after mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.
func (*List) InsertBefore ¶
InsertBefore inserts a new element e with value v immediately before mark and returns e. If mark is not an element of l, the list is not modified. The mark must not be nil.
func (*List) MoveAfter ¶
MoveAfter moves element e to its new position after mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.
func (*List) MoveBefore ¶
MoveBefore moves element e to its new position before mark. If e or mark is not an element of l, or e == mark, the list is not modified. The element and mark must not be nil.
func (*List) MoveToBack ¶
MoveToBack moves element e to the back of list l. If e is not an element of l, the list is not modified. The element must not be nil.
func (*List) MoveToFront ¶
MoveToFront moves element e to the front of list l. If e is not an element of l, the list is not modified. The element must not be nil.
func (*List) PushBack ¶
func (l *List) PushBack(v *VirtualComponent) *list.Element
PushBack inserts a new element e with value v at the back of list l and returns e.
func (*List) PushBackList ¶
PushBackList inserts a copy of an other list at the back of list l. The lists l and other must NOT be the same or nil.
func (*List) PushFront ¶
func (l *List) PushFront(v *VirtualComponent) *list.Element
PushFront inserts a new element e with value v at the front of list l and returns e.
func (*List) PushFrontList ¶
PushFrontList inserts a copy of an other list at the front of list l. The lists l and other must NOT be the same or nil.
func (*List) Remove ¶
func (l *List) Remove(e *list.Element) *VirtualComponent
Remove removes e from l if e is an element of list l. It returns the element value e.Value. The element must not be nil.
func (*List) SeekDown ¶
func (l *List) SeekDown()
SeekDown shifts the contents of this list one row down.
func (*List) SeekEnd ¶
func (l *List) SeekEnd()
SeekEnd shifts the contents of this list such that the last element is drawn at the top of the list.
func (*List) SeekStart ¶
func (l *List) SeekStart()
SeekStart shifts the contents of this list such that the first element is drawn at the top f the list.
func (*List) SetElementHeight ¶
SetElementHeight sets the height for each element of this list.
type Manual ¶
Manual represents a handler's instruction manual and other useful information to be displayed in a text-based user interface.
type Scroll ¶
type Scroll struct { Buffer ResultsFG termbox.Attribute // foreground attribute for search results ResultsBG termbox.Attribute // background attribute for search results Wrap bool // lines longer than the width of the window will wrap and displaying continues on the next line. wrap text // contains filtered or unexported fields }
Scroll adds Draw to a Buffer along with scrolling, searching and wrap-around capabilities.
func NewScroll ¶
func NewScroll() (s *Scroll)
NewScroll allocates storage for a Scroll and initializes it.
func (*Scroll) CanSeekDown ¶
CanSeekDown returns true if SeekDown would seek one row down.
func (*Scroll) CanSeekLeft ¶
CanSeekLeft returns true if SeekLeft would seek one column left.
func (*Scroll) CanSeekRight ¶
CanSeekRight returns true if SeekRight would seek one column right.
func (*Scroll) Draw ¶
Draw draws the contents of this scroll to the given writer. If Wrap is set, lines that are too long to be rendered will wrap around and thus be rendered in the next line.
func (*Scroll) NextResult ¶
func (s *Scroll) NextResult() (pos Coordinates, ok bool)
NextResult returns the coordinates of the next result in the Search list.
func (*Scroll) Offset ¶
func (s *Scroll) Offset() Coordinates
Offset returns the scroll offset from the start of the content.
func (*Scroll) PrevResult ¶
func (s *Scroll) PrevResult() (pos Coordinates, ok bool)
PrevResult returns the coordinates of the previous result in the Search list.
func (*Scroll) Result ¶
func (s *Scroll) Result() (pos Coordinates, ok bool)
Result returns the current search result's coordinates.
func (*Scroll) Search ¶
Search performs a text search of text in the internal cell buffer. It populates a search list so SeekNextResult and SeekPreviousResult can be used to visualize results. It returns the number of matches found.
func (*Scroll) SeekEndFile ¶
SeekEndFile shifts the contents of this scroll to the maximum y offset.
func (*Scroll) SeekEndLine ¶
SeekEndLine shifts the contents of this scroll to the maximum x offset.
func (*Scroll) SeekHorizontal ¶
SeekHorizontal shifts the contents of this scroll such that the horizontal offset is x. If x is out of bounds the contents will be shifted to the maximum possible x offset.
func (*Scroll) SeekNextResult ¶
SeekNextResult shifts the contents of this scroll to visualize the next result in the result list.
func (*Scroll) SeekPrevResult ¶
SeekPrevResult shifts the contents of this scroll to visualize the previous result in the result list.
func (*Scroll) SeekStartFile ¶
SeekStartFile shifts the contents of this scroll to the minimum y offset.
func (*Scroll) SeekStartLine ¶
SeekStartLine shifts the contents of this scroll to the minimum x offset.
func (*Scroll) SeekTo ¶
func (s *Scroll) SeekTo(pos Coordinates) bool
SeekTo shifts the contents of this scroll such that the offset is exactly at given coordinates.
func (*Scroll) SeekVertical ¶
SeekVertical shifts the contents of this scroll such that the vertical offset is y. If y is out of bounds the contents will be shifted to the maximum possible y offset.
type TileNode ¶
type TileNode struct {
// contains filtered or unexported fields
}
TileNode represents a node in a tree of tiled components.
func (*TileNode) Close ¶
func (t *TileNode) Close()
Close removes this node from the tree. It panics if node is last node on the tree.
func (*TileNode) TileDown ¶
TileDown returns the tile in the bottom of t or nil if t is the bottom-most tile in the tree.
func (*TileNode) TileLeft ¶
TileLeft returns the tile left-adjacent to t or nil if t is the left-most tile in the tree.
type TileTree ¶
type TileTree struct {
// contains filtered or unexported fields
}
TileTree represents the root node of a tree of TileNodes.
func (*TileTree) SplitHorizontal ¶
SplitHorizontal splits the given node to incorporate new content. If direction of the given node's split is horizontal, a new node with content will be added as a sibling of node. Otherwise, a new node will become a child of the given node so height will be divided in half so new node can be drawn next to it. It panics if node is a child of this TileTree.
func (*TileTree) SplitVertical ¶
SplitVertical splits the given node to incorporate new content. If direction of the given node's split is vertical, a new node with content will be added as a sibling of node. Otherwise, a new node with content will become a child of the given node so width will be divided in half so new node can be drawn next to it. It panics if node is a child of this TileTree.
func (*TileTree) TilePosition ¶
func (t *TileTree) TilePosition(tile *TileNode) Coordinates
TilePosition returns the given tile's position offset inside this TileTree. It panics if tile is not a member of this tree.
type VirtualComponent ¶
type VirtualComponent struct { C Component // contains filtered or unexported fields }
VirtualComponent wraps a component to provide virtual coordinates and write bound checking. It exposes Move which can be used to move the inner component in the virtual coordinate space.
func (*VirtualComponent) Draw ¶
func (c *VirtualComponent) Draw(writer Writer) error
Draw uses a virtual writer to perform bound checking and if successful draw the inner component in the virtual coordinate space.
func (*VirtualComponent) Height ¶
func (c *VirtualComponent) Height() int
Height returns the height set in last Resize.
func (*VirtualComponent) Move ¶
func (c *VirtualComponent) Move(pos Coordinates)
Move changes the position of this virtual component in the virtual coordinate space.
func (*VirtualComponent) Position ¶
func (c *VirtualComponent) Position() Coordinates
Position returns this virtual component's position in the virtual coordinate space.
func (*VirtualComponent) Resize ¶
func (c *VirtualComponent) Resize(width, height int)
Resize resizes the underlying component and stores size to perform bound checking on Draw.
func (*VirtualComponent) Width ¶
func (c *VirtualComponent) Width() int
Width returns the width set in last Resize.
type WindowManager ¶
type WindowManager struct { TileTree // contains filtered or unexported fields }
WindowManager implements Handler as a tiled window manager.
func NewWindowManager ¶
func NewWindowManager(handler Handler, border bool) (wm *WindowManager)
NewWindowManager allocates storage for a new WindowManager and initializes it with the given handler. If border is true, it will draw a border around every tile.
func (*WindowManager) Focus ¶
func (wm *WindowManager) Focus() *TileNode
Focus returns the tile currently in focus.
func (*WindowManager) FocusDown ¶
func (wm *WindowManager) FocusDown() bool
FocusDown switches the focus to the tile beneath the tile in focus If the tile in focus is the down-most tile in this window manager, then this method does nothing.
func (*WindowManager) FocusLeft ¶
func (wm *WindowManager) FocusLeft() bool
FocusLeft switches the focus to the tile on the left side of the tile in focus If the tile in focus is the left-most tile in this window manager, then this method does nothing.
func (*WindowManager) FocusRight ¶
func (wm *WindowManager) FocusRight() bool
FocusRight switches the focus to the tile on the right side of the tile in focus If the tile in focus is the right-most tile in this window manager, then this method does nothing.
func (*WindowManager) FocusUp ¶
func (wm *WindowManager) FocusUp() bool
FocusUp switches the focus to the tile above the tile in focus If the tile in focus is the up-most tile in this window manager, then this method does nothing.
func (*WindowManager) GetCursor ¶
func (wm *WindowManager) GetCursor() Coordinates
GetCursor returns the cursor coordinates of the tile in focus.
func (*WindowManager) Handle ¶
func (wm *WindowManager) Handle(ev termbox.Event) (exit bool)
Handle : Handler
func (*WindowManager) Init ¶
func (wm *WindowManager) Init(handler Handler, border bool)
Init initializes this WindowManager with the given handler. If border is true, it will draw a border around every tile.
func (*WindowManager) SetFocus ¶
func (wm *WindowManager) SetFocus(tile *TileNode) (prev *TileNode)
SetFocus sets the passed tile in focus. It returns the previous tile in focus. The behaviour is undefined if the given tile is not part of this WindowManager.
func (*WindowManager) SplitHorizontal ¶
func (wm *WindowManager) SplitHorizontal(h Handler) *TileNode
SplitHorizontal creates a new horizontal split over the tile currently in focus.
func (*WindowManager) SplitVertical ¶
func (wm *WindowManager) SplitVertical(h Handler) *TileNode
SplitVertical creates a new vertical split over the tile currently in focus.