aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/events/RoutedEvent.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
committercrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
commit74bb9cd27242b9320f99ff4d2b50c3051576cc14 (patch)
tree744bac5799c593d1d6f81e7b09581bea626f2cde /include/cru/ui/events/RoutedEvent.hpp
parentb90c398de829d1ba5329651d75bae82f5e4085fe (diff)
downloadcru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.gz
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.bz2
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.zip
...
Diffstat (limited to 'include/cru/ui/events/RoutedEvent.hpp')
-rw-r--r--include/cru/ui/events/RoutedEvent.hpp39
1 files changed, 0 insertions, 39 deletions
diff --git a/include/cru/ui/events/RoutedEvent.hpp b/include/cru/ui/events/RoutedEvent.hpp
deleted file mode 100644
index dd0bc21f..00000000
--- a/include/cru/ui/events/RoutedEvent.hpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#pragma once
-#include "UiEventArgs.hpp"
-
-#include "cru/common/Event.hpp"
-
-namespace cru::ui::events {
-// TEventArgs must not be a reference type. This class help add reference.
-// EventArgs must be reference because the IsHandled property must be settable.
-template <typename TEventArgs>
-class CRU_UI_API RoutedEvent {
- public:
- static_assert(std::is_base_of_v<UiEventArgs, TEventArgs>,
- "TEventArgs must be subclass of UiEventArgs.");
- static_assert(!std::is_reference_v<TEventArgs>,
- "TEventArgs must not be reference.");
-
- using RawEventArgs = TEventArgs;
- using IEventType = IEvent<TEventArgs&>;
- using EventArgs = typename IEventType::EventArgs;
-
- RoutedEvent() = default;
- RoutedEvent(const RoutedEvent& other) = delete;
- RoutedEvent(RoutedEvent&& other) = delete;
- RoutedEvent& operator=(const RoutedEvent& other) = delete;
- RoutedEvent& operator=(RoutedEvent&& other) = delete;
- ~RoutedEvent() = default;
-
- IEvent<TEventArgs&>* Direct() { return &direct_; }
-
- IEvent<TEventArgs&>* Bubble() { return &bubble_; }
-
- IEvent<TEventArgs&>* Tunnel() { return &tunnel_; }
-
- private:
- Event<TEventArgs&> direct_;
- Event<TEventArgs&> bubble_;
- Event<TEventArgs&> tunnel_;
-};
-} // namespace cru::ui::event