summaryrefslogtreecommitdiff
path: root/source/Asura.Editor/core/signal.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/Asura.Editor/core/signal.h')
-rw-r--r--source/Asura.Editor/core/signal.h52
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