diff --git a/elements/file/directory.go b/elements/file/directory.go index 7c9f9a3..2d5792b 100644 --- a/elements/file/directory.go +++ b/elements/file/directory.go @@ -171,14 +171,16 @@ func (element *DirectoryView) Child (index int) (child elements.Element) { } func (element *DirectoryView) HandleMouseDown (x, y int, button input.Button) { - var file *File - for _, entry := range element.children { - if image.Pt(x, y).In(entry.Bounds) { - file = entry.File + if button == input.ButtonLeft { + var file *File + for _, entry := range element.children { + if image.Pt(x, y).In(entry.Bounds) { + file = entry.File + } + } + if file != nil { + file.SetSelected(!file.Selected()) } - } - if file != nil { - file.SetSelected(!file.Selected()) } element.Propagator.HandleMouseDown(x, y, button) } diff --git a/elements/file/file.go b/elements/file/file.go index ca53cd6..9d27bbe 100644 --- a/elements/file/file.go +++ b/elements/file/file.go @@ -141,6 +141,20 @@ func (element *File) HandleMouseUp (x, y int, button input.Button) { element.drawAndPush() } +// SetTheme sets the element's theme. +func (element *File) SetTheme (new theme.Theme) { + if new == element.theme.Theme { return } + element.theme.Theme = new + element.drawAndPush() +} + +// SetConfig sets the element's configuration. +func (element *File) SetConfig (new config.Config) { + if new == element.config.Config { return } + element.config.Config = new + element.drawAndPush() +} + func (element *File) state () theme.State { return theme.State { Disabled: !element.Enabled(),