| 1 | package mainscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview/demos/presentation`/ |
| 2 | |
| 3 | import ( |
| 4 | "github.com/gdamore/tcell/v2scip-go gomod github.com/gdamore/tcell/v2 v2.7.4 `github.com/gdamore/tcell/v2`/" |
| 5 | "github.com/darkhz/tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/" |
| 6 | ) |
| 7 | |
| 8 | // Flex demonstrates flexbox layout. |
| 9 | func Flexscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview/demos/presentation`/Flex().(nextSlide func()) (title string, content tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.Primitivescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Primitive#) { |
| 10 | modalShown := false |
| 11 | pages := tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.NewPagesscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/NewPages().() |
| 12 | flex := tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.NewFlexscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/NewFlex().(). |
| 13 | AddItemscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Flex#AddItem().(tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.NewBoxscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/NewBox().().SetBorderscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetBorder().(true).SetTitlescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetTitle().("Flexible width, twice of middle column"), 0, 2, true). |
| 14 | AddItemscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Flex#AddItem().(tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.NewFlexscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/NewFlex().(). |
| 15 | SetDirectionscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Flex#SetDirection().(tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.FlexRowscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/FlexRow.). |
| 16 | AddItemscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Flex#AddItem().(tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.NewBoxscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/NewBox().().SetBorderscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetBorder().(true).SetTitlescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetTitle().("Flexible width"), 0, 1, false). |
| 17 | AddItemscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Flex#AddItem().(tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.NewBoxscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/NewBox().().SetBorderscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetBorder().(true).SetTitlescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetTitle().("Fixed height"), 15, 1, false). |
| 18 | AddItemscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Flex#AddItem().(tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.NewBoxscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/NewBox().().SetBorderscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetBorder().(true).SetTitlescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetTitle().("Flexible height"), 0, 1, false), 0, 1, false). |
| 19 | AddItemscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Flex#AddItem().(tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.NewBoxscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/NewBox().().SetBorderscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetBorder().(true).SetTitlescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetTitle().("Fixed width"), 30, 1, false) |
| 20 | flex.SetInputCapturescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Box#SetInputCapture().(func(event *tcellscip-go gomod github.com/gdamore/tcell/v2 v2.7.4 `github.com/gdamore/tcell/v2`/.EventKeyscip-go gomod github.com/gdamore/tcell/v2 v2.7.4 `github.com/gdamore/tcell/v2`/EventKey#) *tcellscip-go gomod github.com/gdamore/tcell/v2 v2.7.4 `github.com/gdamore/tcell/v2`/.EventKeyscip-go gomod github.com/gdamore/tcell/v2 v2.7.4 `github.com/gdamore/tcell/v2`/EventKey# { |
| 21 | if modalShown { |
| 22 | nextSlide() |
| 23 | modalShown = false |
| 24 | } else { |
| 25 | pages.ShowPagescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Pages#ShowPage().("modal") |
| 26 | modalShown = true |
| 27 | } |
| 28 | return event |
| 29 | }) |
| 30 | modal := tviewscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/.NewModalscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/NewModal().(). |
| 31 | SetTextscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Modal#SetText().("Resize the window to see the effect of the flexbox parameters"). |
| 32 | AddButtonsscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Modal#AddButtons().([]string{"Ok"}).SetDoneFuncscip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Modal#SetDoneFunc().(func(buttonIndex int, buttonLabel string) { |
| 33 | pages.HidePagescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Pages#HidePage().("modal") |
| 34 | }) |
| 35 | pages.AddPagescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Pages#AddPage().("flex", flex, true, true). |
| 36 | AddPagescip-go gomod github.com/darkhz/tview . `github.com/darkhz/tview`/Pages#AddPage().("modal", modal, false, false) |
| 37 | return "Flex", pages |
| 38 | } |