termdraw

package
v0.0.0-...-218a2ba Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

* Copyright (c) 2022 Andreas Signer <asigner@gmail.com> * * This file is part of termdraw. * * termdraw is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * termdraw is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with termdraw. If not, see <http://www.gnu.org/licenses/>.

* Copyright (c) 2022 Andreas Signer <asigner@gmail.com> * * This file is part of termdraw. * * termdraw is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * termdraw is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with termdraw. If not, see <http://www.gnu.org/licenses/>.

* Copyright (c) 2022 Andreas Signer <asigner@gmail.com> * * This file is part of termdraw. * * termdraw is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * termdraw is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with termdraw. If not, see <http://www.gnu.org/licenses/>.

* Copyright (c) 2022 Andreas Signer <asigner@gmail.com> * * This file is part of termdraw. * * termdraw is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * termdraw is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with termdraw. If not, see <http://www.gnu.org/licenses/>.

* Copyright (c) 2022 Andreas Signer <asigner@gmail.com> * * This file is part of termdraw. * * termdraw is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * termdraw is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with termdraw. If not, see <http://www.gnu.org/licenses/>.

* Copyright (c) 2022 Andreas Signer <asigner@gmail.com> * * This file is part of termdraw. * * termdraw is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * termdraw is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with termdraw. If not, see <http://www.gnu.org/licenses/>.

* Copyright (c) 2022 Andreas Signer <asigner@gmail.com> * * This file is part of termdraw. * * termdraw is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * termdraw is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with termdraw. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Color values generated with https://github.com/canidlogic/vgapal
	ColBlack        = termbox.RGBToAttribute(0, 0, 0)
	ColBlue         = termbox.RGBToAttribute(0, 0, 170)
	ColGreen        = termbox.RGBToAttribute(0, 170, 0)
	ColCyan         = termbox.RGBToAttribute(0, 170, 170)
	ColRed          = termbox.RGBToAttribute(170, 0, 0)
	ColMagenta      = termbox.RGBToAttribute(170, 0, 170)
	ColBrown        = termbox.RGBToAttribute(170, 85, 0)
	ColLightGrey    = termbox.RGBToAttribute(170, 170, 170)
	ColGrey         = termbox.RGBToAttribute(85, 85, 85)
	ColLightBlue    = termbox.RGBToAttribute(85, 85, 255)
	ColLightGreen   = termbox.RGBToAttribute(85, 255, 85)
	ColLightCyan    = termbox.RGBToAttribute(85, 255, 255)
	ColLightRed     = termbox.RGBToAttribute(255, 85, 85)
	ColLightMagenta = termbox.RGBToAttribute(255, 85, 255)
	ColYellow       = termbox.RGBToAttribute(255, 255, 85)
	ColWhite        = termbox.RGBToAttribute(255, 255, 255)
)

Functions

func DrawBox

func DrawBox(x, y, w, h int, fg termbox.Attribute, bg termbox.Attribute, bs BorderStyle)

func ErrorDialog

func ErrorDialog(message string)

func FileDialog

func FileDialog(title string) (string, bool)

func FillBox

func FillBox(x, y, w, h int, fg termbox.Attribute, bg termbox.Attribute, bs BorderStyle)

func Puts

func Puts(x, y int, s string, fg, bg termbox.Attribute)

func YesNoCancelDialog

func YesNoCancelDialog(title, message string) (res bool, valid bool)

Types

type Border

type Border [][]rune

type BorderStyle

type BorderStyle uint8
const (
	BorderStyle_None BorderStyle = iota
	BorderStyle_Light
	BorderStyle_Rounded
	BorderStyle_Heavy
	BorderStyle_Double

	BorderStyle_Max = BorderStyle_Double
)

func (BorderStyle) Next

func (b BorderStyle) Next() BorderStyle

func (BorderStyle) Prev

func (b BorderStyle) Prev() BorderStyle

func (BorderStyle) Runes

func (b BorderStyle) Runes() Border

func (BorderStyle) String

func (b BorderStyle) String() string

type Canvas

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

func NewCanvas

func NewCanvas(x, y int, w, h int) *Canvas

func (*Canvas) AsText

func (c *Canvas) AsText() []string

func (*Canvas) Clear

func (c *Canvas) Clear()

func (*Canvas) Delete

func (c *Canvas) Delete(p Pos)

func (*Canvas) DeleteLine

func (c *Canvas) DeleteLine(p Pos)

func (*Canvas) Draw

func (c *Canvas) Draw()

func (*Canvas) IncSize

func (c *Canvas) IncSize(dw, dh int)

func (*Canvas) Insert

func (c *Canvas) Insert(p Pos)

func (*Canvas) InsertLine

func (c *Canvas) InsertLine(p Pos)

func (*Canvas) Move

func (c *Canvas) Move(d Direction) (oldPos, newPos Pos)

func (*Canvas) Pos

func (c *Canvas) Pos() Pos

func (*Canvas) SetPos

func (c *Canvas) SetPos(p Pos)

func (*Canvas) SetRune

func (c *Canvas) SetRune(p Pos, ch rune)

func (*Canvas) SetText

func (c *Canvas) SetText(text []string)

func (*Canvas) SetTile

func (c *Canvas) SetTile(p Pos, t Tile)

func (*Canvas) Tile

func (c *Canvas) Tile(p Pos) Tile

type Direction

type Direction int
const (
	DirUp Direction = iota
	DirDown
	DirLeft
	DirRight
)

func (Direction) Inverse

func (d Direction) Inverse() Direction

type EditField

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

func NewEditField

func NewEditField(x, y, w int, fg, bg termbox.Attribute) *EditField

func (*EditField) Run

func (e *EditField) Run() (string, bool)

type Line

type Line []Segment

func (Line) Width

func (l Line) Width() int

type Pos

type Pos struct {
	X, Y int
}

type Segment

type Segment struct {
	S      string
	Fg, Bg termbox.Attribute
}

type TextCard

type TextCard struct {
	Fg, Bg  termbox.Attribute
	Bs      BorderStyle
	Content []Line
}

func (*TextCard) Show

func (t *TextCard) Show()

type Tile

type Tile uint32

func TileFromRune

func TileFromRune(r rune) Tile

func (Tile) Rune

func (t Tile) Rune() rune

func (Tile) WithDir

func (t Tile) WithDir(dir Direction, border BorderStyle) Tile

Jump to

Keyboard shortcuts

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