Involved Source Filesansi.goapplication.goborders.gobox.gobutton.gocheckbox.gocontextmenu.go Package cview implements rich widgets for terminal based user interfaces.
See the demos folder and the example application provided with the
NewApplication documentation for usage examples.
Types
This package is built on top of tcell, which provides the types necessary to
create a terminal-based application (e.g. EventKey). For information on
inherited types see the tcell documentation.
tcell: https://github.com/gdamore/tcell
Base Primitive
Widgets must implement the Primitive interface. All widgets embed the base
primitive, Box, and thus inherit its functions. This isn't necessarily
required, but it makes more sense than reimplementing Box's functionality in
each widget.
Widgets
The following widgets are available:
Button - Button which is activated when the user selects it.
CheckBox - Selectable checkbox for boolean values.
DropDown - Drop-down selection field.
Flex - A Flexbox based layout manager.
Form - Form composed of input fields, drop down selections, checkboxes, and
buttons.
Grid - A grid based layout manager.
InputField - Single-line text entry field.
List - A navigable text list with optional keyboard shortcuts.
Modal - A centered window with a text message and one or more buttons.
Panels - A panel based layout manager.
ProgressBar - Indicates the progress of an operation.
TabbedPanels - Panels widget with tabbed navigation.
Table - A scrollable display of tabular data. Table cells, rows, or columns
may also be highlighted.
TextView - A scrollable window that displays multi-colored text. Text may
also be highlighted.
TreeView - A scrollable display for hierarchical data. Tree nodes can be
highlighted, collapsed, expanded, and more.
Window - A draggable and resizable container.
Widgets may be used without an application created via NewApplication, allowing
them to be integrated into any tcell-based application.
Concurrency
All functions may be called concurrently (they are thread-safe). When called
from multiple threads, functions will block until the application or widget
becomes available. Function calls may be queued with Application.QueueUpdate to
avoid blocking.
Unicode Support
This package supports unicode characters including wide characters.
Keyboard Shortcuts
Widgets use keyboard shortcuts (a.k.a. keybindings) such as arrow keys and
H/J/K/L by default. You may replace these defaults by modifying the shortcuts
listed in Keys. You may also override keyboard shortcuts globally by setting a
handler with Application.SetInputCapture.
cbind is a library which simplifies the process of adding support for custom
keyboard shortcuts to your application. It allows setting handlers for
EventKeys. It also translates between EventKeys and human-readable strings such
as "Alt+Enter". This makes it possible to store keybindings in a configuration
file.
cbind: https://code.rocketnine.space/tslocum/cbind
Bracketed Paste Mode
Bracketed paste mode is enabled by default. It may be disabled by calling
Application.EnableBracketedPaste before Application.Run. The following demo
shows how to handle paste events and process pasted text.
tcell bracketed paste demo: https://github.com/gdamore/tcell/blob/master/_demos/mouse.go
Mouse Support
Mouse support may be enabled by calling Application.EnableMouse before
Application.Run. See the example application provided with the
Application.EnableMouse documentation.
Double clicks are treated single clicks by default. Specify a maximum duration
between clicks with Application.SetDoubleClickInterval to enable double clicks.
A standard duration is provided as StandardDoubleClick.
Mouse events are passed to:
- The handler set with SetMouseCapture, which is reserved for use by application
developers to permanently intercept mouse events. Return nil to stop
propagation.
- The MouseHandler method of the topmost widget under the mouse.
Colors
Throughout this package, colors are specified using the tcell.Color type.
Functions such as tcell.GetColor(), tcell.NewHexColor(), and tcell.NewRGBColor()
can be used to create colors from W3C color names or RGB values.
Almost all strings which are displayed can contain color tags. Color tags are
W3C color names or six hexadecimal digits following a hash tag, wrapped in
square brackets. Examples:
This is a [red]warning[white]!
The sky is [#8080ff]blue[#ffffff].
A color tag changes the color of the characters following that color tag. This
applies to almost everything from box titles, list text, form item labels, to
table cells. In a TextView, this functionality must be explicitly enabled. See
the TextView documentation for more information.
Color tags may contain not just the foreground (text) color but also the
background color and additional flags. In fact, the full definition of a color
tag is as follows:
[<foreground>:<background>:<flags>]
Each of the three fields can be left blank and trailing fields can be omitted.
(Empty square brackets "[]", however, are not considered color tags.) Colors
that are not specified will be left unchanged. A field with just a dash ("-")
means "reset to default".
You can specify the following flags (some flags may not be supported by your
terminal):
l: blink
b: bold
d: dim
i: italic
r: reverse (switch foreground and background color)
u: underline
s: strikethrough
Examples:
[yellow]Yellow text
[yellow:red]Yellow text on red background
[:red]Red background, text color unchanged
[yellow::u]Yellow text underlined
[::bl]Bold, blinking text
[::-]Colors unchanged, flags reset
[-]Reset foreground color
[-:-:-]Reset everything
[:]No effect
[]Not a valid color tag, will print square brackets as they are
In the rare event that you want to display a string such as "[red]" or
"[#00ff1a]" without applying its effect, you need to put an opening square
bracket before the closing square bracket. Note that the text inside the
brackets will be matched less strictly than region or colors tags. I.e. any
character that may be used in color or region tags will be recognized. Examples:
[red[] will be output as [red]
["123"[] will be output as ["123"]
[#6aff00[[] will be output as [#6aff00[]
[a#"[[[] will be output as [a#"[[]
[] will be output as [] (see color tags above)
[[] will be output as [[] (not an escaped tag)
You can use the Escape() function to insert brackets automatically where needed.
Setting the background color of a primitive to tcell.ColorDefault will use the
default terminal background color. To enable transparency (allowing one or more
primitives to display behind a primitive) call SetBackgroundTransparent. The
screen is not cleared before drawing the application. Overlaying transparent
widgets directly onto the screen may result in artifacts. To resolve this, add
a blank, non-transparent Box to the bottom layer of the interface via Panels,
or set a handler via SetBeforeDrawFunc which clears the screen.
Styles
When primitives are instantiated, they are initialized with colors taken from
the global Styles variable. You may change this variable to adapt the look and
feel of the primitives to your preferred style.
Scroll Bars
Scroll bars are supported by the following widgets: List, Table, TextView and
TreeView. Each widget will display scroll bars automatically when there are
additional items offscreen. See SetScrollBarColor and SetScrollBarVisibility.
Hello World
The following is an example application which shows a box titled "Greetings"
containing the text "Hello, world!":
package main
import (
"code.rocketnine.space/tslocum/cview"
)
func main() {
tv := cview.NewTextView()
tv.SetText("Hello, world!").
SetBorder(true).
SetTitle("Greetings")
if err := cview.NewApplication().SetRoot(tv, true).Run(); err != nil {
panic(err)
}
}
First, we create a TextView with a border and a title. Then we create an
application, set the TextView as its root primitive, and run the event loop.
The application exits when the application's Stop() function is called or when
Ctrl-C is pressed.
If we have a primitive which consumes key presses, we call the application's
SetFocus() function to redirect all key presses to that primitive. Most
primitives then offer ways to install handlers that allow you to react to any
actions performed on them.
Demos
The "demos" subdirectory contains a demo for each widget, as well as a
presentation which gives an overview of the widgets and how they may be used.dropdown.goflex.gofocus.goform.goframe.gogrid.goinputfield.gokeys.golist.gomodal.gomouse.gopanels.goprimitive.goprogressbar.goscrollview.gosemigraphics.goslider.gostyles.gotabbedpanels.gotable.gotextview.gotreeview.goutil.gowindow.gowindowmanager.go
Package-Level Type Names (total 39)
/* sort by: | */
Application represents the top node of an application.
It is not strictly required to use this class as none of the other classes
depend on it. However, it provides useful tools to set up an application and
plays nicely with all widgets.
The following command displays a primitive p on the screen until Ctrl-C is
pressed:
if err := cview.NewApplication().SetRoot(p, true).Run(); err != nil {
panic(err)
}RWMutexsync.RWMutex Draw draws the provided primitives on the screen, or when no primitives are
provided, draws the application's root primitive (i.e. the entire screen).
When one or more primitives are supplied, the Draw functions of the
primitives are called. Handlers set via BeforeDrawFunc and AfterDrawFunc are
not called.
When no primitives are provided, the Draw function of the application's root
primitive is called. This results in drawing the entire screen. Handlers set
via BeforeDrawFunc and AfterDrawFunc are also called. EnableBracketedPaste enables bracketed paste mode, which is enabled by default. EnableMouse enables mouse events. GetAfterDrawFunc returns the callback function installed with
SetAfterDrawFunc() or nil if none has been installed. GetAfterResizeFunc returns the callback function installed with
SetAfterResizeFunc() or nil if none has been installed. GetBeforeDrawFunc returns the callback function installed with
SetBeforeDrawFunc() or nil if none has been installed. GetFocus returns the primitive which has the current focus. If none has it,
nil is returned. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetScreen returns the current tcell.Screen of the application. Lock the
application when manipulating the screen to prevent race conditions. This
value is only available after calling Init or Run. GetScreenSize returns the size of the application's screen. These values are
only available after calling Init or Run. HandlePanic (when deferred at the start of a goroutine) handles panics
gracefully. The terminal is returned to its original state before the panic
message is printed.
Panics may only be handled by the panicking goroutine. Because of this,
HandlePanic must be deferred at the start of each goroutine (including main). Init initializes the application screen. Calling Init before running is not
required. Its primary use is to populate screen dimensions before running an
application. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. QueueEvent sends an event to the Application event loop.
It is not recommended for event to be nil. QueueUpdate queues a function to be executed as part of the event loop.
Note that Draw() is not implicitly called after the execution of f as that
may not be desirable. You can call Draw() from f if the screen should be
refreshed after each update. Alternatively, use QueueUpdateDraw() to follow
up with an immediate refresh of the screen. QueueUpdateDraw works like QueueUpdate() except, when one or more primitives
are provided, the primitives are drawn after the provided function returns.
When no primitives are provided, the entire screen is drawn after the
provided function returns. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. ResizeToFullScreen resizes the given primitive such that it fills the entire
screen. RingBell sends a bell code to the terminal. Run starts the application and thus the event loop. This function returns
when Stop() was called. SetAfterDrawFunc installs a callback function which is invoked after the root
primitive was drawn during screen updates.
Provide nil to uninstall the callback function. SetAfterFocusFunc installs a callback function which is invoked after the
application's focus changes.
Provide nil to uninstall the callback function. SetAfterResizeFunc installs a callback function which is invoked when the
application's window is initialized, and when the application's window size
changes. After invoking this callback the screen is cleared and the
application is drawn.
Provide nil to uninstall the callback function. SetBeforeDrawFunc installs a callback function which is invoked just before
the root primitive is drawn during screen updates. If the function returns
true, drawing will not continue, i.e. the root primitive will not be drawn
(and an after-draw-handler will not be called).
Note that the screen is not cleared by the application. To clear the screen,
you may call screen.Clear().
Provide nil to uninstall the callback function. SetBeforeFocusFunc installs a callback function which is invoked before the
application's focus changes. Return false to maintain the current focus.
Provide nil to uninstall the callback function. SetDoubleClickInterval sets the maximum time between clicks to register a
double click rather than a single click. A standard duration is provided as
StandardDoubleClick. No interval is set by default, disabling double clicks. SetFocus sets the focus on a new primitive. All key events will be redirected
to that primitive. Callers must ensure that the primitive will handle key
events.
Blur() will be called on the previously focused primitive. Focus() will be
called on the new primitive. SetInputCapture sets a function which captures all key events before they are
forwarded to the key event handler of the primitive which currently has
focus. This function can then choose to forward that key event (or a
different one) by returning it or stop the key event processing by returning
nil.
Note that this also affects the default event handling of the application
itself: Such a handler can intercept the Ctrl-C event which closes the
application. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the appropriate mouse event handler. This function can then
choose to forward that event (or a different one) by returning it or stop
the event processing by returning a nil mouse event. SetRoot sets the root primitive for this application. If "fullscreen" is set
to true, the root primitive's position will be changed to fill the screen.
This function must be called at least once or nothing will be displayed when
the application starts.
It also calls SetFocus() on the primitive and draws the application. SetScreen allows you to provide your own tcell.Screen object. For most
applications, this is not needed and you should be familiar with
tcell.Screen when using this function.
This function is typically called before the first call to Run(). Init() need
not be called on the screen. Stop stops the application, causing Run() to return. Suspend temporarily suspends the application by exiting terminal UI mode and
invoking the provided function "f". When "f" returns, terminal UI mode is
entered again and the application resumes.
A return value of true indicates that the application was suspended and "f"
was called. If false is returned, the application was already suspended,
terminal UI mode was not exited, and "f" was not called. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it.
*Application : sync.Locker
func NewApplication() *Application
Box is the base Primitive for all widgets. It has a background color and
optional surrounding elements such as a border and a title. It does not have
inner text. Widgets embed Box and draw their text over it. Blur is called when this primitive loses focus. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns nil. MouseHandler returns nil. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*Box : Focusable
*Box : Primitive
func NewBox() *Box
Button is labeled box that triggers an action when selected.Box*BoxRWMutexsync.RWMutex Blur is called when this primitive loses focus. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetLabel returns the button text. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetBackgroundColor sets the box's background color. SetBackgroundColorFocused sets the background color of the button text when
the button is in focus. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBlurFunc sets a handler which is called when the user leaves the button.
The callback function is provided with the key that was pressed, which is one
of the following:
- KeyEscape: Leaving the button with no specific direction.
- KeyTab: Move to the next field.
- KeyBacktab: Move to the previous field. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetCursorRune sets the rune to show within the button when it is focused. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetLabel sets the button text. SetLabelColor sets the color of the button text. SetLabelColorFocused sets the color of the button text when the button is
in focus. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetSelectedFunc sets a handler which is called when the button was selected. SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
Button : Focusable
*Button : Primitive
*Button : sync.Locker
func NewButton(label string) *Button
func (*Form).GetButton(index int) *Button
CheckBox implements a simple box for boolean values which can be checked and
unchecked.Box*BoxRWMutexsync.RWMutex Blur is called when this primitive loses focus. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFieldHeight returns the height of the field. GetFieldWidth returns this primitive's field width. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetLabel returns the text to be displayed before the input area. GetMessage returns the text to be displayed after the checkbox GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. IsChecked returns whether or not the box is checked. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetChangedFunc sets a handler which is called when the checked state of this
checkbox was changed by the user. The handler function receives the new
state. SetChecked sets the state of the checkbox. SetCheckedRune sets the rune to show when the checkbox is checked. SetCursorRune sets the rune to show within the checkbox when it is focused. SetDoneFunc sets a handler which is called when the user is done using the
checkbox. The callback function is provided with the key that was pressed,
which is one of the following:
- KeyEscape: Abort text input.
- KeyTab: Move to the next field.
- KeyBacktab: Move to the previous field. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetFieldBackgroundColor sets the background color of the input area. SetFieldBackgroundColorFocused sets the background color of the input area when focused. SetFieldTextColor sets the text color of the input area. SetFieldTextColorFocused sets the text color of the input area when focused. SetFinishedFunc sets a callback invoked when the user leaves this form item. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetLabel sets the text to be displayed before the input area. SetLabelColor sets the color of the label. SetLabelColorFocused sets the color of the label when focused. SetLabelWidth sets the screen width of the label. A value of 0 will cause the
primitive to use the width of the label string. SetMessage sets the text to be displayed after the checkbox SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
CheckBox : Focusable
*CheckBox : FormItem
*CheckBox : Primitive
*CheckBox : sync.Locker
func NewCheckBox() *CheckBox
ContextMenu is a menu that appears upon user interaction, such as right
clicking or pressing Alt+Enter. AddContextItem adds an item to the context menu. Adding an item with no text
or shortcut will add a divider. ClearContextMenu removes all items from the context menu. ContextMenuList returns the underlying List of the context menu. ContextMenuVisible returns whether or not the context menu is visible. HideContextMenu hides the context menu. SetContextSelectedFunc sets the function which is called when the user
selects a context menu item. The function receives the item's index in the
menu (starting with 0), its text and its shortcut rune. SetSelectedFunc must
be called before the context menu is shown. ShowContextMenu shows the context menu. Provide -1 for both to position on
the selected item, or specify a position.
func NewContextMenu(parent Primitive) *ContextMenu
DropDown implements a selection widget whose options become visible in a
drop-down list when activated.Box*BoxRWMutexsync.RWMutex AddOptions adds new selectable options to this drop-down. AddOptionsSimple adds new selectable options to this drop-down. Blur is called when this primitive loses focus.(*DropDown) ClearOptions() Draw draws this primitive onto the screen. Focus is called by the application when the primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetCurrentOption returns the index of the currently selected option as well
as the option itself. If no option was selected, -1 and nil is returned. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFieldHeight returns the height of the field. GetFieldWidth returns this primitive's field screen width. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetLabel returns the text to be displayed before the input area. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetAlwaysDrawDropDownSymbol sets a flad that determines whether the drop
down symbol is always drawn. The symbol is normally only drawn when focused. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetChangedFunc sets a handler which is called when the user changes the
focused drop-down option. The handler is provided with the selected option's
index and the option itself. If "no option" was selected, these values are
-1 and nil. SetCurrentOption sets the index of the currently selected option. This may
be a negative value to indicate that no option is currently selected. Calling
this function will also trigger the "selected" callback (if there is one). SetDoneFunc sets a handler which is called when the user is done selecting
options. The callback function is provided with the key that was pressed,
which is one of the following:
- KeyEscape: Abort selection.
- KeyTab: Move to the next field.
- KeyBacktab: Move to the previous field. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetDropDownBackgroundColor sets the background color of the drop-down list. SetDropDownOpenSymbolRune sets the rune to be drawn at the end of the
dropdown field to indicate that the a dropdown is open. SetDropDownSelectedBackgroundColor sets the background color of the selected
option in the drop-down list. SetDropDownSelectedSymbolRune sets the rune to be drawn at the start of the
selected list item. SetDropDownSelectedTextColor sets the text color of the selected option in
the drop-down list. SetDropDownSymbolRune sets the rune to be drawn at the end of the dropdown field
to indicate that this field is a dropdown. SetDropDownTextColor sets text color of the drop-down list. SetFieldBackgroundColor sets the background color of the options area. SetFieldBackgroundColorFocused sets the background color of the options area when focused. SetFieldTextColor sets the text color of the options area. SetFieldTextColorFocused sets the text color of the options area when focused. SetFieldWidth sets the screen width of the options area. A value of 0 means
extend to as long as the longest option text. SetFinishedFunc sets a callback invoked when the user leaves this form item. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetLabel sets the text to be displayed before the input area. SetLabelColor sets the color of the label. SetLabelColorFocused sets the color of the label when focused. SetLabelWidth sets the screen width of the label. A value of 0 will cause the
primitive to use the width of the label string. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetOptions replaces all current options with the ones provided and installs
one callback function which is called when one of the options is selected.
It will be called with the option's index and the option itself.
The "selected" parameter may be nil. SetOptionsSimple replaces all current options with the ones provided and installs
one callback function which is called when one of the options is selected.
It will be called with the option's index and the option itself
The "selected" parameter may be nil. SetPadding sets the size of the padding around the box content. SetPrefixTextColor sets the color of the prefix string. The prefix string is
shown when the user starts typing text, which directly selects the first
option that starts with the typed string. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetSelectedFunc sets a handler which is called when the user selects a
drop-down's option. This handler will be called in addition and prior to
an option's optional individual handler. The handler is provided with the
selected option's index and the option itself. If "no option" was selected, these values
are -1 and nil. SetTextOptions sets the text to be placed before and after each drop-down
option (prefix/suffix), the text placed before and after the currently
selected option (currentPrefix/currentSuffix) as well as the text to be
displayed when no option is currently selected. Per default, all of these
strings are empty. SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*DropDown : Focusable
*DropDown : FormItem
*DropDown : Primitive
*DropDown : sync.Locker
func NewDropDown() *DropDown
DropDownOption is one option that can be selected in a drop-down primitive.RWMutexsync.RWMutex GetReference returns the reference object of this dropdown option. GetText returns the text of this dropdown option. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetReference allows you to store a reference of any type in this option. SetSelectedFunc sets the handler to be called when this option is selected. SetText returns the text of this dropdown option. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it.
*DropDownOption : sync.Locker
func NewDropDownOption(text string) *DropDownOption
func (*DropDown).GetCurrentOption() (int, *DropDownOption)
func (*DropDown).AddOptions(options ...*DropDownOption)
func (*DropDown).SetOptions(selected func(index int, option *DropDownOption), options ...*DropDownOption)
func (*Form).AddDropDown(label string, initialOption int, selected func(index int, option *DropDownOption), options []*DropDownOption)
Flex is a basic implementation of the Flexbox layout. The contained
primitives are arranged horizontally or vertically. The way they are
distributed along that dimension depends on their layout settings, which is
either a fixed length or a proportional length. See AddItem() for details.Box*BoxRWMutexsync.RWMutex AddItem adds a new item to the container. The "fixedSize" argument is a width
or height that may not be changed by the layout algorithm. A value of 0 means
that its size is flexible and may be changed. The "proportion" argument
defines the relative size of the item compared to other flexible-size items.
For example, items with a proportion of 2 will be twice as large as items
with a proportion of 1. The proportion must be at least 1 if fixedSize == 0
(ignored otherwise).
If "focus" is set to true, the item will receive focus when the Flex
primitive receives focus. If multiple items have the "focus" flag set to
true, the first one will receive focus.
A nil value for the primitive represents empty space. AddItemAtIndex adds an item to the flex at a given index.
For more information see AddItem. Blur is called when this primitive loses focus. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDirection returns the direction in which the contained primitives are
distributed. This can be either FlexColumn (default) or FlexRow. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns nil. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. RemoveItem removes all items for the given primitive from the container,
keeping the order of the remaining items intact. ResizeItem sets a new size for the item(s) with the given primitive. If there
are multiple Flex items with the same primitive, they will all receive the
same size. For details regarding the size parameters, see AddItem(). SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetDirection sets the direction in which the contained primitives are
distributed. This can be either FlexColumn (default) or FlexRow. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetFullScreen sets the flag which, when true, causes the flex layout to use
the entire screen space instead of whatever size it is currently assigned to. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*Flex : Focusable
*Flex : Primitive
*Flex : sync.Locker
func NewFlex() *Flex
FocusManager manages application focus.RWMutexsync.RWMutex Add adds an element to the focus handler. AddAt adds an element to the focus handler at the specified index. Focus focuses the provided element. FocusAt focuses the element at the provided index. FocusNext focuses the next element. FocusPrevious focuses the previous element. GetFocusIndex returns the index of the currently focused element. GetFocusedPrimitive returns the currently focused primitive. Len returns the length of added primitives. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. Reset resets the focus manager.(*FocusManager) SetFocusIndex(idx int) error SetWrapAround sets the flag that determines whether navigation will wrap
around. That is, navigating forwards on the last field will move the
selection to the first field (similarly in the other direction). If set to
false, the focus won't change when navigating forwards on the last element
or navigating backwards on the first element. Transform modifies the current focus. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it.
*FocusManager : sync.Locker
func NewFocusManager(setFocus func(p Primitive)) *FocusManager
Form allows you to combine multiple one-line form elements into a vertical
or horizontal layout. Form elements include types such as InputField or
CheckBox. These elements can be optionally followed by one or more buttons
for which you can define form-wide actions (e.g. Save, Clear, Cancel).Box*BoxRWMutexsync.RWMutex AddButton adds a new button to the form. The "selected" function is called
when the user selects this button. It may be nil. AddCheckBox adds a checkbox to the form. It has a label, a message, an
initial state, and an (optional) callback function which is invoked when the
state of the checkbox was changed by the user. AddDropDown adds a drop-down element to the form. It has a label, options,
and an (optional) callback function which is invoked when an option was
selected. The initial option may be a negative value to indicate that no
option is currently selected. AddDropDownSimple adds a drop-down element to the form. It has a label, options,
and an (optional) callback function which is invoked when an option was
selected. The initial option may be a negative value to indicate that no
option is currently selected. AddFormItem adds a new item to the form. This can be used to add your own
objects to the form. Note, however, that the Form class will override some
of its attributes to make it work in the form context. Specifically, these
are:
- The label width
- The label color
- The background color
- The field text color
- The field background color AddInputField adds an input field to the form. It has a label, an optional
initial value, a field width (a value of 0 extends it as far as possible),
an optional accept function to validate the item's value (set to nil to
accept any text), and an (optional) callback function which is invoked when
the input field's text has changed. AddPasswordField adds a password field to the form. This is similar to an
input field except that the user's input not shown. Instead, a "mask"
character is displayed. The password field has a label, an optional initial
value, a field width (a value of 0 extends it as far as possible), and an
(optional) callback function which is invoked when the input field's text has
changed. AddSlider adds a slider to the form. It has a label, an initial value, a
maximum value, an amount to increment by when modified via keyboard, and an
(optional) callback function which is invoked when the state of the slider
was changed by the user. Blur is called when this primitive loses focus. Clear removes all input elements from the form, including the buttons if
specified. ClearButtons removes all buttons from the form. Draw draws this primitive onto the screen. Focus is called by the application when the primitive receives focus. GetAttributes returns the current attribute settings of a form. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetButton returns the button at the specified 0-based index. Note that
buttons have been specially prepared for this form and modifying some of
their attributes may have unintended side effects. GetButtonCount returns the number of buttons in this form. GetButtonIndex returns the index of the button with the given label, starting
with 0 for the button that was added first. If no such label was found, -1
is returned. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetFocusedItemIndex returns the indices of the form element or button which
currently has focus. If they don't, -1 is returned resepectively. GetFormItem returns the form item at the given position, starting with index
0. Elements are referenced in the order they were added. Buttons are not included.
If index is out of bounds it returns nil. GetFormItemByLabel returns the first form element with the given label. If
no such element is found, nil is returned. Buttons are not searched and will
therefore not be returned. GetFormItemCount returns the number of items in the form (not including the
buttons). GetFormItemIndex returns the index of the first form element with the given
label. If no such element is found, -1 is returned. Buttons are not searched
and will therefore not be returned. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. IndexOfFormItem returns the index of the given FormItem. InputHandler returns nil. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. RemoveButton removes the button at the specified position, starting with 0
for the button that was added first. RemoveFormItem removes the form element at the given position, starting with
index 0. Elements are referenced in the order they were added. Buttons are
not included. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetButtonBackgroundColor sets the background color of the buttons. SetButtonBackgroundColorFocused sets the background color of the buttons when focused. SetButtonTextColor sets the color of the button texts. SetButtonTextColorFocused sets the color of the button texts when focused. SetButtonsAlign sets how the buttons align horizontally, one of AlignLeft
(the default), AlignCenter, and AlignRight. This is only SetCancelFunc sets a handler which is called when the user hits the Escape
key. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetFieldBackgroundColor sets the background color of the input areas. SetFieldBackgroundColorFocused sets the background color of the input areas when focused. SetFieldTextColor sets the text color of the input areas. SetFieldTextColorFocused sets the text color of the input areas when focused. SetFocus shifts the focus to the form element with the given index, counting
non-button items first and buttons last. Note that this index is only used
when the form itself receives focus. SetHorizontal sets the direction the form elements are laid out. If set to
true, instead of positioning them from top to bottom (the default), they are
positioned from left to right, moving into the next row if there is not
enough space. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetItemPadding sets the number of empty rows between form items for vertical
layouts and the number of empty cells between form items for horizontal
layouts. SetLabelColor sets the color of the labels. SetLabelColorFocused sets the color of the labels when focused. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. SetWrapAround sets the flag that determines whether navigating the form will
wrap around. That is, navigating downwards on the last item will move the
selection to the first item (similarly in the other direction). If set to
false, the selection won't change when navigating downwards on the last item
or navigating upwards on the first item. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*Form : Focusable
*Form : Primitive
*Form : sync.Locker
func NewForm() *Form
func (*Modal).GetForm() *Form
FormItem is the interface all form items must implement to be able to be
included in a form. Blur is called by the application when the primitive loses focus. Draw draws this primitive onto the screen. Implementers can call the
screen's ShowCursor() function but should only do so when they have focus.
(They will need to keep track of this themselves.) Focus is called by the application when the primitive receives focus.
Implementers may call delegate() to pass the focus on to another primitive. GetFieldHeight returns the height of the form item. GetFieldWidth returns the width of the form item's field (the area which
is manipulated by the user) in number of screen cells. A value of 0
indicates the the field width is flexible and may use as much space as
required. GetFocusable returns the item's Focusable. GetLabel returns the item's label text. GetRect returns the current position of the primitive, x, y, width, and
height. GetVisible returns whether or not the primitive is visible. InputHandler returns a handler which receives key events when it has focus.
It is called by the Application class.
A value of nil may also be returned, in which case this primitive cannot
receive focus and will not process any key events.
The handler will receive the key event and a function that allows it to
set the focus to a different primitive, so that future key events are sent
to that primitive.
The Application's Draw() function will be called automatically after the
handler returns.
The Box class provides functionality to intercept keyboard input. If you
subclass from Box, it is recommended that you wrap your handler using
Box.WrapInputHandler() so you inherit that functionality. MouseHandler returns a handler which receives mouse events.
It is called by the Application class.
A value of nil may also be returned to stop the downward propagation of
mouse events.
The Box class provides functionality to intercept mouse events. If you
subclass from Box, it is recommended that you wrap your handler using
Box.WrapMouseHandler() so you inherit that functionality. SetBackgroundColor sets the background color of the form item. SetFieldBackgroundColor sets the background color of the input area. SetFieldBackgroundColor sets the background color of the input area when focused. SetFieldTextColor sets the text color of the input area. SetFieldTextColorFocused sets the text color of the input area when focused. SetFinishedFunc sets a callback invoked when the user leaves the form item. SetLabelColor sets the color of the label. SetLabelColor sets the color of the label when focused. SetLabelWidth sets the screen width of the label. A value of 0 will cause the
primitive to use the width of the label string. SetRect sets a new position of the primitive. SetVisible sets whether or not the primitive is visible.
*CheckBox
*DropDown
*InputField
*Slider
FormItem : Primitive
func (*Form).GetFormItem(index int) FormItem
func (*Form).GetFormItemByLabel(label string) FormItem
func (*Form).AddFormItem(item FormItem)
func (*Form).IndexOfFormItem(item FormItem) int
Frame is a wrapper which adds space around another primitive. In addition,
the top area (header) and the bottom area (footer) may also contain text.Box*BoxRWMutexsync.RWMutex AddText adds text to the frame. Set "header" to true if the text is to appear
in the header, above the contained primitive. Set it to false for it to
appear in the footer, below the contained primitive. "align" must be one of
the Align constants. Rows in the header are printed top to bottom, rows in
the footer are printed bottom to top. Note that long text can overlap as
different alignments will be placed on the same row. Blur is called when this primitive loses focus. Clear removes all text from the frame. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns nil. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetBorders sets the width of the frame borders as well as "header" and
"footer", the vertical space between the header and footer text and the
contained primitive (does not apply if there is no text). SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*Frame : Focusable
*Frame : Primitive
*Frame : sync.Locker
func NewFrame(primitive Primitive) *Frame
func (*Modal).GetFrame() *Frame
Grid is an implementation of a grid-based layout. It works by defining the
size of the rows and columns, then placing primitives into the grid.
Some settings can lead to the grid exceeding its available space. SetOffset()
can then be used to scroll in steps of rows and columns. These offset values
can also be controlled with the arrow keys (or the "g","G", "j", "k", "h",
and "l" keys) while the grid has focus and none of its contained primitives
do.Box*BoxRWMutexsync.RWMutex AddItem adds a primitive and its position to the grid. The top-left corner
of the primitive will be located in the top-left corner of the grid cell at
the given row and column and will span "rowSpan" rows and "colSpan" columns.
For example, for a primitive to occupy rows 2, 3, and 4 and columns 5 and 6:
grid.AddItem(p, 2, 5, 3, 2, 0, 0, true)
If rowSpan or colSpan is 0, the primitive will not be drawn.
You can add the same primitive multiple times with different grid positions.
The minGridWidth and minGridHeight values will then determine which of those
positions will be used. This is similar to CSS media queries. These minimum
values refer to the overall size of the grid. If multiple items for the same
primitive apply, the one that has at least one highest minimum value will be
used, or the primitive added last if those values are the same. Example:
grid.AddItem(p, 0, 0, 0, 0, 0, 0, true). // Hide in small grids.
AddItem(p, 0, 0, 1, 2, 100, 0, true). // One-column layout for medium grids.
AddItem(p, 1, 1, 3, 2, 300, 0, true) // Multi-column layout for large grids.
To use the same grid layout for all sizes, simply set minGridWidth and
minGridHeight to 0.
If the item's focus is set to true, it will receive focus when the grid
receives focus. If there are multiple items with a true focus flag, the last
visible one that was added will receive focus. Blur is called when this primitive loses focus. Clear removes all items from the grid. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetOffset returns the current row and column offset (see SetOffset() for
details). GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus.(*Grid) HasItem(p Primitive) bool InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. RemoveItem removes all items for the given primitive from the grid, keeping
the order of the remaining items intact. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetBorders sets whether or not borders are drawn around grid items. Setting
this value to true will cause the gap values (see SetGap()) to be ignored and
automatically assumed to be 1 where the border graphics are drawn. SetBordersColor sets the color of the item borders. SetColumns defines how the columns of the grid are distributed. Each value
defines the size of one column, starting with the leftmost column. Values
greater 0 represent absolute column widths (gaps not included). Values less
or equal 0 represent proportional column widths or fractions of the remaining
free space, where 0 is treated the same as -1. That is, a column with a value
of -3 will have three times the width of a column with a value of -1 (or 0).
The minimum width set with SetMinSize() is always observed.
Primitives may extend beyond the columns defined explicitly with this
function. A value of 0 is assumed for any undefined column. In fact, if you
never call this function, all columns occupied by primitives will have the
same width. On the other hand, unoccupied columns defined with this function
will always take their place.
Assuming a total width of the grid of 100 cells and a minimum width of 0, the
following call will result in columns with widths of 30, 10, 15, 15, and 30
cells:
grid.SetColumns(30, 10, -1, -1, -2)
If a primitive were then placed in the 6th and 7th column, the resulting
widths would be: 30, 10, 10, 10, 20, 10, and 10 cells.
If you then called SetMinSize() as follows:
grid.SetMinSize(15, 20)
The resulting widths would be: 30, 15, 15, 15, 20, 15, and 15 cells, a total
of 125 cells, 25 cells wider than the available grid width. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetGap sets the size of the gaps between neighboring primitives on the grid.
If borders are drawn (see SetBorders()), these values are ignored and a gap
of 1 is assumed. Panics if negative values are provided. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMinSize sets an absolute minimum width for rows and an absolute minimum
height for columns. Panics if negative values are provided. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetOffset sets the number of rows and columns which are skipped before
drawing the first grid cell in the top-left corner. As the grid will never
completely move off the screen, these values may be adjusted the next time
the grid is drawn. The actual position of the grid may also be adjusted such
that contained primitives that have focus remain visible. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetRows defines how the rows of the grid are distributed. These values behave
the same as the column values provided with SetColumns(), see there for a
definition and examples.
The provided values correspond to row heights, the first value defining
the height of the topmost row. SetSize is a shortcut for SetRows() and SetColumns() where all row and column
values are set to the given size values. See SetColumns() for details on sizes. SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it.(*Grid) UpdateItem(p Primitive, row, column, rowSpan, colSpan, minGridHeight, minGridWidth int, focus bool) WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*Grid : Focusable
*Grid : Primitive
*Grid : sync.Locker
func NewGrid() *Grid
InputField is a one-line box (three lines if there is a title) where the
user can enter text. Use SetAcceptanceFunc() to accept or reject input,
SetChangedFunc() to listen for changes, and SetMaskCharacter() to hide input
from onlookers (e.g. for password input).
The following keys can be used for navigation and editing:
- Left arrow: Move left by one character.
- Right arrow: Move right by one character.
- Home, Ctrl-A, Alt-a: Move to the beginning of the line.
- End, Ctrl-E, Alt-e: Move to the end of the line.
- Alt-left, Alt-b: Move left by one word.
- Alt-right, Alt-f: Move right by one word.
- Backspace: Delete the character before the cursor.
- Delete: Delete the character after the cursor.
- Ctrl-K: Delete from the cursor to the end of the line.
- Ctrl-W: Delete the last word before the cursor.
- Ctrl-U: Delete the entire line.Box*BoxRWMutexsync.RWMutex Autocomplete invokes the autocomplete callback (if there is one). If the
length of the returned autocomplete entries slice is greater than 0, the
input field will present the user with a corresponding drop-down list the
next time the input field is drawn.
It is safe to call this function from any goroutine. Note that the input
field is not redrawn automatically unless called from the main goroutine
(e.g. in response to events). Blur is called when this primitive loses focus. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetCursorPosition returns the cursor position. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFieldHeight returns the height of the field. GetFieldWidth returns this primitive's field width. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetLabel returns the text to be displayed before the input area. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetText returns the current text of the input field. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. ResetFieldNote sets the note to an empty string. SetAcceptanceFunc sets a handler which may reject the last character that was
entered (by returning false).
This package defines a number of variables prefixed with InputField which may
be used for common input (e.g. numbers, maximum text length). SetAutocompleteFunc sets an autocomplete callback function which may return
ListItems to be selected from a drop-down based on the current text of the
input field. The drop-down appears only if len(entries) > 0. The callback is
invoked in this function and whenever the current text changes or when
Autocomplete() is called. Entries are cleared when the user selects an entry
or presses Escape. SetAutocompleteListBackgroundColor sets the background color of the
autocomplete list. SetAutocompleteListSelectedBackgroundColor sets the background of the
selected ListItem. SetAutocompleteListSelectedTextColor sets the text color of the selected
ListItem. SetAutocompleteListTextColor sets the text color of the ListItems. SetAutocompleteSuggestionTextColor sets the text color of the autocomplete
suggestion in the input field. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetChangedFunc sets a handler which is called whenever the text of the input
field has changed. It receives the current text (after the change). SetCursorPosition sets the cursor position. SetDoneFunc sets a handler which is called when the user is done entering
text. The callback function is provided with the key that was pressed, which
is one of the following:
- KeyEnter: Done entering text.
- KeyEscape: Abort text input.
- KeyTab: Move to the next field.
- KeyBacktab: Move to the previous field. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetFieldBackgroundColor sets the background color of the input area. SetFieldBackgroundColorFocused sets the background color of the input area
when focused. SetFieldNote sets the text to show below the input field, e.g. when the
input is invalid. SetFieldNoteTextColor sets the text color of the note. SetFieldTextColor sets the text color of the input area. SetFieldTextColorFocused sets the text color of the input area when focused. SetFieldWidth sets the screen width of the input area. A value of 0 means
extend as much as possible. SetFinishedFunc sets a callback invoked when the user leaves this form item. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetLabel sets the text to be displayed before the input area. SetLabelColor sets the color of the label. SetLabelColorFocused sets the color of the label when focused. SetLabelWidth sets the screen width of the label. A value of 0 will cause the
primitive to use the width of the label string. SetMaskCharacter sets a character that masks user input on a screen. A value
of 0 disables masking. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetPlaceholder sets the text to be displayed when the input text is empty. SetPlaceholderTextColor sets the text color of placeholder text. SetPlaceholderTextColorFocused sets the text color of placeholder text when
focused. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetText sets the current text of the input field. SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
InputField : Focusable
*InputField : FormItem
*InputField : Primitive
*InputField : sync.Locker
func NewInputField() *InputField
List displays rows of items, each of which can be selected.Box*BoxContextMenu*ContextMenuRWMutexsync.RWMutex AddContextItem adds an item to the context menu. Adding an item with no text
or shortcut will add a divider. AddItem calls InsertItem() with an index of -1. Blur is called when this primitive loses focus. Clear removes all items from the list. ClearContextMenu removes all items from the context menu. ContextMenuList returns the underlying List of the context menu. ContextMenuVisible returns whether or not the context menu is visible. Draw draws this primitive onto the screen. FindItems searches the main and secondary texts for the given strings and
returns a list of item indices in which those strings are found. One of the
two search strings may be empty, it will then be ignored. Indices are always
returned in ascending order.
If mustContainBoth is set to true, mainSearch must be contained in the main
text AND secondarySearch must be contained in the secondary text. If it is
false, only one of the two search strings must be contained.
Set ignoreCase to true for case-insensitive search. Focus is called by the application when the primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetCurrentItem returns the currently selected list item,
Returns nil if no item is selected. GetCurrentItemIndex returns the index of the currently selected list item,
starting at 0 for the first item and its struct. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetItem returns the ListItem at the given index.
Returns nil when index is out of bounds. GetItemCount returns the number of items in the list. GetItemText returns an item's texts (main and secondary). Panics if the index
is out of range. GetItems returns all list items. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetOffset returns the number of list items and columns by which the list is
scrolled down/to the right. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. HideContextMenu hides the context menu. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. InsertItem adds a new item to the list at the specified index. An index of 0
will insert the item at the beginning, an index of 1 before the second item,
and so on. An index of GetItemCount() or higher will insert the item at the
end of the list. Negative indices are also allowed: An index of -1 will
insert the item at the end of the list, an index of -2 before the last item,
and so on. An index of -GetItemCount()-1 or lower will insert the item at the
beginning.
An item has a main text which will be highlighted when selected. It also has
a secondary text which is shown underneath the main text (if it is set to
visible) but which may remain empty.
The shortcut is a key binding. If the specified rune is entered, the item
is selected immediately. Set to 0 for no binding.
The "selected" callback will be invoked when the user selects the item. You
may provide nil if no such callback is needed or if all events are handled
through the selected callback set with SetSelectedFunc().
The currently selected item will shift its position accordingly. If the list
was previously empty, a "changed" event is fired because the new item becomes
selected. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. RemoveItem removes the item with the given index (starting at 0) from the
list. If a negative index is provided, items are referred to from the back
(-1 = last item, -2 = second-to-last item, and so on). Out of range indices
are clamped to the beginning/end, i.e. unless the list is empty, an item is
always removed.
The currently selected item is shifted accordingly. If it is the one that is
removed, a "changed" event is fired. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetChangedFunc sets the function which is called when the user navigates to
a list item. The function receives the item's index in the list of items
(starting with 0) and the list item.
This function is also called when the first item is added or when
SetCurrentItem() is called. SetContextSelectedFunc sets the function which is called when the user
selects a context menu item. The function receives the item's index in the
menu (starting with 0), its text and its shortcut rune. SetSelectedFunc must
be called before the context menu is shown. SetCurrentItem sets the currently selected item by its index, starting at 0
for the first item. If a negative index is provided, items are referred to
from the back (-1 = last item, -2 = second-to-last item, and so on). Out of
range indices are clamped to the beginning/end.
Calling this function triggers a "changed" event if the selection changes. SetDoneFunc sets a function which is called when the user presses the Escape
key. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetHighlightFullLine sets a flag which determines whether the colored
background of selected items spans the entire width of the view. If set to
true, the highlight spans the entire view. If set to false, only the text of
the selected item from beginning to end is highlighted. SetHover sets the flag that determines whether hovering over an item will
highlight it (without triggering callbacks set with SetSelectedFunc). SetIndicators is used to set prefix and suffix indicators for selected and unselected items. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetItemEnabled sets whether an item is selectable. Panics if the index is
out of range. SetItemText sets an item's main and secondary text. Panics if the index is
out of range. SetMainTextColor sets the color of the items' main text. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetOffset sets the number of list items and columns by which the list is
scrolled down/to the right. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetScrollBarColor sets the color of the scroll bar. SetScrollBarVisibility specifies the display of the scroll bar. SetSecondaryTextColor sets the color of the items' secondary text. SetSelectedAlwaysCentered sets a flag which determines whether the currently
selected list item must remain centered when scrolling. SetSelectedAlwaysVisible sets a flag which determines whether the currently
selected list item must remain visible when scrolling. SetSelectedBackgroundColor sets the background color of selected items. SetSelectedFocusOnly sets a flag which determines when the currently selected
list item is highlighted. If set to true, selected items are only highlighted
when the list has focus. If set to false, they are always highlighted. SetSelectedFunc sets the function which is called when the user selects a
list item by pressing Enter on the current selection. The function receives
the item's index in the list of items (starting with 0) and its struct. SetSelectedTextAttributes sets the style attributes of selected items. SetSelectedTextColor sets the text color of selected items. SetShortcutColor sets the color of the items' shortcut. SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. SetWrapAround sets the flag that determines whether navigating the list will
wrap around. That is, navigating downwards on the last item will move the
selection to the first item (similarly in the other direction). If set to
false, the selection won't change when navigating downwards on the last item
or navigating upwards on the first item. ShowContextMenu shows the context menu. Provide -1 for both to position on
the selected item, or specify a position. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. ShowSecondaryText determines whether or not to show secondary item texts. Transform modifies the current selection. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*List : Focusable
*List : Primitive
*List : sync.Locker
func NewList() *List
func (*ContextMenu).ContextMenuList() *List
ListItem represents an item in a List.RWMutexsync.RWMutex GetMainBytes returns the item's main text. GetMainText returns the item's main text. GetReference returns the item's reference object. GetSecondaryBytes returns the item's secondary text. GetSecondaryText returns the item's secondary text. GetShortcut returns the ListItem's shortcut. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetMainBytes sets the main text of the list item. SetMainText sets the main text of the list item. SetReference allows you to store a reference of any type in the item SetSecondaryBytes sets a secondary text to be shown underneath the main text. SetSecondaryText sets a secondary text to be shown underneath the main text. SetSelectedFunc sets a function which is called when the ListItem is selected. SetShortcut sets the key to select the ListItem directly, 0 if there is no shortcut. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it.
*ListItem : sync.Locker
func NewListItem(mainText string) *ListItem
func (*List).GetCurrentItem() *ListItem
func (*List).GetItem(index int) *ListItem
func (*List).GetItems() []*ListItem
func (*List).AddItem(item *ListItem)
func (*List).InsertItem(index int, item *ListItem)
Modal is a centered message window used to inform the user or prompt them
for an immediate decision. It needs to have at least one button (added via
AddButtons) or it will never disappear. You may change the title and
appearance of the window by modifying the Frame returned by GetFrame. You
may include additional elements within the window by modifying the Form
returned by GetForm.Box*BoxRWMutexsync.RWMutex AddButtons adds buttons to the window. There must be at least one button and
a "done" handler so the window can be closed again. Blur is called when this primitive loses focus. ClearButtons removes all buttons from the window. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetForm returns the Form embedded in the window. The returned Form may be
modified to include additional elements (e.g. AddInputField, AddFormItem). GetFrame returns the Frame embedded in the window. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns nil. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetBackgroundColor sets the color of the Modal Frame background. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetButtonBackgroundColor sets the background color of the buttons. SetButtonTextColor sets the color of the button texts. SetButtonsAlign sets the horizontal alignment of the buttons. This must be
either AlignLeft, AlignCenter (the default), or AlignRight. SetDoneFunc sets a handler which is called when one of the buttons was
pressed. It receives the index of the button as well as its label text. The
handler is also called when the user presses the Escape key. The index will
then be negative and the label text an empty string. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetFocus shifts the focus to the button with the given index. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetText sets the message text of the window. The text may contain line
breaks. Note that words are wrapped, too, based on the final size of the
window. SetTextAlign sets the horizontal alignment of the text. This must be either
AlignLeft, AlignCenter (the default), or AlignRight. SetTextColor sets the color of the message text. SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*Modal : Focusable
*Modal : Primitive
*Modal : sync.Locker
func NewModal() *Modal
Pages is a wrapper around Panels.
Deprecated: This type is provided for backwards compatibility.
Developers should use Panels instead.Panels*PanelsPanels.Box*BoxPanels.RWMutexsync.RWMutex AddAndSwitchToPage calls Add(), then SwitchTo() on that newly added panel. AddPage adds a new panel with the given name and primitive. AddPanel adds a new panel with the given name and primitive. If there was
previously a panel with the same name, it is overwritten. Leaving the name
empty may cause conflicts in other functions so always specify a non-empty
name.
Visible panels will be drawn in the order they were added (unless that order
was changed in one of the other functions). If "resize" is set to true, the
primitive will be set to the size available to the Panels primitive whenever
the panels are drawn. Blur is called when this primitive loses focus. Draw draws this primitive onto the screen. Focus is called by the application when the primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetFrontPage returns the front-most visible panel. GetFrontPanel returns the front-most visible panel. If there are no visible
panels, ("", nil) is returned. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetPageCount returns the number of panels currently stored in this object. GetPanelCount returns the number of panels currently stored in this object. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. HasPage returns true if a panel with the given name exists in this object. HasPanel returns true if a panel with the given name exists in this object. HidePage sets a panel's visibility to "false". HidePanel sets a panel's visibility to "false". InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns nil. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. RemovePage removes the panel with the given name. RemovePanel removes the panel with the given name. If that panel was the only
visible panel, visibility is assigned to the last panel. SendToBack changes the order of the panels such that the panel with the given
name comes first, causing it to be drawn first with the next update (if
visible). SendToFront changes the order of the panels such that the panel with the given
name comes last, causing it to be drawn last with the next update (if
visible). SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetChangedFunc sets a handler which is called whenever the visibility or the
order of any visible panels changes. This can be used to redraw the panels. SetCurrentPanel sets a panel's visibility to "true" and all other panels'
visibility to "false". SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. ShowPage sets a panel's visibility to "true". ShowPanel sets a panel's visibility to "true" (in addition to any other panels
which are already visible). SwitchToPage sets a panel's visibility to "true" and all other panels'
visibility to "false". TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
Pages : Focusable
Pages : Primitive
Pages : sync.Locker
func NewPages() *Pages
Panels is a container for other primitives often used as the application's
root primitive. It allows to easily switch the visibility of the contained
primitives.Box*BoxRWMutexsync.RWMutex AddPanel adds a new panel with the given name and primitive. If there was
previously a panel with the same name, it is overwritten. Leaving the name
empty may cause conflicts in other functions so always specify a non-empty
name.
Visible panels will be drawn in the order they were added (unless that order
was changed in one of the other functions). If "resize" is set to true, the
primitive will be set to the size available to the Panels primitive whenever
the panels are drawn. Blur is called when this primitive loses focus. Draw draws this primitive onto the screen. Focus is called by the application when the primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetFrontPanel returns the front-most visible panel. If there are no visible
panels, ("", nil) is returned. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetPanelCount returns the number of panels currently stored in this object. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. HasPanel returns true if a panel with the given name exists in this object. HidePanel sets a panel's visibility to "false". InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns nil. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. RemovePanel removes the panel with the given name. If that panel was the only
visible panel, visibility is assigned to the last panel. SendToBack changes the order of the panels such that the panel with the given
name comes first, causing it to be drawn first with the next update (if
visible). SendToFront changes the order of the panels such that the panel with the given
name comes last, causing it to be drawn last with the next update (if
visible). SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetChangedFunc sets a handler which is called whenever the visibility or the
order of any visible panels changes. This can be used to redraw the panels. SetCurrentPanel sets a panel's visibility to "true" and all other panels'
visibility to "false". SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. ShowPanel sets a panel's visibility to "true" (in addition to any other panels
which are already visible). TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*Panels : Focusable
*Panels : Primitive
*Panels : sync.Locker
func NewPanels() *Panels
Primitive is the top-most interface for all graphical primitives. Blur is called by the application when the primitive loses focus. Draw draws this primitive onto the screen. Implementers can call the
screen's ShowCursor() function but should only do so when they have focus.
(They will need to keep track of this themselves.) Focus is called by the application when the primitive receives focus.
Implementers may call delegate() to pass the focus on to another primitive. GetFocusable returns the item's Focusable. GetRect returns the current position of the primitive, x, y, width, and
height. GetVisible returns whether or not the primitive is visible. InputHandler returns a handler which receives key events when it has focus.
It is called by the Application class.
A value of nil may also be returned, in which case this primitive cannot
receive focus and will not process any key events.
The handler will receive the key event and a function that allows it to
set the focus to a different primitive, so that future key events are sent
to that primitive.
The Application's Draw() function will be called automatically after the
handler returns.
The Box class provides functionality to intercept keyboard input. If you
subclass from Box, it is recommended that you wrap your handler using
Box.WrapInputHandler() so you inherit that functionality. MouseHandler returns a handler which receives mouse events.
It is called by the Application class.
A value of nil may also be returned to stop the downward propagation of
mouse events.
The Box class provides functionality to intercept mouse events. If you
subclass from Box, it is recommended that you wrap your handler using
Box.WrapMouseHandler() so you inherit that functionality. SetRect sets a new position of the primitive. SetVisible sets whether or not the primitive is visible.
*Box
*Button
*CheckBox
*DropDown
*Flex
*FormFormItem(interface)
*Frame
*Grid
*InputField
*List
*ModalPages
*Panels
*ProgressBar
*ScrollView
*Slider
*TabbedPanels
*Table
*TextView
*TreeView
*Window
*WindowManager
func (*Application).GetFocus() Primitive
func (*FocusManager).GetFocusedPrimitive() Primitive
func (*Pages).GetFrontPage() (name string, item Primitive)
func (*Panels).GetFrontPanel() (name string, item Primitive)
func (*ScrollView).GetItems() []Primitive
func NewContextMenu(parent Primitive) *ContextMenu
func NewFrame(primitive Primitive) *Frame
func NewWindow(primitive Primitive) *Window
func (*Application).Draw(p ...Primitive)
func (*Application).QueueUpdateDraw(f func(), p ...Primitive)
func (*Application).ResizeToFullScreen(p Primitive)
func (*Application).SetFocus(p Primitive)
func (*Application).SetRoot(root Primitive, fullscreen bool)
func (*Flex).AddItem(item Primitive, fixedSize, proportion int, focus bool)
func (*Flex).AddItemAtIndex(index int, item Primitive, fixedSize, proportion int, focus bool)
func (*Flex).RemoveItem(p Primitive)
func (*Flex).ResizeItem(p Primitive, fixedSize, proportion int)
func (*FocusManager).Add(p ...Primitive)
func (*FocusManager).AddAt(index int, p Primitive)
func (*FocusManager).Focus(p Primitive)
func (*Grid).AddItem(p Primitive, row, column, rowSpan, colSpan, minGridHeight, minGridWidth int, focus bool)
func (*Grid).HasItem(p Primitive) bool
func (*Grid).RemoveItem(p Primitive)
func (*Grid).UpdateItem(p Primitive, row, column, rowSpan, colSpan, minGridHeight, minGridWidth int, focus bool)
func (*Pages).AddAndSwitchToPage(name string, item Primitive, resize bool)
func (*Pages).AddPage(name string, item Primitive, resize, visible bool)
func (*Panels).AddPanel(name string, item Primitive, resize, visible bool)
func (*ScrollView).AddItem(item Primitive, fixedSize int, focus bool)
func (*ScrollView).AddItemAtIndex(index int, item Primitive, fixedSize int, focus bool)
func (*ScrollView).RemoveItem(p Primitive)
func (*ScrollView).ResizeItem(p Primitive, fixedSize int)
func (*TabbedPanels).AddTab(name, label string, item Primitive)
ProgressBar indicates the progress of an operation.Box*BoxRWMutexsync.RWMutex AddProgress adds to the current progress. Blur is called when this primitive loses focus. Complete returns whether the progress bar has been filled. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMax returns the progress required to fill the bar. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetProgress gets the current progress. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns nil. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns nil. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetEmptyColor sets the color of the empty area of the progress bar. SetEmptyRune sets the rune used for the empty area of the progress bar. SetFilledColor sets the color of the filled area of the progress bar. SetFilledRune sets the rune used for the filled area of the progress bar. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMax sets the progress required to fill the bar. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetProgress sets the current progress. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVertical sets the direction of the progress bar. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
ProgressBar : Focusable
*ProgressBar : Primitive
*ProgressBar : sync.Locker
func NewProgressBar() *ProgressBar
ScrollView is a basic implementation of the Scrollbox layout. The contained
primitives are arranged horizontally or vertically. The way they are
distributed along that dimension depends on their layout settings, which is
either a fixed length or a proportional length. See AddItem() for details.Box*BoxRWMutexsync.RWMutex AddItem adds a new item to the container. The "fixedSize" argument is a width
or height that may not be changed by the layout algorithm. A value of 0 means
that its size is scrollible and may be changed. The "proportion" argument
defines the relative size of the item compared to other scrollible-size items.
For example, items with a proportion of 2 will be twice as large as items
with a proportion of 1. The proportion must be at least 1 if fixedSize == 0
(ignored otherwise).
If "focus" is set to true, the item will receive focus when the ScrollView
primitive receives focus. If multiple items have the "focus" flag set to
true, the first one will receive focus.
A nil value for the primitive represents empty space. AddItemAtIndex adds an item to the scroll at a given index.
For more information see AddItem. Blur is called when this primitive loses focus. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetItems returns a slice of all items in the container. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns nil. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. RemoveItem removes all items for the given primitive from the container,
keeping the order of the remaining items intact. ResizeItem sets a new size for the item(s) with the given primitive. If there
are multiple ScrollView items with the same primitive, they will all receive the
same size. For details regarding the size parameters, see AddItem(). ScrollTo scrolls to the specified height and width (both starting with 0). SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetFullScreen sets the flag which, when true, causes the scroll layout to use
the entire screen space instead of whatever size it is currently assigned to. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetScrollBarColor sets the color of the scroll bar. SetScrollBarVisibility specifies the display of the scroll bar. SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*ScrollView : Focusable
*ScrollView : Primitive
*ScrollView : sync.Locker
func NewScrollView() *ScrollView
Slider is a progress bar which may be modified via keyboard and mouse.ProgressBar*ProgressBarProgressBar.Box*BoxRWMutexsync.RWMutex AddProgress adds to the current progress. Blur is called when this primitive loses focus. Complete returns whether the progress bar has been filled. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFieldHeight returns the height of the field. GetFieldWidth returns this primitive's field width. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetLabel returns the text to be displayed before the input area. GetMax returns the progress required to fill the bar. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetProgress gets the current progress. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetChangedFunc sets a handler which is called when the value of this slider
was changed by the user. The handler function receives the new value. SetDoneFunc sets a handler which is called when the user is done using the
slider. The callback function is provided with the key that was pressed,
which is one of the following:
- KeyEscape: Abort text input.
- KeyTab: Move to the next field.
- KeyBacktab: Move to the previous field. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetEmptyColor sets the color of the empty area of the progress bar. SetEmptyRune sets the rune used for the empty area of the progress bar. SetFieldBackgroundColor sets the background color of the input area. SetFieldBackgroundColorFocused sets the background color of the input area when focused. SetFieldTextColor sets the text color of the input area. SetFieldTextColorFocused sets the text color of the input area when focused. SetFilledColor sets the color of the filled area of the progress bar. SetFilledRune sets the rune used for the filled area of the progress bar. SetFinishedFunc sets a callback invoked when the user leaves this form item. SetIncrement sets the amount the slider is incremented by when modified via
keyboard. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetLabel sets the text to be displayed before the input area. SetLabelColor sets the color of the label. SetLabelColorFocused sets the color of the label when focused. SetLabelWidth sets the screen width of the label. A value of 0 will cause the
primitive to use the width of the label string. SetMax sets the progress required to fill the bar. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetProgress sets the current progress. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVertical sets the direction of the progress bar. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
Slider : Focusable
*Slider : FormItem
*Slider : Primitive
*Slider : sync.Locker
func NewSlider() *Slider
TabbedPanels is a tabbed container for other primitives. The tab switcher
may be positioned vertically or horizontally, before or after the content.Flex*FlexFlex.Box*BoxRWMutexsync.RWMutexSwitcher*TextView AddItem adds a new item to the container. The "fixedSize" argument is a width
or height that may not be changed by the layout algorithm. A value of 0 means
that its size is flexible and may be changed. The "proportion" argument
defines the relative size of the item compared to other flexible-size items.
For example, items with a proportion of 2 will be twice as large as items
with a proportion of 1. The proportion must be at least 1 if fixedSize == 0
(ignored otherwise).
If "focus" is set to true, the item will receive focus when the Flex
primitive receives focus. If multiple items have the "focus" flag set to
true, the first one will receive focus.
A nil value for the primitive represents empty space. AddItemAtIndex adds an item to the flex at a given index.
For more information see AddItem. AddTab adds a new tab. Tab names should consist only of letters, numbers
and spaces. Blur is called when this primitive loses focus. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetCurrentTab returns the currently visible tab. GetDirection returns the direction in which the contained primitives are
distributed. This can be either FlexColumn (default) or FlexRow. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. HasTab returns true if a tab with the given name exists in this object. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. RemoveItem removes all items for the given primitive from the container,
keeping the order of the remaining items intact. RemoveTab removes a tab. ResizeItem sets a new size for the item(s) with the given primitive. If there
are multiple Flex items with the same primitive, they will all receive the
same size. For details regarding the size parameters, see AddItem(). SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetChangedFunc sets a handler which is called whenever a tab is added,
selected, reordered or removed. SetCurrentTab sets the currently visible tab. SetDirection sets the direction in which the contained primitives are
distributed. This can be either FlexColumn (default) or FlexRow. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetFullScreen sets the flag which, when true, causes the flex layout to use
the entire screen space instead of whatever size it is currently assigned to. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTabBackgroundColor sets the background color of the tab. SetTabBackgroundColorFocused sets the background color of the tab when the
tab is in focus. SetTabLabel sets the label of a tab. SetTabSwitcherAfterContent sets whether the tab switcher is positioned after content. SetTabSwitcherDivider sets the tab switcher divider text. Color tags are supported. SetTabSwitcherHeight sets the tab switcher height. This setting only applies
when rendering horizontally. A value of 0 (the default) indicates the height
should automatically adjust to fit all of the tab labels. SetTabSwitcherVertical sets the orientation of the tab switcher. SetTabTextColor sets the color of the tab text. SetTabTextColorFocused sets the color of the tab text when the tab is in focus. SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
TabbedPanels : Focusable
*TabbedPanels : Primitive
*TabbedPanels : sync.Locker
func NewTabbedPanels() *TabbedPanels
Table visualizes two-dimensional data consisting of rows and columns. Each
Table cell is defined via SetCell() by the TableCell type. They can be added
dynamically to the table and changed any time.
Each row of the table must have the same number of columns when it is drawn
or navigated. This isn't strictly enforced, however you may encounter issues
when navigating a table with rows of varied column sizes.
The most compact display of a table is without borders. Each row will then
occupy one row on screen and columns are separated by the rune defined via
SetSeparator() (a space character by default).
When borders are turned on (via SetBorders()), each table cell is surrounded
by lines. Therefore one table row will require two rows on screen.
Columns will use as much horizontal space as they need. You can constrain
their size with the MaxWidth parameter of the TableCell type.
# Fixed Columns
You can define fixed rows and rolumns via SetFixed(). They will always stay
in their place, even when the table is scrolled. Fixed rows are always the
top rows. Fixed columns are always the leftmost columns.
# Selections
You can call SetSelectable() to set columns and/or rows to "selectable". If
the flag is set only for columns, entire columns can be selected by the user.
If it is set only for rows, entire rows can be selected. If both flags are
set, individual cells can be selected. The "selected" handler set via
SetSelectedFunc() is invoked when the user presses Enter on a selection.
# Navigation
If the table extends beyond the available space, it can be navigated with
key bindings similar to Vim:
- h, left arrow: Move left by one column.
- l, right arrow: Move right by one column.
- j, down arrow: Move down by one row.
- k, up arrow: Move up by one row.
- g, home: Move to the top.
- G, end: Move to the bottom.
- Ctrl-F, page down: Move down by one page.
- Ctrl-B, page up: Move up by one page.
When there is no selection, this affects the entire table (except for fixed
rows and columns). When there is a selection, the user moves the selection.
The class will attempt to keep the selection from moving out of the screen.
Use SetInputCapture() to override or modify keyboard input.Box*BoxRWMutexsync.RWMutex Blur is called when this primitive loses focus. Clear removes all table data. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetCell returns the contents of the cell at the specified position. A valid
TableCell object is always returned but it will be uninitialized if the cell
was not previously set. Such an uninitialized object will not automatically
be inserted. Therefore, repeated calls to this function may return different
pointers for uninitialized cells. GetColumnCount returns the (maximum) number of columns in the table. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetOffset returns the current row and column offset. This indicates how many
rows and columns the table is scrolled down and to the right. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetRowCount returns the number of rows in the table. GetSelectable returns what can be selected in a table. Refer to
SetSelectable() for details. GetSelection returns the position of the current selection.
If entire rows are selected, the column index is undefined.
Likewise for entire columns. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. InsertColumn inserts a column before the column with the given index. Cells
in the given column and to its right will be shifted to the right by one
column. Rows that have fewer initialized cells than "column" will remain
unchanged. InsertRow inserts a row before the row with the given index. Cells on the
given row and below will be shifted to the bottom by one row. If "row" is
equal or larger than the current number of rows, this function has no effect. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. RemoveColumn removes the column at the given position from the table. If
there is no such column, this has no effect. RemoveRow removes the row at the given position from the table. If there is
no such row, this has no effect. ScrollToBeginning scrolls the table to the beginning to that the top left
corner of the table is shown. Note that this position may be corrected if
there is a selection. ScrollToEnd scrolls the table to the beginning to that the bottom left corner
of the table is shown. Adding more rows to the table will cause it to
automatically scroll with the new data. Note that this position may be
corrected if there is a selection. Select sets the selected cell. Depending on the selection settings
specified via SetSelectable(), this may be an entire row or column, or even
ignored completely. The "selection changed" event is fired if such a callback
is available (even if the selection ends up being the same as before and even
if cells are not selectable). SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetBorders sets whether or not each cell in the table is surrounded by a
border. SetBordersColor sets the color of the cell borders. SetCell sets the content of a cell the specified position. It is ok to
directly instantiate a TableCell object. If the cell has content, at least
the Text and Color fields should be set.
Note that setting cells in previously unknown rows and columns will
automatically extend the internal table representation, e.g. starting with
a row of 100,000 will immediately create 100,000 empty rows.
To avoid unnecessary garbage collection, fill columns from left to right. SetCellSimple calls SetCell() with the given text, left-aligned, in white. SetDoneFunc sets a handler which is called whenever the user presses the
Escape, Tab, or Backtab key. If nothing is selected, it is also called when
user presses the Enter key (because pressing Enter on a selection triggers
the "selected" handler set via SetSelectedFunc()). SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetEvaluateAllRows sets a flag which determines the rows to be evaluated when
calculating the widths of the table's columns. When false, only visible rows
are evaluated. When true, all rows in the table are evaluated.
Set this flag to true to avoid shifting column widths when the table is
scrolled. (May be slower for large tables.) SetFixed sets the number of fixed rows and columns which are always visible
even when the rest of the cells are scrolled out of view. Rows are always the
top-most ones. Columns are always the left-most ones. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetOffset sets how many rows and columns should be skipped when drawing the
table. This is useful for large tables that do not fit on the screen.
Navigating a selection can change these values.
Fixed rows and columns are never skipped. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetScrollBarColor sets the color of the scroll bar. SetScrollBarVisibility specifies the display of the scroll bar. SetSelectable sets the flags which determine what can be selected in a table.
There are three selection modi:
- rows = false, columns = false: Nothing can be selected.
- rows = true, columns = false: Rows can be selected.
- rows = false, columns = true: Columns can be selected.
- rows = true, columns = true: Individual cells can be selected. SetSelectedFunc sets a handler which is called whenever the user presses the
Enter key on a selected cell/row/column. The handler receives the position of
the selection and its cell contents. If entire rows are selected, the column
index is undefined. Likewise for entire columns. SetSelectedStyle sets a specific style for selected cells. If no such style
is set, per default, selected cells are inverted (i.e. their foreground and
background colors are swapped).
To reset a previous setting to its default, make the following call:
table.SetSelectedStyle(tcell.ColorDefault, tcell.ColorDefault, 0) SetSelectionChangedFunc sets a handler which is called whenever the current
selection changes. The handler receives the position of the new selection.
If entire rows are selected, the column index is undefined. Likewise for
entire columns. SetSeparator sets the character used to fill the space between two
neighboring cells. This is a space character ' ' per default but you may
want to set it to Borders.Vertical (or any other rune) if the column
separation should be more visible. If cell borders are activated, this is
ignored.
Separators have the same color as borders. SetSortClicked sets a flag which determines whether the table is sorted when
a fixed row is clicked. This flag is enabled by default. SetSortFunc sets the sorting function used for the table. When unset, a
case-sensitive string comparison is used. SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. Sort sorts the table by the column at the given index. You may set a custom
sorting function with SetSortFunc. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
Table : Focusable
*Table : Primitive
*Table : sync.Locker
func NewTable() *Table
TableCell represents one cell inside a Table. You can instantiate this type
directly but all colors (background and text) will be set to their default
which is black. The alignment of the cell text. One of AlignLeft (default), AlignCenter,
or AlignRight. The style attributes of the cell. The background color of the cell. The color of the cell text. If the total table width is less than the available width, this value is
used to add extra width to a column. See SetExpansion() for details. The maximum width of the cell in screen space. This is used to give a
column a maximum width. Any cell text whose screen width exceeds this width
is cut off. Set to 0 if there is no maximum width. If set to true, this cell cannot be selected.RWMutexsync.RWMutex The reference object. The text to be displayed in the table cell. GetBytes returns the cell's text. GetLastPosition returns the position of the table cell the last time it was
drawn on screen. If the cell is not on screen, the return values are
undefined.
Because the Table class will attempt to keep selected cells on screen, this
function is most useful in response to a "selected" event (see
SetSelectedFunc()) or a "selectionChanged" event (see
SetSelectionChangedFunc()). GetReference returns this cell's reference object. GetText returns the cell's text. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetAlign sets the cell's text alignment, one of AlignLeft, AlignCenter, or
AlignRight. SetAttributes sets the cell's text attributes. You can combine different
attributes using bitmask operations:
cell.SetAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBackgroundColor sets the cell's background color. Set to
tcell.ColorDefault to use the table's background color. SetBytes sets the cell's text. SetExpansion sets the value by which the column of this cell expands if the
available width for the table is more than the table width (prior to applying
this expansion value). This is a proportional value. The amount of unused
horizontal space is divided into widths to be added to each column. How much
extra width a column receives depends on the expansion value: A value of 0
(the default) will not cause the column to increase in width. Other values
are proportional, e.g. a value of 2 will cause a column to grow by twice
the amount of a column with a value of 1.
Since this value affects an entire column, the maximum over all visible cells
in that column is used.
This function panics if a negative value is provided. SetMaxWidth sets maximum width of the cell in screen space. This is used to
give a column a maximum width. Any cell text whose screen width exceeds this
width is cut off. Set to 0 if there is no maximum width. SetReference allows you to store a reference of any type in this cell. This
will allow you to establish a mapping between the cell and your
actual data. SetSelectable sets whether or not this cell can be selected by the user. SetStyle sets the cell's style (foreground color, background color, and
attributes) all at once. SetText sets the cell's text. SetTextColor sets the cell's text color. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it.
*TableCell : sync.Locker
func NewTableCell(text string) *TableCell
func (*Table).GetCell(row, column int) *TableCell
func (*Table).SetCell(row, column int, cell *TableCell)
TextView is a box which displays text. It implements the io.Writer interface
so you can stream text to it. This does not trigger a redraw automatically
but if a handler is installed via SetChangedFunc(), you can cause it to be
redrawn. (See SetChangedFunc() for more details.)
# Navigation
If the text view is scrollable (the default), text is kept in a buffer which
may be larger than the screen and can be navigated similarly to Vim:
- h, left arrow: Move left.
- l, right arrow: Move right.
- j, down arrow: Move down.
- k, up arrow: Move up.
- g, home: Move to the top.
- G, end: Move to the bottom.
- Ctrl-F, page down: Move down by one page.
- Ctrl-B, page up: Move up by one page.
If the text is not scrollable, any text above the top visible line is
discarded.
Use SetInputCapture() to override or modify keyboard input.
# Colors
If dynamic colors are enabled via SetDynamicColors(), text color can be
changed dynamically by embedding color strings in square brackets. This works
the same way as anywhere else. Please see the package documentation for more
information.
# Regions and Highlights
If regions are enabled via SetRegions(), you can define text regions within
the text and assign region IDs to them. Text regions start with region tags.
Region tags are square brackets that contain a region ID in double quotes,
for example:
We define a ["rg"]region[""] here.
A text region ends with the next region tag. Tags with no region ID ([""])
don't start new regions. They can therefore be used to mark the end of a
region. Region IDs must satisfy the following regular expression:
[a-zA-Z0-9_,;: \-\.]+
Regions can be highlighted by calling the Highlight() function with one or
more region IDs. This can be used to display search results, for example.
The ScrollToHighlight() function can be used to jump to the currently
highlighted region once when the text view is drawn the next time.Box*BoxRWMutexsync.RWMutex Blur is called when this primitive loses focus. Clear removes all text from the buffer. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetBufferSize returns the number of lines and the length of the longest line
in the text buffer. The screen size of the widget is available via GetRect. GetBytes returns the current text of this text view. If "stripTags" is set
to true, any region/color tags are stripped from the text. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetHighlights returns the IDs of all currently highlighted regions. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetRegionText returns the text of the region with the given ID. If dynamic
colors are enabled, color tags are stripped from the text. Newlines are
always returned as '\n' runes.
If the region does not exist or if regions are turned off, an empty string
is returned. GetScrollOffset returns the number of rows and columns that are skipped at
the top left corner when the text view has been scrolled. GetText returns the current text of this text view. If "stripTags" is set
to true, any region/color tags are stripped from the text. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. Highlight specifies which regions should be highlighted. If highlight
toggling is set to true (see SetToggleHighlights()), the highlight of the
provided regions is toggled (highlighted regions are un-highlighted and vice
versa). If toggling is set to false, the provided regions are highlighted and
all other regions will not be highlighted (you may also provide nil to turn
off all highlights).
For more information on regions, see class description. Empty region strings
are ignored.
Text in highlighted regions will be drawn inverted, i.e. with their
background and foreground colors swapped. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. ScrollTo scrolls to the specified row and column (both starting with 0). ScrollToBeginning scrolls to the top left corner of the text if the text view
is scrollable. ScrollToEnd scrolls to the bottom left corner of the text if the text view
is scrollable. Adding new rows to the end of the text view will cause it to
scroll with the new data. ScrollToHighlight will cause the visible area to be scrolled so that the
highlighted regions appear in the visible area of the text view. This
repositioning happens the next time the text view is drawn. It happens only
once so you will need to call this function repeatedly to always keep
highlighted regions in view.
Nothing happens if there are no highlighted regions or if the text view is
not scrollable. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetBytes sets the text of this text view to the provided byte slice.
Previously contained text will be removed. SetChangedFunc sets a handler function which is called when the text of the
text view has changed. This is useful when text is written to this io.Writer
in a separate goroutine. Doing so does not automatically cause the screen to
be refreshed so you may want to use the "changed" handler to redraw the
screen.
Note that to avoid race conditions or deadlocks, there are a few rules you
should follow:
- You can call Application.Draw() from this handler.
- You can call TextView.HasFocus() from this handler.
- During the execution of this handler, access to any other variables from
this primitive or any other primitive should be queued using
Application.QueueUpdate().
See package description for details on dealing with concurrency. SetClickedFunc Handler to run when a region is clicked. SetDoneFunc sets a handler which is called when the user presses on the
following keys: Escape, Enter, Tab, Backtab. The key is passed to the
handler. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetDynamicColors sets the flag that allows the text color to be changed
dynamically. See class description for details. SetHighlightBackgroundColor sets the foreground color of highlighted text. SetHighlightForegroundColor sets the foreground color of highlighted text. SetHighlightedFunc sets a handler which is called when the list of currently
highlighted regions change. It receives a list of region IDs which were newly
highlighted, those that are not highlighted anymore, and those that remain
highlighted.
Note that because regions are only determined during drawing, this function
can only fire for regions that have existed during the last call to Draw(). SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMaxLines sets the maximum number of newlines the text view will hold
before discarding older data from the buffer. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetRegions sets the flag that allows to define regions in the text. See class
description for details. SetReindexBuffer set a flag controlling whether the buffer is reindexed when
it is modified. This improves the performance of TextViews whose contents
always have line-breaks in the same location. This must be called after the
buffer has been indexed. SetScrollBarColor sets the color of the scroll bar. SetScrollBarVisibility specifies the display of the scroll bar. SetScrollable sets the flag that decides whether or not the text view is
scrollable. If true, text is kept in a buffer and can be navigated. If false,
the last line will always be visible. SetText sets the text of this text view to the provided string. Previously
contained text will be removed. SetTextAlign sets the horizontal alignment of the text. This must be either
AlignLeft, AlignCenter, or AlignRight. SetTextColor sets the initial color of the text (which can be changed
dynamically by sending color strings in square brackets to the text view if
dynamic colors are enabled). SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetToggleHighlights sets a flag to determine how regions are highlighted.
When set to true, the Highlight() function will toggle the
provided/selected regions. When set to false, Highlight()
will simply highlight the provided regions. SetVerticalAlign sets the vertical alignment of the text. This must be
either AlignTop, AlignMiddle, or AlignBottom. SetVisible sets the flag indicating whether or not the box is visible. SetWordWrap sets the flag that, if true and if the "wrap" flag is also true
(see SetWrap()), wraps the line at spaces or after punctuation marks. Note
that trailing spaces will not be printed.
This flag is ignored if the "wrap" flag is false. SetWrap sets the flag that, if true, leads to lines that are longer than the
available width being wrapped onto the next line. If false, any characters
beyond the available width are not displayed. SetWrapWidth set the maximum width of lines when wrapping is enabled.
When set to 0 the width of the TextView is used. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives. Write lets us implement the io.Writer interface. Tab characters will be
replaced with TabSize space characters. A "\n" or "\r\n" will be interpreted
as a new line.
*TextView : Focusable
*TextView : Primitive
*TextView : github.com/miekg/dns.Writer
*TextView : internal/bisect.Writer
*TextView : io.Writer
*TextView : sync.Locker
func NewTextView() *TextView
Theme defines the colors used when primitives are initialized. // Box borders. Button // The symbol to draw at the end of button labels when focused. Check box // The symbol to draw within the checkbox when focused.ContextMenuPaddingBottomintContextMenuPaddingLeftintContextMenuPaddingRightint Context menu // Background color for contrasting elements. // Primary text for contrasting elements. // Secondary text on ContrastBackgroundColor-colored backgrounds. Drop down // The chars to show when the option's text gets shortened. // The symbol to draw at the end of the field when opened. // The symbol to draw to indicate the selected list item. // The symbol to draw at the end of the field when closed. // Graphics. // Text on primary-colored backgrounds. // Background color for even more contrasting elements. Text // Primary text. Background // Main background color for primitives. Scroll bar // Secondary text (e.g. labels). // Tertiary text (e.g. subtitles, notes). Title, border and other lines // Box titles.WindowMinHeightint Window
var Styles
TreeNode represents one node in a tree view.RWMutexsync.RWMutex AddChild adds a new child node to this node. ClearChildren removes all child nodes from this node. Collapse makes the child nodes of this node disappear. CollapseAll collapses this node and all descendent nodes. Expand makes the child nodes of this node appear. ExpandAll expands this node and all descendent nodes. GetChildren returns this node's children. GetColor returns the node's color.(*TreeNode) GetHighlighted() bool(*TreeNode) GetIndent() int(*TreeNode) GetParent() *TreeNode GetReference returns this node's reference object. GetText returns this node's text. IsExpanded returns whether the child nodes of this node are visible. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. RemoveChild removes a child node from this node. If the child node cannot be
found, nothing happens.(*TreeNode) SetBold(bold bool) SetChildren sets this node's child nodes. SetColor sets the node's text color. SetExpanded sets whether or not this node's child nodes should be displayed. SetFocusedFunc sets the function which is called when the user navigates to
this node.
This function is also called when the user selects this node.(*TreeNode) SetHighlighted(state bool) SetIndent sets an additional indentation for this node's text. A value of 0
keeps the text as far left as possible with a minimum of line graphics. Any
value greater than that moves the text to the right. SetReference allows you to store a reference of any type in this node. This
will allow you to establish a mapping between the TreeView hierarchy and your
internal tree structure. SetSelectable sets a flag indicating whether this node can be focused and
selected by the user. SetSelectedFunc sets a function which is called when the user selects this
node by hitting Enter when it is focused. SetText sets the node's text which is displayed.(*TreeNode) SetUnderline(underline bool) TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. VisibleLength returns the visible length of the node's text, without style tags. Walk traverses this node's subtree in depth-first, pre-order (NLR) order and
calls the provided callback function on each traversed node (which includes
this node) with the traversed node and its parent node (nil for this node).
The callback returns whether traversal should continue with the traversed
node's child nodes (true) or not recurse any deeper (false).
*TreeNode : sync.Locker
func NewTreeNode(text string) *TreeNode
func (*TreeNode).GetChildren() []*TreeNode
func (*TreeNode).GetParent() *TreeNode
func (*TreeView).GetCurrentNode() *TreeNode
func (*TreeView).GetPath(node *TreeNode) []*TreeNode
func (*TreeView).GetRoot() *TreeNode
func (*TreeNode).AddChild(node *TreeNode)
func (*TreeNode).RemoveChild(node *TreeNode) bool
func (*TreeNode).SetChildren(childNodes []*TreeNode)
func (*TreeView).GetPath(node *TreeNode) []*TreeNode
func (*TreeView).SelectNode(node *TreeNode)
func (*TreeView).SetCurrentNode(node *TreeNode)
func (*TreeView).SetRoot(root *TreeNode)
TreeView displays tree structures. A tree consists of nodes (TreeNode
objects) where each node has zero or more child nodes and exactly one parent
node (except for the root node which has no parent node).
The SetRoot() function is used to specify the root of the tree. Other nodes
are added locally to the root node or any of its descendents. See the
TreeNode documentation for details on node attributes. (You can use
SetReference() to store a reference to nodes of your own tree structure.)
Nodes can be focused by calling SetCurrentNode(). The user can navigate the
selection or the tree by using the following keys:
- j, down arrow, right arrow: Move (the selection) down by one node.
- k, up arrow, left arrow: Move (the selection) up by one node.
- g, home: Move (the selection) to the top.
- G, end: Move (the selection) to the bottom.
- Ctrl-F, page down: Move (the selection) down by one page.
- Ctrl-B, page up: Move (the selection) up by one page.
Selected nodes can trigger the "selected" callback when the user hits Enter.
The root node corresponds to level 0, its children correspond to level 1,
their children to level 2, and so on. Per default, the first level that is
displayed is 0, i.e. the root node. You can call SetTopLevel() to hide
levels.
If graphics are turned on (see SetGraphics()), lines indicate the tree's
hierarchy. Alternative (or additionally), you can set different prefixes
using SetPrefixes() for different levels, for example to display hierarchical
bullet point lists.Box*BoxRWMutexsync.RWMutex Blur is called when this primitive loses focus. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetCurrentNode returns the currently selected node or nil of no node is
currently selected. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetPath returns all nodes located on the path from the root to the given
node, including the root and the node itself. If there is no root node, nil
is returned. If there are multiple paths to the node, a random one is chosen
and returned. GetRect returns the current position of the rectangle, x, y, width, and
height. GetRoot returns the root node of the tree. If no such node was previously
set, nil is returned. GetRowCount returns the number of "visible" nodes. This includes nodes which
fall outside the tree view's box but notably does not include the children
of collapsed nodes. Note that this value is only up to date after the tree
view has been drawn. GetScrollOffset returns the number of node rows that were skipped at the top
of the tree view. Note that when the user navigates the tree view, this value
is only updated after the tree view has been redrawn. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. ScrollCurrentIntoView scroll the current node into view. [soft] keeps the selection in the middle. SelectNode selects the given node. SetAlign controls the horizontal alignment of the node texts. If set to true,
all texts except that of top-level nodes will be placed in the same column.
If set to false, they will indent with the hierarchy. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetChangedFunc sets the function which is called when the user navigates to
a new tree node. SetCurrentNode focuses a node and scrolls into viewport or, when provided with nil,
clears focus.
This function does NOT trigger the "changed" callback. SetDoneFunc sets a handler which is called whenever the user presses the
Escape, Tab, or Backtab key. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetGraphics sets a flag which determines whether or not line graphics are
drawn to illustrate the tree's hierarchy. SetGraphicsColor sets the colors of the lines used to draw the tree structure.(*TreeView) SetHighlightColor(color tcell.Color) SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetPrefixes defines the strings drawn before the nodes' texts. This is a
slice of strings where each element corresponds to a node's hierarchy level,
i.e. 0 for the root, 1 for the root's children, and so on (levels will
cycle).
For example, to display a hierarchical list with bullet points:
treeView.SetGraphics(false).
SetPrefixes([]string{"* ", "- ", "x "}) SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetRoot sets the root node of the tree. SetScrollBarColor sets the color of the scroll bar. SetScrollBarVisibility specifies the display of the scroll bar. SetSelectedBackgroundColor sets the background color of selected items. SetSelectedFunc sets the function which is called when the user selects a
node by pressing Enter on the current selection. SetSelectedTextColor sets the text color of selected items. SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetTopLevel sets the first tree level that is visible with 0 referring to the
root, 1 to the root's child nodes, and so on. Nodes above the top level are
not displayed. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. Transform modifies the current selection. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
TreeView : Focusable
*TreeView : Primitive
*TreeView : sync.Locker
func NewTreeView() *TreeView
Window is a draggable, resizable frame around a primitive. Windows must be
added to a WindowManager.Box*BoxRWMutexsync.RWMutex Blur is called when this primitive loses focus. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns the handler for this primitive. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetFullscreen sets the flag indicating whether or not the the window should
be drawn fullscreen. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*Window : Focusable
*Window : Primitive
*Window : sync.Locker
func NewWindow(primitive Primitive) *Window
func (*WindowManager).Add(w ...*Window)
WindowManager provides an area which windows may be added to.Box*BoxRWMutexsync.RWMutex Add adds a window to the manager. Blur is called when this primitive loses focus. Clear removes all windows from the manager. Draw draws this primitive onto the screen. Focus is called when this primitive receives focus. GetBackgroundColor returns the box's background color. GetBorder returns a value indicating whether the box have a border
or not. GetBorderPadding returns the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use GetPadding instead. GetDrawFunc returns the callback function which was installed with
SetDrawFunc() or nil if no such function has been installed. GetFocusable returns the item's Focusable. GetInnerRect returns the position of the inner rectangle (x, y, width,
height), without the border and without any padding. Width and height values
will clamp to 0 and thus never be negative. GetInputCapture returns the function installed with SetInputCapture() or nil
if no such function has been installed. GetMouseCapture returns the function installed with SetMouseCapture() or nil
if no such function has been installed. GetPadding returns the size of the padding around the box content. GetRect returns the current position of the rectangle, x, y, width, and
height. GetTitle returns the box's current title. GetVisible returns a value indicating whether or not the box is visible. HasFocus returns whether or not this primitive has focus. InRect returns true if the given coordinate is within the bounds of the box's
rectangle. InputHandler returns nil. Lock locks rw for writing.
If the lock is already locked for reading or writing,
Lock blocks until the lock is available. MouseHandler returns the mouse handler for this primitive. RLock locks rw for reading.
It should not be used for recursive read locking; a blocked Lock
call excludes new readers from acquiring the lock. See the
documentation on the [RWMutex] type. RLocker returns a [Locker] interface that implements
the [Locker.Lock] and [Locker.Unlock] methods by calling rw.RLock and rw.RUnlock. RUnlock undoes a single [RWMutex.RLock] call;
it does not affect other simultaneous readers.
It is a run-time error if rw is not locked for reading
on entry to RUnlock. SetBackgroundColor sets the box's background color. SetBackgroundTransparent sets the flag indicating whether or not the box's
background is transparent. The screen is not cleared before drawing the
application. Overlaying transparent widgets directly onto the screen may
result in artifacts. To resolve this, add a blank, non-transparent Box to
the bottom layer of the interface via Panels, or set a handler via
SetBeforeDrawFunc which clears the screen. SetBorder sets the flag indicating whether or not the box should have a
border. SetBorderAttributes sets the border's style attributes. You can combine
different attributes using bitmask operations:
box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) SetBorderColor sets the box's border color. SetBorderColorFocused sets the box's border color when the box is focused. SetBorderPadding sets the size of the padding around the box content.
Deprecated: This function is provided for backwards compatibility.
Developers should use SetPadding instead. SetDrawFunc sets a callback function which is invoked after the box primitive
has been drawn. This allows you to add a more individual style to the box
(and all primitives which extend it).
The function is provided with the box's dimensions (set via SetRect()). It
must return the box's inner dimensions (x, y, width, height) which will be
returned by GetInnerRect(), used by descendent primitives to draw their own
content. SetInputCapture installs a function which captures key events before they are
forwarded to the primitive's default key event handler. This function can
then choose to forward that key event (or a different one) to the default
handler by returning it. If nil is returned, the default handler will not
be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of
other primitives, such as Form, Flex, or Grid. Key events are only captured
by the primitives that have focus (e.g. InputField) and only one primitive
can have focus at a time. Composing primitives such as Form pass the focus on
to their contained primitives and thus never receive any key events
themselves. Therefore, they cannot intercept key events. SetMouseCapture sets a function which captures mouse events (consisting of
the original tcell mouse event and the semantic mouse action) before they are
forwarded to the primitive's default mouse event handler. This function can
then choose to forward that event (or a different one) by returning it or
returning a nil mouse event, in which case the default handler will not be
called.
Providing a nil handler will remove a previously existing handler. SetPadding sets the size of the padding around the box content. SetRect sets a new position of the primitive. Note that this has no effect
if this primitive is part of a layout (e.g. Flex, Grid) or if it was added
like this:
application.SetRoot(b, true) SetTitle sets the box's title. SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
or AlignRight. SetTitleColor sets the box's title color. SetVisible sets the flag indicating whether or not the box is visible. ShowFocus sets the flag indicating whether or not the borders of this
primitive should change thickness when focused. TryLock tries to lock rw for writing and reports whether it succeeded.
Note that while correct uses of TryLock do exist, they are rare,
and use of TryLock is often a sign of a deeper problem
in a particular use of mutexes. TryRLock tries to lock rw for reading and reports whether it succeeded.
Note that while correct uses of TryRLock do exist, they are rare,
and use of TryRLock is often a sign of a deeper problem
in a particular use of mutexes. Unlock unlocks rw for writing. It is a run-time error if rw is
not locked for writing on entry to Unlock.
As with Mutexes, a locked [RWMutex] is not associated with a particular
goroutine. One goroutine may [RWMutex.RLock] ([RWMutex.Lock]) a RWMutex and then
arrange for another goroutine to [RWMutex.RUnlock] ([RWMutex.Unlock]) it. WrapInputHandler wraps an input handler (see InputHandler()) with the
functionality to capture input (see SetInputCapture()) before passing it
on to the provided (default) input handler.
This is only meant to be used by subclassing primitives. WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the
functionality to capture mouse events (see SetMouseCapture()) before passing
them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
*WindowManager : Focusable
*WindowManager : Primitive
*WindowManager : sync.Locker
func NewWindowManager() *WindowManager
Package-Level Functions (total 45)
ANSIWriter returns an io.Writer which translates any ANSI escape codes
written to it into cview color tags. Other escape codes don't have an effect
and are simply removed. The translated text is written to the provided
writer.
ColorHex returns the hexadecimal value of a color as a string, prefixed with #.
If the color is invalid, a blank string is returned.
Escape escapes the given text such that color and/or region tags are not
recognized and substituted by the print functions of this package. For
example, to include a tag-like string in a box title or in a TextView:
box.SetTitle(cview.Escape("[squarebrackets]"))
fmt.Fprint(textView, cview.Escape(`["quoted"]`))
EscapeBytes escapes the given text such that color and/or region tags are not
recognized and substituted by the print functions of this package. For
example, to include a tag-like string in a box title or in a TextView:
box.SetTitle(cview.Escape("[squarebrackets]"))
fmt.Fprint(textView, cview.EscapeBytes(`["quoted"]`))
HitShortcut returns whether the EventKey provided is present in one or more
sets of keybindings.
NewApplication creates and returns a new application.
NewBox returns a Box without a border.
NewButton returns a new input field.
NewCheckBox returns a new input field.
NewContextMenu returns a new context menu.
NewDropDown returns a new drop-down.
NewDropDownOption returns a new option for a dropdown.
NewFlex returns a new flexbox layout container with no primitives and its
direction set to FlexColumn. To add primitives to this layout, see AddItem().
To change the direction, see SetDirection().
Note that Flex will have a transparent background by default so that any nil
flex items will show primitives behind the Flex.
To disable this transparency:
flex.SetBackgroundTransparent(false)
NewFocusManager returns a new FocusManager object.
NewForm returns a new form.
NewFrame returns a new frame around the given primitive. The primitive's
size will be changed to fit within this frame.
NewGrid returns a new grid-based layout container with no initial primitives.
Note that Grid will have a transparent background by default so that any
areas not covered by any primitives will show primitives behind the Grid.
To disable this transparency:
grid.SetBackgroundTransparent(false)
NewInputField returns a new input field.
NewList returns a new form.
NewListItem returns a new item for a list.
NewModal returns a new centered message window.
NewPages returns a new Panels object.
Deprecated: This function is provided for backwards compatibility.
Developers should use NewPanels instead.
NewPanels returns a new Panels object.
NewProgressBar returns a new progress bar.
NewScrollView returns a new scrollbox layout container with no primitives and its
direction set to ScrollColumn. To add primitives to this layout, see AddItem().
To change the direction, see SetDirection().
Note that ScrollView will have a transparent background by default so that any nil
scroll items will show primitives behind the ScrollView.
To disable this transparency:
scroll.SetBackgroundTransparent(false)
NewSlider returns a new slider.
NewTabbedPanels returns a new TabbedPanels object.
NewTable returns a new table.
NewTableCell returns a new table cell with sensible defaults. That is, left
aligned text with the primary text color (see Styles) and a transparent
background (using the background of the Table).
NewTextView returns a new text view.
NewTreeNode returns a new tree node.
NewTreeView returns a new tree view.
NewWindow returns a new window around the given primitive.
NewWindowManager returns a new window manager.
Print prints text onto the screen into the given box at (x,y,maxWidth,1),
not exceeding that box. "align" is one of AlignLeft, AlignCenter, or
AlignRight. The screen's background color will not be changed.
You can change the colors and text styles mid-text by inserting a color tag.
See the package description for details.
Returns the number of actual bytes of the text printed (including color tags)
and the actual width used for the printed runes.
PrintJoinedSemigraphics prints a semigraphics rune into the screen at the given
position with the given color, joining it with any existing semigraphics
rune. Background colors are preserved. At this point, only regular single
line borders are supported.
PrintSimple prints white text to the screen at the given position.
PrintStyle works like Print() but it takes a style instead of just a
foreground color.
RenderScrollBar renders a scroll bar at the specified position.
SetAttributes sets attributes on a style.
StripTags returns the provided text without color and/or region tags.
TaggedStringWidth returns the width of the given string needed to print it on
screen. The text may contain color tags which are not counted.
TaggedTextWidth returns the width of the given string needed to print it on
screen. The text may contain color tags which are not counted.
TranslateANSI replaces ANSI escape sequences found in the provided string
with cview's color tags and returns the resulting string.
WordWrap splits a text such that each resulting line does not exceed the
given screen width. Possible split points are after any punctuation or
whitespace. Whitespace after split points will be dropped.
This function considers color tags to have no width.
Text is always split at newline characters ('\n').
BUG(tslocum) Text containing square brackets is not escaped properly.
Use TextView.SetWrapWidth where possible.
Issue: https://code.rocketnine.space/tslocum/cview/issues/27
Package-Level Variables (total 15)
Borders defines various borders used when primitives are drawn.
These may be changed to accommodate a different look and feel.
ColorUnset represents an unset color. This is necessary because the zero
value of color, ColorDefault, results in default terminal colors.
DefaultFormFieldWidth is the default field screen width of form elements
whose field width is flexible (0). This is used in the Form class for
horizontal layouts.
InputFieldFloat accepts floating-point numbers.
InputFieldInteger accepts integers.
InputFieldMaxLength returns an input field accept handler which accepts
input strings up to a given length. Use it like this:
inputField.SetAcceptanceFunc(InputFieldMaxLength(10)) // Accept up to 10 characters.
Keys defines the keyboard shortcuts of an application.
Secondary shortcuts apply when not focusing a text input.
Scroll bar render text (must be one cell wide)
Scroll bar render text (must be one cell wide)
Scroll bar render text (must be one cell wide)
Scroll bar render text (must be one cell wide)
SemigraphicJoints is a map for joining semigraphic (or otherwise) runes.
So far only light lines are supported but if you want to change the border
styling you need to provide the joints, too.
The matching will be sorted ascending by rune value, so you don't need to
provide all rune combinations,
e.g. (─) + (│) = (┼) will also match (│) + (─) = (┼)
Styles defines the appearance of an application. The default is for a black
background and some basic colors: black, white, yellow, green, cyan, and
blue.
TabSize is the number of spaces with which a tab character will be replaced.
TrueColorTags is a flag which controls whether color tags should render as
the specific colors defined by tcell, or as the colors defined by the user's
terminal configuration (the default).
Package-Level Constants (total 166)
Vertical alignment within a box.
Horizontal alignment within a box.
Horizontal alignment within a box.
Vertical alignment within a box.
Horizontal alignment within a box.
Vertical alignment within a box.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Semigraphics provides an easy way to access unicode characters for drawing.
Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
isn't prefixed itself.
Configuration values.
Configuration values.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
Available mouse actions.
ScrollBarAlways always shows a scroll bar.
ScrollBarAuto shows a scroll bar when there are items offscreen.
StandardDoubleClick is a commonly used double click interval.
Widget transformations.
Widget transformations.
Widget transformations.
Widget transformations.
Widget transformations.
Widget transformations.
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.