Documentation
¶
Index ¶
- func NewTileUpdatedMsg(t Tile) tea.Cmd
- type BaseTile
- type Direction
- type LayoutUpdatedMsg
- type Metrics
- type Size
- type Tile
- type TileLayout
- func (tl *TileLayout) Add(tile Tile)
- func (tl *TileLayout) FocusFirst()
- func (tl *TileLayout) FocusNext()
- func (tl *TileLayout) FocusPrev()
- func (tl *TileLayout) FocusedTile() Tile
- func (tl *TileLayout) Init() tea.Cmd
- func (tl *TileLayout) IsLayout() bool
- func (tl *TileLayout) Remove(name string) bool
- func (tl *TileLayout) Replace(name string, newTile Tile) bool
- func (tl *TileLayout) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (tl *TileLayout) View() string
- type TileUpdatedMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTileUpdatedMsg ¶
Types ¶
type BaseTile ¶
func (*BaseTile) SetFocused ¶
type LayoutUpdatedMsg ¶
Message returned on layout update
type Size ¶
type Size struct {
Width int
Height int
Weight float64
MinWidth int
MinHeight int
MaxWidth int
MaxHeight int
FixedWidth int
FixedHeight int
}
The Size structure and constraints for the layout
type TileLayout ¶
type TileLayout struct {
*BaseTile
Tiles []Tile
Direction Direction
TotalFixedWidth int
TotalFixedHeight int
Metrics Metrics
}
func NewRoot ¶
func NewRoot(direction Direction) *TileLayout
func NewTileLayout ¶
func NewTileLayout(name string, direction Direction, size Size) *TileLayout
func (*TileLayout) Add ¶
func (tl *TileLayout) Add(tile Tile)
Add a tile. The parent of the tile is set to the layout.
func (*TileLayout) FocusFirst ¶
func (tl *TileLayout) FocusFirst()
FocusFirst focuses the first leaf tile in the layout tree.
func (*TileLayout) FocusNext ¶
func (tl *TileLayout) FocusNext()
FocusNext moves focus to the next leaf tile, wrapping around to the first. If nothing is focused, the first tile is focused.
func (*TileLayout) FocusPrev ¶
func (tl *TileLayout) FocusPrev()
FocusPrev moves focus to the previous leaf tile, wrapping around to the last. If nothing is focused, the last tile is focused.
func (*TileLayout) FocusedTile ¶
func (tl *TileLayout) FocusedTile() Tile
FocusedTile returns the currently focused leaf tile, or nil if none is focused.
func (*TileLayout) Init ¶
func (tl *TileLayout) Init() tea.Cmd
Init forwards to all child tiles so they can start their own commands.
func (*TileLayout) IsLayout ¶
func (tl *TileLayout) IsLayout() bool
func (*TileLayout) Remove ¶
func (tl *TileLayout) Remove(name string) bool
Remove a tile by name. Returns true if found and removed.
func (*TileLayout) Replace ¶
func (tl *TileLayout) Replace(name string, newTile Tile) bool
Replace a tile by name with another tile. Returns true if found and replaced.
func (*TileLayout) Update ¶
Handle update messages from BubbleTea. On WidnowSizeMsg, the layout is "layouted" and LayoutUpdatedMsg is additionally returned. The message is forwarded to each tile.
func (*TileLayout) View ¶
func (tl *TileLayout) View() string
Render all tiles, joining them together.