Пример #1
0
        public AdvancedShapeCollectionLoadingWindow(Cursor cursor, MultiButtonMessageBox mbmb, TypesToLoad typesToLoad) : base(cursor)
        {
            this.AddWindow(mbmb);

            this.ScaleX      = mbmb.ScaleX + 12.5f;
            mbmb.DrawBorders = false;
            mbmb.X           = mbmb.ScaleX;

            mbmb.RemoveButton(mbmb.GetButton("Advanced >>"));
            // Maybe one day we want to allow the user to go back to the
            // basic view?  It's a pain, so I won't do that now

            mbmb.Y      = mbmb.ScaleY;
            this.ScaleY = mbmb.ScaleY + 1;


            //Button cancelButton = mbmb.GetButton("Cancel");
            //mbmb.RemoveButton(cancelButton);
            mbmb.HasMoveBar     = false;
            mbmb.HasCloseButton = false;
            this.HasMoveBar     = true;

            //mbmb.AddButton(cancelButton);

            TextDisplay textDisplay = new TextDisplay(cursor);

            textDisplay.Text = "Offset";
            this.AddWindow(textDisplay);
            textDisplay.X = mbmb.ScaleX * 2;
            textDisplay.Y = 1;

            offsetWindow = new Vector3Display(cursor);
            this.AddWindow(offsetWindow);
            offsetWindow.X = mbmb.ScaleX * 2 + offsetWindow.ScaleX;
            offsetWindow.Y = offsetWindow.ScaleY + 2;

            mbmb.Closing += new GuiMessage(CloseThis);
            this.Name     = "";

            PropertyGrid <TypesToLoad> propertyGrid = new PropertyGrid <TypesToLoad>(cursor);

            propertyGrid.ObjectDisplaying = typesToLoad;
            propertyGrid.HasMoveBar       = false;
            propertyGrid.HasCloseButton   = false;

            this.AddWindow(propertyGrid);
            propertyGrid.X = mbmb.ScaleX * 2 + propertyGrid.ScaleX - 1; // subtract 1 because we're not going to show the frames
            propertyGrid.Y = propertyGrid.ScaleY + 2 + offsetWindow.ScaleY * 2 + .5f;

            propertyGrid.DrawBorders = false;
        }
Пример #2
0
        public Vector3OkWindow(Cursor cursor)
            : base(cursor)
        {
            this.ScaleX    = 6.5f;
            this.ScaleY    = 6.0f;
            HasMoveBar     = true;
            HasCloseButton = true;

            mVector3Display = new Vector3Display(cursor);
            this.AddWindow(mVector3Display);
            mVector3Display.Y = .5f + mVector3Display.ScaleY;

            this.Closing += GuiManager.RemoveWindow;

            Button okButton = new Button(mCursor);

            AddWindow(okButton);
            const float border = .5f;

            okButton.Y      = this.ScaleY * 2 - okButton.ScaleY - border;
            okButton.ScaleX = 3;
            okButton.Text   = "Ok";
            okButton.Click += ShiftSceneOk;
        }
Пример #3
0
        private Window CreateEditWindowForType(Type memberType)
        {
            Window toReturn = null;

            #region ComboBox
            if (memberType.IsEnum ||
                memberType == typeof(bool))
            {
                ComboBox comboBox = new ComboBox(GuiManager.Cursor);
                comboBox.ScaleX     = 8;
                toReturn            = comboBox;
                comboBox.ItemClick += UpdateComboBoxValue;

                if (memberType == typeof(bool))
                {
                    comboBox.AddItem("true", true);
                    comboBox.AddItem("false", false);
                }
                else
                {
                    string[] options = Enum.GetNames(memberType);
                    Array    values  = Enum.GetValues(memberType);
                    int      i       = 0;

                    foreach (object value in values)
                    {
                        comboBox.AddItem(options[i], value);

                        ++i;
                    }
                }
            }

            #endregion

            #region UpDown
            else if (
                memberType == typeof(byte) ||
                memberType == typeof(float) ||
                memberType == typeof(double) ||
                memberType == typeof(int))
            {
                UpDown upDown = new UpDown(GuiManager.Cursor);
                upDown.ValueChanged += new GuiMessage(UpdateUpDownValue);
                toReturn             = upDown;
                upDown.ScaleX        = 8;
            }
            #endregion

            #region Vector3
            else if (
                memberType == typeof(Vector3))
            {
                Vector3Display vecDisplay = new Vector3Display(GuiManager.Cursor);
                vecDisplay.LosingFocus  += UpdateVector3Display;
                vecDisplay.ValueChanged += UpdateVector3Display;
                toReturn = vecDisplay;
            }
            #endregion

            #region ColorDisplay
            else if (
                memberType == typeof(System.Drawing.Color))
            {
                ColorDisplay cDisplay = new ColorDisplay(GuiManager.Cursor);

                cDisplay.ValueChanged += UpdateColorDisplayValue;
                cDisplay.LosingFocus  += UpdateColorDisplayValue;

                toReturn = cDisplay;
            }
            #endregion

            #region Textbox
            else if (
                memberType == typeof(string) ||
                memberType == typeof(long))
            {
                TextBox textBox = new TextBox(GuiManager.Cursor);
                textBox.ScaleX = 8;

                if (memberType == typeof(long))
                {
                    textBox.Format = TextBox.FormatTypes.Integer;
                }

                textBox.LosingFocus += UpdateTextBoxValue;

                toReturn = textBox;
            }
            #endregion

            return(toReturn);
        }