summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/UIEventDispatch.h
diff options
context:
space:
mode:
Diffstat (limited to 'StarsEx/UIEventDispatch.h')
-rw-r--r--StarsEx/UIEventDispatch.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/StarsEx/UIEventDispatch.h b/StarsEx/UIEventDispatch.h
new file mode 100644
index 0000000..442a539
--- /dev/null
+++ b/StarsEx/UIEventDispatch.h
@@ -0,0 +1,60 @@
+/* Starshatter: The Open Source Project
+ Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
+ Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
+ Copyright (c) 1997-2006, Destroyer Studios LLC.
+
+ AUTHOR: John DiCamillo
+
+
+ OVERVIEW
+ ========
+ Event Dispatch class
+*/
+
+#ifndef UIEventDispatch_h
+#define UIEventDispatch_h
+
+#include "List.h"
+#include "Types.h"
+#include "UIEventTarget.h"
+
+
+class UIEventDispatch
+{
+public:
+ static const char* TYPENAME() { return "UIEventDispatch"; }
+
+ UIEventDispatch();
+ virtual ~UIEventDispatch();
+
+ static void Create();
+ static void Close();
+ static UIEventDispatch* GetInstance() { return dispatcher; }
+
+ virtual void Dispatch();
+ virtual void Register(UIEventTarget* tgt);
+ virtual void Unregister(UIEventTarget* tgt);
+
+ virtual UIEventTarget* GetCapture();
+ virtual int CaptureMouse(UIEventTarget* tgt);
+ virtual int ReleaseMouse(UIEventTarget* tgt);
+
+ virtual UIEventTarget* GetFocus();
+ virtual void SetFocus(UIEventTarget* tgt);
+ virtual void KillFocus(UIEventTarget* tgt);
+
+ virtual void MouseEnter(UIEventTarget* tgt);
+
+protected:
+ int mouse_x, mouse_y, mouse_l, mouse_r;
+ List<UIEventTarget> clients;
+ UIEventTarget* capture;
+ UIEventTarget* current;
+ UIEventTarget* focus;
+ UIEventTarget* click_tgt;
+
+ static UIEventDispatch* dispatcher;
+};
+
+
+#endif // UIEventDispatch_h