table

package
v0.0.0-...-c41b6d4 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BORDER
	DASHED_BORDER
)
View Source
const BORDERHEIGHT = 40

Variables

View Source
var Border = 40

Border dimension

View Source
var Dimension = 120

Cell dimension

View Source
var ErrCellNotEmpty = errors.New("Cell not empty")

Errors

View Source
var ErrIndexOutOfBounds = errors.New("Index out of bounds")
View Source
var Wireframe bool

Enables / disables the rendering of wireframes

Functions

func NewCell

func NewCell(c *elements.Component, cl elements.ComponentsList) *cell

Correctly initialize a cell

Types

type SVG

type SVG struct {
	Width  string `xml:"width,attr"`
	Height string `xml:"height,attr"`
	Doc    string `xml:",innerxml"`
}

type Table

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

Table representation

func NewTable

func NewTable(cl elements.ComponentsList) *Table

Returns and initializes and empty table

func (*Table) Add

func (t *Table) Add(c TableAbstract)

Add finds the next free slot and adds a component there. Increases the table if no free slot is available

func (*Table) AddTo

func (t *Table) AddTo(x int, y int, c TableAbstract) error

Explicit add to x:y

func (*Table) Columns

func (t *Table) Columns() int

Get columns

func (*Table) Component

func (t *Table) Component() *elements.Component

Satisfy tableAbstract interface

func (*Table) GetFrom

func (t *Table) GetFrom(x int, y int) (TableAbstract, error)

Retrieves an element from pos x:y

func (*Table) Height

func (t *Table) Height() int

Get height

func (*Table) Render

func (t *Table) Render(svg *svg.SVG) error

Calls render on all cell's

func (*Table) Rows

func (t *Table) Rows() int

Get rows

func (*Table) SetBorder

func (t *Table) SetBorder(b int)

Set Border for table

func (*Table) SetCaption

func (t *Table) SetCaption(c string)

Set caption

func (*Table) SetImage

func (t *Table) SetImage(i string)

Set image

func (*Table) SetRewriter

func (t *Table) SetRewriter(r image.Rewriter)

func (*Table) SetX

func (t *Table) SetX(x int)

func (*Table) SetY

func (t *Table) SetY(y int)

func (*Table) Width

func (t *Table) Width() int

Get width

func (*Table) X

func (t *Table) X() int

func (*Table) Y

func (t *Table) Y() int

type TableAbstract

type TableAbstract interface {
	Component() *elements.Component
	Height() int
	Width() int
	X() int
	Y() int
	SetX(int)
	SetY(int)
	Render(*svg.SVG) error
	SetRewriter(image.Rewriter)
}

interface for table and cell (a cell can contain a table)

Jump to

Keyboard shortcuts

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