aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-03-13 23:39:22 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-03-13 23:39:22 +0100
commite5bb6eaee1d61bdcc60ad0a0fb7e81911bd57e47 (patch)
tree91b6ed1cdd153033e2cb7c62c3e0ebf67284ef4c /src
parent09e26d9c08d22f31e1164237d63e2757822ff5d6 (diff)
search entry assembly for new crow widgets
Diffstat (limited to 'src')
-rw-r--r--src/GraphicObjects/Container.cs7
-rw-r--r--src/GraphicObjects/Group.cs10
-rw-r--r--src/GraphicObjects/TemplatedContainer.cs8
3 files changed, 24 insertions, 1 deletions
diff --git a/src/GraphicObjects/Container.cs b/src/GraphicObjects/Container.cs
index 58512a08..69e3a3b4 100644
--- a/src/GraphicObjects/Container.cs
+++ b/src/GraphicObjects/Container.cs
@@ -51,6 +51,13 @@ namespace Crow
return;
Type t = Type.GetType("Crow." + subTree.Name);
+ if (t == null) {
+ Assembly a = Assembly.GetEntryAssembly ();
+ foreach (Type expT in a.GetExportedTypes ()) {
+ if (expT.Name == subTree.Name)
+ t = expT;
+ }
+ }
GraphicObject go = (GraphicObject)Activator.CreateInstance(t);
(go as IXmlSerializable).ReadXml(subTree);
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index 9d458c1d..7ea37161 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -5,6 +5,7 @@ using System.Xml.Serialization;
using Cairo;
using OpenTK.Input;
using System.Diagnostics;
+using System.Reflection;
namespace Crow
@@ -46,7 +47,7 @@ namespace Crow
GraphicObject g = child as GraphicObject;
Children.Add(g);
g.Parent = this as GraphicObject;
- ResolveBindings ();
+ g.ResolveBindings ();
g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
g.LayoutChanged += OnChildLayoutChanges;
return (T)child;
@@ -339,6 +340,13 @@ namespace Crow
break;
Type t = Type.GetType("Crow." + subTree.Name);
+ if (t == null) {
+ Assembly a = Assembly.GetEntryAssembly ();
+ foreach (Type expT in a.GetExportedTypes ()) {
+ if (expT.Name == subTree.Name)
+ t = expT;
+ }
+ }
if (t == null)
throw new Exception ("Crow." + subTree.Name + " type not found");
GraphicObject go = (GraphicObject)Activator.CreateInstance(t);
diff --git a/src/GraphicObjects/TemplatedContainer.cs b/src/GraphicObjects/TemplatedContainer.cs
index 3003d486..a845722a 100644
--- a/src/GraphicObjects/TemplatedContainer.cs
+++ b/src/GraphicObjects/TemplatedContainer.cs
@@ -21,6 +21,7 @@
using System;
using System.Xml.Serialization;
using System.Xml;
+using System.Reflection;
namespace Crow
{
@@ -84,6 +85,13 @@ namespace Crow
}
Type t = Type.GetType ("Crow." + xr.Name);
+ if (t == null) {
+ Assembly a = Assembly.GetEntryAssembly ();
+ foreach (Type expT in a.GetExportedTypes ()) {
+ if (expT.Name == xr.Name)
+ t = expT;
+ }
+ }
GraphicObject go = (GraphicObject)Activator.CreateInstance (t);
(go as IXmlSerializable).ReadXml (xr);