diff --git a/config.go b/config.go index bbbee36..bcbcf7d 100644 --- a/config.go +++ b/config.go @@ -2,14 +2,7 @@ package tomo // Config can return global configuration parameters. type Config interface { - // HandleWidth returns how large grab handles should typically be. This - // is important for accessibility reasons. - HandleWidth () int - // ScrollVelocity returns how many pixels should be scrolled every time // a scroll button is pressed. ScrollVelocity () int - - // ThemePath returns the directory path to the theme. - ThemePath () string } diff --git a/default/config/config.go b/default/config/config.go index 03d666b..249de4e 100644 --- a/default/config/config.go +++ b/default/config/config.go @@ -6,43 +6,22 @@ import "git.tebibyte.media/sashakoshka/tomo" type Default struct { } -// HandleWidth returns the default handle width value. -func (Default) HandleWidth () int { - return 15 -} - // ScrollVelocity returns the default scroll velocity value. func (Default) ScrollVelocity () int { return 16 } -// ThemePath returns the default theme path. -func (Default) ThemePath () (string) { - return "" -} - // Wrapped wraps a configuration and uses Default if it is nil. type Wrapped struct { tomo.Config } -// HandleWidth returns how large grab handles should typically be. This -// is important for accessibility reasons. -func (wrapped Wrapped) HandleWidth () int { - return wrapped.ensure().HandleWidth() -} - // ScrollVelocity returns how many pixels should be scrolled every time // a scroll button is pressed. func (wrapped Wrapped) ScrollVelocity () int { return wrapped.ensure().ScrollVelocity() } -// ThemePath returns the directory path to the theme. -func (wrapped Wrapped) ThemePath () string { - return wrapped.ensure().ThemePath() -} - func (wrapped Wrapped) ensure () (real tomo.Config) { real = wrapped.Config if real == nil { real = Default { } } diff --git a/elements/scrollbar.go b/elements/scrollbar.go index f5d4dac..89b8262 100644 --- a/elements/scrollbar.go +++ b/elements/scrollbar.go @@ -290,15 +290,16 @@ func (element *ScrollBar) recalculateHorizontal () { } func (element *ScrollBar) updateMinimumSize () { - padding := element.theme.Padding(tomo.PatternGutter) + gutterPadding := element.theme.Padding(tomo.PatternGutter) + handlePadding := element.theme.Padding(tomo.PatternHandle) if element.vertical { element.core.SetMinimumSize ( - padding.Horizontal() + element.config.HandleWidth(), - padding.Vertical() + element.config.HandleWidth() * 2) + gutterPadding.Horizontal() + handlePadding.Horizontal(), + gutterPadding.Vertical() + handlePadding.Vertical() * 2) } else { element.core.SetMinimumSize ( - padding.Horizontal() + element.config.HandleWidth() * 2, - padding.Vertical() + element.config.HandleWidth()) + gutterPadding.Horizontal() + handlePadding.Horizontal() * 2, + gutterPadding.Vertical() + handlePadding.Vertical()) } } diff --git a/elements/slider.go b/elements/slider.go index ffbc8a4..e7d38b8 100644 --- a/elements/slider.go +++ b/elements/slider.go @@ -187,14 +187,16 @@ func (element *Slider) valueFor (x, y int) (value float64) { } func (element *Slider) updateMinimumSize () { + gutterPadding := element.theme.Padding(tomo.PatternGutter) + handlePadding := element.theme.Padding(tomo.PatternHandle) if element.vertical { element.core.SetMinimumSize ( - element.config.HandleWidth(), - element.config.HandleWidth() * 2) + gutterPadding.Horizontal() + handlePadding.Horizontal(), + gutterPadding.Vertical() + handlePadding.Vertical() * 2) } else { element.core.SetMinimumSize ( - element.config.HandleWidth() * 2, - element.config.HandleWidth()) + gutterPadding.Horizontal() + handlePadding.Horizontal() * 2, + gutterPadding.Vertical() + handlePadding.Vertical()) } }