Documentation ¶
Overview ¶
Package washeet provides a HTML5 canvas based spreadsheet user-interface for web-assembly target.
Index ¶
- type CellAttribs
- func (cAttribs *CellAttribs) GetAlignment() TextAlignType
- func (cAttribs *CellAttribs) GetBGColor() *Color
- func (cAttribs *CellAttribs) GetFGColor() *Color
- func (cAttribs *CellAttribs) GetFontSize() uint8
- func (cAttribs *CellAttribs) IsBold() bool
- func (cAttribs *CellAttribs) IsItalics() bool
- func (cAttribs *CellAttribs) IsUnderline() bool
- func (cAttribs *CellAttribs) SetAlignment(align TextAlignType)
- func (cAttribs *CellAttribs) SetBGColor(color *Color)
- func (cAttribs *CellAttribs) SetBold(flag bool)
- func (cAttribs *CellAttribs) SetFGColor(color *Color)
- func (cAttribs *CellAttribs) SetFontSize(size uint8)
- func (cAttribs *CellAttribs) SetItalics(flag bool)
- func (cAttribs *CellAttribs) SetUnderline(flag bool)
- type Color
- type Sheet
- type SheetDataProvider
- type SheetNotifier
- type TextAlignType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CellAttribs ¶
type CellAttribs struct {
// contains filtered or unexported fields
}
CellAttribs stores the attributes of a cell.
func NewDefaultCellAttribs ¶
func NewDefaultCellAttribs() *CellAttribs
NewDefaultCellAttribs return a pointer to a new instance of CellAttribs with default settings.
func (*CellAttribs) GetAlignment ¶
func (cAttribs *CellAttribs) GetAlignment() TextAlignType
GetAlignment returns the cell text alignment setting.
func (*CellAttribs) GetBGColor ¶
func (cAttribs *CellAttribs) GetBGColor() *Color
GetBGColor returns the background color setting.
func (*CellAttribs) GetFGColor ¶
func (cAttribs *CellAttribs) GetFGColor() *Color
GetFGColor returns the foreground color setting.
func (*CellAttribs) GetFontSize ¶
func (cAttribs *CellAttribs) GetFontSize() uint8
GetFontSize returns the font size setting in pixels.
func (*CellAttribs) IsBold ¶
func (cAttribs *CellAttribs) IsBold() bool
IsBold returns whether bold attribute is set or not.
func (*CellAttribs) IsItalics ¶
func (cAttribs *CellAttribs) IsItalics() bool
IsItalics returns whether italics attribute is set or not.
func (*CellAttribs) IsUnderline ¶
func (cAttribs *CellAttribs) IsUnderline() bool
IsUnderline returns whether underline attribute is set or not.
func (*CellAttribs) SetAlignment ¶
func (cAttribs *CellAttribs) SetAlignment(align TextAlignType)
SetAlignment sets the cell text alignment setting.
func (*CellAttribs) SetBGColor ¶
func (cAttribs *CellAttribs) SetBGColor(color *Color)
SetBGColor sets the background color.
func (*CellAttribs) SetBold ¶
func (cAttribs *CellAttribs) SetBold(flag bool)
SetBold sets/unsets the cell text's bold attribute.
func (*CellAttribs) SetFGColor ¶
func (cAttribs *CellAttribs) SetFGColor(color *Color)
SetFGColor sets the foreground color.
func (*CellAttribs) SetFontSize ¶
func (cAttribs *CellAttribs) SetFontSize(size uint8)
SetFontSize sets the font size provided in pixels.
func (*CellAttribs) SetItalics ¶
func (cAttribs *CellAttribs) SetItalics(flag bool)
SetItalics sets/unsets the cell text's italics attribute.
func (*CellAttribs) SetUnderline ¶
func (cAttribs *CellAttribs) SetUnderline(flag bool)
SetUnderline sets/unsets the cell text's underline attribute.
type Color ¶
type Color uint32
Color represents a color.
type Sheet ¶
type Sheet struct {
// contains filtered or unexported fields
}
Sheet represents the spreadsheet user-interface.
func NewSheet ¶
NewSheet creates a spreadsheet ui within the given div container The new spreadsheet ui will be drawn in a canvas of dimensions (width, height) dSrc must be an implementation of SheetDataProvder which is used to draw the contents of the spreadsheet.
Note that the spreadsheet does not become visible after calling NewSheet. For that Start() method needs to be called.
func (*Sheet) Start ¶
func (sheet *Sheet) Start()
Start starts the rendering of the spreadsheet and listens to user interactions.
func (*Sheet) Stop ¶
func (sheet *Sheet) Stop()
Stop stops all internal user-event handlers, stops the rendering loop and cleans up the portion of canvas designated to Sheet created by NewSheet.
func (*Sheet) UpdateCell ¶
UpdateCell redraws the contents of the provided cell location.
func (*Sheet) UpdateRange ¶
UpdateRange redraws the contents of the provided range.
type SheetDataProvider ¶
type SheetDataProvider interface { // GetDisplayString returns the content of the cell at (column,row) as a string. GetDisplayString(column int64, row int64) string // GetCellAttribs returns cell-attributes information via CellAttribs type. GetCellAttribs(column, row int64) *CellAttribs // GetColumnWidth returns the width of "column" column in pixels. GetColumnWidth(column int64) float64 // GetRowHeight returns the height of "row" row in pixels. GetRowHeight(row int64) float64 // TrimToNonEmptyRange trims given range represented by // { top-left cell (column = c1, row = r1), bottom-right cell (column = c2, row = r2) // to the biggest sub-range that does not have any leading/trailing empty columns/rows. // It returns false if given range is completely empty, else it returns true. TrimToNonEmptyRange(c1, r1, c2, r2 *int64) bool }
SheetDataProvider is the interface that needs to be implemented by the user of washeet which is used to draw and populate the contents of the spreadsheet.
type SheetNotifier ¶
type SheetNotifier interface { // UpdateCell call tells washeet that the specified cell contents have changed // and needs redrawing. UpdateCell(column, row int64) // UpdateRange call tells washeet that the specified range's contents have changed // and needs redrawing. UpdateRange(startColumn, startRow, endColumn, endRow int64) }
SheetNotifier is the interface via which client-users of washeet can notify which cell/range has changed its contents.
type TextAlignType ¶
type TextAlignType byte
TextAlignType is used to represent alignment of a cell's content.
const ( // AlignLeft indicates left-alignment of cell-content. AlignLeft TextAlignType = iota // AlignCenter indicates center-alignment of cell-content. AlignCenter // AlignRight indicates right-alignment of cell-content. AlignRight )
Source Files ¶
- canvas.go
- cellattribs.go
- clipboard.go
- colors.go
- consts.go
- doc.go
- draw_primitives.go
- event_handlers.go
- layout.go
- layout_primitives.go
- locals.go
- markdata.go
- mouse_state.go
- paint_handlers.go
- paint_methods.go
- paint_queue.go
- paint_requests.go
- selection_state.go
- sheet.go
- sheet_primitives.go
- textattribs.go
- types.go