mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:37:35 +00:00
WindowServer: Use window menu actions when clicking frame buttons
This keeps the minimize/maximize/restore/close implementation consistent with the window menu actions.
This commit is contained in:
parent
7345b502ab
commit
31c3382577
4 changed files with 54 additions and 29 deletions
|
@ -41,15 +41,32 @@ public:
|
|||
const MenuItem& item(int index) const { return m_items.at(index); }
|
||||
MenuItem& item(int index) { return m_items.at(index); }
|
||||
|
||||
MenuItem* item_by_identifier(unsigned identifier)
|
||||
{
|
||||
MenuItem* found_item = nullptr;
|
||||
for_each_item([&](auto& item) {
|
||||
if (item.identifier() == identifier) {
|
||||
found_item = &item;
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
return found_item;
|
||||
}
|
||||
|
||||
void add_item(NonnullOwnPtr<MenuItem>);
|
||||
|
||||
String name() const { return m_name; }
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_item(Callback callback) const
|
||||
IterationDecision for_each_item(Callback callback)
|
||||
{
|
||||
for (auto& item : m_items)
|
||||
callback(item);
|
||||
for (auto& item : m_items) {
|
||||
IterationDecision decision = callback(item);
|
||||
if (decision != IterationDecision::Continue)
|
||||
return decision;
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
}
|
||||
|
||||
Gfx::IntRect rect_in_window_menubar() const { return m_rect_in_window_menubar; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue