示例#1
0
文件: list.go 项目: nelsam/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)
		}
	}
}
示例#2
0
文件: tree.go 项目: nelsam/gxui
// List override
func (t *Tree) PaintChild(c gxui.Canvas, child *gxui.Child, idx int) {
	t.List.PaintChild(c, child, idx)
	if t.selectedItem != nil {
		if deepest := t.listAdapter.DeepestNode(t.selectedItem); deepest != nil {
			if item := deepest.Item(); 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)
					}
				}
			}
		}
	}
}