The theming around List makes slightly more sense
This commit is contained in:
@@ -366,7 +366,6 @@ func (element *List) updateMinimumSize () {
|
||||
_, inset := theme.ListPattern(theme.PatternState {
|
||||
Case: listCase,
|
||||
})
|
||||
minimumWidth += inset[1] + inset[3]
|
||||
minimumHeight += inset[0] + inset[2]
|
||||
|
||||
element.core.SetMinimumSize(minimumWidth, minimumHeight)
|
||||
@@ -387,24 +386,14 @@ func (element *List) draw () {
|
||||
bounds.Min.X,
|
||||
bounds.Min.Y - element.scroll,
|
||||
}
|
||||
innerCanvas := tomo.Cut(element, bounds)
|
||||
for index, entry := range element.entries {
|
||||
entryPosition := dot
|
||||
dot.Y += entry.Bounds().Dy()
|
||||
if dot.Y < bounds.Min.Y { continue }
|
||||
if entryPosition.Y > bounds.Max.Y { break }
|
||||
|
||||
if element.selectedEntry == index {
|
||||
pattern, _ := theme.ItemPattern(theme.PatternState {
|
||||
Case: listEntryCase,
|
||||
On: true,
|
||||
})
|
||||
artist.FillRectangle (
|
||||
element,
|
||||
pattern,
|
||||
entry.Bounds().Add(entryPosition))
|
||||
}
|
||||
entry.Draw (
|
||||
element, entryPosition,
|
||||
element.selectedEntry == index && element.Selected())
|
||||
innerCanvas, entryPosition,
|
||||
element.Selected(), element.selectedEntry == index)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,11 +56,23 @@ func (entry *ListEntry) Draw (
|
||||
destination tomo.Canvas,
|
||||
offset image.Point,
|
||||
selected bool,
|
||||
on bool,
|
||||
) (
|
||||
updatedRegion image.Rectangle,
|
||||
) {
|
||||
pattern, _ := theme.ItemPattern(theme.PatternState {
|
||||
Case: listEntryCase,
|
||||
Selected: selected,
|
||||
On: on,
|
||||
})
|
||||
artist.FillRectangle (
|
||||
destination,
|
||||
pattern,
|
||||
entry.Bounds().Add(offset))
|
||||
foreground, _ := theme.ForegroundPattern (theme.PatternState {
|
||||
Case: listEntryCase,
|
||||
Selected: selected,
|
||||
On: on,
|
||||
})
|
||||
return entry.drawer.Draw (
|
||||
destination,
|
||||
|
||||
@@ -20,14 +20,14 @@ type Artist struct {
|
||||
func NewArtist () (element *Artist) {
|
||||
element = &Artist { }
|
||||
element.Core, element.core = core.NewCore(element)
|
||||
element.core.SetMinimumSize(400, 600)
|
||||
element.core.SetMinimumSize(480, 600)
|
||||
return
|
||||
}
|
||||
|
||||
func (element *Artist) Resize (width, height int) {
|
||||
element.core.AllocateCanvas(width, height)
|
||||
bounds := element.Bounds()
|
||||
element.cellBounds.Max.X = bounds.Dx() / 4
|
||||
element.cellBounds.Max.X = bounds.Dx() / 5
|
||||
element.cellBounds.Max.Y = (bounds.Dy() - 48) / 8
|
||||
|
||||
drawStart := time.Now()
|
||||
@@ -68,6 +68,16 @@ func (element *Artist) Resize (width, height int) {
|
||||
},
|
||||
element.cellAt(3, 0))
|
||||
|
||||
// 4, 0
|
||||
artist.FillRectangle (
|
||||
element,
|
||||
artist.Padded {
|
||||
Stroke: uhex(0xFFFFFFFF),
|
||||
Fill: uhex(0x666666FF),
|
||||
Sides: []int { 4, 13, 2, 0 },
|
||||
},
|
||||
element.cellAt(4, 0))
|
||||
|
||||
// 0, 1 - 3, 1
|
||||
for x := 0; x < 4; x ++ {
|
||||
artist.FillRectangle (
|
||||
|
||||
Reference in New Issue
Block a user