Documentation ¶
Index ¶
- Constants
- Variables
- func Close()
- func Init() error
- func SetFirstResponder(eh Responder)
- func SetPainter(p Painter)
- func StartEventPolling()
- func StopEventPolling()
- func Sync() error
- type AnchorEdge
- type AnchoringView
- type BaseView
- func (v *BaseView) AttachChild(child Painter, rect Rect)
- func (v *BaseView) ChildNeedsPaint(child Painter)
- func (v *BaseView) DesiredMinSize() Size
- func (v *BaseView) DetachChild(child Painter)
- func (v *BaseView) NeedPaint()
- func (v *BaseView) NeedResize()
- func (v *BaseView) PaintTo(buffer *tulib.Buffer, rect Rect) error
- func (v *BaseView) SetPaintSubscriber(cb func())
- func (v *BaseView) SetResizeSubscriber(cb func())
- func (v *BaseView) SetUpdateChildrenRect(cb func(Rect) error)
- type BlankView
- type Event
- type FillerView
- type FpsCounter
- type LinearLayout
- type Orientation
- type Painter
- type Point
- type ProgressSpinner
- type Rect
- func (r Rect) Add(p Point) Rect
- func (r Rect) Empty() bool
- func (r Rect) Eq(s Rect) bool
- func (r Rect) In(s Rect) bool
- func (r Rect) Inset(n int) Rect
- func (r Rect) Intersect(s Rect) Rect
- func (r Rect) Max() Point
- func (r Rect) Overlaps(s Rect) bool
- func (r Rect) String() string
- func (r Rect) Sub(p Point) Rect
- func (r Rect) TulibRect() tulib.Rect
- func (r Rect) Union(s Rect) Rect
- func (r Rect) Valid() bool
- type Responder
- type Signal
- type SignalHandler
- type SignalPublisher
- type Size
- type SplitLayout
- type TextView
- type TextWidget
- type TextWidgetModel
Constants ¶
const (
MaxFps = 40
)
Variables ¶
var ( // Event polling channel Events chan Event = make(chan Event, 20) )
Functions ¶
func SetFirstResponder ¶
func SetFirstResponder(eh Responder)
func SetPainter ¶
func SetPainter(p Painter)
func StartEventPolling ¶
func StartEventPolling()
func StopEventPolling ¶
func StopEventPolling()
Types ¶
type AnchorEdge ¶
type AnchorEdge uint
const ( AnchorEdgeTop AnchorEdge = iota AnchorEdgeBottom AnchorEdgeLeft AnchorEdgeRight )
type AnchoringView ¶
type AnchoringView struct { *BaseView // contains filtered or unexported fields }
func NewAnchoringView ¶
func NewAnchoringView( anchorEdge AnchorEdge, anchorWidth int, anchor, main Painter, ) *AnchoringView
type BaseView ¶
type BaseView struct {
// contains filtered or unexported fields
}
func NewBaseView ¶
func NewBaseView() *BaseView
func (*BaseView) AttachChild ¶
func (*BaseView) ChildNeedsPaint ¶
func (*BaseView) DesiredMinSize ¶
func (*BaseView) DetachChild ¶
func (*BaseView) NeedResize ¶
func (v *BaseView) NeedResize()
func (*BaseView) PaintTo ¶
BaseView.PaintTo does not paint anything itself, but it delegates painting to its children
func (*BaseView) SetPaintSubscriber ¶
func (v *BaseView) SetPaintSubscriber(cb func())
func (*BaseView) SetResizeSubscriber ¶
func (v *BaseView) SetResizeSubscriber(cb func())
func (*BaseView) SetUpdateChildrenRect ¶
type BlankView ¶
type BlankView struct {
*FillerView
}
func NewBlankView ¶
func NewBlankView() *BlankView
type FillerView ¶
type FillerView struct { *BaseView // contains filtered or unexported fields }
func NewFillerView ¶
func NewFillerView(proto termbox.Cell) *FillerView
type FpsCounter ¶
type FpsCounter struct { // The channel on which ticks are sent from client code Ticks chan<- struct{} // Client code receives fps values from this channel Fps <-chan float64 }
func NewFpsCounter ¶
func NewFpsCounter(timeInterval time.Duration) *FpsCounter
type LinearLayout ¶
type LinearLayout struct { *BaseView // contains filtered or unexported fields }
func NewLinearLayout ¶
func NewLinearLayout(children []Painter) *LinearLayout
type Orientation ¶
type Orientation uint8
const ( OrientationVertical Orientation = iota OrientationHorizontal )
type Point ¶
type Point struct {
X, Y int
}
A Point is an X, Y coordinate pair. The axes increase right and down.
var PointZero Point
PointZero is the zero Point.
type ProgressSpinner ¶
type ProgressSpinner struct { *TextView // contains filtered or unexported fields }
func NewProgressSpinner ¶
func NewProgressSpinner() *ProgressSpinner
type Rect ¶
A Rect is the composition of an origin Point and a Size.
var RectZero Rect
RectZero is the zero Rect.
func NewRectFromTulib ¶
NewRectFromTulib creates a Rect equal to rect.
func (Rect) Inset ¶
Inset returns the rectangle r inset by n, which may be negative. If either of r's dimensions is less than 2*n then an empty rectangle near the center of r will be returned.
func (Rect) Intersect ¶
Intersect returns the largest rectangle contained by both r and s. If the two rectangles do not overlap then the zero rectangle will be returned.
type Signal ¶
type Signal struct {
// contains filtered or unexported fields
}
func (*Signal) Attach ¶
func (s *Signal) Attach(handler SignalHandler) int
type SignalHandler ¶
type SignalHandler func()
type SignalPublisher ¶
type SignalPublisher struct {
// contains filtered or unexported fields
}
func (*SignalPublisher) Publish ¶
func (p *SignalPublisher) Publish()
func (*SignalPublisher) Signal ¶
func (p *SignalPublisher) Signal() *Signal
type Size ¶
type Size struct {
Width, Height int
}
A Size is a Width, Height pair.
var SizeZero Size
SizeZero is the zero Size.
type SplitLayout ¶
type SplitLayout struct { *BaseView // contains filtered or unexported fields }
func NewSplitLayout ¶
func NewSplitLayout(split1, split2 Painter) *SplitLayout
func (*SplitLayout) SetOrientation ¶
func (l *SplitLayout) SetOrientation(orientation Orientation)
func (*SplitLayout) SetRatio ¶
func (l *SplitLayout) SetRatio(ratio float32)
type TextView ¶
type TextView struct { *BaseView // contains filtered or unexported fields }
func NewTextView ¶
func NewTextView() *TextView
func (*TextView) SetParams ¶
func (v *TextView) SetParams(params *tulib.LabelParams)
type TextWidget ¶
type TextWidget struct { *TextView Model TextWidgetModel // contains filtered or unexported fields }
func NewTextWidget ¶
func NewTextWidget() *TextWidget
func (*TextWidget) HandleEvent ¶
func (v *TextWidget) HandleEvent(ev *Event)
func (*TextWidget) SetCursorPainter ¶
func (v *TextWidget) SetCursorPainter(cb func(Point))