mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-30 07:42:07 +00:00 
			
		
		
		
	 74be54cce8
			
		
	
	
		74be54cce8
		
	
	
	
	
		
			
			If the .af file for an app contains the App/Category key, we'll now put it in a submenu of the system menu, together with all the other apps in that same category. This is pretty neat! :^)
		
			
				
	
	
		
			52 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "WSMenuItem.h"
 | |
| #include "WSClientConnection.h"
 | |
| #include "WSMenu.h"
 | |
| #include "WSWindowManager.h"
 | |
| #include <LibDraw/GraphicsBitmap.h>
 | |
| 
 | |
| WSMenuItem::WSMenuItem(WSMenu& menu, unsigned identifier, const String& text, const String& shortcut_text, bool enabled, bool checkable, bool checked, const GraphicsBitmap* icon)
 | |
|     : m_menu(menu)
 | |
|     , m_type(Text)
 | |
|     , m_enabled(enabled)
 | |
|     , m_checkable(checkable)
 | |
|     , m_checked(checked)
 | |
|     , m_identifier(identifier)
 | |
|     , m_text(text)
 | |
|     , m_shortcut_text(shortcut_text)
 | |
|     , m_icon(icon)
 | |
| {
 | |
| }
 | |
| 
 | |
| WSMenuItem::WSMenuItem(WSMenu& menu, Type type)
 | |
|     : m_menu(menu)
 | |
|     , m_type(type)
 | |
| {
 | |
| }
 | |
| 
 | |
| WSMenuItem::~WSMenuItem()
 | |
| {
 | |
| }
 | |
| 
 | |
| void WSMenuItem::set_enabled(bool enabled)
 | |
| {
 | |
|     if (m_enabled == enabled)
 | |
|         return;
 | |
|     m_enabled = enabled;
 | |
|     m_menu.redraw();
 | |
| }
 | |
| 
 | |
| void WSMenuItem::set_checked(bool checked)
 | |
| {
 | |
|     if (m_checked == checked)
 | |
|         return;
 | |
|     m_checked = checked;
 | |
|     m_menu.redraw();
 | |
| }
 | |
| 
 | |
| WSMenu* WSMenuItem::submenu()
 | |
| {
 | |
|     ASSERT(is_submenu());
 | |
|     if (m_menu.client())
 | |
|         return m_menu.client()->find_menu_by_id(m_submenu_id);
 | |
|     return WSWindowManager::the().find_internal_menu_by_id(m_submenu_id);
 | |
| }
 |