mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:52:45 +00:00 
			
		
		
		
	 eb610b309e
			
		
	
	
		eb610b309e
		
	
	
	
	
		
			
			I found myself having to cast to GWidget* all the time when writing some generic debugging code that just wanted to dump widget info.
		
			
				
	
	
		
			26 lines
		
	
	
	
		
			562 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
	
		
			562 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <LibGUI/GWidget.h>
 | |
| 
 | |
| class GAction;
 | |
| 
 | |
| class GToolBar : public GWidget {
 | |
| public:
 | |
|     explicit GToolBar(GWidget* parent);
 | |
|     virtual ~GToolBar() override;
 | |
| 
 | |
|     void add_action(Retained<GAction>&&);
 | |
|     void add_separator();
 | |
| 
 | |
|     virtual const char* class_name() const override { return "GToolBar"; }
 | |
| 
 | |
| private:
 | |
|     virtual void paint_event(GPaintEvent&) override;
 | |
| 
 | |
|     struct Item {
 | |
|         enum Type { Invalid, Separator, Action };
 | |
|         Type type { Invalid };
 | |
|         RetainPtr<GAction> action;
 | |
|     };
 | |
|     Vector<OwnPtr<Item>> m_items;
 | |
| };
 |