Exemplo n.º 1
0
        /// <summary>
        /// Instantiates a new ScrollBar using a GuiSkin.  The new instance will not automatically be
        /// added to the GuiManager.
        /// </summary>
        /// <param name="guiSkin">The GuiSkin to customize the appearance of the ScrollBar.</param>
        /// <param name="cursor">The Cursor that the ScrollBar will interact with.</param>
        #endregion
        public ScrollBar(GuiSkin guiSkin, Cursor cursor)
            : base(guiSkin, cursor)
        {
            mScaleX = 1;
            mScaleY = 1;

            upButton = new Button(guiSkin, cursor);
            base.AddWindow(upButton);

            downButton = new Button(guiSkin, cursor);
            base.AddWindow(downButton);
            
            mPositionBar = new Button(guiSkin, cursor);
            base.AddWindow(mPositionBar);

            upButton.SpriteFrame.RelativeZ = -.01f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z;
            downButton.SpriteFrame.RelativeZ = -.01f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z;
            mPositionBar.SpriteFrame.RelativeZ = -.01f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z;

            upButton.SpriteFrame.RelativeY = 10;
            downButton.SpriteFrame.RelativeY = -10;


            upButton.Click += new GuiMessage(OnUpButtonClick);
            downButton.Click += new GuiMessage(OnDownButtonClick);

           // upButton.ScaleX = upButton.ScaleY = downButton.ScaleX = downButton.ScaleY = .95f;

            mSensitivity = .1;

            View = .1f;

            mPositionBar.SetPositionTL(mScaleX, 3);
        }
