56 lines
1.1 KiB
Go
56 lines
1.1 KiB
Go
package gui
|
|
|
|
type WrapperTmpl struct {
|
|
ViewTmpl
|
|
view View
|
|
}
|
|
|
|
var _ Wrapper = &WrapperTmpl{}
|
|
|
|
func (v *WrapperTmpl) Layout(ctx AppContext) (prefWidth, prefHeight int) {
|
|
if v.view != nil {
|
|
return v.view.Layout(ctx)
|
|
}
|
|
return v.ViewTmpl.Layout(ctx)
|
|
}
|
|
|
|
func (v *WrapperTmpl) Draw(img *Image, ctx AppContext) {
|
|
v.ViewTmpl.Draw(img, ctx)
|
|
if v.view != nil {
|
|
v.view.Draw(img, ctx)
|
|
}
|
|
}
|
|
|
|
func (v *WrapperTmpl) OnMouseClick(event MouseEvent) (consumed bool) {
|
|
if v.view != nil {
|
|
return v.view.OnMouseClick(event)
|
|
}
|
|
return v.ViewTmpl.OnMouseClick(event)
|
|
}
|
|
|
|
func (v *WrapperTmpl) OnMouseMove(event MouseEvent) (consumed bool) {
|
|
if v.view != nil {
|
|
return v.view.OnMouseMove(event)
|
|
}
|
|
return v.ViewTmpl.OnMouseMove(event)
|
|
}
|
|
|
|
func (v *WrapperTmpl) OnMouseScroll(event MouseEvent) (consumed bool) {
|
|
if v.view != nil {
|
|
return v.view.OnMouseScroll(event)
|
|
}
|
|
return v.ViewTmpl.OnMouseScroll(event)
|
|
}
|
|
|
|
func (v *WrapperTmpl) Views() []View {
|
|
return []View{v.view}
|
|
}
|
|
|
|
func (v *WrapperTmpl) View() View {
|
|
return v.view
|
|
}
|
|
|
|
func (v *WrapperTmpl) SetView(view View) {
|
|
v.view = view
|
|
}
|