1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:57:44 +00:00

LibCore: Add a way to install an event filter on a Core::Object

The event filter is consulted by Object::dispatch_event() and may
decide that the event should not be delivered to the target object.
This commit is contained in:
Andreas Kling 2021-03-28 11:16:33 +02:00
parent c91bb72964
commit 54c7110d9d
2 changed files with 13 additions and 2 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -113,6 +113,8 @@ public:
void remove_child(Object&);
void remove_all_children();
void set_event_filter(Function<bool(Core::Event&)>);
void dump_tree(int indent = 0);
void deferred_invoke(Function<void(Object&)>);
@ -169,6 +171,7 @@ private:
unsigned m_inspector_count { 0 };
HashMap<String, NonnullOwnPtr<Property>> m_properties;
NonnullRefPtrVector<Object> m_children;
Function<bool(Core::Event&)> m_event_filter;
};
}