Exemplo n.º 2
0
 public override void SetSkin(GuiSkin guiSkin)
 {
     //base.SetSkin(guiSkin);
     if (mTextObject == null)
     {
         mTextObject     = TextManager.AddText(mText);
         GuiManagerDrawn = false;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Sets the ScrollBar's skin and refreshes its appearance.
        /// </summary>
        /// <param name="guiSkin">The GuiSkin to set.</param>
        #endregion
        public override void SetSkin(GuiSkin guiSkin)
        {
            base.SetFromWindowSkin(guiSkin.ScrollBarSkin);

            if (upButton != null && downButton != null && mPositionBar != null)
            {
                upButton.SetSkin(guiSkin.ScrollBarSkin.UpButtonSkin,
                    guiSkin.ScrollBarSkin.UpButtonDownSkin);

                downButton.SetSkin(guiSkin.ScrollBarSkin.DownButtonSkin,
                    guiSkin.ScrollBarSkin.DownButtonDownSkin);

                mPositionBar.SetFromWindowSkin(guiSkin.ScrollBarSkin.PositionBarSkin);
            }
        }
Exemplo n.º 4
0
        public Button(GuiSkin guiSkin, Cursor cursor)
            : base(guiSkin, cursor)
        {
            mUpSkin   = guiSkin.ButtonSkin;
            mDownSkin = guiSkin.ButtonDownSkin;

            mTextObject = TextManager.AddText(this.Text, guiSkin.ButtonSkin.Font);
            mTextObject.HorizontalAlignment = HorizontalAlignment.Center;
            mTextObject.VerticalAlignment   = VerticalAlignment.Center;
            mTextObject.AttachTo(SpriteFrame, false);
            mTextObject.RelativeZ = -.001f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z;

            SetTexturePropertiesFromSkin(mUpSkin);

            ScaleX = 1;
            ScaleY = 1;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new TimeLine using the argument GuiSkin to control the visible representation.
        /// </summary>
        /// <param name="guiSkin">The GuiSkin to use.</param>
        /// <param name="cursor">The Cursor that will interact with the TimeLine.</param>
        #endregion
        public TimeLine(GuiSkin guiSkin, Cursor cursor) :
            base(guiSkin, cursor)
        {
            mMinimumValue = 0;
            mMaximumValue = double.PositiveInfinity;
            mStart        = 0;

            mValueWidth = 100;

            //positionBar = AddButton(positionBarSpriteFrame);
            positionBar.Dragging += new GuiMessage(PositionBarDrag);
            positionBar.SetPositionTL(0, ScaleY);

            SetBarToValue();

            this.Click += new GuiMessage(ClickEvent);
        }
Exemplo n.º 6
0
 public ListBox(GuiSkin guiSkin, Cursor cursor)
     : base(guiSkin, cursor)
 {
 }
Exemplo n.º 7
0
        public ListBoxBase(GuiSkin guiSkin, Cursor cursor)
            : base(guiSkin, cursor)
        {
            mTexts = new PositionedObjectList<Text>();
            mHighlight = new Sprite();
            mHighlight.Z = AbsoluteWorldUnitZ - .0001f *
                FlatRedBall.Math.MathFunctions.ForwardVector3.Z;
            mScrollBar = new ScrollBar(guiSkin, cursor);
            AddWindow(mScrollBar);
            Initialize();
            mScrollBar.SpriteFrame.RelativeZ = -.01f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z;


            // Even though the base constructor calls SetSkin, the mTexts are not
            // created yet so their font is never set.  This set the fonts once again.

            mHighlightBar = new SpriteFrame(
                guiSkin.WindowSkin.Texture, guiSkin.WindowSkin.BorderSides);
            SpriteManager.AddSpriteFrame(mHighlightBar);
            mHighlightBar.AttachTo(SpriteFrame, false);
            mHighlightBar.RelativeZ = -HighlightBarOffset * Math.MathFunctions.ForwardVector3.Z;
            mHighlightBar.Visible = false;

            SetSkin(guiSkin);
        }
Exemplo n.º 8
0
        public override void SetSkin(GuiSkin guiSkin)
        {
            ListBoxSkin listBoxSkin = guiSkin.ListBoxSkin;
            mSeparatorSkin = guiSkin.ListBoxSkin.SeparatorSkin;
            mLeftBorder = listBoxSkin.HorizontalTextOffset;
            SetFromWindowSkin(listBoxSkin);


            mSpacing = listBoxSkin.TextSpacing;
            mScale = listBoxSkin.TextScale;
            // Use the property so the scroll bar gets updated
            DistanceBetweenLines = listBoxSkin.DistanceBetweenLines;
            FirstItemDistanceFromTop = listBoxSkin.FirstItemDistanceFromTop;
            Font = listBoxSkin.Font;

            mTextRed = listBoxSkin.Red;
            mTextGreen = listBoxSkin.Green;
            mTextBlue = listBoxSkin.Blue;

            mDisabledTextRed = listBoxSkin.DisabledRed;
            mDisabledTextGreen = listBoxSkin.DisabledGreen;
            mDisabledTextBlue = listBoxSkin.DisabledBlue;


            mHighlightBarHorizontalBuffer = listBoxSkin.HighlightBarSkin.HighlightBarHorizontalBuffer;

            if (mHighlightBar != null)
            {
                mHighlightBar.ScaleY = listBoxSkin.HighlightBarSkin.ScaleY;
                mHighlightBar.RelativeX = listBoxSkin.HighlightBarSkin.HorizontalOffset;
            }

            if (mScrollBar != null)
            {
                mScrollBar.SetSkin(guiSkin);

                // If the scroll bar isn't null then the mHighlightBar
                // should be a valid reference too.
                mHighlightBar.Texture = listBoxSkin.HighlightBarSkin.Texture;
                mHighlightBar.Borders = listBoxSkin.HighlightBarSkin.BorderSides;
                mHighlightBar.SpriteBorderWidth = listBoxSkin.HighlightBarSkin.SpriteBorderWidth;
                mHighlightBar.TextureBorderWidth = listBoxSkin.HighlightBarSkin.TextureBorderWidth;
                mHighlightBar.ScaleX = ScaleX - mHighlightBarHorizontalBuffer;

                // also the separators
                UpdateSeparators();
            }

            UpdateTextStrings();
        }
Exemplo n.º 9
0
        public ListBox(GuiSkin guiSkin, Cursor cursor)
            : base(guiSkin, cursor)
        {

        }
Exemplo n.º 10
0
        /// <summary>
        /// Creates a new TimeLine using the argument GuiSkin to control the visible representation.
        /// </summary>
        /// <param name="guiSkin">The GuiSkin to use.</param>
        /// <param name="cursor">The Cursor that will interact with the TimeLine.</param>
        #endregion
        public TimeLine(GuiSkin guiSkin, Cursor cursor) :
            base (guiSkin, cursor)
        {
            mMinimumValue = 0;
            mMaximumValue = double.PositiveInfinity;
            mStart = 0;

            mValueWidth = 100;

            //positionBar = AddButton(positionBarSpriteFrame);
            positionBar.Dragging += new GuiMessage(PositionBarDrag);
            positionBar.SetPositionTL(0, ScaleY);

            SetBarToValue();

            this.Click += new GuiMessage(ClickEvent);
        }
Exemplo n.º 11
0
 public override void SetSkin(GuiSkin guiSkin)
 {
     SetSkin(guiSkin.ButtonSkin, guiSkin.ButtonDownSkin);
 }
Exemplo n.º 12
0
        public Button(GuiSkin guiSkin, Cursor cursor)
            : base(guiSkin, cursor)
        {
            mUpSkin = guiSkin.ButtonSkin;
            mDownSkin = guiSkin.ButtonDownSkin;

            mTextObject = TextManager.AddText(this.Text, guiSkin.ButtonSkin.Font);
            mTextObject.HorizontalAlignment = HorizontalAlignment.Center;
            mTextObject.VerticalAlignment = VerticalAlignment.Center;
            mTextObject.AttachTo(SpriteFrame, false);
            mTextObject.RelativeZ = -.001f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z;

            SetTexturePropertiesFromSkin(mUpSkin);

            ScaleX = 1;
            ScaleY = 1;
        }
Exemplo n.º 13
0
 public override void SetSkin(GuiSkin guiSkin)
 {
     SetSkin(guiSkin.ButtonSkin, guiSkin.ButtonDownSkin);
 }
Exemplo n.º 14
0
        public override void SetSkin(GuiSkin guiSkin)
        {
            //base.SetSkin(guiSkin);
            if (mTextObject == null)
            {
                mTextObject = TextManager.AddText(mText);
                GuiManagerDrawn  = false;
            }


        }