ui

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: BSD-3-Clause Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ScrollBarWidthDp is a default width of scroll bar in ScrollView in Dip
	ScrollBarWidthDp = 32
	// ScrollBarMinHeightDp is a default minimum height of scroll bar in Dip.
	// ScrollBar height is smaller by increasing Scroller#MaximumStep, the minimum height
	// prevents making too small to visible.
	ScrollBarMinHeightDp = 32
	// ScrollButtonHeightDp is a default height of scroll button for both of up and down.
	ScrollButtonHeightDp = 32

	// ScrollDefaultVisibleStep is a default number of steps of content which is visible on view window.
	ScrollDefaultVisibleStep = 30
)

Variables

View Source
var (
	// ErrorGameQuitByRestartRequest indicates the game thread ends by restart request.
	// It is notified via ModelErorr and can be obtained from ModelError.Cause().
	ErrorGameQuitByRestartRequest = fmt.Errorf("Quit model thread by restart request")

	// ErrorGameAlreadyRunning indicates the game thread already running but
	// invalid operations such as starting the game are arrived.
	ErrorGameAlreadyRunning = fmt.Errorf("game already running")
)
View Source
var (
	ScrollBarFgColor      = colornames.Grey600
	ScrollBarFgHoverColor = colornames.Grey400
	ScrollBarFgFocusColor = colornames.Grey300
	ScrollBarBgColor      = colornames.Grey900
)
View Source
var DefaultTextViewOptions = TextViewOptions{
	MaxParagraphs:     1024,
	MaxParagraphBytes: 1024,
}

DefaultTextViewOptions defines the volume of stored text content, which can be visible by scrolling.

Functions

This section is empty.

Types

type CmdSender

type CmdSender interface {
	SendCommand(cmd string)
	SendRawCommand(r rune)
	SendControlSkippingWait(enable bool)
}

CmdSender is interface for sending information to the model.

type CommandLine

type CommandLine struct {
	node.LeafEmbed
	// contains filtered or unexported fields
}

CommandLine is a leaf widget which can edit its text content and submit it.

func NewCommandLine

func NewCommandLine(sender CmdSender) *CommandLine

construct new CommandLine widget with custom theme.

func (*CommandLine) Append

func (cl *CommandLine) Append(s string)

append text at end of command line. and position is moved to end.

func (CommandLine) Close

func (cl CommandLine) Close()

finalization. after this editing text does not work. It is exported for unexpected panic. It is called automatically onLifeCycelEvent.

func (*CommandLine) Confirm

func (cl *CommandLine) Confirm() string

confirm current text as command and return it. all of the command line's text is cleared after confirming.

func (*CommandLine) Delete

func (cl *CommandLine) Delete(n_rune int) int

delete n runes backwards. It returns deleted number of runes.

func (*CommandLine) InsertString

func (cl *CommandLine) InsertString(s string)

insert text at current positon

func (*CommandLine) Measure

func (cl *CommandLine) Measure(t *theme.Theme, widthHint, heightHint int)

implements node.Node interface.

func (*CommandLine) MoveCurosr

func (cl *CommandLine) MoveCurosr(n_rune int)

func (*CommandLine) OnInputEvent

func (cl *CommandLine) OnInputEvent(ev interface{}, origin image.Point) node.EventHandled

implements node.Node interface.

func (*CommandLine) OnLifecycleEvent

func (cl *CommandLine) OnLifecycleEvent(e lifecycle.Event)

func (*CommandLine) PaintBase

func (cl *CommandLine) PaintBase(ctx *node.PaintBaseContext, origin image.Point) error

implements node.Node interface.

type DiscreteScroller added in v0.7.0

