65 lines
1.3 KiB
Go
65 lines
1.3 KiB
Go
package tins2020
|
|
|
|
import (
|
|
"image/color"
|
|
|
|
"opslag.de/schobers/zntg/ui"
|
|
)
|
|
|
|
// import "github.com/veandco/go-sdl2/sdl"
|
|
|
|
type ButtonBar struct {
|
|
ui.ContainerBase
|
|
|
|
Background color.Color
|
|
ButtonLength float32
|
|
Orientation ui.Orientation
|
|
}
|
|
|
|
const buttonBarWidth = 96
|
|
|
|
// func (b *ButtonBar) Init(ctx ui.Context) error {
|
|
// for i := range b.Buttons {
|
|
// b.AddChild(b.Buttons[i])
|
|
// }
|
|
// return b.Container.Init(ctx)
|
|
// }
|
|
|
|
// func (b *ButtonBar) Arrange(ctx ui.Context, bounds Rectangle) {
|
|
// b.Container.Arrange(ctx, bounds)
|
|
// length := b.ButtonLength
|
|
// switch b.Orientation {
|
|
// case OrientationHorizontal:
|
|
// if length == 0 {
|
|
// length = bounds.H
|
|
// }
|
|
// offset := bounds.X
|
|
// for i := range b.Buttons {
|
|
// b.Buttons[i].Arrange(ctx, Rect(offset, bounds.Y, length, bounds.H))
|
|
// offset += length
|
|
// }
|
|
// default:
|
|
// if length == 0 {
|
|
// length = bounds.W
|
|
// }
|
|
// offset := bounds.Y
|
|
// for i := range b.Buttons {
|
|
// b.Buttons[i].Arrange(ctx, Rect(bounds.X, offset, bounds.W, length))
|
|
// offset += length
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// func (b *ButtonBar) Render(ctx ui.Context) {
|
|
// SetDrawColor(ctx.Renderer, b.Background)
|
|
// ctx.Renderer.FillRect(b.Bounds.SDLPtr())
|
|
// b.Container.Render(ctx)
|
|
// }
|
|
|
|
// type Orientation int
|
|
|
|
// const (
|
|
// OrientationVertical Orientation = iota
|
|
// OrientationHorizontal
|
|
// )
|