forked from tslocum/cview
Completed Godoc documentation.
This commit is contained in:
parent
8c9be84ef8
commit
36cca0dedc
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the Box primitive.
|
||||
package main
|
||||
|
||||
import "github.com/rivo/tview"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the Button primitive.
|
||||
package main
|
||||
|
||||
import "github.com/rivo/tview"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the Checkbox primitive.
|
||||
package main
|
||||
|
||||
import "github.com/rivo/tview"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the DropDown primitive.
|
||||
package main
|
||||
|
||||
import "github.com/rivo/tview"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the Flex primitive.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the Form primitive.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the Frame primitive.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the InputField primitive.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the List primitive.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the Modal primitive.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the Pages primitive.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
/*
|
||||
A presentation of the tview package, implemented with tview.
|
||||
|
||||
Navigation
|
||||
|
||||
The presentation will advance to the next slide when the primitive demonstrated
|
||||
in the current slide is left (usually by hitting Enter or Escape). Additionally,
|
||||
the following shortcuts can be used:
|
||||
|
||||
- Ctrl-N: Jump to next slide
|
||||
- Ctrl-P: Jump to previous slide
|
||||
*/
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the Table primitive.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Demo code for the TextView primitive.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
55
doc.go
55
doc.go
|
@ -1,10 +1,34 @@
|
|||
/*
|
||||
Package tview implements primitives for terminal based applications. It uses
|
||||
github.com/gdamore/tcell.
|
||||
Package tview implements rich widgets for terminal based user interfaces. The
|
||||
widgets provided with this package are useful for data exploration and data
|
||||
entry.
|
||||
|
||||
Widgets
|
||||
|
||||
The package implements the following widgets:
|
||||
|
||||
- TextView: Scrollable windows that display multi-colored text. Text may also
|
||||
be highlighted.
|
||||
- Table: Scrollable display of tabular data. Table cells, rows, or columns may
|
||||
also be highlighted.
|
||||
- List: A navigable text list with optional keyboard shortcuts.
|
||||
- InputField: One-line input fields to enter text.
|
||||
- DropDown: Drop-down selection fields.
|
||||
- Checkbox: Selectable checkbox for boolean values.
|
||||
- Button: Buttons which get activated when the user selects them.
|
||||
- Form: Forms composed of input fields, drop down selections, checkboxes, and
|
||||
buttons.
|
||||
- Modal: A centered window with a text message and one or more buttons.
|
||||
- Flex: A Flexbox based layout manager.
|
||||
- Pages: A page based layout manager.
|
||||
|
||||
The package also provides Application which is used to poll the event queue and
|
||||
draw widgets on screen.
|
||||
|
||||
Hello World
|
||||
|
||||
Here is a very basic example showing a box with the title "Hello, world!":
|
||||
The following is a very basic example showing a box with the title "Hello,
|
||||
world!":
|
||||
|
||||
package main
|
||||
|
||||
|
@ -20,15 +44,32 @@ Here is a very basic example showing a box with the title "Hello, world!":
|
|||
}
|
||||
|
||||
First, we create a box primitive with a border and a title. Then we create an
|
||||
application, set the box as its root primitive, and run the event loop. It
|
||||
exits when the application's Stop() function is called or when Ctrl-C is
|
||||
pressed.
|
||||
application, set the box 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.
|
||||
|
||||
No mouse input (yet).
|
||||
More Demos
|
||||
|
||||
You will find more demos in the "demos" subdirectory. It also contains a
|
||||
presentation (written using tview) which gives an overview of the different
|
||||
widgets and how they can be used.
|
||||
|
||||
Type Hierarchy
|
||||
|
||||
All widgets listed above contain the Box type. All of Box's functions are
|
||||
therefore available for all widgets, too.
|
||||
|
||||
All widgets also implement the Primitive interface. There is also the Focusable
|
||||
interface which is used to override functions in subclassing types.
|
||||
|
||||
The tview package is based on github.com/gdamore/tcell. It uses types and
|
||||
constants from that package (e.g. colors and keyboard values).
|
||||
|
||||
This package does not process mouse input (yet).
|
||||
*/
|
||||
package tview
|
||||
|
|
Loading…
Reference in New Issue