type DiscreteScroller interface {
	// Scroll scrolls view by step. Positive step means lower content is visible, otherwise upper content is visible.
	Scroll(step int)
	// CurrentStep indicates current position of scroll region.
	// step =0 indicates top of content and =(MaximumStep-VisibleStep) indicates bottom end of content.
	// That is, current step can take [0:(MaximumStep-Visiblestep)].
	CurrentStep() int
	// MaximumStep indicates maximum poition of scroll region.
	MaximumStep() int
	// VisibleStep indicates number of steps of the content which is visble on view window.
	// Negative value means can not detect it by implementer, in such case use default value instead.
	VisibleStep() int
	// OnScroll registers callback function which is called every call of Scroll.
	// currStep and maxStep which is same as return value of CurrentStep and MaximumStep,
	// are passed to the callback.
	OnScroll(fn func(currStep, maxStep, visibleStep int))
}

DiscreteScroller is a interface for scrollable view whose scroll is discreted by step. It cooperates with ScrollView.

type DiscreteScrollerNode added in v0.7.0

type DiscreteScrollerNode interface {
	DiscreteScroller
	node.Node
}

DiscreteScrollerNode is a composit interface of Scroller and node.Node.

type Edge

type Edge uint8

Edge is four edges in square shape, upper, bottom, left, and right.

const (
	EdgeNone Edge = iota
	EdgeTop
	EdgeBottom
	EdgeLeft
	EdgeRight
)

func (Edge) Horizontal

func (e Edge) Horizontal() bool

whether Edge axis is Horizontal?

func (Edge) Vertical

func (e Edge) Vertical() bool

whether Edge axis is Vertical?

type EragoPresenter

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

EragoPresenter is mediator between erago.Game model and GUI widgets. It sends PresenterTask and ModelError for eventQ, user should handle these.

func NewEragoPresenter

func NewEragoPresenter(eventQ screen.EventDeque) *EragoPresenter

func (*EragoPresenter) AddRequestObserver

func (p *EragoPresenter) AddRequestObserver(obs uiadapter.RequestObserver)

add uiadapter.RequestObserver to notify inputRequest is changed. it is valid before RunGameThread() and not used concurrently.

func (*EragoPresenter) CommandWaiting

func (p *EragoPresenter) CommandWaiting() bool

return command event is waitng?

func (*EragoPresenter) InputWaiting

func (p *EragoPresenter) InputWaiting() bool

return any input event is waitng?

func (*EragoPresenter) Mark

func (p *EragoPresenter) Mark(n node.Node, mark node.Marks)

Mark any node.Marks, NeedsPaint etc, to node n. It is queued in main event queue and execute on UI thread, not execute immdiately.

func (*EragoPresenter) OnRequestChanged

func (p *EragoPresenter) OnRequestChanged(typ uiadapter.InputRequestType)

implements uiadapter.RequestObserver

func (*EragoPresenter) Quit

func (p *EragoPresenter) Quit()

send quit signal to the internal model execution. it must be called after RunGameThread().

func (*EragoPresenter) RestartGameThread added in v0.5.0

func (p *EragoPresenter) RestartGameThread(ui uiadapter.UI, conf erago.Config) error

RestartGameThread restarts game thread with another game instance. Exsiting game thread is stopped and diposed. It returns nil when restart succeeded and also notifies ModelError.Cause() == ErrorGameQuitByRestartRequest through the event queue. Otherwise returns error.

func (*EragoPresenter) RunGameThread

func (p *EragoPresenter) RunGameThread(ui uiadapter.UI, Conf erago.Config) error

run game main thread on other gorutine. return true if staring at first time, false if multiple calling this.

func (*EragoPresenter) SendCommand

func (p *EragoPresenter) SendCommand(cmd string)

implements CmdSender interface.

func (*EragoPresenter) SendControlSkippingWait

func (p *EragoPresenter) SendControlSkippingWait(enable bool)

implements CmdSender interface.

func (*EragoPresenter) SendRawCommand

func (p *EragoPresenter) SendRawCommand(r rune)

implements CmdSender interface.

type FixedSplit

type FixedSplit struct {
	node.ContainerEmbed

	Edge       Edge
	BorderSize unit.Value
}

FixedSplit splits itself to 2 widgets. its splitting line is same axis as Edge and BorderSize away from Edge. The size of Node close to Edge is fixed by BorderSize and another Node's one is chaged by FixedSplit's size. These sizes along with Edge are always expanded or shrinked to fit FixedSplit's size.

func NewFixedSplit

