summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-08 19:53:10 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-08 19:54:34 +0200
commit30a6f8174ab44c12ccdfb212a2f6895440581d1a (patch)
tree87846e0ddf91dff28eac4c39a5d6373177497f1d
parent5127ff4c1afe6c2ec62cc2cae1c48dbca3b7dd89 (diff)
+ Add EventListenerInterface protocol
+ Also added EventListenerInterface as a public class. Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
-rw-r--r--SCIKit/SCIBase.hxx12
-rw-r--r--SCIKit/SCM.drawio8
-rw-r--r--SCIKit/scm.internal.inl17
3 files changed, 33 insertions, 4 deletions
diff --git a/SCIKit/SCIBase.hxx b/SCIKit/SCIBase.hxx
index 95eb5bb1..c2241715 100644
--- a/SCIKit/SCIBase.hxx
+++ b/SCIKit/SCIBase.hxx
@@ -68,6 +68,18 @@ public:
virtual VoidPtr QueryInterface(UUID* p_uuid) = 0;
};
+template <typename FnSign, typename ClsID>
+class EventListenerInterface final : public ClsID
+{
+public:
+ explicit EventListenerInterface() = default;
+ virtual ~UnknownInterface() = default;
+
+ EventListenerInterface& operator=(const EventListenerInterface&) = default;
+ EventListenerInterface(const EventListenerInterface&) = default;
+
+ virtual EventListenerInterface& operator +=(FnSign arg) = 0;
+};
#endif
/// @note Part of NK loader API.
diff --git a/SCIKit/SCM.drawio b/SCIKit/SCM.drawio
index 978ebb6d..b4523fe2 100644
--- a/SCIKit/SCM.drawio
+++ b/SCIKit/SCM.drawio
@@ -1,13 +1,13 @@
<mxfile host="65bd71144e">
<diagram name="Page-1" id="_vc7fxBdNKI2W8YhI8VA">
- <mxGraphModel dx="746" dy="563" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
+ <mxGraphModel dx="746" dy="325" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="eRehIIeIVOPW1y23kRkx-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="eRehIIeIVOPW1y23kRkx-2" target="eRehIIeIVOPW1y23kRkx-8" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
- <mxCell id="eRehIIeIVOPW1y23kRkx-2" value="User level interfaces" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxCell id="eRehIIeIVOPW1y23kRkx-2" value="User level interfaces and events." style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="200" y="450" width="226" height="60" as="geometry"/>
</mxCell>
<mxCell id="eRehIIeIVOPW1y23kRkx-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="eRehIIeIVOPW1y23kRkx-3" target="eRehIIeIVOPW1y23kRkx-2" edge="1">
@@ -19,8 +19,8 @@
<mxCell id="eRehIIeIVOPW1y23kRkx-8" value="Program #2&lt;div&gt;Is a web browser, it uses an HTML parser component.&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="253" y="570" width="120" height="60" as="geometry"/>
</mxCell>
- <mxCell id="eRehIIeIVOPW1y23kRkx-10" value="&lt;h1 style=&quot;margin-top: 0px;&quot;&gt;System Component Model&lt;/h1&gt;&lt;p&gt;SCM is a standardized way of sharing code within DLLs in NewOS.&lt;/p&gt;" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
- <mxGeometry x="430" y="240" width="180" height="180" as="geometry"/>
+ <mxCell id="eRehIIeIVOPW1y23kRkx-10" value="&lt;h1 style=&quot;margin-top: 0px;&quot;&gt;System Component Model&lt;/h1&gt;&lt;p&gt;SCM is a standardized way of sharing code within DLLs in NewOS.&lt;/p&gt;&lt;p&gt;It is also used to register and call code using&amp;nbsp;&lt;span style=&quot;color: rgb(78, 201, 176); background-color: rgb(31, 31, 31); font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px;&quot;&gt;EventListenerInterface&lt;/span&gt;&lt;/p&gt;" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
+ <mxGeometry x="430" y="240" width="270" height="160" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
diff --git a/SCIKit/scm.internal.inl b/SCIKit/scm.internal.inl
index b4e8e7dd..6b3af973 100644
--- a/SCIKit/scm.internal.inl
+++ b/SCIKit/scm.internal.inl
@@ -65,3 +65,20 @@ inline SInt32 ScmReleaseClass(TCLS* cls)
return 0;
}
+
+template <typename FnSign, typename ClsID>
+protocol EventListenerInterface final : public ClsID
+{
+public:
+ explicit EventListenerInterface() = default;
+ virtual ~UnknownInterface() = default;
+
+ EventListenerInterface& operator=(const EventListenerInterface&) = default;
+ EventListenerInterface(const EventListenerInterface&) = default;
+
+ virtual EventListenerInterface& operator +=(FnSign arg)
+ {
+ this->AddEvent(arg);
+ return *this;
+ }
+};