widget

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPalette = Palette{
	"text_cursor_fg":             nil,
	"text_fg":                    cint(0x0),
	"text_bg":                    cint(0xffffff),
	"text_selection_fg":          nil,
	"text_selection_bg":          cint(0xeeee9e),
	"text_colorize_string_fg":    cint(0x008b00),
	"text_colorize_string_bg":    nil,
	"text_colorize_comments_fg":  cint(0x757575),
	"text_colorize_comments_bg":  nil,
	"text_highlightword_fg":      nil,
	"text_highlightword_bg":      cint(0xc6ee9e),
	"text_wrapline_fg":           cint(0x0),
	"text_wrapline_bg":           cint(0xd8d8d8),
	"text_parenthesis_fg":        cint(0x0),
	"text_parenthesis_bg":        cint(0xc3c3c3),
	"text_annotations_fg":        cint(0x0),
	"text_annotations_bg":        cint(0xb0e0ef),
	"text_annotations_select_fg": cint(0x0),
	"text_annotations_select_bg": cint(0xefc7b0),

	"scrollbar_bg":        cint(0xf2f2f2),
	"scrollhandle_normal": cint(0xb2b2b2),
	"scrollhandle_hover":  cint(0x8e8e8e),
	"scrollhandle_select": cint(0x5f5f5f),

	"button_hover_fg":  nil,
	"button_hover_bg":  cint(0xdddddd),
	"button_down_fg":   nil,
	"button_down_bg":   cint(0xaaaaaa),
	"button_sticky_fg": cint(0xffffff),
	"button_sticky_bg": cint(0x0),

	"pad":    cint(0x8080ff),
	"border": cint(0x00ff00),
	"rect":   cint(0xff8000),
}

Functions

func StableOffsetScroll added in v1.3.0

func StableOffsetScroll(o int, s, dn, in int) int

offset, start, deletedn, insertedn

Types

type AEDragState

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

type ApplyEvent

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

func NewApplyEvent

func NewApplyEvent(cctx CursorContext) *ApplyEvent

func (*ApplyEvent) Apply

func (ae *ApplyEvent) Apply(node Node, ev any, p image.Point)

type BgLayer

type BgLayer struct {
	ENode
	// contains filtered or unexported fields
}

type Border

type Border struct {
	*Padder
}

func NewBorder

func NewBorder(ctx ImageContext, child Node) *Border

type BottomShadow

type BottomShadow struct {
	*BoxLayout
	Height  int
	MaxDiff float64
	// contains filtered or unexported fields
}

func NewBottomShadow

func NewBottomShadow(ctx ImageContext, content Node) *BottomShadow

type BottomShadowPart

type BottomShadowPart struct {
	ENode
	// contains filtered or unexported fields
}

func (*BottomShadowPart) Measure

func (s *BottomShadowPart) Measure(hint image.Point) image.Point

func (*BottomShadowPart) Paint

func (s *BottomShadowPart) Paint()

type BoxLayout

type BoxLayout struct {
	ENode
	YAxis bool
	// contains filtered or unexported fields
}

func NewBoxLayout

func NewBoxLayout() *BoxLayout

func (*BoxLayout) Layout

func (bl *BoxLayout) Layout()

func (*BoxLayout) Measure

func (bl *BoxLayout) Measure(hint image.Point) image.Point

func (*BoxLayout) SetChildFill

func (bl *BoxLayout) SetChildFill(node Node, x, y bool)

func (*BoxLayout) SetChildFlex

func (bl *BoxLayout) SetChildFlex(node Node, x, y bool)

type Button

type Button struct {
	ENode
	Label   *Label
	Sticky  bool // stay down after click to behave like a menu button
	OnClick func(*event.MouseClick)
	// contains filtered or unexported fields
}

func NewButton

func NewButton(ctx ImageContext) *Button

func (*Button) OnInputEvent

func (b *Button) OnInputEvent(ev0 any, p image.Point) event.Handled

type CursorContext

