mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 17:58:49 +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:
parent
78fc7a9ef2
commit
145aa27b8f
Notes:
sideshowbarker
2024-07-19 15:47:37 +09:00
Author: https://github.com/awesomekling
Commit: 145aa27b8f
5 changed files with 41 additions and 9 deletions
|
@ -185,19 +185,26 @@ WSWindowManager::WSWindowManager()
|
|||
|
||||
{
|
||||
auto menu = make<WSMenu>("Serenity");
|
||||
menu->add_item(make<WSMenuItem>("Launch Terminal"));
|
||||
menu->add_item(make<WSMenuItem>(0, "Launch Terminal"));
|
||||
menu->add_item(make<WSMenuItem>(WSMenuItem::Separator));
|
||||
menu->add_item(make<WSMenuItem>("Hello again"));
|
||||
menu->add_item(make<WSMenuItem>("To all my friends"));
|
||||
menu->add_item(make<WSMenuItem>("Together we can play some rock&roll"));
|
||||
menu->add_item(make<WSMenuItem>(1, "Hello again"));
|
||||
menu->add_item(make<WSMenuItem>(2, "To all my friends"));
|
||||
menu->add_item(make<WSMenuItem>(3, "Together we can play some rock&roll"));
|
||||
menu->add_item(make<WSMenuItem>(WSMenuItem::Separator));
|
||||
menu->add_item(make<WSMenuItem>("About..."));
|
||||
menu->add_item(make<WSMenuItem>(4, "About..."));
|
||||
menu->on_item_activation = [] (WSMenuItem& item) {
|
||||
kprintf("WSMenu 1 item activated: '%s'\n", item.text().characters());
|
||||
};
|
||||
menubar->add_menu(move(menu));
|
||||
}
|
||||
{
|
||||
auto menu = make<WSMenu>("Application");
|
||||
menu->add_item(make<WSMenuItem>("Bar!"));
|
||||
menu->add_item(make<WSMenuItem>("Foo!"));
|
||||
menu->add_item(make<WSMenuItem>(5, "Foo."));
|
||||
menu->add_item(make<WSMenuItem>(6, "Bar?"));
|
||||
menu->add_item(make<WSMenuItem>(7, "Baz!"));
|
||||
menu->on_item_activation = [] (WSMenuItem& item) {
|
||||
kprintf("WSMenu 2 item activated: '%s'\n", item.text().characters());
|
||||
};
|
||||
menubar->add_menu(move(menu));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue