twink/tui/size.go

28 lines
489 B
Go
Raw Permalink Normal View History

2025-12-06 11:01:11 +01:00
package tui
import tea "github.com/charmbracelet/bubbletea"
2025-12-07 11:42:57 +01:00
type (
Size struct{
Width, Height int
}
Sized interface{
SetSize(width, height int) tea.Model
}
SizedWidth interface{
SetWidth(width int) tea.Model
}
SizedHeight interface{
SetHeight(height int) tea.Model
}
)
2025-12-06 11:01:11 +01:00
func NewSize(width, height int) Size {
return Size { Width: width, Height: height }
}
func NewSizeFromWindow(size tea.WindowSizeMsg) Size {
return Size { Width: size.Width, Height: size.Height }
}