type CursorContext interface {
	SetCursor(event.Cursor)
}

type ENode

type ENode struct {
	EmbedNode
}

Doesn't allow embed to be assigned to a Node directly, which prevents a range of programming mistakes. This is the node other widgets should inherit from.

type EmbedNode

type EmbedNode struct {
	Bounds  image.Rectangle
	Cursor  event.Cursor
	Wrapper Node
	Parent  *EmbedNode
	// contains filtered or unexported fields
}

func (*EmbedNode) AddMarks

func (en *EmbedNode) AddMarks(m Marks)

func (*EmbedNode) Append

func (en *EmbedNode) Append(nodes ...Node)

If a node wants its InsertBefore implementation to be used, the wrapper must be set.

func (*EmbedNode) ChildsLayoutTree

func (en *EmbedNode) ChildsLayoutTree()

func (*EmbedNode) ChildsLen

func (en *EmbedNode) ChildsLen() int

func (*EmbedNode) ChildsPaintTree

func (en *EmbedNode) ChildsPaintTree()

func (*EmbedNode) ChildsWrappers

func (en *EmbedNode) ChildsWrappers() []Node

func (*EmbedNode) Embed

func (en *EmbedNode) Embed() *EmbedNode

func (*EmbedNode) FirstChild

func (en *EmbedNode) FirstChild() *EmbedNode

func (*EmbedNode) FirstChildWrapper

func (en *EmbedNode) FirstChildWrapper() Node

func (*EmbedNode) HasAnyMarks

func (en *EmbedNode) HasAnyMarks(m Marks) bool

func (*EmbedNode) InsertBefore

func (en *EmbedNode) InsertBefore(child Node, next *EmbedNode)

func (*EmbedNode) Iterate

func (en *EmbedNode) Iterate(f func(*EmbedNode) bool)

func (*EmbedNode) Iterate2

func (en *EmbedNode) Iterate2(f func(*EmbedNode))

func (*EmbedNode) IterateReverse

func (en *EmbedNode) IterateReverse(f func(*EmbedNode) bool)

func (*EmbedNode) IterateReverse2

func (en *EmbedNode) IterateReverse2(f func(*EmbedNode))

func (*EmbedNode) IterateWrappers

func (en *EmbedNode) IterateWrappers(f func(Node) bool)

func (*EmbedNode) IterateWrappers2

func (en *EmbedNode) IterateWrappers2(f func(Node))

func (*EmbedNode) IterateWrappersReverse

func (en *EmbedNode) IterateWrappersReverse(f func(Node) bool)

func (*EmbedNode) IterateWrappersReverse2

func (en *EmbedNode) IterateWrappersReverse2(f func(Node))

func (*EmbedNode) LastChild

func (en *EmbedNode) LastChild() *EmbedNode

func (*EmbedNode) LastChildWrapper

func (en *EmbedNode) LastChildWrapper() Node

func (*EmbedNode) Layout

func (en *EmbedNode) Layout()

func (*EmbedNode) LayoutMarked

func (en *EmbedNode) LayoutMarked()

func (*EmbedNode) LayoutTree

func (en *EmbedNode) LayoutTree()

func (*EmbedNode) MarkNeedsLayout

func (en *EmbedNode) MarkNeedsLayout()

func (*EmbedNode) MarkNeedsLayoutAndPaint

func (en *EmbedNode) MarkNeedsLayoutAndPaint()

func (*EmbedNode) MarkNeedsPaint

func (en *EmbedNode) MarkNeedsPaint()

func (*EmbedNode) Measure

func (en *EmbedNode) Measure(hint image.Point) image.Point

func (*EmbedNode) NextSibling

func (en *EmbedNode) NextSibling() *EmbedNode

func (*EmbedNode) NextSiblingWrapper

func (en *EmbedNode) NextSiblingWrapper() Node

func (*EmbedNode) OnChildMarked

func (en *EmbedNode) OnChildMarked(child Node, newMarks Marks)

func (*EmbedNode) OnInputEvent

