// Methods public AttributesWindow(GuiMessages messages) : base(GuiManager.Cursor) { this.ScaleX = 11f; this.ScaleY = 20f; base.HasMoveBar = true; base.HasCloseButton = true; base.Name = "Attributes"; this.mListBox = new ListBox(mCursor); AddWindow(mListBox); this.mListBox.ScaleX = this.ScaleX - 0.5f; this.mListBox.ScaleY = this.ScaleY - 3f; this.mListBox.SetPositionTL(this.ScaleX, this.ScaleY - 0.5f); this.mListBox.Click += new GuiMessage(this.AttributesListBoxClick); this.mListBox.Name = "Attributes ListBox"; this.mAddAttribute = new Button(mCursor); AddWindow(mAddAttribute); this.mAddAttribute.ScaleX = 8f; this.mAddAttribute.ScaleY = 1.4f; this.mAddAttribute.SetPositionTL(8.5f, (2f * this.ScaleY) - 2f); this.mAddAttribute.Text = "Create New Attribute"; this.mAddAttribute.Click += new GuiMessage(this.AddAttribute); }
public override void Initialize(bool addToManagers) { base.Initialize(addToManagers); screenTitle = new Text(); screenTitle.DisplayText = "Options"; Vector2 titlePosition = PositionHelper.percentToCoordSprite(0.0f, 50.0f); screenTitle.Y = titlePosition.Y; screenTitle.HorizontalAlignment = HorizontalAlignment.Center; TextManager.AddText(screenTitle); GuiManager.IsUIEnabled = true; listBox = GuiManager.AddListBox(); listBox.ScaleX = 20; listBox.ScaleY = 12; // The first argument to AddItem is the text to show for the item // The second argument is the object that the Item will store. // The second argment is optional, but we'll use it to reference // the background color that we want to use. listBox.AddItem("Red", Color.Red); listBox.AddItem("Blue", Color.Blue); listBox.AddItem("Yellow", Color.Yellow); for (int i = 0; i < 200; i++) listBox.AddItem("BLAAA" + i); if(addToManagers) AddToManagers(); }
public ChatWindow(Cursor cursor) : base(cursor) { mListBox = new ListBox(mCursor); AddWindow(mListBox); mTextBox = new TextBox(mCursor); AddWindow(mTextBox); mTextBox.EnterPressed += TextBoxEnter; Resizing += ResizeEvent; ScaleX = 5; ScaleY = 5; }
public override void Initialize(bool addToManagers) { base.Initialize(addToManagers); screenTitle = new Text(); screenTitle.DisplayText = "Song Selection"; Vector2 titlePosition = PositionHelper.percentToCoordSprite(0.0f, 80.0f); screenTitle.Y = titlePosition.Y; screenTitle.HorizontalAlignment = HorizontalAlignment.Center; TextManager.AddText(screenTitle); GuiManager.IsUIEnabled = true; listBox = GuiManager.AddListBox(); listBox.ScaleX = 10; listBox.ScaleY = 20; for (int i = 0; i < 200; i++) listBox.AddItem("Song " + i); if(addToManagers) AddToManagers(); }
void OnClick(Window callingWindow) { if (MenuItems.Count != 0) { #region Create the new ListBox and store it in mChildPerishableListBox mChildPerishableListBox = GuiManager.AddPerishableListBox(); mChildPerishableListBox.SortingStyle = ListBoxBase.Sorting.None; mChildPerishableListBox.ScaleX = 5; mChildPerishableListBox.ScaleY = 5; mChildPerishableListBox.ScrollBarVisible = false; #endregion #region Add the MenuItems to the new ListBox foreach (MenuItem menuItem in MenuItems) { CollapseItem item = mChildPerishableListBox.AddItem(menuItem.Text, menuItem); menuItem.mParentListBox = this.mChildPerishableListBox; item.Enabled = menuItem.Enabled; } #endregion #region Scale the new ListBox for the contents mChildPerishableListBox.SetScaleToContents(3); float maximumScale = GuiManager.YEdge - (MenuStrip.MenuStripHeight/2.0f); if (mChildPerishableListBox.ScaleY > maximumScale) { mChildPerishableListBox.ScrollBarVisible = true; mChildPerishableListBox.ScaleY = maximumScale; } #endregion if (this.mParentListBox != null) { GuiManager.PersistPerishableThroughNextClick(mChildPerishableListBox); } mChildPerishableListBox.Click += ListBoxClick; if (this.mParentListBox != null) { mChildPerishableListBox.X = mParentListBox.ScaleX + mParentListBox.WorldUnitX + GuiManager.UnmodifiedXEdge + mChildPerishableListBox.ScaleX; int indexofHighlighted = mParentListBox.GetFirstHighlightedIndex(); float extraDistanceDown = mParentListBox.DistanceBetweenLines * indexofHighlighted; mChildPerishableListBox.Y = -(mParentListBox.WorldUnitY - GuiManager.UnmodifiedYEdge) + mChildPerishableListBox.ScaleY - mParentListBox.ScaleY + mTextScale + extraDistanceDown - mChildPerishableListBox.FirstItemDistanceFromTop/2.0f ; } else { mChildPerishableListBox.X = X + mChildPerishableListBox.ScaleX; mChildPerishableListBox.Y = Y + mChildPerishableListBox.ScaleY + mTextScale; } mChildPerishableListBox.HighlightOnRollOver = true; } }
/// <summary> /// Creates a new FileWindow. /// </summary> /// <remarks> /// By default, the save name TextBox is invisible making this a text box for loading. Call /// SetToSave to make the box appear. /// </remarks> /// <param name="InpMan"></param> /// <param name="SprMan"></param> internal FileWindow(Cursor cursor) : base(cursor) { #region Create the "settings" directory if (System.IO.Directory.Exists(ApplicationFolderForThisProgram + "settings") == false) System.IO.Directory.CreateDirectory(ApplicationFolderForThisProgram + "settings"); #endregion #region Set "this" properties this.HasMoveBar = true; this.Closing += new GuiMessage(OnFileWindowClose); mScaleX = 20; mScaleY = 20; this.Resizable = true; this.Resizing += new GuiMessage(SetGUIPosition); this.OkClick += new GuiMessage(AddFileToRecent); this.Closing += OnClose; MinimumScaleX = 13; MinimumScaleY = 16; #endregion mFileTypes = new List<string>(); #region Create the Texture display button mTextureDisplayButton = new Button(mCursor); AddWindow(mTextureDisplayButton); mTextureDisplayButton.ScaleY = 4; mTextureDisplayButton.ScaleX = 4; mTextureDisplayButton.Click += ShowChildTextureDisplayWindow; #endregion #region Create the Bookmark button mBookmarkToggleButton = new ToggleButton(mCursor); AddWindow(mBookmarkToggleButton); mBookmarkToggleButton.ScaleX = mBookmarkToggleButton.ScaleY = 1.3f; mBookmarkToggleButton.SetPositionTL(.5f + mBookmarkToggleButton.ScaleX, .5f + mBookmarkToggleButton.ScaleY); mBookmarkToggleButton.Click += BookmarkButtonClick; mBookmarkToggleButton.SetOverlayTextures( 9, 3); #endregion #region CurrentDirectoryDisplay Combo Box mCurrentDirectoryDisplay = new ComboBox(mCursor); base.AddWindow(mCurrentDirectoryDisplay); mCurrentDirectoryDisplay.ItemClick += ChangeSelectedDirectory; mCurrentDirectoryDisplay.TextChange += ChangeSelectedDirectory; mCurrentDirectoryDisplay.AllowTypingInTextBox = true; ResetCurrentDirectoryComboBox(); #endregion #region Create the ListBox mListBox = new ListBox(mCursor); AddWindow(mListBox); mListBox.SortingStyle = ListBoxBase.Sorting.None; mListBox.Highlight += new GuiMessage(OnListBoxClick); mListBox.StrongSelect += new GuiMessage(OnListBoxStrongSelect); mListBox.EscapeRelease += new GuiMessage(CloseFileWindow); mListBox.CurrentToolTipOption = ListBoxBase.ToolTipOption.CursorOver; #endregion #region Create the Ok Button mOkButton = new Button(mCursor); AddWindow(mOkButton); mOkButton.Text = "Ok"; mOkButton.Click += new GuiMessage(OkButtonClick); #endregion #region Create the Cancel button mCancelButton = new Button(mCursor); AddWindow(mCancelButton); mCancelButton.Text = "Cancel"; mCancelButton.Click += OnCancelClick; #endregion #region Create the Load Directory Button loadDirectory = new Button(mCursor); AddWindow(loadDirectory); loadDirectory.Text = "Load Dir"; loadDirectory.Click += new GuiMessage(LoadDirClick); loadDirectory.Visible = false; #endregion //#region Create the "Add" button //addButton = new Button(mCursor); //AddWindow(addButton); //addButton.ScaleX = 4; //addButton.ScaleY = 1.5f; //addButton.Text = "Add"; //addButton.Click += new GuiMessage(AddButtonClick); //addButton.Visible = false; //#endregion #region Create the Up Directory button mUpDirectory = new Button(mCursor); AddWindow(mUpDirectory); #if FRB_MDX // This is always null in the new engines - not sure how this button gets its texture. mUpDirectory.SetOverlayTextures(GuiManager.mUpDirectory, null); #endif mUpDirectory.ScaleY = 1; mUpDirectory.ScaleX = 1; mUpDirectory.Text = "Up One Directory"; mUpDirectory.overlayTL = new FlatRedBall.Math.Geometry.Point(0.38281250, 0.6445312500); mUpDirectory.overlayTR = new FlatRedBall.Math.Geometry.Point(0.42968750, 0.6445312500); mUpDirectory.overlayBL = new FlatRedBall.Math.Geometry.Point(0.38281250, 0.687500000); mUpDirectory.overlayBR = new FlatRedBall.Math.Geometry.Point(0.42968750, 0.687500000); mUpDirectory.Click += this.UpOneDirectoryClick; #endregion mCreateNewDirectory = new Button(mCursor); base.AddWindow(mCreateNewDirectory); mCreateNewDirectory.SetOverlayTextures(5, 3); mCreateNewDirectory.ScaleX = 1; mCreateNewDirectory.ScaleY = 1; mCreateNewDirectory.Text = "Create New\nDirectory"; mCreateNewDirectory.Click += AddDirectoryClick; saveName = new TextBox(mCursor); AddWindow(saveName); saveName.ScaleY = 1.4f; saveName.Visible = false; saveName.fixedLength = false; saveName.EnterPressed += new GuiMessage(OnSaveNameEnter); saveName.EscapeRelease += new GuiMessage(CloseFileWindow); Name = "Loading File"; // displayTextureLoadedBefore = false; mShowFileHierarchy = new ToggleButton(mCursor); AddWindow(mShowFileHierarchy); mShowFileHierarchy.SetPositionTL(7.0f, 4.5f); mShowFileHierarchy.ScaleX = 5.5f; mShowFileHierarchy.Text = "File Hierarchy"; mShowFileHierarchy.SetOneAlwaysDown(true); mShowFileHierarchy.Click += new GuiMessage(OnFileHierarchyClick); mAllRelativeToggleButton = new ToggleButton(mCursor); AddWindow(mAllRelativeToggleButton); mAllRelativeToggleButton.SetPositionTL(7.0f, 6.5f); mAllRelativeToggleButton.ScaleX = 5.5f; mAllRelativeToggleButton.Text = "All Relative"; mAllRelativeToggleButton.Click += new GuiMessage(OnAllRelativeClick); mAllRelativeToggleButton.SetOneAlwaysDown(true); mAllRelativeToggleButton.AddToRadioGroup(mShowFileHierarchy); mShowRecent = new ToggleButton(mCursor); AddWindow(mShowRecent); mShowRecent.SetPositionTL(19, 4.5f); mShowRecent.ScaleX = 5.5f; mShowRecent.Text = "Recent Files"; mShowRecent.Click += new GuiMessage(OnShowRecent); mShowRecent.SetOneAlwaysDown(true); mShowRecent.AddToRadioGroup(mShowFileHierarchy); // go here!!! mShowFileHierarchy.Press(); mFileTypeBox = new ComboBox(mCursor); AddWindow(mFileTypeBox); mFileTypeBox.ItemClick += OnFileTypeChange; #if XBOX360 || WINDOWS_PHONE || MONODROID SetDirectory(); #else SetDirectory(FileManager.MyDocuments); #endif SetGUIPosition(null); LoadBookmarks(); }
public ComboBox(Cursor cursor) : base(cursor) { #region Create the TextBox (mSelectionDisplay) mSelectionDisplay = new TextBox(mCursor); AddWindow(mSelectionDisplay); mSelectionDisplay.TakingInput = false; mSelectionDisplay.fixedLength = false; //mStretchListBoxToContentWidth = true; #endregion #region Create drop-down button mDropDownButton = new Button(mCursor); AddWindow(mDropDownButton); // Not sure why this is here. Commented out July 31 2007 //dropDownButton.mSprite.RotationZ = (float)System.Math.PI; mDropDownButton.ScaleX = .9f; mDropDownButton.Click += new GuiMessage(OnDropDownButtonClick); #endregion this.ScaleY = 1.4f; SelectedObject = null; this.ScaleX = 4; mListBox = new ListBox(mCursor); AddWindow(mListBox); this.RemoveWindow(mListBox); // just a quick way to have a list box initialized for us, but not keep it on this window mListBox.SetPositionTL(ScaleX, ScaleY + 2); mListBox.Visible = false; mListBox.ScrollBarVisible = false; mListBox.Click += new GuiMessage(OnListBoxClicked); MouseWheelScroll += OnMouseWheelScroll; mSelectionDisplay.MouseWheelScroll += OnMouseWheelScroll; mDropDownButton.MouseWheelScroll += OnMouseWheelScroll; mSelectionDisplay.LosingFocus += RaiseTextChange; }
public UsedPropertySelectionWindow() : base(GuiManager.Cursor) { GuiManager.AddWindow(this); HasMoveBar = true; ScaleX = 18; ScaleY = 23; MinimumScaleX = 14; MinimumScaleY = 10; Resizable = true; Resizing += SetChildrenWindowPositionsAndScales; mOkButton = AddButton(); mOkButton.Text = "Ok"; mOkButton.ScaleX = 3; mOkButton.Click += OkButtonClick; mCancelButton = AddButton(); mCancelButton.Text = "Cancel"; mCancelButton.ScaleX = 3; mCancelButton.Click += CancelButtonClick; mAllProperties = AddListBox(); mAllProperties.StrongSelect += AddSelectedProperty; mPropertiesToSave = AddListBox(); mPropertiesToSave.StrongSelect += RemoveSelectedProperty; mAllPropertiesDisplay = AddTextDisplay(); mAllPropertiesDisplay.Text = "All properties:"; mPropertiesToSaveDisplay = AddTextDisplay(); mPropertiesToSaveDisplay.Text = "Properties to save:"; mUseAllButton = AddButton(); mUseAllButton.Text = "Use All ->"; mUseAllButton.ScaleX = 4; mUseAllButton.Click += UseAllClick; SetChildrenWindowPositionsAndScales(null); PopulateFromStringLists(); }
public CollapseListBox(Cursor cursor) : base(cursor) { mListBox = new ListBox(mCursor); mListBox.AddItem("Expand All"); mListBox.AddItem("Collapse All"); mListBox.SetScaleToContents(0); mListBox.HighlightOnRollOver = true; mListBox.ScrollBarVisible = false; mListBox.Click += PopupListBoxClick; SecondaryClick += OnRightClick; }
public OkListWindow(string message, string title) : base(GuiManager.Cursor) { mName = title; ScaleX = 13; ScaleY = 15; HasMoveBar = true; HasCloseButton = true; MinimumScaleX = 9; MinimumScaleY = 10; mOkButton = new Button(mCursor); AddWindow(mOkButton); mOkButton.ScaleX = 1.7f; mOkButton.ScaleY = 1.2f; mOkButton.Text = "Ok"; mOkButton.Click += new GuiMessage(OkButtonClicked); mMessageTextDisplay = new TextDisplay(mCursor); AddWindow(mMessageTextDisplay); mMessageTextDisplay.Text = message; mMessageTextDisplay.X = 1; mMessageTextDisplay.Y = 1.4f; mListBox = new ListBox(mCursor); AddWindow(mListBox); mListBox.StrongSelect += ShowSelectedItemInNewWindow; this.Resizable = true; Resizing += WindowResize; WindowResize(this); GuiManager.AddDominantWindow(this); }