mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:37:44 +00:00
WindowServer: Add some app icons to the system menu
This commit is contained in:
parent
c0d81bea06
commit
1077c15917
3 changed files with 8 additions and 6 deletions
|
@ -2,7 +2,7 @@
|
||||||
#include "WSMenu.h"
|
#include "WSMenu.h"
|
||||||
#include <LibDraw/GraphicsBitmap.h>
|
#include <LibDraw/GraphicsBitmap.h>
|
||||||
|
|
||||||
WSMenuItem::WSMenuItem(WSMenu& menu, unsigned identifier, const String& text, const String& shortcut_text, bool enabled, bool checkable, bool checked)
|
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_menu(menu)
|
||||||
, m_type(Text)
|
, m_type(Text)
|
||||||
, m_enabled(enabled)
|
, m_enabled(enabled)
|
||||||
|
@ -11,6 +11,7 @@ WSMenuItem::WSMenuItem(WSMenu& menu, unsigned identifier, const String& text, co
|
||||||
, m_identifier(identifier)
|
, m_identifier(identifier)
|
||||||
, m_text(text)
|
, m_text(text)
|
||||||
, m_shortcut_text(shortcut_text)
|
, m_shortcut_text(shortcut_text)
|
||||||
|
, m_icon(icon)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ public:
|
||||||
Separator,
|
Separator,
|
||||||
};
|
};
|
||||||
|
|
||||||
WSMenuItem(WSMenu&, unsigned identifier, const String& text, const String& shortcut_text = {}, bool enabled = true, bool checkable = false, bool checked = false);
|
WSMenuItem(WSMenu&, unsigned identifier, const String& text, const String& shortcut_text = {}, bool enabled = true, bool checkable = false, bool checked = false, const GraphicsBitmap* icon = nullptr);
|
||||||
WSMenuItem(WSMenu&, Type);
|
WSMenuItem(WSMenu&, Type);
|
||||||
~WSMenuItem();
|
~WSMenuItem();
|
||||||
|
|
||||||
|
|
|
@ -47,12 +47,13 @@ WSWindowManager::WSWindowManager()
|
||||||
struct AppMenuItem {
|
struct AppMenuItem {
|
||||||
const char* binary_name;
|
const char* binary_name;
|
||||||
const char* description;
|
const char* description;
|
||||||
|
const char* icon_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<AppMenuItem> apps = {
|
Vector<AppMenuItem> apps = {
|
||||||
{ "/bin/Terminal", "Open Terminal..." },
|
{ "/bin/Terminal", "Open Terminal...", "/res/icons/16x16/app-terminal.png" },
|
||||||
{ "/bin/FileManager", "Open FileManager..." },
|
{ "/bin/FileManager", "Open FileManager...", "/res/icons/16x16/filetype-folder.png" },
|
||||||
{ "/bin/ProcessManager", "Open ProcessManager..." }
|
{ "/bin/SystemMonitor", "Open SystemMonitor...", "/res/icons/16x16/app-system-monitor.png" }
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 system_menu_name[] = { 0xf8, 0 };
|
u8 system_menu_name[] = { 0xf8, 0 };
|
||||||
|
@ -60,7 +61,7 @@ WSWindowManager::WSWindowManager()
|
||||||
|
|
||||||
int appIndex = 1;
|
int appIndex = 1;
|
||||||
for (const auto& app : apps) {
|
for (const auto& app : apps) {
|
||||||
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, appIndex++, app.description));
|
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, appIndex++, app.description, String(), true, false, false, load_png(app.icon_path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, WSMenuItem::Separator));
|
m_system_menu->add_item(make<WSMenuItem>(*m_system_menu, WSMenuItem::Separator));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue