diff --git a/ui/frame.go b/ui/frame.go index 3e1dc82f8..8ec0e864e 100644 --- a/ui/frame.go +++ b/ui/frame.go @@ -221,8 +221,11 @@ type extra struct { // gives the frame the declarations. Tests and previews that need the engine // paint through a View; applications do not reach a frame. type frame struct { - canvas *gfx.Canvas - theme Theme + canvas *gfx.Canvas + theme Theme + // barStyle is the page's default scrollbar geometry, which every area of the frame + // starts from; Box.Bars overrides it for one area. + barStyle components.ScrollBarStyle nodes []node inputs []components.InputSnapshot addons []fieldAddons // the icons and buttons inside fields, by 1 + extra.addons diff --git a/ui/page.go b/ui/page.go index 81558cdb3..f2f96d4bd 100644 --- a/ui/page.go +++ b/ui/page.go @@ -39,6 +39,7 @@ import ( "unsafe" "github.com/vivaui/viva/app" + "github.com/vivaui/viva/components" "github.com/vivaui/viva/gfx" ) @@ -201,6 +202,10 @@ type PageConfig struct { // copy of the last paint would have differed, as MemoCheck(true) does for every // page. It is for tests. MemoCheck bool + // BarStyle is the geometry of the scrollbars every scroll area of this page draws, so + // a product whose bars are its own sets it once: IDEA's eleven point track with a five + // point thumb. The zero style keeps Viva's, and Box.Bars overrides it for one area. + BarStyle components.ScrollBarStyle } // Page is a window's declaration: one tree for the whole window. A Page lives @@ -727,6 +732,7 @@ func (p *Page) paintOnce(canvas *gfx.Canvas, bounds Rect, view func(C)) { } f := p.view.Begin(canvas, p.currentTheme(), bounds) f.page = p + f.barStyle = p.config.BarStyle p.ctx.page, p.ctx.f, p.ctx.nextSet = p, f, false p.nodes = append(p.nodes[:0], protoNode{scope: p.root, named: true, parentNode: -1}) // node 0, the root column view(&p.ctx) diff --git a/ui/scroll.go b/ui/scroll.go index cf58f84a7..9eb636e78 100644 --- a/ui/scroll.go +++ b/ui/scroll.go @@ -255,6 +255,7 @@ func (f *frame) ScrollArea(id gfx.ID) Box { } state := f.scrolls.get(id) state.id, state.follow, state.sideways, state.bars = id, false, false, false + state.barStyle = f.barStyle b := f.Scroll(state.Offset) f.extra(b.i).scrollState = state return b