ui/wpf/UIcore/Container.cs

changeset 85
91f45354d1e2
parent 84
a56c2baa9429
child 101
1c943d43fa81
--- a/ui/wpf/UIcore/Container.cs	Sun Feb 01 10:35:07 2015 +0100
+++ b/ui/wpf/UIcore/Container.cs	Sun Feb 01 12:37:31 2015 +0100
@@ -10,9 +10,36 @@
 {
     public interface Container
     {
+        Layout Layout { get; set; }
+        
         void Add(UIElement control, bool fill);
     }
 
+    public class Layout
+    {
+        public bool? Fill { get; set; }
+
+        public Layout()
+        {
+            Fill = null;
+        }
+
+        public bool IsFill(bool fill)
+        {
+            if (Fill != null)
+            {
+                
+                return (bool)Fill;
+            }
+            return fill;
+        }
+
+        public void Reset()
+        {
+            Fill = null;
+        }
+    }
+
     public enum BoxOrientation
     {
         VERTICAL,
@@ -21,7 +48,9 @@
 
     public class BoxContainer : Grid, Container
     {
-        public BoxOrientation Orientation;
+        public Layout Layout { get; set; }
+        
+        private BoxOrientation Orientation;
 
         private int x = 0;
         private int y = 0;
@@ -30,6 +59,8 @@
 
         public BoxContainer(BoxOrientation orientation) : base()
         {
+            Layout = new Layout();
+            
             Orientation = orientation;
             if(Orientation == BoxOrientation.HORIZONTAL)
             {
@@ -52,6 +83,8 @@
         
         public void Add(UIElement control, bool fill)
         {
+            fill = Layout.IsFill(fill);
+            
             if(Orientation == BoxOrientation.HORIZONTAL)
             {
                 ColumnDefinition col = new ColumnDefinition();
@@ -103,6 +136,8 @@
             {
                 y++;
             }
+
+            Layout.Reset();
         }
 
         public static BoxContainer CreateBoxContainer(Container parent, BoxOrientation orientation)
@@ -113,6 +148,8 @@
     
     public class GridContainer : Container
     {
+        public Layout Layout { get; set; }
+        
         public Grid Grid;
 
         public GridContainer(System.Windows.Controls.Grid grid)

mercurial