Browse Source

Completed Godoc documentation.

tablepad
Oliver 5 years ago
parent
commit
36cca0dedc
  1. 1
      demos/box/main.go
  2. 1
      demos/button/main.go
  3. 1
      demos/checkbox/main.go
  4. 1
      demos/dropdown/main.go
  5. 1
      demos/flex/main.go
  6. 1
      demos/form/main.go
  7. 1
      demos/frame/main.go
  8. 1
      demos/inputfield/main.go
  9. 1
      demos/list/main.go
  10. 1
      demos/modal/main.go
  11. 1
      demos/pages/main.go
  12. 6
      demos/presentation/main.go
  13. 1
      demos/table/main.go
  14. 1
      demos/textview/main.go
  15. 55
      doc.go

1
demos/box/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the Box primitive.
package main
import "github.com/rivo/tview"

1
demos/button/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the Button primitive.
package main
import "github.com/rivo/tview"

1
demos/checkbox/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the Checkbox primitive.
package main
import "github.com/rivo/tview"

1
demos/dropdown/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the DropDown primitive.
package main
import "github.com/rivo/tview"

1
demos/flex/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the Flex primitive.
package main
import (

1
demos/form/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the Form primitive.
package main
import (

1
demos/frame/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the Frame primitive.
package main
import (

1
demos/inputfield/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the InputField primitive.
package main
import (

1
demos/list/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the List primitive.
package main
import (

1
demos/modal/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the Modal primitive.
package main
import (

1
demos/pages/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the Pages primitive.
package main
import (

6
demos/presentation/main.go

@ -1,6 +1,12 @@ @@ -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
demos/table/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the Table primitive.
package main
import (

1
demos/textview/main.go

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
// Demo code for the TextView primitive.
package main
import (

55
doc.go

@ -1,10 +1,34 @@ @@ -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!": @@ -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…
Cancel
Save