Exemple #1
0
 public override void Update(GUIControlContext Context, double Time)
 {
     foreach (_Child c in this._Children)
     {
         c.Control.Update(Context.CreateChildContext(c.Control, c.Offset), Time);
     }
 }
Exemple #2
0
        public override void Update(GUIControlContext Context, double Time)
        {
            MouseState ms = Context.MouseState;
            Point? mousepos = ms != null ? (Point?)ms.Position : null;
            LinkedList<LayerControl> oldlayercontrols = this._LayerControls;
            this._LayerControls = new LinkedList<LayerControl>(this._LayerControls);
            ModalOptions mo = this._ModalOptions;

            // Go through control in reverse order (since the last control is the top-most).
            LinkedListNode<LayerControl> cur = oldlayercontrols.Last;
            while (cur != null)
            {
                LayerControl lc = cur.Value;

                // Standard updating procedure
                lc.Update(Context.CreateChildContext(lc, lc._Position, mousepos == null), Time);
                if (mousepos != null)
                {
                    // If the mouse is over a hover control, do not let it fall through to lower controls.
                    if (new Rectangle(lc._Position, lc.Size).In(mousepos.Value))
                    {
                        mousepos = null;
                    }
                }

                // Handle modal options
                if (mo != null)
                {
                    if (mo.LowestModal == lc)
                    {
                        // Background click?
                        if (mousepos != null && (ms.IsButtonDown(MouseButton.Left) || ms.IsButtonDown(MouseButton.Right)))
                        {
                            mo._BackgroundClick();
                        }

                        // Mouse blocked?
                        if (!mo.MouseFallthrough)
                        {
                            mousepos = null;
                        }
                    }
                }

                cur = cur.Previous;
            }

            if (this._Background != null)
            {
                this._Background.Update(Context.CreateChildContext(this._Background, new Point(), mousepos == null), Time);
            }

            // Update lightbox (really low priority).
            if (this._ModalOptions != null && this._ModalOptions.Lightbox)
            {
                this._LightboxTime = Math.Min(this._Style.LightBoxFadeTime, this._LightboxTime + Time);
            }
            else
            {
                this._LightboxTime = Math.Max(0.0, this._LightboxTime - Time);
            }
        }
Exemple #3
0
        public override void Update(GUIControlContext Context, double Time)
        {
            this._TopLeftButton.Update(Context.CreateChildContext(this._TopLeftButton, new Point(0.0, 0.0)), Time);
            this._BottomRightButton.Update(Context.CreateChildContext(this._BottomRightButton, this._BottomRightButtonOffset), Time);

            // Handle mouse
            MouseState ms = Context.MouseState;
            if (this._Enabled && ms != null)
            {
                bool oldmousedown = this._MouseDown;
                this._MouseDown = ms.IsButtonDown(MouseButton.Left);

                double areastart;
                double areaend;
                double areasize;
                double sliderstart;
                double slidersize;
                this._GetScrollMeasurements(out areastart, out areaend, out areasize, out sliderstart, out slidersize);
                double mouse = ms.Position.SwapIf(this._Direction == Axis.Vertical).X;

                // Dragging
                if (this._DragOffset != null)
                {
                    this.Value = (mouse - this._DragOffset.Value - areastart) / (areasize - slidersize);
                    if (!this._MouseDown)
                    {
                        this._DragOffset = null;
                        Context.ReleaseMouse();
                    }
                }

                // Check for press
                if (!oldmousedown && this._MouseDown)
                {
                    // See if its in one of the empty regions to either end of the scrollbar.
                    if (mouse > areastart && mouse < sliderstart)
                    {
                        this.Value = this._Value - this._MajorIncrement;
                    }
                    if (mouse < areaend && mouse > sliderstart + slidersize)
                    {
                        this.Value = this._Value + this._MajorIncrement;
                    }

                    // Perhaps the user intends to drag?
                    if (mouse > sliderstart && mouse < sliderstart + slidersize)
                    {
                        Context.CaptureMouse();
                        this._DragOffset = mouse - sliderstart;
                    }
                }
            }
        }
