File is now configurable
This commit is contained in:
parent
6c8ff55dc1
commit
6638a471c7
@ -171,6 +171,7 @@ func (element *DirectoryView) Child (index int) (child elements.Element) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (element *DirectoryView) HandleMouseDown (x, y int, button input.Button) {
|
func (element *DirectoryView) HandleMouseDown (x, y int, button input.Button) {
|
||||||
|
if button == input.ButtonLeft {
|
||||||
var file *File
|
var file *File
|
||||||
for _, entry := range element.children {
|
for _, entry := range element.children {
|
||||||
if image.Pt(x, y).In(entry.Bounds) {
|
if image.Pt(x, y).In(entry.Bounds) {
|
||||||
@ -180,6 +181,7 @@ func (element *DirectoryView) HandleMouseDown (x, y int, button input.Button) {
|
|||||||
if file != nil {
|
if file != nil {
|
||||||
file.SetSelected(!file.Selected())
|
file.SetSelected(!file.Selected())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
element.Propagator.HandleMouseDown(x, y, button)
|
element.Propagator.HandleMouseDown(x, y, button)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +141,20 @@ func (element *File) HandleMouseUp (x, y int, button input.Button) {
|
|||||||
element.drawAndPush()
|
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 {
|
func (element *File) state () theme.State {
|
||||||
return theme.State {
|
return theme.State {
|
||||||
Disabled: !element.Enabled(),
|
Disabled: !element.Enabled(),
|
||||||
|
Reference in New Issue
Block a user