mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:22:43 +00:00 
			
		
		
		
	LibGUI: Handle cursor keydown events in AbstractView
Move the basic movement keys (up/down/left/right/home/end/pgup/pgdn) up to AbstractView::keydown_event() and have it call the virtual move_cursor() which is then implemented by subclasses.
This commit is contained in:
		
							parent
							
								
									4ba12e9c23
								
							
						
					
					
						commit
						27687b1c6e
					
				
					 6 changed files with 53 additions and 120 deletions
				
			
		|  | @ -320,32 +320,12 @@ void ColumnsView::keydown_event(KeyEvent& event) | |||
|     if (!model()) | ||||
|         return; | ||||
| 
 | ||||
|     SelectionUpdate selection_update = SelectionUpdate::Set; | ||||
| 
 | ||||
|     if (event.key() == KeyCode::Key_Return) { | ||||
|         activate_selected(); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     if (event.key() == KeyCode::Key_Up) { | ||||
|         move_cursor(CursorMovement::Up, selection_update); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     if (event.key() == KeyCode::Key_Down) { | ||||
|         move_cursor(CursorMovement::Down, selection_update); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     if (event.key() == KeyCode::Key_Left) { | ||||
|         move_cursor(CursorMovement::Left, selection_update); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     if (event.key() == KeyCode::Key_Right) { | ||||
|         move_cursor(CursorMovement::Right, selection_update); | ||||
|         return; | ||||
|     } | ||||
|     AbstractView::keydown_event(event); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling