mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:02:46 +00:00 
			
		
		
		
	 395e4210ef
			
		
	
	
		395e4210ef
		
	
	
	
	
		
			
			This also adds a toolbar and a menu which allow you to navigate back and forth through history ^)
		
			
				
	
	
		
			22 lines
		
	
	
	
		
			448 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			448 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/String.h>
 | |
| #include <AK/Vector.h>
 | |
| 
 | |
| class History final {
 | |
| public:
 | |
|     void push(const StringView& history_item);
 | |
|     String current();
 | |
| 
 | |
|     void go_back();
 | |
|     void go_forward();
 | |
| 
 | |
|     bool can_go_back() { return m_current_history_item > 0; }
 | |
|     bool can_go_forward() { return m_current_history_item + 1 < m_items.size(); }
 | |
| 
 | |
|     void clear();
 | |
| 
 | |
| private:
 | |
|     Vector<String> m_items;
 | |
|     int m_current_history_item { -1 };
 | |
| };
 |