예제 #1
0
파일: Wrapper.cs 프로젝트: slagusev/Crow
        public override void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
        {
            //children can't stretch in a wrapper
            GraphicObject go = sender as GraphicObject;

            //System.Diagnostics.Debug.WriteLine ("wrapper child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString());
            switch (arg.LayoutType)
            {
            case LayoutingType.Width:
                if (Orientation == Orientation.Horizontal && go.Width.Units == Unit.Percent)
                {
                    go.Width = Measure.Fit;
                    return;
                }
                this.RegisterForLayouting(LayoutingType.Width);
                break;

            case LayoutingType.Height:
                if (Orientation == Orientation.Vertical && go.Height.Units == Unit.Percent)
                {
                    go.Height = Measure.Fit;
                    return;
                }
                this.RegisterForLayouting(LayoutingType.Height);
                break;

            default:
                return;
            }
            this.RegisterForLayouting(LayoutingType.ArrangeChildren);
        }
예제 #2
0
파일: Scroller.cs 프로젝트: slagusev/Crow
        void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
        {
            //Debug.WriteLine ("scroller childLayoutChanges");
            int maxScroll = MaximumScroll;

            //Debug.WriteLine ("maxscroll={0}", maxScroll);
            if (_verticalScrolling)
            {
                if (arg.LayoutType == LayoutingType.Height)
                {
                    if (maxScroll < ScrollY)
                    {
                        //Debug.WriteLine ("scrolly={0} maxscroll={1}", ScrollY, maxScroll);
                        ScrollY = maxScroll;
                    }
                    NotifyValueChanged("MaximumScroll", maxScroll);
                }
            }
            else if (arg.LayoutType == LayoutingType.Width)
            {
                if (maxScroll < ScrollX)
                {
                    //Debug.WriteLine ("scrolly={0} maxscroll={1}", ScrollY, maxScroll);
                    ScrollX = maxScroll;
                }
                NotifyValueChanged("MaximumScroll", maxScroll);
            }
        }
예제 #3
0
파일: TabView.cs 프로젝트: masums/Crow
 void Ti_TabTitle_LayoutChanged(object sender, LayoutingEventArgs e)
 {
     if (e.LayoutType == LayoutingType.X)
     {
         RegisterForLayouting(LayoutingType.ArrangeChildren);
     }
 }
예제 #4
0
파일: Popper.cs 프로젝트: slagusev/Crow
 protected void _content_LayoutChanged(object sender, LayoutingEventArgs e)
 {
     if (e.LayoutType.HasFlag(LayoutingType.Width))
     {
         positionContent(LayoutingType.X);
     }
     if (e.LayoutType.HasFlag(LayoutingType.Height))
     {
         positionContent(LayoutingType.Y);
     }
 }
예제 #5
0
        public virtual void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
        {
            GraphicObject g = sender as GraphicObject;

            if (arg.LayoutType == LayoutingType.Width) {
                if (Width != Measure.Fit)
                    return;
                contentSize.Width = g.Slot.Width;
                this.RegisterForLayouting (LayoutingType.Width);
            }else if (arg.LayoutType == LayoutingType.Height){
                if (Height != Measure.Fit)
                    return;
                contentSize.Height = g.Slot.Height;
                this.RegisterForLayouting (LayoutingType.Height);
            }
        }
예제 #6
0
        protected void _list_LayoutChanged(object sender, LayoutingEventArgs e)
        {
#if DEBUG_LAYOUTING
            Debug.WriteLine("list_LayoutChanged");
#endif
            if (_gsList.Orientation == Orientation.Horizontal)
            {
                if (e.LayoutType == LayoutingType.Width)
                {
                    _gsList.Width = approxSize;
                }
            }
            else if (e.LayoutType == LayoutingType.Height)
            {
                _gsList.Height = approxSize;
            }
        }
예제 #7
0
        public virtual void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
        {
            GraphicObject g = sender as GraphicObject;

            switch (arg.LayoutType)
            {
            case LayoutingType.Width:
                if (Width != Measure.Fit)
                {
                    return;
                }
                if (g.Slot.Width > contentSize.Width)
                {
                    largestChild      = g;
                    contentSize.Width = g.Slot.Width;
                }
                else if (g == largestChild)
                {
                    searchLargestChild();
                }

                this.RegisterForLayouting(LayoutingType.Width);
                break;

            case LayoutingType.Height:
                if (Height != Measure.Fit)
                {
                    return;
                }
                if (g.Slot.Height > contentSize.Height)
                {
                    tallestChild       = g;
                    contentSize.Height = g.Slot.Height;
                }
                else if (g == tallestChild)
                {
                    searchTallestChild();
                }

                this.RegisterForLayouting(LayoutingType.Height);
                break;
            }
        }
