]> O.S.I.I.S - jp/crow.git/commitdiff
iface param ctor #38
authorj-p <jp.bruyere@live.be>
Tue, 30 Jan 2018 00:28:26 +0000 (01:28 +0100)
committerGitHub <noreply@github.com>
Tue, 30 Jan 2018 00:28:26 +0000 (01:28 +0100)
59 files changed:
Crow.csproj
Tests/BasicTests.cs
Tests/HelloCube.cs
Tests/HelloWorld.cs
Tests/Showcase.cs
Tests/Tests.csproj
src/CompilerServices/CompilerServices.cs
src/GraphicObjects/AnalogMeter.cs
src/GraphicObjects/Border.cs
src/GraphicObjects/Button.cs
src/GraphicObjects/CheckBox.cs
src/GraphicObjects/ColorPicker.cs
src/GraphicObjects/ColorSelector.cs
src/GraphicObjects/ComboBox.cs
src/GraphicObjects/Container.cs
src/GraphicObjects/DirectoryView.cs
src/GraphicObjects/DummyTemplate.cs [deleted file]
src/GraphicObjects/Expandable.cs
src/GraphicObjects/FileDialog.cs
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraduatedSlider.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Grid.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/GroupBox.cs
src/GraphicObjects/HorizontalStack.cs
src/GraphicObjects/HueSelector.cs
src/GraphicObjects/Image.cs
src/GraphicObjects/Label.cs
src/GraphicObjects/ListBox.cs
src/GraphicObjects/Menu.cs
src/GraphicObjects/MenuItem.cs
src/GraphicObjects/MessageBox.cs
src/GraphicObjects/NumericControl.cs
src/GraphicObjects/Popper.cs
src/GraphicObjects/PrivateContainer.cs
src/GraphicObjects/ProgressBar.cs
src/GraphicObjects/RadioButton.cs
src/GraphicObjects/SaturationValueSelector.cs
src/GraphicObjects/ScrollBar.cs
src/GraphicObjects/Scroller.cs
src/GraphicObjects/ScrollingObject.cs
src/GraphicObjects/ScrollingTextBox.cs
src/GraphicObjects/Slider.cs
src/GraphicObjects/Spinner.cs
src/GraphicObjects/Splitter.cs
src/GraphicObjects/TabItem.cs
src/GraphicObjects/TabView.cs
src/GraphicObjects/TemplatedContainer.cs
src/GraphicObjects/TemplatedControl.cs
src/GraphicObjects/TemplatedGroup.cs
src/GraphicObjects/TextBox.cs
src/GraphicObjects/TextRun.cs
src/GraphicObjects/TreeView.cs
src/GraphicObjects/VerticalStack.cs
src/GraphicObjects/Window.cs
src/GraphicObjects/Wrapper.cs
src/IML/Context.cs
src/Instantiator.cs

index c556bc7998d1dbaaed77ae7cd00580e2a7728d58..4edb707b05714f81a3ecb9c5411f78e77024b426 100644 (file)
     <Compile Include="src\GraphicObjects\TreeView.cs" />
     <Compile Include="src\GraphicObjects\TabView.cs" />
     <Compile Include="src\GraphicObjects\TabItem.cs" />
-    <Compile Include="src\GraphicObjects\DummyTemplate.cs" />
     <Compile Include="src\Input\KeyboardKeyEventArgs.cs" />
     <Compile Include="src\Input\Buttons.cs" />
     <Compile Include="src\Input\ButtonState.cs" />
index 8d0a802621bababd2d7f5b5994a0122039013ac4..6adabf6cc25aab615e3d8fa68c83f7bcb06283a1 100644 (file)
@@ -141,7 +141,7 @@ namespace Tests
 
                        //testFiles = new string [] { @"Interfaces/Unsorted/testFileDialog.crow" };
                        //testFiles = new string [] { @"Interfaces/Divers/colorPicker.crow" };