func (en *EmbedNode) OnInputEvent(ev any, p image.Point) event.Handled

func (*EmbedNode) OnThemeChange

func (en *EmbedNode) OnThemeChange()

func (*EmbedNode) Paint

func (en *EmbedNode) Paint()

func (*EmbedNode) PaintBase

func (en *EmbedNode) PaintBase()

func (*EmbedNode) PaintMarked

func (en *EmbedNode) PaintMarked() image.Rectangle

func (*EmbedNode) PaintTree

func (en *EmbedNode) PaintTree() bool

func (*EmbedNode) PrevSibling

func (en *EmbedNode) PrevSibling() *EmbedNode

func (*EmbedNode) PrevSiblingWrapper

func (en *EmbedNode) PrevSiblingWrapper() Node

func (*EmbedNode) Remove

func (en *EmbedNode) Remove(child Node)

func (*EmbedNode) RemoveMarks

func (en *EmbedNode) RemoveMarks(m Marks)

func (*EmbedNode) SetTheme

func (en *EmbedNode) SetTheme(t Theme)

func (*EmbedNode) SetThemeFontFace added in v1.3.0

func (en *EmbedNode) SetThemeFontFace(ff *fontutil.FontFace)

func (*EmbedNode) SetThemePalette

func (en *EmbedNode) SetThemePalette(p Palette)

func (*EmbedNode) SetThemePaletteColor

func (en *EmbedNode) SetThemePaletteColor(name string, c color.Color)

func (*EmbedNode) SetThemePaletteNamePrefix

func (en *EmbedNode) SetThemePaletteNamePrefix(prefix string)

func (*EmbedNode) SetWrapperForRoot

func (en *EmbedNode) SetWrapperForRoot(n Node)

Only the root node should need to set the wrapper explicitly.

func (*EmbedNode) Swap

func (en *EmbedNode) Swap(u Node)

Doesn't use Remove/Insert. So implementing nodes overriding those will not see their functions used.

func (*EmbedNode) Theme

func (en *EmbedNode) Theme() *Theme

func (*EmbedNode) ThemePalette

func (en *EmbedNode) ThemePalette() Palette

func (*EmbedNode) TreeNeedsLayout

func (en *EmbedNode) TreeNeedsLayout() bool

func (*EmbedNode) TreeNeedsPaint

func (en *EmbedNode) TreeNeedsPaint() bool

func (*EmbedNode) TreeThemeFontFace added in v1.3.0

func (en *EmbedNode) TreeThemeFontFace() *fontutil.FontFace

func (*EmbedNode) TreeThemePaletteColor

func (en *EmbedNode) TreeThemePaletteColor(name string) color.Color

type FloatBox

type FloatBox struct {
	ENode
	RefPoint image.Point

	MaxSize image.Point
	// contains filtered or unexported fields
}

Should be a child of FloatLayer.

func NewFloatBox

func NewFloatBox(ml *MultiLayer, content Node) *FloatBox

func (*FloatBox) Hide

func (fb *FloatBox) Hide()

func (*FloatBox) Layout

func (fb *FloatBox) Layout()

func (*FloatBox) Measure

func (fb *FloatBox) Measure(hint image.Point) image.Point

func (*FloatBox) Show

func (fb *FloatBox) Show()

func (*FloatBox) Toggle

func (fb *FloatBox) Toggle()

func (*FloatBox) Visible

func (fb *FloatBox) Visible() bool

type FloatBoxButton

type FloatBoxButton struct {
	*Button
	// contains filtered or unexported fields
}

func NewFloatBoxButton

func NewFloatBoxButton(ctx ImageContext, ml *MultiLayer, fl *FloatLayer, content Node) *FloatBoxButton

func (*FloatBoxButton) Close

func (fbb *FloatBoxButton) Close()

func (*FloatBoxButton) Layout

func (fbb *FloatBoxButton) Layout()

type FloatLayer

type FloatLayer struct {
	ENode
	// contains filtered or unexported fields
}

