InputEvent相关函数、变量改名

This commit is contained in:
2025-06-27 02:58:00 +08:00
parent 71b459c024
commit 9eabdaf1d1

View File

@@ -2,6 +2,7 @@
#include<hgl/type/SortedSet.h> #include<hgl/type/SortedSet.h>
#include<hgl/io/event/InputEventSource.h> #include<hgl/io/event/InputEventSource.h>
namespace hgl::io namespace hgl::io
{ {
struct EventHeader struct EventHeader
@@ -30,7 +31,9 @@ namespace hgl::io
InputEvent * parent_input_event; InputEvent * parent_input_event;
SortedSet<InputEvent *> sub_event_proc; SortedSet<InputEvent *> event_dispatch_subscribers;
protected:
void SetParent(InputEvent *ie){parent_input_event=ie;} void SetParent(InputEvent *ie){parent_input_event=ie;}
@@ -43,9 +46,9 @@ namespace hgl::io
if(!RangeCheck(header.type)) if(!RangeCheck(header.type))
return(EventProcResult::Break); return(EventProcResult::Break);
if(!sub_event_proc.IsEmpty()) if(!event_dispatch_subscribers.IsEmpty())
{ {
for(InputEvent *ie:sub_event_proc) for(InputEvent *ie:event_dispatch_subscribers)
if(ie->OnEvent(header,data)==EventProcResult::Break) if(ie->OnEvent(header,data)==EventProcResult::Break)
return EventProcResult::Break; return EventProcResult::Break;
} }
@@ -70,10 +73,10 @@ namespace hgl::io
virtual ~InputEvent() virtual ~InputEvent()
{ {
if(parent_input_event) if(parent_input_event)
parent_input_event->Unjoin(this); parent_input_event->UnregistryEventDispatch(this);
} }
virtual bool Join(InputEvent *ie) virtual bool RegistryEventDispatch(InputEvent *ie)
{ {
if(!ie) if(!ie)
return(false); return(false);
@@ -85,10 +88,10 @@ namespace hgl::io
ie->SetParent(this); ie->SetParent(this);
return(sub_event_proc.Add(ie)!=-1); return(event_dispatch_subscribers.Add(ie)!=-1);
} }
bool Unjoin(InputEvent *ie) bool UnregistryEventDispatch(InputEvent *ie)
{ {
if(!ie)return(false); if(!ie)return(false);
@@ -99,7 +102,7 @@ namespace hgl::io
ie->SetParent(nullptr); ie->SetParent(nullptr);
return sub_event_proc.Delete(ie); return event_dispatch_subscribers.Delete(ie);
} }
virtual bool Update(){return true;} virtual bool Update(){return true;}