func NewFixedSplit(edge Edge, borderSize unit.Value, fixedNode, another node.Node) *FixedSplit

func (*FixedSplit) Insert

func (fsp *FixedSplit) Insert(c, nextSibling node.Node)

can not insert new child after build.

func (*FixedSplit) Layout

func (fsp *FixedSplit) Layout(t *theme.Theme)

implements node.Node interface

func (*FixedSplit) Measure

func (fsp *FixedSplit) Measure(t *theme.Theme, widthHint, heightHint int)

implements node.Node interface

func (*FixedSplit) OnInputEvent

func (fsp *FixedSplit) OnInputEvent(ev interface{}, origin image.Point) node.EventHandled

type Frame

type Frame struct {
	*widget.Padder

	// color to draw frame.
	ThemeColor theme.Color
}

frame is a shell widget which paints frame on its margin space.

func NewFrame

func NewFrame(margin unit.Value, color theme.Color, inner node.Node) *Frame

func (*Frame) PaintBase

func (w *Frame) PaintBase(ctx *node.PaintBaseContext, origin image.Point) error

implements node.Node interface. Paint flikers the screen so deprecated.

type ImageView

type ImageView struct {
	node.LeafEmbed
	// contains filtered or unexported fields
}

ImageView is a leaf widget that paints image.Image. the painted image is fitted to its widget size so that entire view of image is shown.

func NewImageView

func NewImageView(filename string) *ImageView

func (*ImageView) Layout

func (v *ImageView) Layout(t *theme.Theme)

func (*ImageView) Measure

func (v *ImageView) Measure(t *theme.Theme, widthHint, heightHint int)

func (*ImageView) PaintBase

func (v *ImageView) PaintBase(ctx *node.PaintBaseContext, origin image.Point) error

func (*ImageView) SrcName

func (v *ImageView) SrcName() string

type ModelError

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

ModelError reperesents error in the Game model. The Game also returns error(nil) if quiting it correctly. To distinguish quiting signal and an error, check ModelError.HasCause(). It means error that having a cause, quiting signal otherwise.

func (ModelError) Cause added in v0.5.0

func (me ModelError) Cause() error

Cause returns error which caused this ModelError, or may return nil when game thread quiting correctly.

func (ModelError) Error

func (me ModelError) Error() string

implements error interface.

func (ModelError) HasCause

func (me ModelError) HasCause() bool

whether model's error has cause? model error if cause exist, quiting signal otherwise.

type MultipleView

type MultipleView struct {
	// ShellEmbed has MultipleView's root as a child.
	// a child may be changed dynamically from other goroutine.
	node.ShellEmbed
	// contains filtered or unexported fields
}

MultipleView is abstruct of multiple views which has current view state. It implements uiadapter.UI interface, the functions accessing current view are called through currentView.Printer.

func NewMultipleView

func NewMultipleView(sender *EragoPresenter) *MultipleView

func (*MultipleView) ClearLine

func (mv *MultipleView) ClearLine(nline int) error

func (*MultipleView) ClearLineAll

func (mv *MultipleView) ClearLineAll() error

func (*MultipleView) Close

func (mv *MultipleView) Close()

finalize MultipleView. Multiple calling It is OK but do nothing. It is called automatically when lifecycle stage go to StageDead. but for unexpected panic, it is exported.

func (*MultipleView) CurrentRuneWidth

func (mv *MultipleView) CurrentRuneWidth() (int, error)

func (*MultipleView) GetAlignment

func (mv *MultipleView) GetAlignment() (attr.Alignment, error)

func (*MultipleView) GetColor

func (mv *MultipleView) GetColor() (color uint32, err error)

func (*MultipleView) GetCurrentViewName

func (mv *MultipleView) GetCurrentViewName() string

implement uiadapter.UI.

func (*MultipleView) GetViewNames

func (mv *MultipleView) GetViewNames() []string

implement uiadapter.UI.

func (*MultipleView) Layout

func (mv *MultipleView) Layout(t *theme.Theme)

func (*MultipleView) LineCount

func (mv *MultipleView) LineCount() (int, error)