func (*FloatLayer) OnChildMarked

func (fl *FloatLayer) OnChildMarked(child Node, newMarks Marks)

type FreeLayout

type FreeLayout struct {
	ENode
}

func NewFreeLayout

func NewFreeLayout() *FreeLayout

func (*FreeLayout) Layout

func (fl *FreeLayout) Layout()

type ImageContext

type ImageContext interface {
	Image() draw.Image
}

type Label

type Label struct {
	ENode
	Text   *Text
	Border *Border
	Pad    *Pad
	// contains filtered or unexported fields
}

func NewLabel

func NewLabel(ctx ImageContext) *Label

func (*Label) OnThemeChange

func (l *Label) OnThemeChange()

type Marks

type Marks uint16
const (
	MarkNeedsPaint Marks = 1 << iota
	MarkNeedsLayout

	MarkChildNeedsPaint
	MarkChildNeedsLayout

	MarkPointerInside // mouseEnter/mouseLeave events
	MarkNotDraggable  // won't emit mouseDrag events

	MarkForceZeroBounds // sets bounds to zero (aka not visible)

	MarkInBoundsHandlesEvent // helps with layer nodes keep events

	// For transparent widgets that cross two or more other widgets (ex: a non visible separator handle). Improves on detecting if others need paint.
	MarkNotPaintable
)

func (*Marks) Add

func (m *Marks) Add(u Marks)

func (Marks) HasAny

func (m Marks) HasAny(u Marks) bool

func (Marks) Mask

func (m Marks) Mask(u Marks) Marks

func (*Marks) Remove

func (m *Marks) Remove(u Marks)

type MultiLayer

type MultiLayer struct {
	ENode

	BgLayer        *BgLayer
	SeparatorLayer *ENode
	ContextLayer   *FloatLayer
	MenuLayer      *FloatLayer
	// contains filtered or unexported fields
}

First/last child is the bottom/top layer.

func NewMultiLayer

func NewMultiLayer() *MultiLayer

func (*MultiLayer) AddMarkRect

func (ml *MultiLayer) AddMarkRect(r image.Rectangle)

func (*MultiLayer) InsertBefore

func (ml *MultiLayer) InsertBefore(col Node, next *EmbedNode)

func (*MultiLayer) PaintMarked

func (ml *MultiLayer) PaintMarked() image.Rectangle

type Node

type Node interface {
	Embed() *EmbedNode

	InsertBefore(n Node, mark *EmbedNode)
	Append(n ...Node)
	Remove(child Node)

	Measure(hint image.Point) image.Point

	LayoutMarked()
	LayoutTree()
	Layout() // set childs bounds, don't call childs layout
	ChildsLayoutTree()

	PaintMarked() image.Rectangle
	PaintTree() bool
	PaintBase() // pre-paint step, useful for widgets with a pre-paint stage
	Paint()
	ChildsPaintTree()

	OnThemeChange()
	OnChildMarked(child Node, newMarks Marks)
	OnInputEvent(ev any, p image.Point) event.Handled
	// contains filtered or unexported methods
}

type Pad

type Pad struct {
	*Padder
}

func NewPad

func NewPad(ctx ImageContext, child Node) *Pad

type Padder

type Padder struct {
	ENode
	Top, Right, Bottom, Left int
	// contains filtered or unexported fields
}

Used by Pad and Border.

func NewPadder

func NewPadder(ctx ImageContext, child Node) *Padder

func (*Padder) Layout

func (p *Padder) Layout()

func (*Padder) Measure

func (p *Padder) Measure(hint image.Point) image.Point

func (*Padder) Paint

func (p *Padder) Paint()

func (*Padder) Set

func (p *Padder) Set(t, r, b, l int)

func (*Padder) Set2

func (p *Padder) Set2(v [4]int)

func (*Padder) SetAll

func (p *Padder) SetAll(v int)

type Palette

type Palette map[string]color.Color

func (Palette) Empty

func (pal Palette) Empty() bool

func (Palette) Merge

