]> O.S.I.I.S - jp/crow.git/commitdiff
make publi Initialize func of GraphicObj, test logical parent in popper to allow...
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 30 Jan 2017 11:09:57 +0000 (12:09 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 30 Jan 2017 11:09:57 +0000 (12:09 +0100)
Default.style
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Popper.cs
src/GraphicObjects/TemplatedContainer.cs
src/GraphicObjects/TemplatedControl.cs
src/GraphicObjects/TemplatedGroup.cs

index 62618b172a843e5a42b6d45d40ff23aab49f1079..5b39bc02eab3a4593fd918fd4905b6346f567277 100644 (file)
@@ -23,6 +23,7 @@ Menu {
 }
 MenuItem {
        Width = Stretched;
+       Height = Fit;
        Background = Transparent;
        Foreground = LightGray;
        MouseEnter = {Background = vgradient|0:UnitedNationsBlue|1:Onyx;Foreground=White;}
index 574870f83e612e57804272afad99a505faeea9f1..f7e193e18a81437c0f6364d54e9129020a06861f 100644 (file)
@@ -23,7 +23,7 @@ namespace Crow
                        get {
                                if (currentInterface == null) {
                                        currentInterface = Interface.CurrentInterface;
-                                       initialize ();
+                                       Initialize ();
                                }
                                return currentInterface;
                        }
@@ -53,7 +53,13 @@ namespace Crow
                        #endif
                }
                #endregion
-               internal protected virtual void initialize(){
+
+               /// <summary>
+               /// 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;
                        loadDefaultValues ();
                }
                #region private fields
@@ -513,7 +519,8 @@ namespace Crow
                                        LayoutChanged.Raise (this, new LayoutingEventArgs (LayoutingType.Width));
                                        Slot.Height = 0;
                                        LayoutChanged.Raise (this, new LayoutingEventArgs (LayoutingType.Height));
-                                       CurrentInterface.EnqueueForRepaint (this);
+                                       if (this.parent != null)
+                                               CurrentInterface.EnqueueForRepaint (this);
                                        LastSlots.Width = LastSlots.Height = 0;
                                }
 
index 8c79ce24f07ff60b99a47665c9f45719ede31733..0b022842bf09112c71f82a450563209b5f397240 100644 (file)
@@ -229,6 +229,8 @@ namespace Crow
                                Content.Visible = true;
                                if (Content.Parent == null)
                                        CurrentInterface.AddWidget (Content, true);
+                               if (Content.LogicalParent != this)
+                                       Content.LogicalParent = this;
                                CurrentInterface.PutOnTop (Content, true);
                                _content_LayoutChanged (this, new LayoutingEventArgs (LayoutingType.Sizing));
                        }
index f4243588ac2565d5a562eda13b1febaf54074614..44f2ca7c3894918804551a91ec4b9c35120fb5bb 100644 (file)
@@ -31,7 +31,7 @@ namespace Crow
                public TemplatedContainer () : base(){}
                #endregion
 
-               [XmlIgnore]public abstract GraphicObject Content{ get; set;}
+               [XmlAttributeAttribute]public virtual GraphicObject Content{ get; set;}
 
                #region GraphicObject overrides
                public override GraphicObject FindByName (string nameToFind)
index 4a3a2507b92ca0286685109c1450524a3ec5b8ac..cd645dd37d082aa268e03621aecf48f8f9266f15 100644 (file)
@@ -39,10 +39,10 @@ namespace Crow
                }
                #endregion
 
-               internal protected override void initialize ()
+               public override void Initialize ()
                {
                        loadTemplate ();
-                       base.initialize ();
+                       base.Initialize ();
                }
 
                string _template;
index 4c35197f2fc40e4f80d7f6da9a7060ae06b021b3..fbb3c4bd3b3d166391eb437ab09f564cbdfbe822 100644 (file)
@@ -330,7 +330,7 @@ namespace Crow
                        }else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) {
                                GenericStack gs = new GenericStack ();
                                gs.CurrentInterface = items.CurrentInterface;
-                               gs.initialize ();
+                               gs.Initialize ();
                                gs.Orientation = (items as GenericStack).Orientation;
                                gs.Width = items.Width;
                                gs.Height = items.Height;