Sander Schobers
2c9007ce9b
- Removes dependency on the specific backend from an application point-of-view.
28 lines
666 B
Go
28 lines
666 B
Go
package allg5ui
|
|
|
|
import (
|
|
"opslag.de/schobers/allg5"
|
|
"opslag.de/schobers/zntg/ui"
|
|
)
|
|
|
|
func init() {
|
|
ui.SetRendererFactory(&rendererFactory{})
|
|
}
|
|
|
|
type rendererFactory struct{}
|
|
|
|
func (f rendererFactory) New(title string, width, height int) (ui.Renderer, error) {
|
|
return f.NewOptions(title, width, height, ui.NewRendererOptions{Resizable: true})
|
|
}
|
|
|
|
func (f rendererFactory) NewOptions(title string, width, height int, opts ui.NewRendererOptions) (ui.Renderer, error) {
|
|
renderer, err := NewRenderer(width, height, allg5.NewDisplayOptions{
|
|
Resizable: opts.Resizable,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
renderer.SetWindowTitle(title)
|
|
return renderer, nil
|
|
}
|