func (*MultipleView) Measure

func (mv *MultipleView) Measure(t *theme.Theme, widthHint, heightHint int)

func (*MultipleView) MeasureImageSize added in v0.6.0

func (mv *MultipleView) MeasureImageSize(file string, widthInRW, heightInLC int) (int, int, error)

func (*MultipleView) NewPage

func (mv *MultipleView) NewPage() error

func (*MultipleView) OnInputEvent

func (mv *MultipleView) OnInputEvent(ev interface{}, origin image.Point) node.EventHandled

func (*MultipleView) OnLifeCycleEvent

func (mv *MultipleView) OnLifeCycleEvent(e lifecycle.Event)

func (*MultipleView) Paint

func (mv *MultipleView) Paint(ctx *node.PaintContext, origin image.Point) error

implements node.Node interface.

func (*MultipleView) PaintBase

func (mv *MultipleView) PaintBase(ctx *node.PaintBaseContext, origin image.Point) error

implements node.Node interface.

func (*MultipleView) Print

func (mv *MultipleView) Print(s string) error

func (*MultipleView) PrintButton

func (mv *MultipleView) PrintButton(caption string, command string) error

func (*MultipleView) PrintImage added in v0.6.0

func (mv *MultipleView) PrintImage(file string, widthInRW, heightInLC int) error

func (*MultipleView) PrintLabel

func (mv *MultipleView) PrintLabel(s string) error

func (*MultipleView) PrintLine

func (mv *MultipleView) PrintLine(sym string) error

func (*MultipleView) ResetColor

func (mv *MultipleView) ResetColor() error

func (*MultipleView) SetAlignment

func (mv *MultipleView) SetAlignment(a attr.Alignment) error

func (*MultipleView) SetColor

func (mv *MultipleView) SetColor(color uint32) error

func (*MultipleView) SetCurrentView

func (mv *MultipleView) SetCurrentView(vname string) error

implement uiadapter.UI.

func (*MultipleView) SetHorizontalLayout

func (mv *MultipleView) SetHorizontalLayout(vname1, vname2 string, rate float64) error

implement uiadapter.UI.

func (*MultipleView) SetLayout

func (mv *MultipleView) SetLayout(l *attr.LayoutData) error

implement uiadapter.UI.

func (*MultipleView) SetSingleLayout

func (mv *MultipleView) SetSingleLayout(vname string) error

implement uiadapter.UI.

func (*MultipleView) SetVerticalLayout

func (mv *MultipleView) SetVerticalLayout(vname1, vname2 string, rate float64) error

implement uiadapter.UI.

func (*MultipleView) String

func (mv *MultipleView) String() string

implements fmt.Stringer interface.

func (*MultipleView) Sync

func (mv *MultipleView) Sync() error

func (*MultipleView) WindowLineCount

func (mv *MultipleView) WindowLineCount() (int, error)

func (*MultipleView) WindowRuneWidth

func (mv *MultipleView) WindowRuneWidth() (int, error)

type PresenterTask

type PresenterTask func()

Presenter pushes asynchronized task for screen.EventDeque. it should handled on UI thread.

func (PresenterTask) Run

func (task PresenterTask) Run()

execute task.

type Printer

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

Printer is interface for text.Frame. It implements erago.uiadapter.UI.Printer

func NewPrinter

func NewPrinter(f *text.Frame) *Printer

func (Printer) ClearLine

func (p Printer) ClearLine(nline int)

implemnts erago/uiadapter/UI.

func (Printer) ClearLineAll

func (p Printer) ClearLineAll()

implemnts erago/uiadapter/UI.

func (Printer) CurrentRuneWidth

func (p Printer) CurrentRuneWidth() int

implemnts erago/uiadapter/UI.

func (Printer) GetAlignment

func (p Printer) GetAlignment() attr.Alignment

implemnts erago/uiadapter/UI.

func (Printer) GetColor

func (p Printer) GetColor() uint32

implemnts erago/uiadapter/UI.

func (Printer) LineCount

func (p Printer) LineCount() int

implemnts erago/uiadapter/UI.

