diff options
author | chai <chaifix@163.com> | 2019-03-25 23:46:59 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-25 23:46:59 +0800 |
commit | 03b3b8ae80559745f98ef94569b421adddeb441f (patch) | |
tree | 7bf46892fef7453d4c25172333bd4fbddb29ee16 /source/Asura.Editor/core/signal.h | |
parent | 82956beb1fe17e1226327638c8ab22b5f5adfc1d (diff) |
*misc
Diffstat (limited to 'source/Asura.Editor/core/signal.h')
-rw-r--r-- | source/Asura.Editor/core/signal.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/source/Asura.Editor/core/signal.h b/source/Asura.Editor/core/signal.h new file mode 100644 index 0000000..f1ab9b4 --- /dev/null +++ b/source/Asura.Editor/core/signal.h @@ -0,0 +1,52 @@ +#ifndef __ASRUA_EDTIRO_SIGNAL_H__ +#define __ASRUA_EDTIRO_SIGNAL_H__ + +#include <vector> + +#include <asura-lib-utils/scripting/portable.hpp> + +#include "../widgets/widget.h" +#include "slot.h" + +namespace AsuraEditor +{ + + /// + /// ؼ¼ + /// + class Signal + { + public: + Signal(); + + /// + /// Fire¼connectļߣãconnectĺ + /// + void operator()(void* userdata) + { + for (auto callback : mCallbacks) + callback(); + } + + /// + /// עص + /// + void Connect(const Slot& callback) + { + mCallbacks.push_back(callback); + } + + /// + /// + /// + void Disconnect(); + + private: + + std::vector<Slot> mCallbacks; // + + }; + +} + +#endif
\ No newline at end of file |