Small theming tweaks
This commit is contained in:
parent
55633d6915
commit
09eede2c90
@ -131,9 +131,13 @@ func (element *ScrollContainer) HandleMouseDown (x, y int, button tomo.Button) {
|
||||
func (element *ScrollContainer) HandleMouseUp (x, y int, button tomo.Button) {
|
||||
if element.horizontal.dragging {
|
||||
element.horizontal.dragging = false
|
||||
element.drawHorizontalBar()
|
||||
element.core.DamageRegion(element.horizontal.bar)
|
||||
|
||||
} else if element.vertical.dragging {
|
||||
element.vertical.dragging = false
|
||||
element.drawVerticalBar()
|
||||
element.core.DamageRegion(element.vertical.bar)
|
||||
|
||||
} else if child, ok := element.child.(tomo.MouseTarget); ok {
|
||||
child.HandleMouseUp(x, y, button)
|
||||
@ -338,7 +342,9 @@ func (element *ScrollContainer) drawHorizontalBar () {
|
||||
element.horizontal.gutter)
|
||||
artist.FillRectangle (
|
||||
element,
|
||||
theme.ScrollBarPattern(true, element.horizontal.enabled),
|
||||
theme.ScrollBarPattern (
|
||||
true, element.horizontal.enabled,
|
||||
element.horizontal.dragging),
|
||||
element.horizontal.bar)
|
||||
}
|
||||
|
||||
@ -349,7 +355,9 @@ func (element *ScrollContainer) drawVerticalBar () {
|
||||
element.vertical.gutter)
|
||||
artist.FillRectangle (
|
||||
element,
|
||||
theme.ScrollBarPattern(false, element.vertical.enabled),
|
||||
theme.ScrollBarPattern (
|
||||
false, element.vertical.enabled,
|
||||
element.vertical.dragging),
|
||||
element.vertical.bar)
|
||||
}
|
||||
|
||||
|
@ -2,18 +2,60 @@ package theme
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo/artist"
|
||||
|
||||
func ScrollGutterPattern (horizontal bool, enabled bool) (artist.Pattern) {
|
||||
var scrollGutterPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
Highlight: artist.NewUniform(hex(0x3b534eFF)),
|
||||
Shadow: artist.NewUniform(hex(0x6e8079FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x6e8079FF)) })
|
||||
var disabledScrollGutterPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: weakForegroundPattern },
|
||||
artist.Stroke { Pattern: backgroundPattern })
|
||||
var scrollBarPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
Highlight: artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
Shadow: artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x8D9894FF)) })
|
||||
var pressedScrollBarPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
Highlight: artist.NewUniform(hex(0xCCD5D2FF)),
|
||||
Shadow: artist.NewUniform(hex(0x4B5B59FF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Weight: 1, Pattern: artist.NewUniform(hex(0x8D9894FF)) },
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x7f8c89FF)) })
|
||||
var disabledScrollBarPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: weakForegroundPattern },
|
||||
artist.Stroke { Pattern: backgroundPattern })
|
||||
|
||||
func ScrollGutterPattern (horizontal, enabled bool) (artist.Pattern) {
|
||||
if enabled {
|
||||
return sunkenPattern
|
||||
return scrollGutterPattern
|
||||
} else {
|
||||
return disabledButtonPattern
|
||||
return disabledScrollGutterPattern
|
||||
}
|
||||
}
|
||||
|
||||
func ScrollBarPattern (horizontal bool, enabled bool) (artist.Pattern) {
|
||||
func ScrollBarPattern (horizontal, enabled, pressed bool) (artist.Pattern) {
|
||||
if enabled {
|
||||
return buttonPattern
|
||||
if pressed {
|
||||
return pressedScrollBarPattern
|
||||
} else {
|
||||
return scrollBarPattern
|
||||
}
|
||||
} else {
|
||||
return disabledButtonPattern
|
||||
return disabledScrollBarPattern
|
||||
}
|
||||
}
|
||||
|
@ -34,13 +34,43 @@ var sunkenPattern = artist.NewMultiBordered (
|
||||
},
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x97a09cFF)) })
|
||||
|
||||
var raisedPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
Highlight: artist.NewUniform(hex(0xDBDBDBFF)),
|
||||
Shadow: artist.NewUniform(hex(0x383C3AFF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0xAAAAAAFF)) })
|
||||
|
||||
var selectedRaisedPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke {
|
||||
Weight: 1,
|
||||
Pattern: artist.Beveled {
|
||||
Highlight: artist.NewUniform(hex(0xDBDBDBFF)),
|
||||
Shadow: artist.NewUniform(hex(0x383C3AFF)),
|
||||
},
|
||||
},
|
||||
artist.Stroke { Weight: 1, Pattern: accentPattern },
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0xAAAAAAFF)) })
|
||||
|
||||
var deadPattern = artist.NewMultiBordered (
|
||||
artist.Stroke { Weight: 1, Pattern: strokePattern },
|
||||
artist.Stroke { Pattern: artist.NewUniform(hex(0x97a09cFF)) })
|
||||
|
||||
func AccentPattern () (artist.Pattern) { return accentPattern }
|
||||
func BackgroundPattern () (artist.Pattern) { return backgroundPattern }
|
||||
func SunkenPattern () (artist.Pattern) { return sunkenPattern}
|
||||
func SunkenPattern () (artist.Pattern) { return sunkenPattern }
|
||||
func RaisedPattern (selected bool) (artist.Pattern) {
|
||||
if selected {
|
||||
return selectedRaisedPattern
|
||||
} else {
|
||||
return raisedPattern
|
||||
}
|
||||
}
|
||||
func DeadPattern () (artist.Pattern) { return deadPattern }
|
||||
func ForegroundPattern (enabled bool) (artist.Pattern) {
|
||||
if enabled {
|
||||
|
Reference in New Issue
Block a user