func (Printer) NewPage

func (p Printer) NewPage()

implemnts erago/uiadapter/UI.

func (Printer) Print

func (p Printer) Print(s string)

implemnts erago/uiadapter/UI.

func (Printer) PrintButton

func (p Printer) PrintButton(caption, cmd string)

implemnts erago/uiadapter/UI.

func (Printer) PrintImage added in v0.6.0

func (p Printer) PrintImage(file string, widthInRW, heightInLC int)

implements erago/uiadapter/UI.

func (Printer) PrintLabel

func (p Printer) PrintLabel(s string)

implemnts erago/uiadapter/UI.

func (Printer) PrintLine

func (p Printer) PrintLine(sym string)

implemnts erago/uiadapter/UI.

func (Printer) ResetColor

func (p Printer) ResetColor()

implemnts erago/uiadapter/UI.

func (Printer) SetAlignment

func (p Printer) SetAlignment(a attr.Alignment)

implemnts erago/uiadapter/UI.

func (Printer) SetColor

func (p Printer) SetColor(c uint32)

implemnts erago/uiadapter/UI.

func (Printer) WindowLineCount

func (p Printer) WindowLineCount() int

implemnts erago/uiadapter/UI.

func (Printer) WindowRuneWidth

func (p Printer) WindowRuneWidth() int

implemnts erago/uiadapter/UI.

type ScrollBar added in v0.7.0

type ScrollBar struct {
	node.LeafEmbed

	ScrollBarWidthDp     int
	ScrollBarMinHeightDp int
	ScrollButtonHeightDp int
	// contains filtered or unexported fields
}

func NewScrollBar added in v0.7.0

func NewScrollBar() *ScrollBar

func (*ScrollBar) CurrentStep added in v0.7.0

func (sbar *ScrollBar) CurrentStep() int

func (*ScrollBar) Layout added in v0.7.0

func (sbar *ScrollBar) Layout(t *theme.Theme)

Implement node.Node interface.

func (*ScrollBar) MaximumStep added in v0.7.0

func (sbar *ScrollBar) MaximumStep() int

func (*ScrollBar) Measure added in v0.7.0

func (sbar *ScrollBar) Measure(t *theme.Theme, widthHint int, heightHint int)

implement node.Node interface

func (*ScrollBar) OnInputEvent added in v0.7.0

func (sbar *ScrollBar) OnInputEvent(e interface{}, origin image.Point) node.EventHandled

Implement node.Node interface.

func (*ScrollBar) OnScroll added in v0.7.0

func (sbar *ScrollBar) OnScroll(fn func(currStep, maxStep, visibleStep int))

func (*ScrollBar) PaintBase added in v0.7.0

func (sbar *ScrollBar) PaintBase(ctx *node.PaintBaseContext, origin image.Point) error

func (*ScrollBar) Scroll added in v0.7.0

func (sbar *ScrollBar) Scroll(step int)

func (*ScrollBar) Update added in v0.7.0

func (sbar *ScrollBar) Update(currStep, maxStep, visibleStep int)

func (*ScrollBar) VisibleStep added in v0.7.0

func (sbar *ScrollBar) VisibleStep() int

type ScrollInner added in v0.7.0

type ScrollInner struct {
	DiscreteScroller
	node.Node
}

ScrollInner Implements DiscreteScrollerNode interface

func NewScrollInnerFromChildNode added in v0.7.0

func NewScrollInnerFromChildNode(n node.Node) *ScrollInner

NewScrollInnerFromChildNode is a helper function which takes inner Node and find object implementing Scroller interface by preorder travasal in tree of Node children. This function will panic when given node has no object implementing Scroller interface in the finding path.

type ScrollView added in v0.7.0

type ScrollView struct {
	*widget.Flow
	// contains filtered or unexported fields
}

func NewScrollView added in v0.7.0

func NewScrollView(inner DiscreteScrollerNode) *ScrollView

func NewScrollViewFromNode added in v0.7.0

func NewScrollViewFromNode(n node.Node) *ScrollView

