File is now configurable
This commit is contained in:
		
							parent
							
								
									6c8ff55dc1
								
							
						
					
					
						commit
						6638a471c7
					
				@ -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)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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(),
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user