func (pal Palette) Merge(p2 Palette)

type Rectangle

type Rectangle struct {
	ENode
	Size image.Point
	// contains filtered or unexported fields
}

func NewRectangle

func NewRectangle(ctx ImageContext) *Rectangle

func (*Rectangle) Measure

func (r *Rectangle) Measure(hint image.Point) image.Point

func (*Rectangle) Paint

func (r *Rectangle) Paint()

type ScrollArea

type ScrollArea struct {
	ENode
	ScrollWidth int
	LeftScroll  bool
	YBar        *ScrollBar
	XBar        *ScrollBar
	// contains filtered or unexported fields
}

func NewScrollArea

func NewScrollArea(ctx ImageContext, scrollable ScrollableNode, xbar, ybar bool) *ScrollArea

func (*ScrollArea) Layout

func (sa *ScrollArea) Layout()

func (*ScrollArea) Measure

func (sa *ScrollArea) Measure(hint image.Point) image.Point

func (*ScrollArea) OnChildMarked

func (sa *ScrollArea) OnChildMarked(child Node, newMarks Marks)

func (*ScrollArea) OnInputEvent

func (sa *ScrollArea) OnInputEvent(ev0 any, p image.Point) event.Handled

func (*ScrollArea) SetBars

func (sa *ScrollArea) SetBars(xbar, ybar bool)

type ScrollBar

type ScrollBar struct {
	ENode
	Handle     *ScrollHandle
	Horizontal bool
	// contains filtered or unexported fields
}

Used by ScrollArea. Parent of ScrollHandle.

func NewScrollBar

func NewScrollBar(ctx ImageContext, sa *ScrollArea) *ScrollBar

func (*ScrollBar) Layout

func (sb *ScrollBar) Layout()

func (*ScrollBar) OnChildMarked

func (sb *ScrollBar) OnChildMarked(child Node, newMarks Marks)

func (*ScrollBar) OnInputEvent

func (sb *ScrollBar) OnInputEvent(ev any, p image.Point) event.Handled

func (*ScrollBar) Paint

func (sb *ScrollBar) Paint()

type ScrollHandle

type ScrollHandle struct {
	ENode
	// contains filtered or unexported fields
}

Used by ScrollBar.

func NewScrollHandle

func NewScrollHandle(ctx ImageContext, sb *ScrollBar) *ScrollHandle

func (*ScrollHandle) OnInputEvent

func (sh *ScrollHandle) OnInputEvent(ev any, p image.Point) event.Handled

func (*ScrollHandle) Paint

func (sh *ScrollHandle) Paint()

type Scrollable

type Scrollable interface {
	SetScrollable(x, y bool)

	ScrollOffset() image.Point
	SetScrollOffset(image.Point)
	ScrollSize() image.Point
	ScrollViewSize() image.Point
	ScrollPageSizeY(up bool) int
	ScrollWheelSizeY(up bool) int
}

type ScrollableNode

type ScrollableNode interface {
	Node
	Scrollable
}

Used by ScrollArea.

type Separator

type Separator struct {
	Rectangle
	Handle *SeparatorHandle
}

func NewSeparator

func NewSeparator(ctx ImageContext, ml *MultiLayer) *Separator

func (*Separator) Close

func (s *Separator) Close()

func (*Separator) Layout

func (s *Separator) Layout()

type SeparatorHandle

type SeparatorHandle struct {
	ENode
	Top, Bottom, Left, Right int
	DragPad                  image.Point
	// contains filtered or unexported fields
}

A transparent widget added to a top layer (usually multilayer) to facilitate dragging. Calculations are made on top of the reference node (usually a thin separator that otherwise would not be easy to put the pointer over for dragging).

func NewSeparatorHandle

func NewSeparatorHandle(ref Node) *SeparatorHandle

func (*SeparatorHandle) Layout

func (sh *SeparatorHandle) Layout()

func (*SeparatorHandle) Measure

func (sh *SeparatorHandle) Measure(hint image.Point) image.Point