예제 #8
0
        public virtual void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
        {
            GraphicObject g = sender as GraphicObject;

            if (arg.LayoutType == LayoutingType.Width)
            {
                if (Width != Measure.Fit)
                {
                    return;
                }
                contentSize.Width = g.Slot.Width;
                this.RegisterForLayouting(LayoutingType.Width);
            }
            else if (arg.LayoutType == LayoutingType.Height)
            {
                if (Height != Measure.Fit)
                {
                    return;
                }
                contentSize.Height = g.Slot.Height;
                this.RegisterForLayouting(LayoutingType.Height);
            }
        }
예제 #9
0
 public override void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
 {
     //base.OnChildLayoutChanges (sender, arg);
 }
예제 #10
0
파일: Scroller.cs 프로젝트: jpbruyere/Crow
 void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
 {
     int maxScroll = MaximumScroll;
     if (_verticalScrolling) {
         if (arg.LayoutType == LayoutingType.Height) {
             if (maxScroll < ScrollY) {
                 Debug.WriteLine ("scrolly={0} maxscroll={1}", ScrollY, maxScroll);
                 ScrollY = 0;
             }
             NotifyValueChanged("MaximumScroll", maxScroll);
         }
     } else if (arg.LayoutType == LayoutingType.Width) {
         if (maxScroll < ScrollX)
             ScrollX = 0;
         NotifyValueChanged("MaximumScroll", maxScroll);
     }
 }
예제 #11
0
        public override void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
        {
            GraphicObject go = sender as GraphicObject;

            //Debug.WriteLine ("child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString());
            switch (arg.LayoutType)
            {
            case LayoutingType.Width:
                if (Orientation == Orientation.Horizontal)
                {
                    if (go.Width == Measure.Stretched)
                    {
                        if (stretchedGO == null && Width != Measure.Fit)
                        {
                            stretchedGO = go;
                        }
                        else if (stretchedGO != go)
                        {
                            go.Slot.Width = 0;
                            go.Width      = Measure.Fit;
                            return;
                        }
                    }
                    else
                    {
                        contentSize.Width += go.Slot.Width - go.LastSlots.Width;
                    }

                    adjustStretchedGo(LayoutingType.Width);

                    if (Width == Measure.Fit)
                    {
                        this.RegisterForLayouting(LayoutingType.Width);
                    }

                    this.RegisterForLayouting(LayoutingType.ArrangeChildren);
                    return;
                }
                break;

            case LayoutingType.Height:
                if (Orientation == Orientation.Vertical)
                {
                    if (go.Height == Measure.Stretched)
                    {
                        if (stretchedGO == null && Height != Measure.Fit)
                        {
                            stretchedGO = go;
                        }
                        else if (stretchedGO != go)
                        {
                            go.Slot.Height = 0;
                            go.Height      = Measure.Fit;
                            return;
                        }
                    }
                    else
                    {
                        contentSize.Height += go.Slot.Height - go.LastSlots.Height;
                    }

                    adjustStretchedGo(LayoutingType.Height);

                    if (Height == Measure.Fit)
                    {
                        this.RegisterForLayouting(LayoutingType.Height);
                    }

                    this.RegisterForLayouting(LayoutingType.ArrangeChildren);
                    return;
                }
                break;
            }
            base.OnChildLayoutChanges(sender, arg);
        }