Exemple #4
0
 public override void Update(GUIControlContext Context, double Time)
 {
     this._Client.Update(Context.CreateChildContext(this._Client, -this._Offset), Time);
 }
Exemple #5
0
 public override void Update(GUIControlContext Context, double Time)
 {
     double d = 0.0;
     foreach (_Child c in this._Children)
     {
         c.Control.Update(Context.CreateChildContext(c.Control, new Point(d, 0.0).SwapIf(this._Direction == Axis.Vertical)), Time);
         d += c.Size + this._Seperation;
     }
 }
Exemple #6
0
 public override void Update(GUIControlContext Context, double Time)
 {
     this._View.Update(Context.CreateChildContext(this._View, new Point(0.0, 0.0)), Time);
     if (this._VScroll != null)
     {
         this._VScroll.Update(Context.CreateChildContext(this._VScroll, new Point(this.Size.X - this._VScroll.Size.X, 0.0)), Time);
     }
     if (this._HScroll != null)
     {
         this._HScroll.Update(Context.CreateChildContext(this._HScroll, new Point(0.0, this.Size.Y - this._HScroll.Size.Y)), Time);
     }
 }
Exemple #7
0
 public override void Update(GUIControlContext Context, double Time)
 {
     this._Client.Update(Context.CreateChildContext(this._Client, new Point(0.0, 0.0)), Time);
 }
Exemple #8
0
        public override void Update(GUIControlContext Context, double Time)
        {
            MouseState ms = Context.MouseState;
            if (ms != null)
            {
                this._MouseOver = true;
                if (ms.IsButtonDown(MouseButton.Left))
                {
                    this._MouseDown = true;
                }
                else
                {
                    if (this._MouseDown)
                    {
                        // That would be a click!
                        this._Click();
                        this._MouseDown = false;
                    }
                }
            }
            else
            {
                this._MouseDown = false;
                this._MouseOver = false;
            }

            // Update client, if any
            if (this._Client != null)
            {
                this._Client.Update(Context.CreateChildContext(this._Client, new Point(this._Style.ClientMargin, this._Style.ClientMargin)), Time);
            }
        }
Exemple #9
0
 public override void Update(GUIControlContext Context, double Time)
 {
     this._Child.Update(Context.CreateChildContext(this._Child, new Point(this._Margin, this._Margin)), Time);
 }
Exemple #10
0
        public override void Update(GUIControlContext Context, double Time)
        {
            this._Client.Update(Context.CreateChildContext(this._Client, this.ClientRectangle.Location), Time);
            this._RightTitleBar.Update(Context.CreateChildContext(this._RightTitleBar, this._RightTitleBarOffset), Time);

            // Form needs to be dragged?
            MouseState ms = Context.MouseState;
            if (ms != null)
            {
                Point mousepos = ms.Position;
                if (this._FormDragOffset == null)
                {
                    if (new Rectangle(
                        this._Style.TitleBarLeftRightMargin,
                        0.0,
                        this.Size.X - this._RightTitleBar.Size.X - this._Style.TitleBarLeftRightMargin,
                        this._Style.TitleBarSize).In(mousepos))
                    {
                        if (ms.HasPushedButton(MouseButton.Left))
                        {
                            Context.CaptureMouse();
                            this.Container.BringToTop(this);
                            this._FormDragOffset = mousepos;
                        }
                    }
                }
                else
                {
                    this.Position = this.Position + mousepos - this._FormDragOffset.Value;
                    if (!ms.IsButtonDown(MouseButton.Left))
                    {
                        Context.ReleaseMouse();
                        this._FormDragOffset = null;
                    }
                }
            }
        }
Exemple #11
0
 public override void Update(GUIControlContext Context, double Time)
 {
     this._Near.Update(Context.CreateChildContext(this._Near, new Point(0.0, 0.0)), Time);
     this._Far.Update(Context.CreateChildContext(this._Far, new Point(this._NearSize, 0.0).SwapIf(this._Direction == Axis.Vertical)), Time);
 }