func (*SeparatorHandle) OnInputEvent

func (sh *SeparatorHandle) OnInputEvent(ev0 any, p image.Point) event.Handled

type SplBg

type SplBg struct {
	ENode
	Spl *StartPercentLayout
	Bg  Node
}

Wraps a StartPercentLayout with a node that fills the first space background.

func NewSplBg

func NewSplBg(bg Node) *SplBg

func (*SplBg) Layout

func (l *SplBg) Layout()

func (*SplBg) OnChildMarked

func (l *SplBg) OnChildMarked(child Node, newMarks Marks)

type StartPercentLayout

type StartPercentLayout struct {
	ENode
	YAxis            bool
	MinimumChildSize int
	// contains filtered or unexported fields
}

Start percent sets the child left X bound to the percent of the size. This ensures a change in the percentage of a middle child doesn't affect the bounds of the other childs (ex: like causing a small adjustment when resizing).

func NewStartPercentLayout

func NewStartPercentLayout() *StartPercentLayout

func (*StartPercentLayout) InsertBefore

func (spl *StartPercentLayout) InsertBefore(n Node, mark *EmbedNode)

func (*StartPercentLayout) Layout

func (spl *StartPercentLayout) Layout()

func (*StartPercentLayout) MaximizeNode

func (spl *StartPercentLayout) MaximizeNode(node Node)

func (*StartPercentLayout) Measure

func (spl *StartPercentLayout) Measure(hint image.Point) image.Point

func (*StartPercentLayout) RawStartPercent

func (spl *StartPercentLayout) RawStartPercent(child Node) float64

Used for encoding/decoding only. (Ex: sessions)

func (*StartPercentLayout) Remove

func (spl *StartPercentLayout) Remove(n Node)

func (*StartPercentLayout) Resize

func (spl *StartPercentLayout) Resize(node Node, percent float64)

func (*StartPercentLayout) ResizeWithMove

func (spl *StartPercentLayout) ResizeWithMove(node Node, percent float64)

func (*StartPercentLayout) SetPercentWithPush

func (spl *StartPercentLayout) SetPercentWithPush(node Node, percentPos float64)

func (*StartPercentLayout) SetRawStartPercent

func (spl *StartPercentLayout) SetRawStartPercent(child Node, v float64)

Used for encoding/decoding only. (Ex: sessions)

func (*StartPercentLayout) SetSizePercentWithPush

func (spl *StartPercentLayout) SetSizePercentWithPush(node Node, sizePercent float64)

type Text

type Text struct {
	ENode
	TextScroll

	Drawer drawutil.Drawer
	// contains filtered or unexported fields
}

func NewText

func NewText(ctx ImageContext) *Text

func (*Text) Bytes

func (t *Text) Bytes() ([]byte, error)

Result might not be a copy, so changes to the slice might affect the text data.

func (*Text) GetIndex

func (t *Text) GetIndex(p image.Point) int

func (*Text) GetPoint

func (t *Text) GetPoint(i int) image.Point

func (*Text) IndexVisible

func (t *Text) IndexVisible(offset int) bool

func (*Text) Layout

func (t *Text) Layout()

func (*Text) Len

func (t *Text) Len() int

func (*Text) LineHeight

func (t *Text) LineHeight() int

func (*Text) MakeIndexVisible

func (t *Text) MakeIndexVisible(offset int)

func (*Text) MakeRangeVisible

func (t *Text) MakeRangeVisible(offset, n int)

func (*Text) MakeRangeVisible2 added in v1.3.8

func (t *Text) MakeRangeVisible2(offset, n int, align drawutil.RangeAlignment)

func (*Text) Measure

func (t *Text) Measure(hint image.Point) image.Point

func (*Text) OnThemeChange

func (t *Text) OnThemeChange()

func (*Text) Paint

func (t *Text) Paint()

func (*Text) PaintBase

func (t *Text) PaintBase()

func (*Text) RW added in v1.3.0

