aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/IML/Node.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-12-14 01:03:55 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-12-14 01:03:55 +0100
commitbdd6f9a1db93cbe52ad35e17d909fd8eb28368d5 (patch)
tree60bc66251dca0567cc38c894628378b8b0225141 /src/IML/Node.cs
parentc30725eb225c84682bc58124f7a7769db531bc69 (diff)
Template binding instantiation, dynamic event handler emition.
intermediate save. modifié : src/CompilerServices/CompilerServices.cs modifié : src/IML/Context.cs modifié : src/IML/Node.cs modifié : src/IML/NodeAddress.cs modifié : src/Instantiator.cs
Diffstat (limited to 'src/IML/Node.cs')
-rw-r--r--src/IML/Node.cs21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/IML/Node.cs b/src/IML/Node.cs
index 14cffdb2..a9e9bb80 100644
--- a/src/IML/Node.cs
+++ b/src/IML/Node.cs
@@ -26,14 +26,13 @@ using System.Collections.Generic;
namespace Crow.IML
{
/// <summary>
- /// IML Node are the elements of the interface XML,
+ /// IML Node are defined with a type and the index in the parent,
/// </summary>
public struct Node
{
+ /// <summary> Current node type</summary>
public Type CrowType;
- /// <summary>
- /// Indexer for group child, -1 for template
- /// </summary>
+ /// <summary> Index in parent, -1 for template</summary>
public int Index;
public Node (Type crowType, int _index = 0)
@@ -42,6 +41,20 @@ namespace Crow.IML
Index = _index;
}
+ public MethodInfo GetAddMethod(int childIdx){
+ if (typeof (Group).IsAssignableFrom (CrowType))
+ return CompilerServices.miAddChild;
+ if (typeof (Container).IsAssignableFrom (CrowType))
+ return CompilerServices.miSetChild;
+ if (typeof (TemplatedContainer).IsAssignableFrom (CrowType))
+ return childIdx < 0 ? CompilerServices.miLoadTmp : CompilerServices.miSetContent;
+ if (typeof (TemplatedGroup).IsAssignableFrom (CrowType))
+ return childIdx < 0 ? CompilerServices.miLoadTmp : CompilerServices.miAddItem;
+ if (typeof (TemplatedControl).IsAssignableFrom (CrowType))
+ return CompilerServices.miLoadTmp;
+ return null;
+ }
+
#region Equality Compare
public override bool Equals (object obj)
{