Exemple #1
0
        public void Redraw()
        {
            Calculate();

            Vector2 buttonPosition = new Vector2(FormSize.X - 15f, 2f) + FormPos;
            int     x = 0;

            if (BtnClose != null)
            {
                BtnClose.MoveTo(buttonPosition);
            }
            if (BtnMini != null)
            {
                x = 0;
                if (BtnClose != null)
                {
                    x += 10;
                }
                if (BtnMaxi != null)
                {
                    x += 10;
                }
                BtnMini.MoveTo(buttonPosition - new Vector2(x, 0f));
            }
            if (BtnMaxi != null)
            {
                x = 0;
                if (BtnClose != null)
                {
                    x += 10;
                }
                BtnMaxi.MoveTo(buttonPosition - new Vector2(x, 0f));
            }
            if (BtnRestore != null)
            {
                x = 0;
                if (BtnClose != null)
                {
                    x += 10;
                }
                BtnRestore.MoveTo(buttonPosition - new Vector2(x, 0f));
            }
        }
Exemple #2
0
        private void DrawButtons()
        {
            if (BtnClose != null && CanClose == true)
            {
                BtnClose.Draw(EngineCore.SpriteBatch, mAlpha);
            }
            if (FormState != EFormState.Minimized && FormState != EFormState.Minimizing && BtnMini != null && CanMini == true)
            {
                BtnMini.Draw(EngineCore.SpriteBatch, mAlpha);
            }

            if (BtnRestore != null && FormState != EFormState.Restored && FormState != EFormState.Restoring)
            {
                BtnRestore.Draw(EngineCore.SpriteBatch, mAlpha);
            }
            else if (BtnMaxi != null && CanMaxi == true)
            {
                BtnMaxi.Draw(EngineCore.SpriteBatch, mAlpha);
            }
        }
Exemple #3
0
        private void DrawButtons()
        {
            // f**k, switch Maximize & Restore..
            // Restore => Minimize to normal
            // Maximize => Minimize/normal to Max

            if (BtnClose != null && CanClose == true)
            {
                BtnClose.Draw(EngineCore.SpriteBatch, mAlpha);
            }
            if (FormState != EFormState.Minimized && FormState != EFormState.Minimizing && BtnMini != null && CanMini == true)
            {
                BtnMini.Draw(EngineCore.SpriteBatch, mAlpha);
            }

            if (BtnRestore != null && FormState != EFormState.Restored && FormState != EFormState.Restoring)
            {
                BtnRestore.Draw(EngineCore.SpriteBatch, mAlpha);
            }
            else if (FormState != EFormState.Maximized && FormState != EFormState.Maximizing && BtnMaxi != null && CanMaxi == true)
            {
                BtnMaxi.Draw(EngineCore.SpriteBatch, mAlpha);
            }
        }
Exemple #4
0
        public virtual void Update(GameTime gameTime)
        {
            mMouseState = Mouse.GetState();

            mMousePos.X = mMouseState.X;
            mMousePos.Y = mMouseState.Y;

            if (Visible && (Form.TopForm == this || Form.TopForm == null || Form.TopForm.CanLostFocus == true))
            {
                if (!Form.InUse)
                {
                    CheckFocus();
                }

                if (BtnClose != null)
                {
                    BtnClose.Update(gameTime);
                }
                if (BtnMini != null)
                {
                    BtnMini.Update(gameTime);
                }
                if (BtnMaxi != null)
                {
                    BtnMaxi.Update(gameTime);
                }
                if (BtnRestore != null)
                {
                    BtnRestore.Update(gameTime);
                }

                if (Controls.Count > 0)
                {
                    Controls.Update(gameTime, FormPos, FormSize);
                }

                if (CanDrag)
                {
                    if (mMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
                    {
                        if (!mDragging && !Form.InUse)
                        {
                            CheckDrag();
                        }
                        else if (mDragging)
                        {
                            if (mFormAlpha > 0.5f)
                            {
                                mFormAlpha -= 0.02f;
                            }
                            Drag();
                        }
                    }
                    else if (mDragging)
                    {
                        StopDrag();
                        mFormAlpha = 1f;
                    }
                }

                if (mCanResize)
                {
                    CheckResize();
                }

                if (Controls.Count > 0)
                {
                    Controls.Update(gameTime, FormPos, FormSize);
                }

                if (FormState == EFormState.Maximizing)
                {
                    Maximize();
                }
                else if (FormState == EFormState.Minimizing)
                {
                    Minimize();
                }
                else if (FormState == EFormState.Restoring)
                {
                    Restore();
                }

                if (Form.TopForm == this)
                {
                    CheckKeyboardState();
                }

                UpdateVisibility();
            }
        }