func (t *Text) RW() iorw.ReadWriterAt

func (*Text) RuneOffset

func (t *Text) RuneOffset() int

func (*Text) SetBytes

func (t *Text) SetBytes(b []byte) error

func (*Text) SetRW

func (t *Text) SetRW(rw iorw.ReadWriterAt)

func (*Text) SetRuneOffset

func (t *Text) SetRuneOffset(v int)

func (*Text) SetScrollable

func (t *Text) SetScrollable(x, y bool)

implements Scrollable interface.

func (*Text) SetStr

func (t *Text) SetStr(str string) error

func (*Text) Str

func (t *Text) Str() string

type TextEdit

type TextEdit struct {
	*Text

	RWEvReg *evreg.Register // the rwundo wraps the rwev, so on a write event callback, the undo data is not commited yet. It is incorrect to try to undo inside a write callback. If a rwev wraps rwundo, undoing will not trigger the outer rwev events, otherwise undoing would register as another undo event (cycle).
	// contains filtered or unexported fields
}

func NewTextEdit

func NewTextEdit(uiCtx UIContext) *TextEdit

func (*TextEdit) AppendBytesClearHistory

func (te *TextEdit) AppendBytesClearHistory(b []byte) error

func (*TextEdit) BeginUndoGroup added in v1.3.0

func (te *TextEdit) BeginUndoGroup()

func (*TextEdit) ClearPos

func (te *TextEdit) ClearPos()

func (*TextEdit) ClearUndones added in v1.3.0

func (te *TextEdit) ClearUndones()

func (*TextEdit) Cursor added in v1.3.0

func (te *TextEdit) Cursor() rwedit.Cursor

func (*TextEdit) CursorIndex added in v1.3.0

func (te *TextEdit) CursorIndex() int

func (*TextEdit) EditCtx added in v1.3.0

func (te *TextEdit) EditCtx() *rwedit.Ctx

func (*TextEdit) EndUndoGroup added in v1.3.0

func (te *TextEdit) EndUndoGroup()

func (*TextEdit) HandleRWWrite2 added in v1.3.0

func (te *TextEdit) HandleRWWrite2(ev *iorw.RWEvWrite2)

Called when changes were made on another row

func (*TextEdit) MakeCursorVisible added in v1.3.0

func (te *TextEdit) MakeCursorVisible()

func (*TextEdit) OnInputEvent added in v1.3.0

func (te *TextEdit) OnInputEvent(ev any, p image.Point) event.Handled

func (*TextEdit) RW added in v1.3.0

func (te *TextEdit) RW() iorw.ReadWriterAt

func (*TextEdit) Redo added in v1.3.0

func (te *TextEdit) Redo() error

func (*TextEdit) SetBytes

func (te *TextEdit) SetBytes(b []byte) error

func (*TextEdit) SetBytesClearHistory

func (te *TextEdit) SetBytesClearHistory(b []byte) error

Keeps position (useful for file save)

func (*TextEdit) SetBytesClearPos

func (te *TextEdit) SetBytesClearPos(b []byte) error

func (*TextEdit) SetCursorIndex added in v1.3.0

func (te *TextEdit) SetCursorIndex(i int)

func (*TextEdit) SetRW

func (te *TextEdit) SetRW(rw iorw.ReadWriterAt)

func (*TextEdit) SetRWFromMaster added in v1.3.0

func (te *TextEdit) SetRWFromMaster(m *TextEdit)

func (*TextEdit) SetStr

func (te *TextEdit) SetStr(str string) error

func (*TextEdit) SetStrClearHistory

func (te *TextEdit) SetStrClearHistory(str string) error

func (*TextEdit) SetStrClearPos

func (te *TextEdit) SetStrClearPos(str string) error

func (*TextEdit) Undo added in v1.3.0

func (te *TextEdit) Undo() error

type TextEditX

type TextEditX struct {
	*TextEdit
	// contains filtered or unexported fields
}

textedit with extensions

func NewTextEditX

