mirror of
https://github.com/rivo/tview.git
synced 2024-11-07 03:20:39 +00:00
Added getters for some callback functions. Resolves #65
This commit is contained in:
parent
c96894c0cf
commit
45acc0d895
@ -59,6 +59,12 @@ func (a *Application) SetInputCapture(capture func(event *tcell.EventKey) *tcell
|
||||
return a
|
||||
}
|
||||
|
||||
// GetInputCapture returns the function installed with SetInputCapture() or nil
|
||||
// if no such function has been installed.
|
||||
func (a *Application) GetInputCapture() func(event *tcell.EventKey) *tcell.EventKey {
|
||||
return a.inputCapture
|
||||
}
|
||||
|
||||
// Run starts the application and thus the event loop. This function returns
|
||||
// when Stop() was called.
|
||||
func (a *Application) Run() error {
|
||||
@ -214,6 +220,12 @@ func (a *Application) SetBeforeDrawFunc(handler func(screen tcell.Screen) bool)
|
||||
return a
|
||||
}
|
||||
|
||||
// GetBeforeDrawFunc returns the callback function installed with
|
||||
// SetBeforeDrawFunc() or nil if none has been installed.
|
||||
func (a *Application) GetBeforeDrawFunc() func(screen tcell.Screen) bool {
|
||||
return a.beforeDraw
|
||||
}
|
||||
|
||||
// SetAfterDrawFunc installs a callback function which is invoked after the root
|
||||
// primitive was drawn during screen updates.
|
||||
//
|
||||
@ -223,6 +235,12 @@ func (a *Application) SetAfterDrawFunc(handler func(screen tcell.Screen)) *Appli
|
||||
return a
|
||||
}
|
||||
|
||||
// GetAfterDrawFunc returns the callback function installed with
|
||||
// SetAfterDrawFunc() or nil if none has been installed.
|
||||
func (a *Application) GetAfterDrawFunc() func(screen tcell.Screen) {
|
||||
return a.afterDraw
|
||||
}
|
||||
|
||||
// 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.
|
||||
//
|
||||
|
12
box.go
12
box.go
@ -124,6 +124,12 @@ func (b *Box) SetDrawFunc(handler func(screen tcell.Screen, x, y, width, height
|
||||
return b
|
||||
}
|
||||
|
||||
// GetDrawFunc returns the callback function which was installed with
|
||||
// SetDrawFunc() or nil if no such function has been installed.
|
||||
func (b *Box) GetDrawFunc() func(screen tcell.Screen, x, y, width, height int) (int, int, int, int) {
|
||||
return b.draw
|
||||
}
|
||||
|
||||
// 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.
|
||||
@ -155,6 +161,12 @@ func (b *Box) SetInputCapture(capture func(event *tcell.EventKey) *tcell.EventKe
|
||||
return b
|
||||
}
|
||||
|
||||
// GetInputCapture returns the function installed with SetInputCapture() or nil
|
||||
// if no such function has been installed.
|
||||
func (b *Box) GetInputCapture() func(event *tcell.EventKey) *tcell.EventKey {
|
||||
return b.inputCapture
|
||||
}
|
||||
|
||||
// SetBackgroundColor sets the box's background color.
|
||||
func (b *Box) SetBackgroundColor(color tcell.Color) *Box {
|
||||
b.backgroundColor = color
|
||||
|
Loading…
Reference in New Issue
Block a user