| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package layout
- type Rect struct {
- x int
- y int
- width int
- height int
- }
- type LayoutManager struct {
- Workspaces []Workspace
- ActiveIdx int
- }
- type Workspace struct {
- RootContainer Container[[]int]
- }
- type SplitType int
- const (
- SplitHorizontal SplitType = iota
- SplitVertical
- )
- type ContainerNode interface {
- []int | Container[[]int]
- }
- type Container[T ContainerNode] struct {
- Children [2]any
- Split SplitType
- ActiveBuffer *int
- }
- func NewLayoutManager() LayoutManager {
- return LayoutManager{
- Workspaces: []Workspace{NewWorkspace()},
- }
- }
- func NewWorkspace() Workspace {
- return Workspace{
- RootContainer: NewContainerEmpty(),
- }
- }
- func NewContainerEmpty() Container[[]int] {
- return Container[[]int]{
- Children: [2]any{},
- Split: SplitHorizontal,
- ActiveBuffer: nil,
- }
- }
|