예제 #12
0
        public override void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
        {
            GraphicObject go = sender as GraphicObject;
            //Debug.WriteLine ("child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString());
            switch (arg.LayoutType) {
            case LayoutingType.Width:
                if (Orientation == Orientation.Horizontal) {
                    if (go.Width == Measure.Stretched) {
                        if (stretchedGO == null && Width != Measure.Fit)
                            stretchedGO = go;
                        else if (stretchedGO != go) {
                            go.Slot.Width = 0;
                            go.Width = Measure.Fit;
                            return;
                        }
                    } else
                        contentSize.Width += go.Slot.Width - go.LastSlots.Width;

                    if (stretchedGO != null) {
                        int newW = Math.Max (
                                       this.ClientRectangle.Width - contentSize.Width - Spacing * (Children.Count - 1),
                                       stretchedGO.MinimumSize.Width);
                        if (stretchedGO.MaximumSize.Width > 0)
                            newW = Math.Min (newW, stretchedGO.MaximumSize.Width);
                        if (newW != stretchedGO.Slot.Width) {
                            stretchedGO.Slot.Width = newW;
                            stretchedGO.IsDirty = true;
            #if DEBUG_LAYOUTING
                    Debug.WriteLine ("\tAdjusting Width of " + stretchedGO.ToString());
            #endif
                            stretchedGO.LayoutChanged -= OnChildLayoutChanges;
                            stretchedGO.OnLayoutChanges (LayoutingType.Width);
                            stretchedGO.LayoutChanged += OnChildLayoutChanges;
                            stretchedGO.LastSlots.Width = stretchedGO.Slot.Width;
                        }
                    }

                    if (Width == Measure.Fit)
                        this.RegisterForLayouting (LayoutingType.Width);

                    this.RegisterForLayouting (LayoutingType.ArrangeChildren);
                    return;
                }
                break;
            case LayoutingType.Height:
                if (Orientation == Orientation.Vertical) {
                    if (go.Height == Measure.Stretched) {
                        if (stretchedGO == null && Height != Measure.Fit)
                            stretchedGO = go;
                        else if (stretchedGO != go){
                            go.Slot.Height = 0;
                            go.Height = Measure.Fit;
                            return;
                        }
                    } else
                        contentSize.Height += go.Slot.Height - go.LastSlots.Height;

                    if (stretchedGO != null) {
                        int newH = Math.Max (
                            this.ClientRectangle.Height - contentSize.Height - Spacing * (Children.Count - 1),
                            stretchedGO.MinimumSize.Height);
                        if (stretchedGO.MaximumSize.Height > 0)
                            newH = Math.Min (newH, stretchedGO.MaximumSize.Height);
                        if (newH != stretchedGO.Slot.Height) {
                            stretchedGO.Slot.Height = newH;
                            stretchedGO.IsDirty = true;
            #if DEBUG_LAYOUTING
                    Debug.WriteLine ("\tAdjusting Height of " + stretchedGO.ToString());
            #endif
                            stretchedGO.LayoutChanged -= OnChildLayoutChanges;
                            stretchedGO.OnLayoutChanges (LayoutingType.Height);
                            stretchedGO.LayoutChanged += OnChildLayoutChanges;
                            stretchedGO.LastSlots.Height = stretchedGO.Slot.Height;
                        }
                    }

                    if (Height == Measure.Fit)
                        this.RegisterForLayouting (LayoutingType.Height);

                    this.RegisterForLayouting (LayoutingType.ArrangeChildren);
                    return;
                }
                break;
            }
            base.OnChildLayoutChanges (sender, arg);
        }
예제 #13
0
파일: Wrapper.cs 프로젝트: jpbruyere/Crow
 public override void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
 {
     //children can't stretch in a wrapper
     GraphicObject go = sender as GraphicObject;
     //Debug.WriteLine ("child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString());
     switch (arg.LayoutType) {
     case LayoutingType.Width:
         if (Orientation == Orientation.Horizontal && go.Width.Units == Unit.Percent) {
             go.Width = Measure.Fit;
             return;
         }
         break;
     case LayoutingType.Height:
         if (Orientation == Orientation.Vertical && go.Height.Units == Unit.Percent) {
             go.Height = Measure.Fit;
             return;
         }
         break;
     default:
         return;
     }
     this.RegisterForLayouting (LayoutingType.ArrangeChildren);
 }
