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); }
public ListBoxBase(Cursor cursor) : base(cursor) { mHighlight = new Sprite(); mHighlight.Z = AbsoluteWorldUnitZ - .0001f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z; mScrollBar = new ScrollBar(mCursor); AddWindow(mScrollBar); Initialize(); }
private void DestroyScrollBar() { GuiManager.RemoveWindow(mScrollBar); mScrollBar = null; }
private void CreateScrollBar() { mScrollBar = new ScrollBar(mCursor); AddWindow(mScrollBar); const float ScrollBarBorder = .5f; mScrollBar.X = this.ScaleX; mScrollBar.ScaleX = this.ScaleX - ScrollBarBorder; mScrollBar.Alignment = ScrollBar.ScrollBarAlignment.Horizontal; mScrollBar.ScaleY = 1; mScrollBar.Y = 2 * this.ScaleY - mScrollBar.ScaleY - ScrollBarBorder; UpdateScrollBarToRange(); mScrollBar.UpButtonClick += ScrollBarChanged; mScrollBar.DownButtonClick += ScrollBarChanged; mScrollBar.PositionBarMove += ScrollBarChanged; mScrollBar.Name = "TimeLine ScrollBar"; mScrollBar.RatioDown = (float)((this.Start - MinimumValue) / (MaximumValue - MinimumValue)); }
public TextureCoordinatesSelectionWindow() : base(GuiManager.Cursor) { // Victor says: This class USED to // add itself to the GuiManager. This // is no longer recommended as it makes // windows not as reusable. Therefore, I // removed the automatic adding to the GuiManager. // This might break your code if you're using this, // so if your TextureCoordinatesSelectionWindow isn't // showing up, you might want to make sure you're adding // it to the GuiManager. #region Create "this" and add it to the GuiManager HasMoveBar = true; ScaleY = 12.5f; ScaleX = 11.4f; Resizable = true; MinimumScaleX = ScaleX; MinimumScaleY = ScaleY; this.Resizing += OnWindowResize; #endregion #region Create the texture display area mTextureDisplayArea = new Window(mCursor); AddWindow(mTextureDisplayArea); mTextureDisplayArea.DrawBorders = false; mTextureDisplayArea.Push += OnWindowPush; mTextureDisplayArea.Dragging += OnWindowDrag; mTextureDisplayArea.Click += OnWindowClick; mTextureDisplayArea.RollingOver += this.OnRollOver; mTextureDisplayArea.DoubleClick += OnWindowDoubleClick; mTextureDisplayArea.MouseWheelScroll += MouseWheelZoom; mTextureDisplayArea.SecondaryClick += RightClickMenu; #endregion mSelectedArea = new Window(mCursor); mTextureDisplayArea.AddWindow(mSelectedArea); mSelectedArea.ScaleX = 3; mSelectedArea.ScaleY = 3; mSelectedArea.BaseTexture = FlatRedBallServices.Load<Texture2D>("genGfx/targetBox.bmp", GuiManager.InternalGuiContentManagerName); mSelectedArea.Enabled = false; // so it doesn't block input from the this (the parent Window) mSelectedArea.DrawBorders = false; mSelectedArea.Alpha = 127; mAddToListButton = new Button(mCursor); AddWindow(mAddToListButton); mAddToListButton.Text = "Add To List"; mAddToListButton.Visible = false; #region Pixel Perfect ToggleButton and ComboBoxes mPixelPerfect = new ToggleButton(mCursor); AddWindow(mPixelPerfect); mPixelPerfect.ScaleX = 5; mPixelPerfect.SetText("Free", "Snapping"); mPixelPerfect.Press(); mPixelPerfect.Click += PixelPerfectClick; mMinimumXSelection = new ComboBox(mCursor); AddWindow(mMinimumXSelection); mMinimumXSelection.ScaleX = 3; mMinimumXSelection.AddItem("1"); mMinimumXSelection.AddItem("4"); mMinimumXSelection.AddItem("8"); mMinimumXSelection.AddItem("16"); mMinimumXSelection.AddItem("32"); mMinimumXSelection.Text = "1"; mMinimumYSelection = new ComboBox(mCursor); AddWindow(mMinimumYSelection); mMinimumYSelection.ScaleX = 3; mMinimumYSelection.AddItem("1"); mMinimumYSelection.AddItem("4"); mMinimumYSelection.AddItem("8"); mMinimumYSelection.AddItem("16"); mMinimumYSelection.AddItem("32"); mMinimumYSelection.Text = "1"; #endregion #region Create the ScrollBars mVerticalScrollBar = new ScrollBar(mCursor); AddWindow(mVerticalScrollBar); mVerticalScrollBar.UpButtonClick += AdjustToVerticalScrollBar; mVerticalScrollBar.DownButtonClick += AdjustToVerticalScrollBar; mVerticalScrollBar.PositionBarMove += AdjustToVerticalScrollBar; mHorizontalScrollBar = new ScrollBar(mCursor); AddWindow(mHorizontalScrollBar); mHorizontalScrollBar.UpButtonClick += AdjustToVerticalScrollBar; mHorizontalScrollBar.DownButtonClick += AdjustToVerticalScrollBar; mHorizontalScrollBar.PositionBarMove += AdjustToVerticalScrollBar; mHorizontalScrollBar.Alignment = ScrollBar.ScrollBarAlignment.Horizontal; mHorizontalScrollBar.ScaleY = 1; #endregion OnWindowResize(this); }