mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 12:52:44 +00:00 
			
		
		
		
	 0dc9af5f7e
			
		
	
	
		0dc9af5f7e
		
	
	
	
	
		
			
			Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
		
			
				
	
	
		
			35 lines
		
	
	
	
		
			815 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
	
		
			815 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include "WSMenu.h"
 | |
| #include <AK/Vector.h>
 | |
| #include <AK/WeakPtr.h>
 | |
| #include <AK/Weakable.h>
 | |
| 
 | |
| class WSMenuBar : public Weakable<WSMenuBar> {
 | |
| public:
 | |
|     WSMenuBar(WSClientConnection& client, int menubar_id);
 | |
|     ~WSMenuBar();
 | |
| 
 | |
|     WSClientConnection& client() { return m_client; }
 | |
|     const WSClientConnection& client() const { return m_client; }
 | |
|     int menubar_id() const { return m_menubar_id; }
 | |
|     void add_menu(WSMenu& menu)
 | |
|     {
 | |
|         menu.set_menubar(this);
 | |
|         m_menus.append(&menu);
 | |
|     }
 | |
| 
 | |
|     template<typename Callback>
 | |
|     void for_each_menu(Callback callback)
 | |
|     {
 | |
|         for (auto& menu : m_menus) {
 | |
|             if (!callback(*menu))
 | |
|                 return;
 | |
|         }
 | |
|     }
 | |
| 
 | |
| private:
 | |
|     WSClientConnection& m_client;
 | |
|     int m_menubar_id { 0 };
 | |
|     Vector<WSMenu*> m_menus;
 | |
| };
 |