mirror of
				https://github.com/taigrr/wtf
				synced 2025-01-18 04:03:14 -08:00 
			
		
		
		
	Add FocusTracker#Refocus()
This commit is contained in:
		
							parent
							
								
									c4cf871ccf
								
							
						
					
					
						commit
						d982ca48c5
					
				@ -17,10 +17,6 @@ type FocusTracker struct {
 | 
				
			|||||||
// Next sets the focus on the next widget in the widget list. If the current widget is
 | 
					// Next sets the focus on the next widget in the widget list. If the current widget is
 | 
				
			||||||
// the last widget, sets focus on the first widget.
 | 
					// the last widget, sets focus on the first widget.
 | 
				
			||||||
func (tracker *FocusTracker) Next() {
 | 
					func (tracker *FocusTracker) Next() {
 | 
				
			||||||
	//if tracker.widgetHasFocus() == false {
 | 
					 | 
				
			||||||
	//return
 | 
					 | 
				
			||||||
	//}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	tracker.blur(tracker.Idx)
 | 
						tracker.blur(tracker.Idx)
 | 
				
			||||||
	tracker.increment()
 | 
						tracker.increment()
 | 
				
			||||||
	tracker.focus(tracker.Idx)
 | 
						tracker.focus(tracker.Idx)
 | 
				
			||||||
@ -34,15 +30,15 @@ func (tracker *FocusTracker) None() {
 | 
				
			|||||||
// Prev sets the focus on the previous widget in the widget list. If the current widget is
 | 
					// Prev sets the focus on the previous widget in the widget list. If the current widget is
 | 
				
			||||||
// the last widget, sets focus on the last widget.
 | 
					// the last widget, sets focus on the last widget.
 | 
				
			||||||
func (tracker *FocusTracker) Prev() {
 | 
					func (tracker *FocusTracker) Prev() {
 | 
				
			||||||
	//if tracker.widgetHasFocus() == false {
 | 
					 | 
				
			||||||
	//return
 | 
					 | 
				
			||||||
	//}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	tracker.blur(tracker.Idx)
 | 
						tracker.blur(tracker.Idx)
 | 
				
			||||||
	tracker.decrement()
 | 
						tracker.decrement()
 | 
				
			||||||
	tracker.focus(tracker.Idx)
 | 
						tracker.focus(tracker.Idx)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (tracker *FocusTracker) Refocus() {
 | 
				
			||||||
 | 
						tracker.focus(tracker.Idx)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* -------------------- Unexported Functions -------------------- */
 | 
					/* -------------------- Unexported Functions -------------------- */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (tracker *FocusTracker) blur(idx int) {
 | 
					func (tracker *FocusTracker) blur(idx int) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user