diff --git a/elements/containers/box.go b/elements/box.go similarity index 99% rename from elements/containers/box.go rename to elements/box.go index d8b2862..e72755f 100644 --- a/elements/containers/box.go +++ b/elements/box.go @@ -1,4 +1,4 @@ -package containers +package elements import "image" import "git.tebibyte.media/sashakoshka/tomo" diff --git a/elements/containers/notdone/document.go b/elements/containers/notdone/document.go deleted file mode 100644 index 4ba9fde..0000000 --- a/elements/containers/notdone/document.go +++ /dev/null @@ -1,368 +0,0 @@ -package containers - -import "image" -import "git.tebibyte.media/sashakoshka/tomo" -import "git.tebibyte.media/sashakoshka/tomo/canvas" -import "git.tebibyte.media/sashakoshka/tomo/artist" -import "git.tebibyte.media/sashakoshka/tomo/elements/core" -import "git.tebibyte.media/sashakoshka/tomo/default/theme" -import "git.tebibyte.media/sashakoshka/tomo/default/config" - -// DocumentContainer is a scrollable container capable of containing flexible -// elements. -type DocumentContainer struct { - *core.Core - *core.Propagator - core core.CoreControl - - children []tomo.LayoutEntry - scroll image.Point - warping bool - contentBounds image.Rectangle - - config config.Wrapped - theme theme.Wrapped - - onScrollBoundsChange func () -} - -// NewDocumentContainer creates a new document container. -func NewDocumentContainer () (element *DocumentContainer) { - element = &DocumentContainer { } - element.theme.Case = tomo.C("tomo", "documentContainer") - element.Core, element.core = core.NewCore(element, element.redoAll) - element.Propagator = core.NewPropagator(element, element.core) - return -} - -// Adopt adds a new child element to the container. If expand is true, then the -// element will stretch to either side of the container (much like a css block -// element). If expand is false, the element will share a line with other inline -// elements. -func (element *DocumentContainer) Adopt (child tomo.Element, expand bool) { - // set event handlers - if child0, ok := child.(tomo.Themeable); ok { - child0.SetTheme(element.theme.Theme) - } - if child0, ok := child.(tomo.Configurable); ok { - child0.SetConfig(element.config.Config) - } - - // add child - element.children = append (element.children, tomo.LayoutEntry { - Element: child, - Expand: expand, - }) - - child.SetParent(element) - - // refresh stale data - element.updateMinimumSize() - if element.core.HasImage() && !element.warping { - element.redoAll() - element.core.DamageAll() - } -} - -// Warp runs the specified callback, deferring all layout and rendering updates -// until the callback has finished executing. This allows for aplications to -// perform batch gui updates without flickering and stuff. -func (element *DocumentContainer) Warp (callback func ()) { - if element.warping { - callback() - return - } - - element.warping = true - callback() - element.warping = false - - if element.core.HasImage() { - element.redoAll() - element.core.DamageAll() - } -} - -// Disown removes the given child from the container if it is contained within -// it. -func (element *DocumentContainer) Disown (child tomo.Element) { - for index, entry := range element.children { - if entry.Element == child { - element.clearChildEventHandlers(entry.Element) - element.children = append ( - element.children[:index], - element.children[index + 1:]...) - break - } - } - - element.updateMinimumSize() - if element.core.HasImage() && !element.warping { - element.redoAll() - element.core.DamageAll() - } -} - -func (element *DocumentContainer) clearChildEventHandlers (child tomo.Element) { - child.DrawTo(nil, image.Rectangle { }, nil) - child.SetParent(nil) - - if child, ok := child.(tomo.Focusable); ok { - if child.Focused() { - child.HandleUnfocus() - } - } -} - -// DisownAll removes all child elements from the container at once. -func (element *DocumentContainer) DisownAll () { - for _, entry := range element.children { - element.clearChildEventHandlers(entry.Element) - } - element.children = nil - - element.updateMinimumSize() - if element.core.HasImage() && !element.warping { - element.redoAll() - element.core.DamageAll() - } -} - -// Children returns a slice containing this element's children. -func (element *DocumentContainer) Children () (children []tomo.Element) { - children = make([]tomo.Element, len(element.children)) - for index, entry := range element.children { - children[index] = entry.Element - } - return -} - -// CountChildren returns the amount of children contained within this element. -func (element *DocumentContainer) CountChildren () (count int) { - return len(element.children) -} - -// Child returns the child at the specified index. If the index is out of -// bounds, this method will return nil. -func (element *DocumentContainer) Child (index int) (child tomo.Element) { - if index < 0 || index > len(element.children) { return } - return element.children[index].Element -} - -// ChildAt returns the child that contains the specified x and y coordinates. If -// there are no children at the coordinates, this method will return nil. -func (element *DocumentContainer) ChildAt (point image.Point) (child tomo.Element) { - for _, entry := range element.children { - if point.In(entry.Bounds) { - child = entry.Element - } - } - return -} - -func (element *DocumentContainer) redoAll () { - if !element.core.HasImage() { return } - - // do a layout - element.doLayout() - - maxScrollHeight := element.maxScrollHeight() - if element.scroll.Y > maxScrollHeight { - element.scroll.Y = maxScrollHeight - element.doLayout() - } - - // draw a background - rocks := make([]image.Rectangle, len(element.children)) - for index, entry := range element.children { - rocks[index] = entry.Bounds - } - pattern := element.theme.Pattern ( - tomo.PatternBackground, - tomo.State { }) - artist.DrawShatter(element.core, pattern, element.Bounds(), rocks...) - - element.partition() - if parent, ok := element.core.Parent().(tomo.ScrollableParent); ok { - parent.NotifyScrollBoundsChange(element) - } - if element.onScrollBoundsChange != nil { - element.onScrollBoundsChange() - } -} - -func (element *DocumentContainer) partition () { - for _, entry := range element.children { - entry.DrawTo(nil, entry.Bounds, nil) - } - - // cut our canvas up and give peices to child elements - for _, entry := range element.children { - if entry.Bounds.Overlaps(element.Bounds()) { - entry.DrawTo ( - canvas.Cut(element.core, entry.Bounds), - entry.Bounds, func (region image.Rectangle) { - element.core.DamageRegion(region) - }) - } - } -} - -func (element *DocumentContainer) Window () tomo.Window { - return element.core.Window() -} - -// NotifyMinimumSizeChange notifies the container that the minimum size of a -// child element has changed. -func (element *DocumentContainer) NotifyMinimumSizeChange (child tomo.Element) { - element.redoAll() - element.core.DamageAll() -} - -// DrawBackground draws a portion of the container's background pattern within -// the specified bounds. The container will not push these changes. -func (element *DocumentContainer) DrawBackground (bounds image.Rectangle) { - element.core.DrawBackgroundBounds ( - element.theme.Pattern(tomo.PatternBackground, tomo.State { }), - bounds) -} - -// NotifyFlexibleHeightChange notifies the parent that the parameters -// affecting a child's flexible height have changed. This method is -// expected to be called by flexible child element when their content -// changes. -func (element *DocumentContainer) NotifyFlexibleHeightChange (child tomo.Flexible) { - element.redoAll() - element.core.DamageAll() -} - -// SetTheme sets the element's theme. -func (element *DocumentContainer) SetTheme (new tomo.Theme) { - if new == element.theme.Theme { return } - element.theme.Theme = new - element.Propagator.SetTheme(new) - element.redoAll() -} - -// SetConfig sets the element's configuration. -func (element *DocumentContainer) SetConfig (new tomo.Config) { - if new == element.config.Config { return } - element.Propagator.SetConfig(new) - element.redoAll() -} - -// ScrollContentBounds returns the full content size of the element. -func (element *DocumentContainer) ScrollContentBounds () image.Rectangle { - return element.contentBounds -} - -// ScrollViewportBounds returns the size and position of the element's -// viewport relative to ScrollBounds. -func (element *DocumentContainer) ScrollViewportBounds () image.Rectangle { - padding := element.theme.Padding(tomo.PatternBackground) - bounds := padding.Apply(element.Bounds()) - bounds = bounds.Sub(bounds.Min).Add(element.scroll) - return bounds -} - -// ScrollTo scrolls the viewport to the specified point relative to -// ScrollBounds. -func (element *DocumentContainer) ScrollTo (position image.Point) { - if position.Y < 0 { - position.Y = 0 - } - maxScrollHeight := element.maxScrollHeight() - if position.Y > maxScrollHeight { - position.Y = maxScrollHeight - } - element.scroll = position - if element.core.HasImage() && !element.warping { - element.redoAll() - element.core.DamageAll() - } -} - -// OnScrollBoundsChange sets a function to be called when the element's viewport -// bounds, content bounds, or scroll axes change. -func (element *DocumentContainer) OnScrollBoundsChange (callback func ()) { - element.onScrollBoundsChange = callback -} - -func (element *DocumentContainer) maxScrollHeight () (height int) { - padding := element.theme.Padding(tomo.PatternSunken) - viewportHeight := element.Bounds().Dy() - padding.Vertical() - height = element.contentBounds.Dy() - viewportHeight - if height < 0 { height = 0 } - return -} - -// ScrollAxes returns the supported axes for scrolling. -func (element *DocumentContainer) ScrollAxes () (horizontal, vertical bool) { - return false, true -} - -func (element *DocumentContainer) doLayout () { - margin := element.theme.Margin(tomo.PatternBackground) - padding := element.theme.Padding(tomo.PatternBackground) - bounds := padding.Apply(element.Bounds()) - element.contentBounds = image.Rectangle { } - - dot := bounds.Min.Sub(element.scroll) - xStart := dot.X - rowHeight := 0 - - nextLine := func () { - dot.X = xStart - dot.Y += margin.Y - dot.Y += rowHeight - rowHeight = 0 - } - - for index, entry := range element.children { - if dot.X > xStart && entry.Expand { - nextLine() - } - - width, height := entry.MinimumSize() - if width + dot.X > bounds.Dx() && !entry.Expand { - nextLine() - } - if width < bounds.Dx() && entry.Expand { - width = bounds.Dx() - } - if typedChild, ok := entry.Element.(tomo.Flexible); ok { - height = typedChild.FlexibleHeightFor(width) - } - if rowHeight < height { - rowHeight = height - } - - entry.Bounds.Min = dot - entry.Bounds.Max = image.Pt(dot.X + width, dot.Y + height) - element.children[index] = entry - element.contentBounds = element.contentBounds.Union(entry.Bounds) - - if entry.Expand { - nextLine() - } else { - dot.X += width + margin.X - } - } - - element.contentBounds = - element.contentBounds.Sub(element.contentBounds.Min) -} - -func (element *DocumentContainer) updateMinimumSize () { - padding := element.theme.Padding(tomo.PatternBackground) - minimumWidth := 0 - for _, entry := range element.children { - width, _ := entry.MinimumSize() - if width > minimumWidth { - minimumWidth = width - } - } - element.core.SetMinimumSize ( - minimumWidth + padding.Horizontal(), - padding.Vertical()) -} diff --git a/elements/containers/document.go b/elements/document.go similarity index 99% rename from elements/containers/document.go rename to elements/document.go index 9bc5f2d..d090d23 100644 --- a/elements/containers/document.go +++ b/elements/document.go @@ -1,4 +1,4 @@ -package containers +package elements import "image" import "git.tebibyte.media/sashakoshka/tomo" diff --git a/elements/containers/notdone/table.go b/elements/notdone/table.go similarity index 100% rename from elements/containers/notdone/table.go rename to elements/notdone/table.go diff --git a/elements/containers/scroll.go b/elements/scroll.go similarity index 95% rename from elements/containers/scroll.go rename to elements/scroll.go index b83fc47..f7cf300 100644 --- a/elements/containers/scroll.go +++ b/elements/scroll.go @@ -1,10 +1,9 @@ -package containers +package elements import "image" import "git.tebibyte.media/sashakoshka/tomo" // import "git.tebibyte.media/sashakoshka/tomo/input" import "git.tebibyte.media/sashakoshka/tomo/canvas" -import "git.tebibyte.media/sashakoshka/tomo/elements" import "git.tebibyte.media/sashakoshka/tomo/default/theme" import "git.tebibyte.media/sashakoshka/tomo/default/config" @@ -12,8 +11,8 @@ type Scroll struct { entity tomo.ContainerEntity child tomo.Scrollable - horizontal *elements.ScrollBar - vertical *elements.ScrollBar + horizontal *ScrollBar + vertical *ScrollBar config config.Wrapped theme theme.Wrapped @@ -25,7 +24,7 @@ func NewScroll (horizontal, vertical bool) (element *Scroll) { element.entity = tomo.NewEntity(element).(tomo.ContainerEntity) if horizontal { - element.horizontal = elements.NewScrollBar(false) + element.horizontal = NewScrollBar(false) element.horizontal.OnScroll (func (viewport image.Point) { if element.child != nil { element.child.ScrollTo(viewport) @@ -39,7 +38,7 @@ func NewScroll (horizontal, vertical bool) (element *Scroll) { element.entity.Adopt(element.horizontal) } if vertical { - element.vertical = elements.NewScrollBar(true) + element.vertical = NewScrollBar(true) element.vertical.OnScroll (func (viewport image.Point) { if element.child != nil { element.child.ScrollTo(viewport) diff --git a/examples/align/main.go b/examples/align/main.go index 8c86d98..e8a6e6e 100644 --- a/examples/align/main.go +++ b/examples/align/main.go @@ -4,7 +4,6 @@ import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/textdraw" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -15,7 +14,7 @@ func run () { window.SetTitle("Text alignment") container := containers.NewDocument() - scrollContainer := containers.NewScroll(false, true) + scrollContainer := elements.NewScroll(false, true) scrollContainer.Adopt(container) window.Adopt(scrollContainer) diff --git a/examples/checkbox/main.go b/examples/checkbox/main.go index 3bb199f..519e82d 100644 --- a/examples/checkbox/main.go +++ b/examples/checkbox/main.go @@ -3,7 +3,6 @@ package main import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/popups" import "git.tebibyte.media/sashakoshka/tomo/elements" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { @@ -14,7 +13,7 @@ func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 0, 0)) window.SetTitle("Checkboxes") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) window.Adopt(container) introText := elements.NewLabel ( diff --git a/examples/clipboard/main.go b/examples/clipboard/main.go index a730b50..f11cab5 100644 --- a/examples/clipboard/main.go +++ b/examples/clipboard/main.go @@ -10,7 +10,6 @@ import "git.tebibyte.media/sashakoshka/tomo/data" import "git.tebibyte.media/sashakoshka/tomo/popups" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -26,9 +25,9 @@ func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 256, 0)) window.SetTitle("Clipboard") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) textInput := elements.NewTextBox("", "") - controlRow := containers.NewHBox(false, true) + controlRow := elements.NewHBox(false, true) copyButton := elements.NewButton("Copy") copyButton.SetIcon(tomo.IconCopy) pasteButton := elements.NewButton("Paste") diff --git a/examples/documentContainer/main.go b/examples/documentContainer/main.go index 7d04983..934a445 100644 --- a/examples/documentContainer/main.go +++ b/examples/documentContainer/main.go @@ -6,7 +6,6 @@ import _ "image/png" import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -22,8 +21,8 @@ func run () { file.Close() if err != nil { panic(err.Error()); return } - scrollContainer := containers.NewScroll(false, true) - document := containers.NewDocument() + scrollContainer := elements.NewScroll(false, true) + document := elements.NewDocument() document.Adopt (elements.NewLabel ( "A document container is a vertically stacked container " + diff --git a/examples/flow/main.go b/examples/flow/main.go index b7873f7..381eb40 100644 --- a/examples/flow/main.go +++ b/examples/flow/main.go @@ -4,7 +4,6 @@ import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/flow" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -13,7 +12,7 @@ func main () { func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 192, 192)) window.SetTitle("adventure") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) window.Adopt(container) var world flow.Flow diff --git a/examples/goroutines/main.go b/examples/goroutines/main.go index 0d8eb76..29f547a 100644 --- a/examples/goroutines/main.go +++ b/examples/goroutines/main.go @@ -6,7 +6,6 @@ import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" import "git.tebibyte.media/sashakoshka/tomo/elements/fun" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -16,7 +15,7 @@ func main () { func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 200, 216)) window.SetTitle("Clock") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) window.Adopt(container) clock := fun.NewAnalogClock(time.Now()) diff --git a/examples/hbox/main.go b/examples/hbox/main.go index 100bbdf..ed5a112 100644 --- a/examples/hbox/main.go +++ b/examples/hbox/main.go @@ -3,7 +3,6 @@ package main import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -13,7 +12,7 @@ func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 360, 0)) window.SetTitle("horizontal stack") - container := containers.NewHBox(true, true) + container := elements.NewHBox(true, true) window.Adopt(container) container.Adopt(elements.NewLabel("this is sample text", true), true) diff --git a/examples/icons/main.go b/examples/icons/main.go index 16b3be2..5e17d2a 100644 --- a/examples/icons/main.go +++ b/examples/icons/main.go @@ -3,7 +3,6 @@ package main import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -13,7 +12,7 @@ func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 360, 0)) window.SetTitle("Icons") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) window.Adopt(container) container.Adopt(elements.NewLabel("Just some of the wonderful icons we have:", false), false) diff --git a/examples/input/main.go b/examples/input/main.go index 00577ac..b0e8a84 100644 --- a/examples/input/main.go +++ b/examples/input/main.go @@ -4,7 +4,6 @@ import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/popups" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -13,7 +12,7 @@ func main () { func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 0, 0)) window.SetTitle("Enter Details") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) window.Adopt(container) // create inputs diff --git a/examples/panels/main.go b/examples/panels/main.go index 0d7284b..0141795 100644 --- a/examples/panels/main.go +++ b/examples/panels/main.go @@ -5,7 +5,6 @@ import "image" import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -15,7 +14,7 @@ func run () { window, _ := tomo.NewWindow(tomo.Bounds(200, 200, 256, 256)) window.SetTitle("Main") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) container.Adopt(elements.NewLabel("Main window", false), true) window.Adopt(container) diff --git a/examples/popups/main.go b/examples/popups/main.go index a07e728..eb4f395 100644 --- a/examples/popups/main.go +++ b/examples/popups/main.go @@ -4,7 +4,6 @@ import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/popups" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -15,7 +14,7 @@ func run () { if err != nil { panic(err.Error()) } window.SetTitle("Dialog Boxes") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) window.Adopt(container) container.Adopt(elements.NewLabel("Try out different dialogs:", false), true) diff --git a/examples/progress/main.go b/examples/progress/main.go index 18268f2..33831b9 100644 --- a/examples/progress/main.go +++ b/examples/progress/main.go @@ -4,7 +4,6 @@ import "time" import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/popups" import "git.tebibyte.media/sashakoshka/tomo/elements" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { @@ -14,7 +13,7 @@ func main () { func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 0, 0)) window.SetTitle("Approaching") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) window.Adopt(container) container.Adopt (elements.NewLabel ( diff --git a/examples/raycaster/main.go b/examples/raycaster/main.go index 0e741fb..b0c8906 100644 --- a/examples/raycaster/main.go +++ b/examples/raycaster/main.go @@ -7,7 +7,6 @@ import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/popups" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" //go:embed wall.png var wallTextureBytes []uint8 @@ -22,7 +21,7 @@ func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 640, 480)) window.SetTitle("Raycaster") - container := containers.NewVBox(false, false) + container := elements.NewVBox(false, false) window.Adopt(container) wallTexture, _ := TextureFrom(bytes.NewReader(wallTextureBytes)) diff --git a/examples/scroll/main.go b/examples/scroll/main.go index b01a887..28a9f34 100644 --- a/examples/scroll/main.go +++ b/examples/scroll/main.go @@ -4,7 +4,6 @@ package main import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -13,7 +12,7 @@ func main () { func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 360, 240)) window.SetTitle("Scroll") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) window.Adopt(container) textBox := elements.NewTextBox("", copypasta) diff --git a/examples/spacer/main.go b/examples/spacer/main.go index ba20293..e74dbba 100644 --- a/examples/spacer/main.go +++ b/examples/spacer/main.go @@ -3,7 +3,6 @@ package main import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -13,7 +12,7 @@ func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 0, 0)) window.SetTitle("Spaced Out") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) window.Adopt(container) container.Adopt (elements.NewLabel("This is at the top", false), false) diff --git a/examples/switch/main.go b/examples/switch/main.go index 66a9413..fa38c92 100644 --- a/examples/switch/main.go +++ b/examples/switch/main.go @@ -3,7 +3,6 @@ package main import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" func main () { tomo.Run(run) @@ -13,7 +12,7 @@ func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 0, 0)) window.SetTitle("Switches") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) window.Adopt(container) container.Adopt(elements.NewSwitch("hahahah", false), false) diff --git a/examples/vbox/main.go b/examples/vbox/main.go index 7b9c7b7..d90edb0 100644 --- a/examples/vbox/main.go +++ b/examples/vbox/main.go @@ -3,7 +3,6 @@ package main import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" import "git.tebibyte.media/sashakoshka/tomo/elements/testing" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" import _ "git.tebibyte.media/sashakoshka/tomo/backends/all" func main () { @@ -14,7 +13,7 @@ func run () { window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 128, 128)) window.SetTitle("vertical stack") - container := containers.NewVBox(true, true) + container := elements.NewVBox(true, true) label := elements.NewLabel("it is a label hehe", true) button := elements.NewButton("drawing pad") diff --git a/popups/dialog.go b/popups/dialog.go index 514ea22..af91ead 100644 --- a/popups/dialog.go +++ b/popups/dialog.go @@ -3,7 +3,6 @@ package popups import "image" import "git.tebibyte.media/sashakoshka/tomo" import "git.tebibyte.media/sashakoshka/tomo/elements" -import "git.tebibyte.media/sashakoshka/tomo/elements/containers" // DialogKind defines the semantic role of a dialog window. type DialogKind int @@ -44,9 +43,9 @@ func NewDialog ( } window.SetTitle(title) - box := containers.NewVBox(true, true) - messageRow := containers.NewHBox(false, true) - controlRow := containers.NewHBox(false, true) + box := elements.NewVBox(true, true) + messageRow := elements.NewHBox(false, true) + controlRow := elements.NewHBox(false, true) iconId := tomo.IconInformation switch kind {