1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 09:47:35 +00:00

WindowServer: Give menu items an identifier field and add a simple callback.

Eventually these identifiers will be sent to the userspace client who created
the menu. None of that is hooked up yet though.
This commit is contained in:
Andreas Kling 2019-02-11 10:55:02 +01:00
parent 78fc7a9ef2
commit 145aa27b8f
5 changed files with 41 additions and 9 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include <AK/AKString.h>
#include <AK/Function.h>
#include <SharedGraphics/Rect.h>
class WSMenuItem {
@ -11,7 +12,7 @@ public:
Separator,
};
explicit WSMenuItem(const String& text);
explicit WSMenuItem(unsigned identifier, const String& text);
explicit WSMenuItem(Type);
~WSMenuItem();
@ -23,9 +24,12 @@ public:
void set_rect(const Rect& rect) { m_rect = rect; }
Rect rect() const { return m_rect; }
unsigned identifier() const { return m_identifier; }
private:
Type m_type { None };
bool m_enabled { true };
unsigned m_identifier { 0 };
String m_text;
Rect m_rect;
};