aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/IMLStream.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-08-05 07:05:13 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-08-05 07:05:13 +0200
commite9963abca14fbad8ff6c215e5c9d6b45652b38dc (patch)
treefa1b55a3bd76257c01849e48f97b3d955012cece /src/IMLStream.cs
parent47dad629d4ff744071f06a342f5f2eabaa879d71 (diff)
* ListBox.cs:
* TemplatedControl.cs: set ItemTemplate as public * IMLStream.cs: copy ItemTemplates in tree hierarchy * TreeView.crow: add scrolling * treeList.crow: simple list template for tree children * testTreeView.crow: update test * Tests.csproj: update tests
Diffstat (limited to 'src/IMLStream.cs')
-rw-r--r--src/IMLStream.cs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/IMLStream.cs b/src/IMLStream.cs
index c7e26d5d..ccc09f45 100644
--- a/src/IMLStream.cs
+++ b/src/IMLStream.cs
@@ -46,9 +46,9 @@ namespace Crow
public ItemTemplate(Byte[] b)
: base(b){}
- public void CreateExpandDelegate (string strDataType, string method){
+ public void CreateExpandDelegate (TemplatedControl host, string strDataType, string method){
Type dataType = Type.GetType(strDataType);
- Type hostType = typeof(ItemTemplate);//not sure is the best place to put the dyn method
+ Type hostType = typeof(TemplatedControl);//not sure is the best place to put the dyn method
Type evtType = typeof(EventHandler);
Type listBoxType = typeof(ListBox);
@@ -65,13 +65,22 @@ namespace Crow
#region IL generation
ILGenerator il = dm.GetILGenerator (256);
+ il.DeclareLocal(typeof(GraphicObject));
il.Emit (OpCodes.Ldarg_1);
MethodInfo miFindByName = typeof(GraphicObject).GetMethod("FindByName");
il.Emit(OpCodes.Ldstr, "List");
il.Emit (OpCodes.Callvirt, miFindByName);
+ il.Emit (OpCodes.Stloc_0);
+ FieldInfo fiTemplates = typeof(TemplatedControl).GetField("ItemTemplates");
+ il.Emit (OpCodes.Ldloc_0);
+ il.Emit (OpCodes.Ldarg_0);
+ il.Emit (OpCodes.Ldfld, fiTemplates);
+ il.Emit (OpCodes.Stfld, fiTemplates);
+
+ il.Emit (OpCodes.Ldloc_0);
il.Emit (OpCodes.Ldarg_1);
il.Emit (OpCodes.Callvirt, typeof(GraphicObject).GetProperty("DataSource").GetGetMethod ());
@@ -84,7 +93,7 @@ namespace Crow
#endregion
- Expand = (EventHandler)dm.CreateDelegate (evtType, this);
+ Expand = (EventHandler)dm.CreateDelegate (evtType, host);
}
}
}