Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ui/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions ui/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"unsafe"

"github.com/vivaui/viva/app"
"github.com/vivaui/viva/components"
"github.com/vivaui/viva/gfx"
)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions ui/scroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down