package tui // View defines the behavior of any element displayable on screen. // To define custom Views, it is recommended to add ViewTmpl // as the promoted anonymous field for your custom View struct. // It implements the View interface with useful default behavior type View interface { Events SetStyle(s Style) Style() Style // Layout is usually called by the parent view to ask the view's preferred size. // If the parent view does not care about its preferred size, it might not be called at all. // Negative values indicate as much space as possible. Layout() (prefWidth, prefHeight int) // Draw is called for each view when it should print itself onto the screen. // The parent view has full control of the ViewBuffer size // and may or may not use the values returned from Layout() to set the size. Draw(buf *ViewBuffer) } // Layout defines the behavior of a View which can hold multiple sub views type Layout interface { View Views() []View } // Wrapper defines the behavior of a Layout which can hold exactly one sub view. // To define custom Wrappers, it is recommended to add WrapperTmpl // as the promoted anonymous field for your custom Wrapper struct. // It implements the Wrapper interface with useful default behavior type Wrapper interface { Layout SetView(View) View() View }