예제 #14
0
        public override void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
        {
            GraphicObject go = sender as GraphicObject;

            //Debug.WriteLine ("child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString());
            switch (arg.LayoutType)
            {
            case LayoutingType.Width:
                if (Orientation == Orientation.Horizontal)
                {
                    if (go.Width == Measure.Stretched)
                    {
                        if (stretchedGO == null && Width != Measure.Fit)
                        {
                            stretchedGO = go;
                        }
                        else if (stretchedGO != go)
                        {
                            go.Slot.Width = 0;
                            go.Width      = Measure.Fit;
                            return;
                        }
                    }
                    else
                    {
                        contentSize.Width += go.Slot.Width - go.LastSlots.Width;
                    }

                    if (stretchedGO != null)
                    {
                        int newW = Math.Max(
                            this.ClientRectangle.Width - contentSize.Width - Spacing * (Children.Count - 1),
                            stretchedGO.MinimumSize.Width);
                        if (stretchedGO.MaximumSize.Width > 0)
                        {
                            newW = Math.Min(newW, stretchedGO.MaximumSize.Width);
                        }
                        if (newW != stretchedGO.Slot.Width)
                        {
                            stretchedGO.Slot.Width = newW;
                            stretchedGO.bmp        = null;
#if DEBUG_LAYOUTING
                            Debug.WriteLine("\tAdjusting Width of " + stretchedGO.ToString());
#endif
                            stretchedGO.LayoutChanged -= OnChildLayoutChanges;
                            stretchedGO.OnLayoutChanges(LayoutingType.Width);
                            stretchedGO.LayoutChanged  += OnChildLayoutChanges;
                            stretchedGO.LastSlots.Width = stretchedGO.Slot.Width;
                        }
                    }

                    if (Width == Measure.Fit)
                    {
                        this.RegisterForLayouting(LayoutingType.Width);
                    }

                    this.RegisterForLayouting(LayoutingType.ArrangeChildren);
                    return;
                }
                break;

            case LayoutingType.Height:
                if (Orientation == Orientation.Vertical)
                {
                    if (go.Height == Measure.Stretched)
                    {
                        if (stretchedGO == null && Height != Measure.Fit)
                        {
                            stretchedGO = go;
                        }
                        else if (stretchedGO != go)
                        {
                            go.Slot.Height = 0;
                            go.Height      = Measure.Fit;
                            return;
                        }
                    }
                    else
                    {
                        contentSize.Height += go.Slot.Height - go.LastSlots.Height;
                    }

                    if (stretchedGO != null)
                    {
                        int newH = Math.Max(
                            this.ClientRectangle.Height - contentSize.Height - Spacing * (Children.Count - 1),
                            stretchedGO.MinimumSize.Height);
                        if (stretchedGO.MaximumSize.Height > 0)
                        {
                            newH = Math.Min(newH, stretchedGO.MaximumSize.Height);
                        }
                        if (newH != stretchedGO.Slot.Height)
                        {
                            stretchedGO.Slot.Height = newH;
                            stretchedGO.bmp         = null;
#if DEBUG_LAYOUTING
                            Debug.WriteLine("\tAdjusting Height of " + stretchedGO.ToString());
#endif
                            stretchedGO.LayoutChanged -= OnChildLayoutChanges;
                            stretchedGO.OnLayoutChanges(LayoutingType.Height);
                            stretchedGO.LayoutChanged   += OnChildLayoutChanges;
                            stretchedGO.LastSlots.Height = stretchedGO.Slot.Height;
                        }
                    }

                    if (Height == Measure.Fit)
                    {
                        this.RegisterForLayouting(LayoutingType.Height);
                    }

                    this.RegisterForLayouting(LayoutingType.ArrangeChildren);
                    return;
                }
                break;
            }
            base.OnChildLayoutChanges(sender, arg);
        }
예제 #15
0
파일: Group.cs 프로젝트: jpbruyere/Crow
        public virtual void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
        {
            GraphicObject g = sender as GraphicObject;

            switch (arg.LayoutType) {
            case LayoutingType.Width:
                if (Width != Measure.Fit)
                    return;
                if (g.Slot.Width > contentSize.Width) {
                    largestChild = g;
                    contentSize.Width = g.Slot.Width;
                } else if (g == largestChild)
                    searchLargestChild ();

                this.RegisterForLayouting (LayoutingType.Width);
                break;
            case LayoutingType.Height:
                if (Height != Measure.Fit)
                    return;
                if (g.Slot.Height > contentSize.Height) {
                    tallestChild = g;
                    contentSize.Height = g.Slot.Height;
                } else if (g == tallestChild)
                    searchTallestChild ();

                this.RegisterForLayouting (LayoutingType.Height);
                break;
            }
        }