NewScrollViewFromNode creates ScrollView from node.Node. The node.Node should contains DiscreteScroller interface implementer in its child tree (including node itself).

func (*ScrollView) Layout added in v0.7.0

func (sv *ScrollView) Layout(t *theme.Theme)

Implement node.Node interface.

func (*ScrollView) OnInputEvent added in v0.7.0

func (sv *ScrollView) OnInputEvent(e interface{}, origin image.Point) node.EventHandled

func (*ScrollView) PaintBase added in v0.7.0

func (sv *ScrollView) PaintBase(ctx *node.PaintBaseContext, origin image.Point) error

type Sheet added in v0.8.0

type Sheet struct {
	*widget.Sheet
}

Sheet is same as widget.Sheet, but avoid some bugs cases, such as empty rect.

func NewSheet added in v0.8.0

func NewSheet(inner node.Node) *Sheet

func (*Sheet) Paint added in v0.8.0

func (s *Sheet) Paint(ctx *node.PaintContext, origin image.Point) error

type TabView

type TabView struct {
	*widget.Flow
	// contains filtered or unexported fields
}

TabView is a container widget which paints only current view and has tabs for selecting view to paint. It implements uiadapter.UI interface, the functions accessing current view are called through currentView.Printer.

func NewTabView

func NewTabView(sender *EragoPresenter) *TabView

func (*TabView) ClearLine

func (v *TabView) ClearLine(nline int)

func (*TabView) ClearLineAll

func (v *TabView) ClearLineAll()

func (*TabView) CurrentRuneWidth

func (v *TabView) CurrentRuneWidth() (int, error)

func (*TabView) GetAlignment

func (v *TabView) GetAlignment() (attr.Alignment, error)

func (*TabView) GetColor

func (v *TabView) GetColor() (color uint32, err error)

func (*TabView) GetCurrentViewName

func (v *TabView) GetCurrentViewName() string

func (*TabView) GetViewNames

func (v *TabView) GetViewNames() []string

func (*TabView) Layout

func (v *TabView) Layout(t *theme.Theme)

func (*TabView) LineCount

func (v *TabView) LineCount() (int, error)

func (*TabView) Measure

func (v *TabView) Measure(t *theme.Theme, widthHint, heightHint int)

func (*TabView) NewPage

func (v *TabView) NewPage()

func (*TabView) OnInputEvent

func (v *TabView) OnInputEvent(ev interface{}, origin image.Point) node.EventHandled

func (*TabView) Paint

func (v *TabView) Paint(ctx *node.PaintContext, origin image.Point) error

func (*TabView) PaintBase

func (v *TabView) PaintBase(ctx *node.PaintBaseContext, origin image.Point) error

func (*TabView) Print

func (v *TabView) Print(s string)

func (*TabView) PrintButton

func (v *TabView) PrintButton(caption string, command string)

func (*TabView) PrintLabel

func (v *TabView) PrintLabel(s string)

func (*TabView) PrintLine

func (v *TabView) PrintLine(sym string)

func (*TabView) ResetColor

func (v *TabView) ResetColor() error

func (*TabView) SetAlignment

func (v *TabView) SetAlignment(a attr.Alignment) error

func (*TabView) SetColor

func (v *TabView) SetColor(color uint32) error

func (*TabView) SetCurrentView

func (v *TabView) SetCurrentView(vname string) error

func (*TabView) SetHorizontalLayout

func (v *TabView) SetHorizontalLayout(vname1 string, vname2 string, rate float64) error

func (*TabView) SetLayout

func (v *TabView) SetLayout(layout *attr.LayoutData) error

func (*TabView) SetSingleLayout

func (v *TabView) SetSingleLayout(name string) error

func (*TabView) SetVerticalLayout

func (v *TabView) SetVerticalLayout(vname1 string, vname2 string, rate float64) error

func (*TabView) WindowLineCount

func (v *TabView) WindowLineCount() (int, error)

func (*TabView) WindowRuneWidth

func (v *TabView) WindowRuneWidth() (int, error)

type TextView

type TextView struct {
	node.LeafEmbed
	// implements erago/uiadapter.Printer interface.
	*Printer
	// contains filtered or unexported fields
}

