aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-08-16 15:23:34 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-08-16 15:23:34 +0200
commit8c7cd405658cbe7e4d64be189549b8125300964f (patch)
tree409ce325828c665bd0b285a09d40a5a924d73419 /src/GraphicObjects
parentea5ba40d536aa80b56db118c3e8e077790c24359 (diff)
Correct bug 'Instanciing from code instead of IML'
set currentInterface to default one if null modifié : Crow.OpenTK.nuspec modifié : src/CompilerServices/CompilerServices.cs modifié : src/GraphicObjects/Container.cs modifié : src/GraphicObjects/GraphicObject.cs modifié : src/GraphicObjects/PrivateContainer.cs modifié : src/GraphicObjects/TemplatedControl.cs modifié : src/Interface.cs
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/Container.cs4
-rw-r--r--src/GraphicObjects/GraphicObject.cs34
-rw-r--r--src/GraphicObjects/PrivateContainer.cs4
-rw-r--r--src/GraphicObjects/TemplatedControl.cs9
4 files changed, 24 insertions, 27 deletions
diff --git a/src/GraphicObjects/Container.cs b/src/GraphicObjects/Container.cs
index fb4a7834..0b6045bb 100644
--- a/src/GraphicObjects/Container.cs
+++ b/src/GraphicObjects/Container.cs
@@ -14,10 +14,6 @@ namespace Crow
: base()
{
}
- public Container(Rectangle _bounds)
- : base(_bounds)
- {
- }
#endregion
[XmlIgnore]
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index bd96b76c..0cde106a 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -25,6 +25,21 @@ namespace Crow
internal static ulong currentUid = 0;
internal ulong uid = 0;
+ Interface currentInterface = null;
+
+ public Interface CurrentInterface {
+ get {
+ if (currentInterface == null) {
+ currentInterface = Interface.CurrentInterface;
+ initialize ();
+ }
+ return currentInterface;
+ }
+ set {
+ currentInterface = value;
+ }
+ }
+
Rectangles clipping = new Rectangles();
public Rectangles Clipping { get { return clipping; }}
@@ -41,23 +56,11 @@ namespace Crow
{
uid = currentUid;
currentUid++;
-
-// if (CurrentInterface.XmlLoading)
-// return;
-// loadDefaultValues ();
- }
- public GraphicObject (Rectangle _bounds)
- {
-// if (!CurrentInterface.XmlLoading)
-// loadDefaultValues ();
-
- Left = _bounds.Left;
- Top = _bounds.Top;
- Width = _bounds.Width;
- Height = _bounds.Height;
}
#endregion
-
+ internal protected virtual void initialize(){
+ loadDefaultValues ();
+ }
#region private fields
LayoutingType registeredLayoutings = LayoutingType.All;
ILayoutable logicalParent;
@@ -729,7 +732,6 @@ namespace Crow
if (RegisteredLayoutings == LayoutingType.None)
CurrentInterface.EnqueueForRepaint (this);
}
- internal Interface CurrentInterface = null;
#endregion
#region Layouting
diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs
index 5f70dd17..2a5deeaa 100644
--- a/src/GraphicObjects/PrivateContainer.cs
+++ b/src/GraphicObjects/PrivateContainer.cs
@@ -39,10 +39,6 @@ namespace Crow
: base()
{
}
- public PrivateContainer(Rectangle _bounds)
- : base(_bounds)
- {
- }
#endregion
protected GraphicObject child;
diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs
index b77c89e3..02d6108a 100644
--- a/src/GraphicObjects/TemplatedControl.cs
+++ b/src/GraphicObjects/TemplatedControl.cs
@@ -36,12 +36,15 @@ namespace Crow
#region CTOR
public TemplatedControl () : base()
{
-// if (CurrentInterface.XmlLoading)
-// return;
- //loadTemplate ();
}
#endregion
+ internal protected override void initialize ()
+ {
+ loadTemplate ();
+ base.initialize ();
+ }
+
string _template;
string _itemTemplate;
public Dictionary<string, ItemTemplate> ItemTemplates = new Dictionary<string, Crow.ItemTemplate>();//TODO: dont instantiate if not used