コード例 #1
0
ファイル: list.go プロジェクト: 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)
		}
	}
}
コード例 #2
0
ファイル: tree.go プロジェクト: henrylee2cn/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 {
		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)
				}
			}
		}
	}
}