예제 #16
0
파일: Popper.cs 프로젝트: jpbruyere/Crow
 protected void _content_LayoutChanged(object sender, LayoutingEventArgs e)
 {
     ILayoutable tc = Content.Parent;
     if (tc == null)
         return;
     Rectangle r = this.ScreenCoordinates (this.Slot);
     if (e.LayoutType.HasFlag(LayoutingType.Width)) {
         if (popDirection.HasFlag (Alignment.Right)) {
             if (r.Right + Content.Slot.Width > tc.ClientRectangle.Right)
                 Content.Left = r.Left - Content.Slot.Width;
             else
                 Content.Left = r.Right;
         } else if (popDirection.HasFlag (Alignment.Left)) {
             if (r.Left - Content.Slot.Width < tc.ClientRectangle.Left)
                 Content.Left = r.Right;
             else
                 Content.Left = r.Left - Content.Slot.Width;
         } else {
             if (Content.Slot.Width < tc.ClientRectangle.Width) {
                 if (r.Left + Content.Slot.Width > tc.ClientRectangle.Right)
                     Content.Left = tc.ClientRectangle.Right - Content.Slot.Width;
                 else
                     Content.Left = r.Left;
             } else
                 Content.Left = 0;
         }
     }
     if (e.LayoutType.HasFlag(LayoutingType.Height)) {
         if (Content.Slot.Height < tc.ClientRectangle.Height) {
             if (PopDirection.HasFlag (Alignment.Bottom)) {
                 if (r.Bottom + Content.Slot.Height > tc.ClientRectangle.Bottom)
                     Content.Top = r.Top - Content.Slot.Height;
                 else
                     Content.Top = r.Bottom;
             } else if (PopDirection.HasFlag (Alignment.Top)) {
                 if (r.Top - Content.Slot.Height < tc.ClientRectangle.Top)
                     Content.Top = r.Bottom;
                 else
                     Content.Top = r.Top - Content.Slot.Height;
             } else
                 Content.Top = r.Top;
         }else
             Content.Top = 0;
     }
 }
예제 #17
0
        protected void _content_LayoutChanged(object sender, LayoutingEventArgs e)
        {
            ILayoutable tc = Content.Parent as ILayoutable;

            if (tc == null)
            {
                return;
            }
            Rectangle r = this.ScreenCoordinates(this.Slot);

            if (e.LayoutType.HasFlag(LayoutingType.Width))
            {
                if (popDirection.HasFlag(Alignment.Right))
                {
                    if (r.Right + Content.Slot.Width > tc.ClientRectangle.Right)
                    {
                        Content.Left = r.Left - Content.Slot.Width;
                    }
                    else
                    {
                        Content.Left = r.Right;
                    }
                }
                else if (popDirection.HasFlag(Alignment.Left))
                {
                    if (r.Left - Content.Slot.Width < tc.ClientRectangle.Left)
                    {
                        Content.Left = r.Right;
                    }
                    else
                    {
                        Content.Left = r.Left - Content.Slot.Width;
                    }
                }
                else
                {
                    if (Content.Slot.Width < tc.ClientRectangle.Width)
                    {
                        if (r.Left + Content.Slot.Width > tc.ClientRectangle.Right)
                        {
                            Content.Left = tc.ClientRectangle.Right - Content.Slot.Width;
                        }
                        else
                        {
                            Content.Left = r.Left;
                        }
                    }
                    else
                    {
                        Content.Left = 0;
                    }
                }
            }
            if (e.LayoutType.HasFlag(LayoutingType.Height))
            {
                if (Content.Slot.Height < tc.ClientRectangle.Height)
                {
                    if (PopDirection.HasFlag(Alignment.Bottom))
                    {
                        if (r.Bottom + Content.Slot.Height > tc.ClientRectangle.Bottom)
                        {
                            Content.Top = r.Top - Content.Slot.Height;
                        }
                        else
                        {
                            Content.Top = r.Bottom;
                        }
                    }
                    else if (PopDirection.HasFlag(Alignment.Top))
                    {
                        if (r.Top - Content.Slot.Height < tc.ClientRectangle.Top)
                        {
                            Content.Top = r.Bottom;
                        }
                        else
                        {
                            Content.Top = r.Top - Content.Slot.Height;
                        }
                    }
                    else
                    {
                        Content.Top = r.Top;
                    }
                }
                else
                {
                    Content.Top = 0;
                }
            }
        }
예제 #18
0
 public override void OnChildLayoutChanges(object sender, LayoutingEventArgs arg)
 {
     base.OnChildLayoutChanges(sender, arg);
     updateMaxScroll(arg.LayoutType);
 }
예제 #19
0
		internal protected void raiseLayoutChanged(LayoutingEventArgs e){
			LayoutChanged.Raise (this, e);
		}