View is interface of text.Frame and its Printer. Any text.Frame is treated through View. View is identified by uniq name.

func NewTextView

func NewTextView(name string, sender *EragoPresenter, opts ...TextViewOptions) *TextView

func (*TextView) ClearLine

func (v *TextView) ClearLine(nline int) error

func (*TextView) ClearLineAll

func (v *TextView) ClearLineAll() error

func (*TextView) Close

func (v *TextView) Close()

close to explicitly finalize this.

func (*TextView) CurrentRuneWidth

func (v *TextView) CurrentRuneWidth() (int, error)

func (*TextView) CurrentStep added in v0.7.0

func (v *TextView) CurrentStep() int

func (*TextView) FindCommand

func (v *TextView) FindCommand(at, origin image.Point) (string, bool)

find clicakble Command at the postion. Return command and command found.

func (*TextView) Focus

func (v *TextView) Focus()

Focused means this view is current view on viewManager, not lifecycle.Focused.

func (*TextView) GetAlignment

func (v *TextView) GetAlignment() (attr.Alignment, error)

func (*TextView) GetColor

func (v *TextView) GetColor() (uint32, error)

func (*TextView) HighlightCommand

func (v *TextView) HighlightCommand(at, origin image.Point) bool

highlight Command at the postion. Return highlighted command is found.

func (*TextView) Layout

func (v *TextView) Layout(t *theme.Theme)

implements node.Node interface

func (*TextView) LineCount

func (v *TextView) LineCount() (int, error)

func (*TextView) MaximumStep added in v0.7.0

func (v *TextView) MaximumStep() int

func (*TextView) Measure

func (v *TextView) Measure(t *theme.Theme, widthHint, heightHint int)

implements node.Node interface

func (*TextView) MeasureImageSize added in v0.6.0

func (v *TextView) MeasureImageSize(file string, widthInRW, heightInLC int) (width, height int, err error)

func (*TextView) NewPage

func (v *TextView) NewPage() error

func (*TextView) OnInputEvent

func (v *TextView) OnInputEvent(ev interface{}, origin image.Point) node.EventHandled

implements node.Node interface if it has no focus then do nothing and return NotHandled.

func (*TextView) OnScroll added in v0.7.0

func (v *TextView) OnScroll(fn func(currStep, maxStep, visibleStep int))

func (*TextView) PaintBase

func (v *TextView) PaintBase(ctx *node.PaintBaseContext, origin image.Point) error

implements node.Node interface if it has no MarkPaintBase then do nothing.

func (*TextView) Print

func (v *TextView) Print(s string) error

func (*TextView) PrintButton

func (v *TextView) PrintButton(caption string, command string) error

func (*TextView) PrintImage added in v0.6.0

func (v *TextView) PrintImage(file string, widthInRW, heightInLC int) error

func (*TextView) PrintLabel

func (v *TextView) PrintLabel(s string) error

func (*TextView) PrintLine

func (v *TextView) PrintLine(sym string) error

func (*TextView) ResetColor

func (v *TextView) ResetColor() error

func (*TextView) Scroll added in v0.7.0

func (v *TextView) Scroll(step int)

Scroll scrolls view by step. Positive step means lower content is visible, otherwise upper content is visible.

func (*TextView) SetAlignment

func (v *TextView) SetAlignment(a attr.Alignment) error

func (*TextView) SetColor

func (v *TextView) SetColor(c uint32) error

func (*TextView) String

func (v *TextView) String() string

implements fmt.Stringer

func (*TextView) Sync

func (v *TextView) Sync() error

func (*TextView) Unfocus

func (v *TextView) Unfocus()

func (*TextView) VisibleStep added in v0.7.0

func (v *TextView) VisibleStep() int

func (*TextView) WindowLineCount

func (v *TextView) WindowLineCount() (int, error)

func (*TextView) WindowRuneWidth

func (v *TextView) WindowRuneWidth() (int, error)

type TextViewOptions added in v0.7.0

type TextViewOptions = text.FrameOptions

Jump to

Keyboard shortcuts

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