Add documentation for GetChildren methods
This commit is contained in:
parent
dd0792c33a
commit
51704b9844
13 changed files with 18 additions and 10 deletions
|
@ -2,6 +2,7 @@ v1.4.1 (WIP)
|
|||
- Add ProgressBar widget
|
||||
- Add Application.RingBell
|
||||
- Add example multi-layout application and mouse-enabled application
|
||||
- Add documentation for GetChildren methods
|
||||
|
||||
v1.4.0 (2020-01-16)
|
||||
- Bump version to resolve issues with "go get"
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
// The size of the event/update/redraw channels.
|
||||
const queueSize = 100
|
||||
|
||||
// The minimum duration between resize event callbacks.
|
||||
// ResizeEventThrottle is the minimum duration between resize event callbacks.
|
||||
const ResizeEventThrottle = 200 * time.Millisecond
|
||||
|
||||
// Application represents the top node of an application.
|
||||
|
|
2
box.go
2
box.go
|
@ -403,7 +403,7 @@ func (b *Box) GetFocusable() Focusable {
|
|||
return b.focus
|
||||
}
|
||||
|
||||
// GetChildren gets the children.
|
||||
// GetChildren returns nil because Box doesn't have any use for children.
|
||||
func (b *Box) GetChildren() []Primitive {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -129,9 +129,9 @@ func (c *Checkbox) SetFormAttributes(labelWidth int, labelColor, bgColor, fieldT
|
|||
func (c *Checkbox) GetFieldWidth() int {
|
||||
if c.message == "" {
|
||||
return 1
|
||||
} else {
|
||||
return 2 + len(c.message)
|
||||
}
|
||||
|
||||
return 2 + len(c.message)
|
||||
}
|
||||
|
||||
// SetChangedFunc sets a handler which is called when the checked state of this
|
||||
|
|
8
doc.go
8
doc.go
|
@ -19,6 +19,7 @@ The package implements the following widgets:
|
|||
- DropDown: Drop-down selection fields.
|
||||
- Checkbox: Selectable checkbox for boolean values.
|
||||
- Button: Buttons which get activated when the user selects them.
|
||||
- ProgressBar: Indicates the progress of an operation.
|
||||
- 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.
|
||||
|
@ -192,9 +193,8 @@ 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 cview package is based on https://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).
|
||||
This package is a fork of [tview](https://github.com/rivo/tview), which is
|
||||
based on https://github.com/gdamore/tcell. It uses types and constants from
|
||||
that package (e.g. colors and keyboard values).
|
||||
*/
|
||||
package cview
|
||||
|
|
|
@ -10,6 +10,7 @@ type EventKey = tcell.EventKey
|
|||
// MouseAction are bit flags indicating what the mouse is logically doing.
|
||||
type MouseAction int
|
||||
|
||||
// All MouseActions
|
||||
const (
|
||||
MouseDown MouseAction = 1 << iota
|
||||
MouseUp
|
||||
|
@ -35,7 +36,7 @@ func (e *EventMouse) Application() *Application {
|
|||
return e.app
|
||||
}
|
||||
|
||||
// MouseAction gets the mouse action of this event.
|
||||
// Action gets the mouse action of this event.
|
||||
func (e *EventMouse) Action() MouseAction {
|
||||
return e.action
|
||||
}
|
||||
|
|
1
flex.go
1
flex.go
|
@ -196,6 +196,7 @@ func (f *Flex) HasFocus() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// GetChildren returns all primitives that have been added.
|
||||
func (f *Flex) GetChildren() []Primitive {
|
||||
children := make([]Primitive, len(f.items))
|
||||
for i, item := range f.items {
|
||||
|
|
1
form.go
1
form.go
|
@ -621,6 +621,7 @@ func (f *Form) focusIndex() int {
|
|||
return -1
|
||||
}
|
||||
|
||||
// GetChildren returns all primitives that have been added.
|
||||
func (f *Form) GetChildren() []Primitive {
|
||||
children := make([]Primitive, len(f.items)+len(f.buttons))
|
||||
i := 0
|
||||
|
|
1
frame.go
1
frame.go
|
@ -156,6 +156,7 @@ func (f *Frame) HasFocus() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// GetChildren returns all primitives that have been added.
|
||||
func (f *Frame) GetChildren() []Primitive {
|
||||
return []Primitive{f.primitive}
|
||||
}
|
||||
|
|
1
grid.go
1
grid.go
|
@ -661,6 +661,7 @@ func (g *Grid) Draw(screen tcell.Screen) {
|
|||
}
|
||||
}
|
||||
|
||||
// GetChildren returns all primitives that have been added.
|
||||
func (g *Grid) GetChildren() []Primitive {
|
||||
children := make([]Primitive, len(g.items))
|
||||
for i, item := range g.items {
|
||||
|
|
1
modal.go
1
modal.go
|
@ -176,6 +176,7 @@ func (m *Modal) Draw(screen tcell.Screen) {
|
|||
m.frame.Draw(screen)
|
||||
}
|
||||
|
||||
// GetChildren returns all primitives that have been added.
|
||||
func (m *Modal) GetChildren() []Primitive {
|
||||
return []Primitive{m.frame}
|
||||
}
|
||||
|
|
1
pages.go
1
pages.go
|
@ -279,6 +279,7 @@ func (p *Pages) Draw(screen tcell.Screen) {
|
|||
}
|
||||
}
|
||||
|
||||
// GetChildren returns all primitives that have been added.
|
||||
func (p *Pages) GetChildren() []Primitive {
|
||||
var children []Primitive
|
||||
for _, page := range p.pages {
|
||||
|
|
|
@ -44,7 +44,7 @@ type Primitive interface {
|
|||
// GetFocusable returns the item's Focusable.
|
||||
GetFocusable() Focusable
|
||||
|
||||
// GetChildren gets the children.
|
||||
// GetChildren returns all child primitives that have been added.
|
||||
GetChildren() []Primitive
|
||||
|
||||
// MouseHandler returns a handler which receives mouse events.
|
||||
|
|
Loading…
Reference in a new issue