From ce550f08fa91598612c016ebebc89c4af2e9505e Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 15 Sep 2022 00:53:01 +0200 Subject: Renamed EventDispatch and EventTarget by adding UI prefix --- StarsEx/UIEventDispatch.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 StarsEx/UIEventDispatch.h (limited to 'StarsEx/UIEventDispatch.h') 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 clients; + UIEventTarget* capture; + UIEventTarget* current; + UIEventTarget* focus; + UIEventTarget* click_tgt; + + static UIEventDispatch* dispatcher; +}; + + +#endif // UIEventDispatch_h -- cgit v1.1