func NewTextEditX(uiCtx UIContext) *TextEditX

func (*TextEditX) EnableCursorWordHighlight

func (te *TextEditX) EnableCursorWordHighlight(v bool)

func (*TextEditX) EnableParenthesisMatch

func (te *TextEditX) EnableParenthesisMatch(v bool)

func (*TextEditX) EnableSyntaxHighlight

func (te *TextEditX) EnableSyntaxHighlight(v bool)

func (*TextEditX) FlashIndexLen

func (te *TextEditX) FlashIndexLen(index int, len int)

func (*TextEditX) FlashLine

func (te *TextEditX) FlashLine(index int)

func (*TextEditX) OnThemeChange

func (te *TextEditX) OnThemeChange()

func (*TextEditX) Paint

func (te *TextEditX) Paint()

func (*TextEditX) PaintBase

func (te *TextEditX) PaintBase()

func (*TextEditX) SetCommentStrings

func (te *TextEditX) SetCommentStrings(a ...any)

type TextScroll

type TextScroll struct {
	*Text
}

func (*TextScroll) ScrollOffset

func (ts *TextScroll) ScrollOffset() image.Point

func (*TextScroll) ScrollPageSizeY

func (ts *TextScroll) ScrollPageSizeY(up bool) int

func (*TextScroll) ScrollSize

func (ts *TextScroll) ScrollSize() image.Point

func (*TextScroll) ScrollViewSize

func (ts *TextScroll) ScrollViewSize() image.Point

func (*TextScroll) ScrollWheelSizeY

func (ts *TextScroll) ScrollWheelSizeY(up bool) int

func (*TextScroll) SetScrollOffset

func (ts *TextScroll) SetScrollOffset(o image.Point)

type Theme

type Theme struct {
	FontFace          *fontutil.FontFace
	Palette           Palette
	PaletteNamePrefix string
}

func (*Theme) Clear

func (t *Theme) Clear()

func (*Theme) SetFontFace added in v1.3.0

func (t *Theme) SetFontFace(ff *fontutil.FontFace)

Can be set to nil to erase.

func (*Theme) SetPalette

func (t *Theme) SetPalette(p Palette)

Can be set to nil to erase.

func (*Theme) SetPaletteColor

func (t *Theme) SetPaletteColor(name string, c color.Color)

Can be set to nil to erase.

func (*Theme) SetPaletteNamePrefix

func (t *Theme) SetPaletteNamePrefix(prefix string)

Can be set to "" to erase.

type TopShadow

type TopShadow struct {
	ENode
	Height  int
	MaxDiff float64
	// contains filtered or unexported fields
}

func NewTopShadow

func NewTopShadow(ctx ImageContext, content Node) *TopShadow

func (*TopShadow) ChildsPaintTree

func (s *TopShadow) ChildsPaintTree()

func (*TopShadow) OnChildMarked

func (s *TopShadow) OnChildMarked(child Node, newMarks Marks)

func (*TopShadow) Paint

func (s *TopShadow) Paint()

type UIContext added in v1.3.0

type UIContext interface {
	Error(error)

	ImageContext
	CursorContext

	RunOnUIGoRoutine(f func())
	SetClipboardData(event.ClipboardIndex, string)
	GetClipboardData(event.ClipboardIndex, func(string, error))
}

type XYAxis

type XYAxis struct {
	YAxis bool
}

Allows calculations to be done X oriented, and have it translated to Y axis. Useful for layouts that want to layout elements in a vertical or horizontal direction depending on a flag.

func (*XYAxis) BoolPair

func (xy *XYAxis) BoolPair(bp XYAxisBoolPair) XYAxisBoolPair

func (*XYAxis) Point

func (xy *XYAxis) Point(p *image.Point) image.Point

func (*XYAxis) Rectangle

func (xy *XYAxis) Rectangle(r *image.Rectangle) image.Rectangle

type XYAxisBoolPair

type XYAxisBoolPair struct {
	X, Y bool
}

Jump to

Keyboard shortcuts

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