-                       testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
+                       testFiles = new string [] { @"Interfaces/TemplatedContainer/testTabView.crow" };
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray ();
index aa4600255f2803eeabfd22f4164ec4a77d29627b..d44a9bfff71fa0898b6089596a2919e6169c4bbc 100644 (file)
@@ -69,7 +69,7 @@ namespace Tests
                        base.OnLoad (e);
 
                        AddWidget(
-                               new Window ()
+                               new Window (this.CurrentInterface)
                                {
                                        Caption = "Hello World"
                                }
index ca1560ef9a80b28494189137a212e57de1ef262e..ea37a1429af2261517202834decb55dda70a55ab 100644 (file)
@@ -40,9 +40,18 @@ namespace Tests
                {
                        base.OnLoad (e);
 
+                       Container c = (Container) Instantiator.CreateFromImlFragment (@"<Border BorderWidth='1' Background='Red' Foreground='White' Width='50%'></Border>").CreateInstance (CurrentInterface);
+                       GraphicObject obj = new GraphicObject (this.CurrentInterface) 
+                       {
+                               Background = Color.AirForceBlueRaf,
+                               Margin = 10,
+                               Width = 100,
+                               Height = 100
+                       };
+                       c.SetChild (obj);
+                       AddWidget (c);
 
-                       AddWidget(Instantiator.CreateFromImlFragment (@"<Border Fit='true' BorderWidth='2' BorderStyle='Normal' MouseDown='{BorderStyle=Sunken}' MouseUp='{BorderStyle=Raised}' MouseEnter='{BorderStyle=Raised}' MouseLeave='{BorderStyle=Normal}'><Label Margin='50'/></Border>").CreateInstance (CurrentInterface));
-                       //Load(@"Interfaces/GraphicObject/0.crow");
+                       //Load(@"Interfaces/GraphicObject/2.crow");
                }
 
                [STAThread]
index 4880ede5b7f126c58619a2286320438122fe0fbd..67ef5eef15bc2fa9c19087037cf56f90786c41c5 100644 (file)
@@ -32,6 +32,7 @@ using System.IO;
 using System.Collections.Generic;
 using System.Reflection;
 using System.Linq;
+using System.Text;
 
 namespace Tests
 {
@@ -106,7 +107,7 @@ namespace Tests
                        try {
                                lock (this.ifaceControl [0].CrowInterface.UpdateMutex) {
                                        Instantiator inst = null;
-                                       using (MemoryStream ms = new MemoryStream (System.Text.Encoding.Unicode.GetBytes (e.Text))){
+                                       using (MemoryStream ms = new MemoryStream (Encoding.UTF8.GetBytes (e.Text))){
                                                inst = new Instantiator (ms);
                                        }
                                        g = inst.CreateInstance (this.ifaceControl [0].CrowInterface);
index 2adcdb16b88ff81baa386c3c2c99f0d7894d731f..38152f0b9acd42bee1cc780f4d9303c503ad4df3 100644 (file)
@@ -50,7 +50,6 @@
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>
-    <Compile Include="Interfaces\testBorder.goml.cs" />
     <Compile Include="BasicTests.cs" />
     <Compile Include="OpenGL\Shader.cs" />
     <Compile Include="OpenGL\vaoMesh.cs" />
index b119b3e7d811b4b382fee07507f2a4678e18f16b..000562d772dbf96b487644c7b8725009232f1cec 100644 (file)
@@ -76,7 +76,7 @@ namespace Crow
                internal static MethodInfo miDSChangeEmitHelper = typeof(Instantiator).GetMethod("dataSourceChangedEmitHelper", BindingFlags.Instance | BindingFlags.NonPublic);
                internal static MethodInfo miDSReverseBinding = typeof(Instantiator).GetMethod("dataSourceReverseBinding", BindingFlags.Static | BindingFlags.NonPublic);
 
-               internal static FieldInfo miSetCurIface = typeof(GraphicObject).GetField ("currentInterface", BindingFlags.NonPublic | BindingFlags.Instance);
+               internal static FieldInfo miSetCurIface = typeof(GraphicObject).GetField ("CurrentInterface", BindingFlags.Public | BindingFlags.Instance);
                internal static MethodInfo miFindByName = typeof (GraphicObject).GetMethod ("FindByName");
                internal static MethodInfo miGetGObjItem = typeof(List<GraphicObject>).GetMethod("get_Item", new Type[] { typeof(Int32) });
                internal static MethodInfo miLoadDefaultVals = typeof (GraphicObject).GetMethod ("loadDefaultValues");
index 3875df15b1737767bac9320acc611226fe0aeece..fba58d9d8c2b2003d2ee3852d734025ce98948f8 100644 (file)
@@ -34,12 +34,8 @@ namespace Crow
        public class AnalogMeter : NumericControl
        {
                #region CTOR
-               public AnalogMeter() : base()
-               {}
-               public AnalogMeter(double minimum, double maximum, double step)
-                       : base(minimum,maximum,step)
-               {
-               }
+               public AnalogMeter () : base(){}
+               public AnalogMeter (Interface iface) : base(iface){}
                #endregion
 
                #region GraphicObject Overrides
index ef210b5788363231839480a7007e8de02c7155ef..6ac97d7f1bc6509724e592a60e651f4802960e51 100644 (file)
@@ -41,6 +41,7 @@ namespace Crow
        {
                #region CTOR
                public Border () : base(){}
+               public Border (Interface iface) : base(iface){}
                #endregion
 
                #region private fields
index 75f4301410803c3241a1806561f74079e358880e..4f791ed9e810e5af7046a49d02732106f463b058 100644 (file)
@@ -40,15 +40,15 @@ namespace Crow
 {
     public class Button : TemplatedContainer
     {
+               #region CTOR
+               public Button() : base() {}
+               public Button (Interface iface) : base(iface){}
+               #endregion
+
                string image;
                bool isPressed;
                Container _contentContainer;
 
-               #region CTOR
-        public Button() : base()
-        {}
-               #endregion
-
                public event EventHandler Pressed;
                public event EventHandler Released;
 
index 0a40d269d42385d29a8aed654846855305e50771..3a63ba2c57b2eec79fd64c49180fbd71eff168fc 100644 (file)
@@ -32,13 +32,13 @@ namespace Crow
 {
        public class CheckBox : TemplatedControl
        {
-               bool isChecked;
-
                #region CTOR
-               public CheckBox() : base()
-               {}
+               public CheckBox () : base(){}
+               public CheckBox (Interface iface) : base(iface){}
                #endregion
 
+               bool isChecked;
+
                public event EventHandler Checked;
                public event EventHandler Unchecked;
 
index 02496b3bb41ca721c2ac4a778de1f3a233620a68..b47e8ffcf17f070e477e64840a5a91f3ef7edd04 100644 (file)
@@ -32,9 +32,10 @@ namespace Crow
 {
        public class ColorPicker : TemplatedControl
        {
-               public ColorPicker () : base ()
-               {
-               }
+               #region CTOR
+               public ColorPicker () : base(){}
+               public ColorPicker (Interface iface) : base(iface){}
+               #endregion
 
                const double div = 255.0;
                const double colDiv = 1.0 / div;
index c9f3a19869da776fd656f571e80584e2eb70dcd0..4dfc68f6f6ce603d65c7a740380e61477f6b8562 100644 (file)
@@ -32,9 +32,10 @@ namespace Crow
 {
        public class ColorSelector : GraphicObject
        {
-               public ColorSelector (): base()
-               {
-               }
+               #region CTOR
+               public ColorSelector () : base(){}
+               public ColorSelector (Interface iface) : base(iface){}
+               #endregion
 
                const double div = 255.0;
                const double colDiv = 1.0 / div;
index 15b49dbe2fe3a54f3dd5f0d1852eb8b6b9a47e09..85a04608d3601d550ae8a804ad1e698211b5e3fe 100644 (file)
@@ -30,9 +30,10 @@ using System.Xml.Serialization;
 namespace Crow
 {
        public class ComboBox : ListBox
-    {          
+    {
                #region CTOR
-               public ComboBox() : base(){     }       
+               public ComboBox () : base(){}
+               public ComboBox (Interface iface) : base(iface){}
                #endregion
 
                Size minimumPopupSize = "10,10";
index df14b8e213104c99a2340e5ddbfe97aa39b498f5..c7dfd78b3665baa8e520ed403ba5e8b71975d11e 100644 (file)
@@ -36,17 +36,18 @@ namespace Crow
     public class Container : PrivateContainer
     {
                #region CTOR
-               public Container()
-                       : base()
-               {
-               }
+               public Container () : base(){}
+               public Container (Interface iface) : base(iface){}
                #endregion
 
-               [XmlIgnore]
-               public GraphicObject Child {
+               [XmlIgnore]public GraphicObject Child {
                        get { return child; }
-                       set { child = value; }
+                       set { base.SetChild(value); }
                }
+               /// <summary>
+               /// override this to handle specific steps in child addition in derived class,
+               /// and don't forget to call the base.SetChild
+               /// </summary>
                public virtual void SetChild(GraphicObject _child)
                {
                        base.SetChild (_child);
index 98477cba42b4d831b755c80eeeb4b8b9f04a87e9..ab5d4aba53ecbae451d69a8043b518265d47985e 100644 (file)
@@ -34,9 +34,8 @@ namespace Crow
        public class DirectoryView : TemplatedControl
        {
                #region CTOR
-               public DirectoryView ()
-                       : base()
-               {}
+               public DirectoryView () : base(){}
+               public DirectoryView (Interface iface) : base(iface){}
                #endregion
 
                #region events
diff --git a/src/GraphicObjects/DummyTemplate.cs b/src/GraphicObjects/DummyTemplate.cs
deleted file mode 100644 (file)
index 65d9e08..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// DummyTemplate.cs
-//
-// Author:
-//       Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-
-namespace Crow
-{
-       public class DummyTemplate : TemplatedControl
-       {
-               public DummyTemplate () : base()
-               {
-               }
-       }
-}
-
index 1cb36450cc5029470445d04b5bccae27a4b2df9a..243caf06b6744c5b600fe1cf3dd46bbc9dec5a38 100644 (file)
@@ -33,9 +33,8 @@ namespace Crow
     public class Expandable : TemplatedContainer
     {
                #region CTOR
-               public Expandable() : base()
-               {
-               }
+               public Expandable () : base(){}
+               public Expandable (Interface iface) : base(iface){}
                #endregion
 
                #region Private fields
index 8182e02166dc3818125e32a4d09b6942e8a3ebbd..550e2eaf80ccc6026c129d2fd54de1bbd47d4949 100644 (file)
@@ -37,18 +37,17 @@ namespace Crow
 {
        public class FileDialog: Window
        {
+               #region CTOR
+               public FileDialog () : base(){}
+               public FileDialog (Interface iface) : base(iface){}
+               #endregion
+
                string searchPattern, curDir, _selectedFile, _selectedDir;
 
                #region events
                public event EventHandler OkClicked;
                #endregion
 
-               #region CTOR
-               public FileDialog () : base()
-               {
-               }
-               #endregion
-
                [XmlAttributeAttribute][DefaultValue("/home")]
                public virtual string CurrentDirectory {
                        get { return curDir; }
index cecdaffd5116825561ac2114810960b28fe8042b..e52485ac8f8263c262ea9465ae1f64de8810c42c 100644 (file)
@@ -34,10 +34,8 @@ namespace Crow
        public class GenericStack : Group
     {
                #region CTOR
-               public GenericStack()
-                       : base()
-               {            
-               }
+               public GenericStack () : base(){}
+               public GenericStack(Interface iface) : base(iface){}
                #endregion
 
                #region Private fields
index 0721e767792a2cb94fca5535d354c94ccfeb1982..b8d7d581dc3d3ad9f9caf1bdef6ee624d4b7fd99 100644 (file)
@@ -36,16 +36,17 @@ namespace Crow
        public class GraduatedSlider : Slider
     {     
                #region CTOR
-               public GraduatedSlider() : base()
+               public GraduatedSlider () : base(){}
+               public GraduatedSlider(Interface iface) : base(iface)
                {}
-               public GraduatedSlider(double minimum, double maximum, double step)
-            : base()
-        {
-                       Minimum = minimum;
-                       Maximum = maximum;
-                       SmallIncrement = step;
-                       LargeIncrement = step * 5;
-        }
+//             public GraduatedSlider(double minimum, double maximum, double step)
+//            : base()
+//        {
+//                     Minimum = minimum;
+//                     Maximum = maximum;
+//                     SmallIncrement = step;
+//                     LargeIncrement = step * 5;
+//        }
                #endregion
 
                protected override void DrawGraduations(Context gr, PointD pStart, PointD pEnd)
index 1ba524d72001d31d5e8c9f4745d490717e9729fe..954c08e74709d7e7c4d41cd66d703f57dd3490ce 100644 (file)
@@ -64,17 +64,17 @@ namespace Crow
                                if (IsQueueForRedraw)
                                throw new Exception("Trying to dispose an object queued for Redraw: " + this.ToString());
                                #endif
-                               if (currentInterface.HoverWidget != null) {
-                                       if (currentInterface.HoverWidget.IsOrIsInside(this))
-                                               currentInterface.HoverWidget = null;
+                               if (CurrentInterface.HoverWidget != null) {
+                                       if (CurrentInterface.HoverWidget.IsOrIsInside(this))
+                                               CurrentInterface.HoverWidget = null;
                                }
-                               if (currentInterface.ActiveWidget != null) {
-                                       if (currentInterface.ActiveWidget.IsOrIsInside (this))
-                                               currentInterface.ActiveWidget = null;
+                               if (CurrentInterface.ActiveWidget != null) {
+                                       if (CurrentInterface.ActiveWidget.IsOrIsInside (this))
+                                               CurrentInterface.ActiveWidget = null;
                                }
-                               if (currentInterface.FocusedWidget != null) {
-                                       if (currentInterface.FocusedWidget.IsOrIsInside (this))
-                                               currentInterface.FocusedWidget = null;
+                               if (CurrentInterface.FocusedWidget != null) {
+                                       if (CurrentInterface.FocusedWidget.IsOrIsInside (this))
+                                               CurrentInterface.FocusedWidget = null;
                                }
                                if (!localDataSourceIsNull)
                                        DataSource = null;
@@ -91,20 +91,7 @@ namespace Crow
                internal static ulong currentUid = 0;
                internal ulong uid = 0;
 
-               Interface currentInterface = null;
-
-               [XmlIgnore]public Interface CurrentInterface {
-                       get {
-                               if (currentInterface == null) {
-                                       currentInterface = Interface.CurrentInterface;
-                                       Initialize ();
-                               }
-                               return currentInterface;
-                       }
-                       set {
-                               currentInterface = value;
-                       }
-               }
+               public Interface CurrentInterface = null;
 
                public Region Clipping;
 
@@ -118,13 +105,20 @@ namespace Crow
                #endregion
 
                #region CTOR
-               public GraphicObject ()
-               {
+               /// <summary>
+               /// default private parameter less constructor use in instantiators
+               /// </summary>
+               protected GraphicObject () {
                        Clipping = new Region ();
                        #if DEBUG
                        uid = currentUid;
                        currentUid++;
-                       #endif
+                       #endif                  
+               }
+               public GraphicObject (Interface iface) : this()
+               {
+                       CurrentInterface = iface;
+                       Initialize ();
                }
                #endregion
                internal bool initialized = false;
@@ -132,8 +126,8 @@ namespace Crow
                /// Initialize this Graphic object instance by setting style and default values and loading template if required
                /// </summary>
                public virtual void Initialize(){
-                       if (currentInterface == null)
-                               currentInterface = Interface.CurrentInterface;                  
+//                     if (CurrentInterface == null)
+//                             CurrentInterface = Interface.CurrentInterface;                  
                        loadDefaultValues ();
                        initialized = true;
                }
@@ -1336,7 +1330,7 @@ namespace Crow
                        if (CurrentInterface.eligibleForDoubleClick == this && CurrentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick)
                                onMouseDoubleClick (this, e);
                        else
-                               currentInterface.clickTimer.Restart();
+                               CurrentInterface.clickTimer.Restart();
                        CurrentInterface.eligibleForDoubleClick = null;
 
                        if (CurrentInterface.ActiveWidget == null)
index 3d1847a28502f0d7783cf1c432927873b7e0dc66..5756525e74ad40ff0cceed4a48cf2a96e9ebb947 100644 (file)
@@ -43,8 +43,8 @@ namespace Crow
     public class Grid : Group
     {
                #region CTOR
-               public Grid()
-                       : base()
+               public Grid () : base(){}
+               public Grid(Interface iface) : base(iface)
                {            
                }
                #endregion
index e4e9ba2047db34693c47ef3931751c272992aa27..551db8892dbbae92a7ec5b053dfe7150b0b8df05 100644 (file)
@@ -38,8 +38,8 @@ namespace Crow
        public class Group : GraphicObject
     {
                #region CTOR
-               public Group()
-                       : base(){}
+               public Group () : base(){}
+               public Group(Interface iface) : base(iface){}
                #endregion
 
                #region EVENT HANDLERS
index 9cabbb5194e2503851d1b66f36f3f4b99bb4ac16..ad79231e9ff0c44d45f06873ee8d2f49a0e166c4 100644 (file)
@@ -35,7 +35,8 @@ namespace Crow
                Container _contentContainer;
 
                #region CTOR
-               public GroupBox() : base(){}
+               public GroupBox () : base(){}
+               public GroupBox(Interface iface) : base(iface){}
                #endregion
 
                #region Template overrides
index 620dab223df75c5a5f78aa7c039b2d1c831dc68f..13ed4cb5295667ba6d909eff04ae93c3fb1d1165 100644 (file)
@@ -34,10 +34,12 @@ namespace Crow
 {
     public class HorizontalStack : GenericStack
     {
-        public HorizontalStack()
-            : base()
+               #region CTOR
+               public HorizontalStack () : base(){}
+               public HorizontalStack(Interface iface) : base(iface)
         {            
         }
+               #endregion
 
         [XmlIgnore]
         public override Orientation Orientation
index 365cc72a43a6b5aa7911629a08348c7a31ccd38c..a94053fdb2140075b1783a36a470952087d0e02f 100644 (file)
@@ -33,9 +33,12 @@ namespace Crow
 {
        public class HueSelector : ColorSelector
        {
-               public HueSelector () : base()
+               #region CTOR
+               public HueSelector () : base(){}
+               public HueSelector (Interface iface) : base(iface)
                {
                }
+               #endregion
 
                Orientation _orientation;
                double hue;
index 6a4c590d0b274ed27b17c3343e2e68fd8a7538c2..3ec49d37dbe3a214c0ebcd8cc426b2131a913830 100644 (file)
@@ -125,7 +125,8 @@ namespace Crow
                #endregion
 
                #region CTOR
-               public Image () : base()
+               public Image () : base(){}
+               public Image (Interface iface) : base(iface)
                {
                }
                #endregion
index e477c3f693e9134b248be270d5fc2d0353d05f49..7c7c584c1203a9e21176271f58e6e78a3f147d55 100644 (file)
@@ -38,15 +38,17 @@ namespace Crow
     public class Label : GraphicObject
     {
                #region CTOR
-               public Label()
-               {
+               public Label () : base(){}
 
-               }
-               public Label(string _text)
-                       : base()
+               public Label(Interface iface) : base(iface)
                {
-                       Text = _text;
+
                }
+//             public Label(string _text)
+//                     : base()
+//             {
+//                     Text = _text;
+//             }
                #endregion
 
                public event EventHandler<TextChangeEventArgs> TextChanged;
index f66edf614c5f7bbf23df443dd9a3afa6aac62ce6..67e4b58379b15f763099d27ff73f98060731dffd 100644 (file)
@@ -39,7 +39,8 @@ namespace Crow
        public class ListBox : TemplatedGroup
        {
                #region CTOR
-               public ListBox () : base() {}
+               public ListBox () : base(){}
+               public ListBox (Interface iface) : base(iface) {}
                #endregion
 
        }
index 50494815a817814b29833c50b8dbf996f7ae3e0b..d7a7f5a64c3b56c1f71e473628fd0b6d32cbb365 100644 (file)
@@ -33,7 +33,8 @@ namespace Crow
        public class Menu : TemplatedGroup
        {
                #region CTOR
-               public Menu () : base() {}
+               public Menu () : base(){}
+               public Menu (Interface iface) : base(iface) {}
                #endregion
 
                Orientation orientation;
index 0d99a2eb6efdc10a2727365b280f9762445e9cc2..5565ace3ac652ada353f7e7daefb60e3c86898b3 100644 (file)
@@ -33,7 +33,8 @@ namespace Crow
        public class MenuItem : Menu
        {
                #region CTOR
-               public MenuItem () : base() {}
+               public MenuItem () : base(){}
+               public MenuItem (Interface iface) : base(iface) {}
                #endregion
 
                public event EventHandler Open;
index d8ce1dae7d401b327d0a3ad08f9157ece9a4e722..0e308bf947346db25c3583070050ac98cc6210d2 100644 (file)
@@ -32,13 +32,17 @@ namespace Crow
 {
        public class MessageBox : Window
        {
+               #region CTOR
+               public MessageBox () : base(){}
+               public MessageBox (Interface iface) : base(iface){}
+               #endregion
+
                public enum Type {
                        Information,
                        YesNo,
                        Alert,
                        Error
                }
-               public MessageBox (): base(){}
 
                protected override void loadTemplate (GraphicObject template)
                {
@@ -133,8 +137,7 @@ namespace Crow
                }
                public static MessageBox Show (Type msgBoxType, string message, string okMsg = "", string cancelMsg = ""){
                        lock (Interface.CurrentInterface.UpdateMutex) {
-                               MessageBox mb = new MessageBox ();
-                               mb.Initialize ();
+                               MessageBox mb = new MessageBox (Interface.CurrentInterface);
                                mb.CurrentInterface.AddWidget (mb);
                                mb.MsgType = msgBoxType;
                                mb.Message = message;
index 8ab60edbc9638b2972d069582ece0a1862d58cbd..d8fdead40251d04043ddf3e941fb8592fb513e72 100644 (file)
@@ -33,13 +33,14 @@ namespace Crow
        public abstract class NumericControl : TemplatedControl
        {
                #region CTOR
-               public NumericControl () : base()
-               {
-               }
-               public NumericControl(double minimum, double maximum, double step)
-                       : base()
+               public NumericControl () : base(){}
+               public NumericControl (Interface iface) : base(iface)
                {
                }
+//             public NumericControl(double minimum, double maximum, double step)
+//                     : base()
+//             {
+//             }
                #endregion
 
                #region private fields
index 72a3fa8de380dc364c94108b302884e5918261b5..9f60aa4022f26b84d0a1cf7a3c50a8c78e64ed43 100644 (file)
@@ -33,9 +33,8 @@ namespace Crow
     public class Popper : TemplatedContainer
     {
                #region CTOR
-               public Popper() : base()
-               {
-               }
+               public Popper () : base(){}
+               public Popper (Interface iface) : base(iface){}
                #endregion
 
                bool _isPopped, _canPop;
index c40bceb47b49c749832cf33ca481e6d3108b8e85..f25190ea6764f1512f8a3c8ea34e10aa1fca9363 100644 (file)
@@ -41,10 +41,8 @@ namespace Crow
        public class PrivateContainer : GraphicObject
        {
                #region CTOR
-               public PrivateContainer()
-                       : base()
-               {
-               }
+               public PrivateContainer () : base(){}
+               public PrivateContainer (Interface iface) : base(iface){}
                #endregion
 
                protected GraphicObject child;
index 34366ca7112a36fdcdb5a3a5758ed5be24d9936e..2995272bd3dae05ee259e50af059327ad15d8fd2 100644 (file)
@@ -39,7 +39,8 @@ namespace Crow
        public class ProgressBar : NumericControl
     {
                #region CTOR
-               public ProgressBar() : base(){}
+               public ProgressBar () : base(){}
+               public ProgressBar(Interface iface) : base(iface){}
                #endregion
 
                protected override void loadTemplate (GraphicObject template)
index 993ead5991a42bb71b08b2800a5af6f68300480c..bf31a42cbab60e273703d3f4cba2cbc6387cbf94 100644 (file)
@@ -35,7 +35,8 @@ namespace Crow
                bool isChecked;
 
                #region CTOR
-               public RadioButton() : base(){} 
+               public RadioButton () : base(){}
+               public RadioButton(Interface iface) : base(iface){}     
                #endregion
 
                public event EventHandler Checked;
index 39c324f43a4e7dc45883a13be74c3522491efdae..fb3cbf4802244bac37a1bd706010dc68050472f4 100644 (file)
@@ -32,7 +32,8 @@ namespace Crow
 {
        public class SaturationValueSelector : ColorSelector
        {
-               public SaturationValueSelector () : base()
+               public SaturationValueSelector () : base(){}
+               public SaturationValueSelector (Interface iface) : base(iface)
                {
                }
 
index ca258aaed821cf2627a0d4124331fe4f24a5cc6c..75a3b2dbe9bd95f9b4e644fa4d8379da979d9b8e 100644 (file)
@@ -35,7 +35,8 @@ namespace Crow
                Orientation _orientation;
 
                #region CTOR
-               public ScrollBar() : base()     {}
+               public ScrollBar () : base(){}
+               public ScrollBar(Interface iface) : base(iface) {}
                #endregion
 
                [XmlAttributeAttribute()][DefaultValue(Orientation.Vertical)]
index e38b2205dd2fc7b6e88cbe5d30c04fb3245299bb..7f7bd5dec0e4647ad8f4d6c8604507647dcb4c80 100644 (file)
@@ -34,6 +34,11 @@ namespace Crow
 {
        public class Scroller : Container
        {
+               #region CTOR
+               public Scroller () : base(){}
+               public Scroller (Interface iface) : base(iface){}
+               #endregion
+
                bool _verticalScrolling;
                bool _horizontalScrolling;
                bool _scrollbarVisible;
@@ -122,9 +127,6 @@ namespace Crow
                }
                #endregion
 
-        public Scroller()
-            : base(){}
-
                #region GraphicObject Overrides
                public override void OnLayoutChanges (LayoutingType layoutType)
                {
index 09558984d9ca0b3b5b29fdcb2343bd1484e2826e..3d8c942cd16f3d832b481628f27b57e69e764336 100644 (file)
@@ -36,9 +36,8 @@ namespace Crow
        public class ScrollingObject : GraphicObject
        {
                #region CTOR
-               public ScrollingObject ():base()
-               {
-               }
+               public ScrollingObject ():base(){}
+               public ScrollingObject (Interface iface):base(iface){}
                #endregion
 
                int scrollX, scrollY, maxScrollX, maxScrollY, mouseWheelSpeed;
index a435f9ee6bf042dcbed486d0e84f1a37a49a4bbd..0fb9a7b445a3c82d55642f4148d01b27080d0614 100644 (file)
@@ -42,6 +42,9 @@ namespace Crow
        public class ScrollingTextBox : ScrollingObject
        {
                #region CTOR
+               public ScrollingTextBox (Interface iface):base(iface){
+                       KeyEventsOverrides = true;
+               }
                public ScrollingTextBox ():base()
                {
                        KeyEventsOverrides = true;
index 97c8b3842f0c8b6104cedd1efc3fff4080549926..bf43f2fa027c0770005eb78b367717dc560db867 100644 (file)
@@ -35,12 +35,13 @@ namespace Crow
        public class Slider : NumericControl
     {
                #region CTOR
-               public Slider() : base()
+               public Slider() : base(){}
+               public Slider(Interface iface) : base(iface)
                {}
-               public Slider(double minimum, double maximum, double step)
-                       : base(minimum,maximum,step)
-               {
-               }
+//             public Slider(double minimum, double maximum, double step)
+//                     : base(minimum,maximum,step)
+//             {
+//             }
                #endregion
 
                #region implemented abstract members of TemplatedControl
index 1bf93a37a4f27a427fedfc99004ac1ea31da44c0..c29a2b2753d9de77d5608cbf3c35abc8811f66dc 100644 (file)
@@ -31,13 +31,9 @@ namespace Crow
        public class Spinner : NumericControl
        {
                #region CTOR
-               public Spinner () : base()
+               public Spinner() : base(){}
+               public Spinner (Interface iface) : base(iface)
                {
-               }
-               public Spinner (double minimum, double maximum, double step) : 
-               base (minimum, maximum, step)
-               {
-
                }
                #endregion
 
index 2f5dd15b9601a2b6bcf68b72a8ab6fd0ad317608..dab3937bf7008d79302bf8341be9f767f03c9f72 100644 (file)
@@ -33,7 +33,8 @@ namespace Crow
        public class Splitter : GraphicObject
        {
                #region CTOR
-               public Splitter (): base(){}
+               public Splitter() : base(){}
+               public Splitter (Interface iface) : base(iface){}
                #endregion
 
                int thickness;
index 7dac5472f672a7e705acbee9138359fd169bc6c3..2b578d18086afa8899de6dee5462c8d3f2a90dfe 100644 (file)
@@ -34,7 +34,8 @@ namespace Crow
        public class TabItem : TemplatedContainer
        {
                #region CTOR
-               public TabItem () : base() {}
+               public TabItem() : base(){}
+               public TabItem (Interface iface) : base(iface){}
                #endregion
 
                #region Private fields
index ecf38f109a692fb789c80f75b828cb3f69ec8a6a..62ada31218cd527d076f9868d8f9d6a9a29a72ff 100644 (file)
@@ -35,7 +35,8 @@ namespace Crow
        public class TabView : Group
        {
                #region CTOR
-               public TabView () : base() {}
+               public TabView() : base(){}
+               public TabView (Interface iface) : base(iface){}
                #endregion
 
                #region Private fields
index b8a321670c75bb07171d9dac561bdd3543f1c67d..c219f9b610e19376e7bd7b8b82efc86815db9ab1 100644 (file)
@@ -34,7 +34,8 @@ namespace Crow
        public abstract class TemplatedContainer : TemplatedControl
        {
                #region CTOR
-               public TemplatedContainer () : base(){}
+               public TemplatedContainer() : base(){}
+               public TemplatedContainer (Interface iface) : base(iface){}
                #endregion
 
                [XmlAttributeAttribute]public virtual GraphicObject Content{ get; set;}
index c4ef5788708679f4bcc91805be930723c2da62c7..6476265a3ecf6e069428d9c8c7a707352ec0a9c9 100644 (file)
@@ -40,9 +40,8 @@ namespace Crow
        public abstract class TemplatedControl : PrivateContainer
        {
                #region CTOR
-               public TemplatedControl () : base()
-               {
-               }
+               public TemplatedControl() : base(){}
+               public TemplatedControl (Interface iface) : base(iface){}
                #endregion
 
                string _template;
index 3d5b7e83ae1b6ecd439b10e5f75588ff24133ac3..dda03119623ef907c3885e1db95dd3232c18e004 100644 (file)
@@ -39,7 +39,8 @@ namespace Crow
        public abstract class TemplatedGroup : TemplatedControl
        {
                #region CTOR
-               public TemplatedGroup () : base(){}
+               public TemplatedGroup() : base(){}
+               public TemplatedGroup (Interface iface) : base(iface){}
                #endregion
 
                protected Group items;
@@ -300,9 +301,7 @@ namespace Crow
                                page = items;
                                itemPerPage = int.MaxValue;
                        } else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) {
-                               GenericStack gs = new GenericStack ();
-                               gs.CurrentInterface = items.CurrentInterface;
-                               gs.Initialize ();
+                               GenericStack gs = new GenericStack (items.CurrentInterface);
                                gs.Orientation = (items as GenericStack).Orientation;
                                gs.Width = items.Width;
                                gs.Height = items.Height;
index 0cbee9f8a4e560b16731be318f1814bea79c6e11..2438c65ab748c4fae2595599a2a0425be5e1f312 100644 (file)
@@ -34,13 +34,14 @@ namespace Crow
     public class TextBox : Label
     {
                #region CTOR
-               public TextBox()
+               public TextBox() : base(){}
+               public TextBox(Interface iface) : base(iface)
                { }
-               public TextBox(string _initialValue)
-                       : base(_initialValue)
-               {
-
-               }
+//             public TextBox(string _initialValue)
+//                     : base(_initialValue)
+//             {
+//
+//             }
                #endregion
 
                #region GraphicObject overrides
index a312ca1e1f5870af5d889ee2a451967883cbe8a2..55ac7f33e58f851ad565487d244ea6ccc566cc74 100644 (file)
@@ -39,15 +39,8 @@ namespace Crow
        public class TextRun : GraphicObject
        {
                #region CTOR
-               public TextRun ()
-               {
-
-               }
-               public TextRun (string _text)
-                       : base ()
-               {
-                       Text = _text;
-               }
+               public TextRun () : base(){}
+               public TextRun (Interface iface) : base (iface){}
                #endregion
 
                //TODO:change protected to private
index 6549f148c070f9bc216376ae5d048297b9b9aa1a..80c3385fa42d965f507b598438140c8cb229458c 100644 (file)
@@ -39,7 +39,8 @@ namespace Crow
                bool isRoot;
 
                #region CTOR
-               public TreeView () : base()
+               public TreeView() : base(){}
+               public TreeView (Interface iface) : base(iface)
                {
                }
                #endregion
index d5d0236baf26cca49044e634f6de89f6e172aae9..23271624cf8b3cf2a9e3ad29523c260824bc4502 100644 (file)
@@ -33,8 +33,8 @@ namespace Crow
 {
     public class VerticalStack : GenericStack
     {
-        public VerticalStack()
-            : base()
+               public VerticalStack() : base(){}
+               public VerticalStack(Interface iface) : base(iface)
         {
         }
 
index 7ea4db752d0d279eab0bb9b80a11e87b137d0608..d4087d0285c4aba16a2abdd146489148070bd139 100644 (file)
@@ -66,9 +66,8 @@ namespace Crow
                #endregion
 
                #region CTOR
-               public Window () : base() {
-                       
-               }
+               public Window() : base(){}
+               public Window (Interface iface) : base(iface){}
                #endregion
 
                #region TemplatedContainer overrides
index 8b282ebbce528908981925d1af7d6e5fee849031..81dce15405fb2ae402de5d38a132ed4a69f6dd63 100644 (file)
@@ -30,8 +30,10 @@ namespace Crow
 {
        public class Wrapper : GenericStack
        {
-               public Wrapper () : base()
-               {}
+               #region CTOR
+               public Wrapper() : base(){}
+               public Wrapper (Interface iface) : base(iface){}
+               #endregion
 
                #region Group Overrides
                public override void ChildrenLayoutingConstraints (ref LayoutingType layoutType)
index fb1035808427cf3431046e3fc7b041105ab67e38..7c34745d11d53496303e7d939c6063ae4552fb09 100644 (file)
@@ -68,8 +68,13 @@ namespace Crow.IML
 
                        il.DeclareLocal (typeof (GraphicObject));
                        il.Emit (OpCodes.Nop);
-                       //set local GraphicObject to root object 
-                       il.Emit (OpCodes.Newobj, rootType.GetConstructors () [0]);
+                       //set local GraphicObject to root object
+                       ConstructorInfo ci = rootType.GetConstructor (
+                                       BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, 
+                                       null, Type.EmptyTypes, null);
+                       if (ci == null)
+                               throw new Exception ("No default parameterless constructor found in " + rootType.Name);                 
+                       il.Emit (OpCodes.Newobj, ci);
                        il.Emit (OpCodes.Stloc_0);
                        CompilerServices.emitSetCurInterface (il);
                }
index 3520ce8363177380c60f1a9fd548086b4c3a61f7..42c5de96d5408b480f0f11dc2b3ac38fbd404781 100644 (file)
@@ -161,6 +161,12 @@ namespace Crow
 
                        //emitCheckAndBindValueChanged (ctx);
                }
+               /// <summary>
+               /// process template and item template definition prior to
+               /// other attributes or childs processing
+               /// </summary>
+               /// <param name="ctx">Loading Context</param>
+               /// <param name="tmpXml">xml fragment</param>
                void emitTemplateLoad (Context ctx, string tmpXml) {
                        //if its a template, first read template elements
                        using (XmlTextReader reader = new XmlTextReader (tmpXml, XmlNodeType.Element, null)) {
@@ -242,11 +248,17 @@ namespace Crow
                                }
                        }
                }
+               /// <summary>
+               /// process styling, attributes and children loading.
+               /// </summary>
+               /// <param name="ctx">parsing context</param>
+               /// <param name="tmpXml">xml fragment</param>
                void emitGOLoad (Context ctx, string tmpXml) {
                        using (XmlTextReader reader = new XmlTextReader (tmpXml, XmlNodeType.Element, null)) {
                                reader.Read ();
 
                                #region Styling and default values loading
+                               //first check for Style attribute then trigger default value loading
                                if (reader.HasAttributes) {
                                        string style = reader.GetAttribute ("Style");
                                        if (!string.IsNullOrEmpty (style))
@@ -328,8 +340,12 @@ namespace Crow
                                        Type t = tryGetGOType (reader.Name);
                                        if (t == null)
                                                throw new Exception (reader.Name + " type not found");
-
-                                       ctx.il.Emit (OpCodes.Newobj, t.GetConstructors () [0]);//TODO:search parameterless ctor
+                                       ConstructorInfo ci = t.GetConstructor (
+                                                                    BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public,  
+                                               null, Type.EmptyTypes, null);
+                                       if (ci == null)
+                                               throw new Exception ("No default parameterless constructor found in " + t.Name);                                        
+                                       ctx.il.Emit (OpCodes.Newobj, ci);
                                        ctx.il.Emit (OpCodes.Stloc_0);//child is now loc_0
                                        CompilerServices.emitSetCurInterface (ctx.il);