Ejemplo n.º 1
0
Archivo: list.go Proyecto: langxj/gxui
// PaintChildren overrides
func (l *List) PaintChild(c gxui.Canvas, child *gxui.Child, idx int) {
	if child == l.itemMouseOver {
		b := child.Bounds().Expand(child.Control.Margin())
		l.outer.PaintMouseOverBackground(c, b)
	}
	l.PaintChildren.PaintChild(c, child, idx)
	if selected, found := l.details[l.selectedItem]; found {
		if child == selected.child {
			b := child.Bounds().Expand(child.Control.Margin())
			l.outer.PaintSelection(c, b)
		}
	}
}
Ejemplo n.º 2
0
// List override
func (t *Tree) PaintChild(c gxui.Canvas, child *gxui.Child, idx int) {
	t.List.PaintChild(c, child, idx)
	if t.selectedItem != nil {
		item := t.listAdapter.DeepestNode(t.selectedItem).Item()
		if item != t.selectedItem {
			// The selected item is hidden by an unexpanded node.
			// Highlight the deepest visible node instead.
			if details, found := t.details[item]; found {
				if child == details.child {
					b := child.Bounds().Expand(child.Control.Margin())
					t.outer.PaintUnexpandedSelection(c, b)
				}
			}
		}
	}
}