This is the base class for most Gui elements.
The WindowClass contains common properties, events, and methods used by other Gui elements. Much like most FRB objects, Windows and window sub-classes should be created through the GuiManager.

Windows can be created and drawn two different ways. One is the default Gui. The default is drawn using the guiTex.png graphic. The appearance of the default Gui is similar to a regular Windows Gui. Most default-drawn Gui elements must be added through a Window instance rather than the GuiManager. It is common practice to create a Window through the GuiManager, then to add the children Gui elements through the newly-created Window.

To chnage the appearance of the Gui, most Gui elements can be constructed using SpriteFrames. SpriteFrame-created GuiElements can be created either through the GuiManager or a Window instance.

FlatRedBall.Gui.GuiManager.AddWindow() FlatRedBall.ManagedSpriteGroups.SpriteFrame
Inheritance: IScalable, IAnimationChainAnimatable, INameable, IWindow, IVisible:IWindow, IVisible
Example #1
0
 private void emitAllClick(FlatRedBall.Gui.Window callingWindow)
 {
     foreach (Emitter emitter in EditorData.Emitters)
     {
         emitter.Emit();
     }
 }
 void toStartButtonClick(Window callingWindow)
 {
     if (ToStartClick != null)
     {
         ToStartClick(this);
     }
 }
 void OnSetButtonClick(Window callingWindow)
 {
     if (SetButtonClick != null)
     {
         SetButtonClick(this);
     }
 }
 void OnEditButtonClick(Window callingWindow)
 {
     if (EditButtonClick != null)
     {
         EditButtonClick(this);
     }
 }
 void SaveInstructionCodeClick(Window callingWindow)
 {
     FileWindow fileWindow = GuiManager.AddFileWindow();
     fileWindow.SetToSave();
     fileWindow.SetFileType("txt");
     fileWindow.OkClick += SaveInstructionCodeOk;
 }
Example #6
0
        void TextBoxEnter(Window callingWindow)
        {
            AddText(mTextBox.Text);
            mTextBox.Text = "";

            Input.InputManager.ReceivingInput = mTextBox;
        }
Example #7
0
 private void emitCurrentClick(FlatRedBall.Gui.Window callingWindow)
 {
     if (AppState.Self.CurrentEmitter != null)
     {
         AppState.Self.CurrentEmitter.Emit(null);
     }
 }
		public static void SpriteYPosBoxGuiChange(Window callingWindow)
		{
			if(EditorData.EditorLogic.CurrentSprites.Count == 0)	return;
            EditorData.EditorLogic.CurrentSprites[0].Y = ((UpDown)callingWindow).CurrentValue;


		}
Example #9
0
 void ComboBoxItemClick(Window callingWindow)
 {
     if (ItemSelect != null)
     {
         ItemSelect(this);
     }
 }
        void SetChildrenWindowPositionsAndScales(Window callingWindow)
        {
            mAllProperties.ScaleX = (ScaleX - 1.5f) / 2.0f;
            mAllProperties.ScaleY = ScaleY - 3.9f;
            mAllProperties.X = mAllProperties.ScaleX + .7f;
            mAllProperties.Y = 1.7f + mAllProperties.ScaleY;

            mPropertiesToSave.ScaleX = mAllProperties.ScaleX;
            mPropertiesToSave.ScaleY = mAllProperties.ScaleY;
            mPropertiesToSave.X = (ScaleX * 2) - mPropertiesToSave.ScaleX - .7f;
            mPropertiesToSave.Y = mAllProperties.Y;

            mOkButton.Y = ScaleY * 2 - 1.5f;
            mCancelButton.Y = ScaleY * 2 - 1.5f;

            mCancelButton.X = ScaleX * 2 - .7f - mCancelButton.ScaleX;
            mOkButton.X = mCancelButton.X - mCancelButton.ScaleX - .5f - mOkButton.ScaleX;

            mAllPropertiesDisplay.X = .7f;
            mAllPropertiesDisplay.Y = 1;

            mPropertiesToSaveDisplay.X = mPropertiesToSave.X - mPropertiesToSave.ScaleX;
            mPropertiesToSaveDisplay.Y = 1;

            mUseAllButton.X = mAllProperties.X;
            mUseAllButton.ScaleX = mAllProperties.ScaleX;
            mUseAllButton.Y = this.ScaleY * 2 - 4.8f;
        }
Example #11
0
 private void ShiftSceneOk(Window callingWindow)
 {
     if (OkClick != null)
     {
         OkClick(this);
     }
 }
 void playButtonClick(Window callingWindow)
 {
     if (PlayClick != null)
     {
         PlayClick(this);
     }
 }
Example #13
0
 void RestoreToStateBefore(Window callingWindow)
 {
     if (this.mCursor.PrimaryDown && this.mCursor.WindowPushed == this)
     {
         this.ButtonPushedState = mStateBeforePrimaryPush;
     }
 }
Example #14
0
        void WarnAboutSavingScene(Window callingWindow)
        {
            string message = "You are attempting to save a Scene (.scnx).  Scenes do not include any node network information.  If you are trying to save a node network, select the Save Node Network menu item";

            OkCancelWindow ocw = GuiManager.ShowOkCancelWindow(message, "Warning");
            ocw.OkClick += OpenFileWindowSaveScene;
        }
Example #15
0
        void ScaleAllPolygons(Window callingWindow)
        {
            Window polyScaleWindow = GuiManager.AddWindow();
            polyScaleWindow.Name = "Scale All Polygons";
            polyScaleWindow.ScaleX = 10f;
            polyScaleWindow.ScaleY = 4f;
            polyScaleWindow.HasMoveBar = true;
            polyScaleWindow.HasCloseButton = true;

            UpDown scaleBox = new UpDown(mCursor);
            polyScaleWindow.AddWindow(scaleBox);
            scaleBox.Name = "scale";
            scaleBox.CurrentValue = 1f;
            scaleBox.ScaleX = 9f;
            scaleBox.X = 10f;
            scaleBox.Y = Window.MoveBarHeight;

            Button okButton = new Button(mCursor);
            polyScaleWindow.AddWindow(okButton);
            okButton.Text = "Set Scale";
            okButton.ScaleX = 9f;
            okButton.X = 10f;
            okButton.Y = scaleBox.Y + scaleBox.ScaleY * 2f;
            okButton.Click += ScalePolygonsOK;
        }
        public static void LoadScnxButtonClick(FlatRedBall.Gui.Window callingWindow)
        {
            FileWindow tempWindow = GuiManager.AddFileWindow();

            tempWindow.SetFileType("scnx");
            tempWindow.OkClick += new GuiMessage(LoadScnxFileWindowOK);
        }
        private void RemovalOfWatchedWindow(Window callingWindow)
        {
            IObjectDisplayer asObjectDisplayer = callingWindow as IObjectDisplayer;

            GuiManager.RemoveWindow(callingWindow);

            if (asObjectDisplayer.ObjectDisplayingAsObject != null &&
                mObjectDisplayers.ContainsKey(asObjectDisplayer.ObjectDisplayingAsObject))
            {
                mObjectDisplayers.Remove(asObjectDisplayer.ObjectDisplayingAsObject);
            }
            else
            {
                // We still need to see if this Window is contained in this dictionary even
                // if the previous if statement fails.  The reason for this is because of value
                // and immutable types.  For example, a String PropertyGrid might open up for the
                // value "".  Afterwards, the user changes the value and then double-clicks a list
                // to open a new PropertyGrid.  Since the string has changed, then asObjectDisplayer.ObjectDisplayingAsObject
                // will no longer equal the "" string so the Window will never be removed when it should be.
                object keyToRemove = null;

                foreach (KeyValuePair<object, IObjectDisplayer> kvp in mObjectDisplayers)
                {
                    if (kvp.Value == asObjectDisplayer)
                    {
                        keyToRemove = kvp.Key;
                        break;
                    }
                }

                if (keyToRemove != null)
                {
                    mObjectDisplayers.Remove(keyToRemove);
                }

            }
            


            if (mWindowFamilies.ContainsValue(asObjectDisplayer))
            {
                // Remove the object by its value
                IObjectDisplayer keyToRemove = null;

                foreach (KeyValuePair<IObjectDisplayer, IObjectDisplayer> kvp in mWindowFamilies)
                {
                    if (kvp.Value == asObjectDisplayer)
                    {
                        keyToRemove = kvp.Key;
                        break;
                    }
                }

                if (keyToRemove != null)
                {
                    mWindowFamilies.Remove(keyToRemove);

                }
            }
        }
Example #18
0
        void OnOkButtonClick(Window callingWindow)
        {
            if (OkClick != null)
                OkClick(this);

            GuiManager.RemoveWindow(this);
        }
 void AddSpriteClick(Window callingWindow)
 {
     FileWindow fileWindow = GuiManager.AddFileWindow();
     fileWindow.SetToLoad();
     fileWindow.SetFileType("graphic and animation");
     fileWindow.OkClick += AddSpriteOk;            
 }
Example #20
0
        //public Button AddKeyframeListButton
        //{
        //    get { return mAddKeyframeListButton; }
        //}


        #endregion

        #region Event Methods

        private void AddKeyframeListClick(Window callingWindow)
        {
            if (EditorData.EditorLogic.CurrentInstructionSet == null)
            {
                GuiManager.ShowMessageBox("Currently the InstructionEditor is under \"Current'\" editing mode." +
                    "  To add an Animation, you must have a selected object first.", "Error");

                return;
            }

            TextInputWindow tiw = GuiManager.ShowTextInputWindow("Enter a name for the new Animation:", "Enter name");
            if (GuiData.TimeLineWindow.InstructionMode == InstructionMode.Current)
            {
                if (EditorData.EditorLogic.CurrentInstructionSet != null)
                {
                    tiw.Text = "Keyframe List " + EditorData.EditorLogic.CurrentInstructionSet.Count;
                }
                else
                {
                    tiw.Text = "Keyframe List " + 0;
                }
            }
            else
            {
                tiw.Text = "Animation " + EditorData.GlobalInstructionSets.Count;
            }

            tiw.OkClick += new GuiMessage(AddKeyframeListOk);
        }
 private void ShowObjectDisplayWindowForSelectedObject(Window callingWindow)
 {
     if (SelectedObject != null)
     {
         GuiManager.ObjectDisplayManager.GetObjectDisplayerForObject(SelectedObject);
     }
 }
 void SaveActiveScene(Window callingWindow)
 {
     FileWindow fileWindow = GuiManager.AddFileWindow();
     fileWindow.SetToSave();
     fileWindow.SetFileType("scnx");
     fileWindow.OkClick += SaveActiveSceneOk;
 }
Example #23
0
		public void ExitOk(Window callingWindow)
		{
#if FRB_XNA
            FlatRedBallServices.Game.Exit();
#else
			GameForm.Exit(form);
#endif
		}
        void LoadNodeNetworkClick(Window callingWindow)
        {
            FileWindow fileWindow = GuiManager.AddFileWindow();
            fileWindow.SetToLoad();
            fileWindow.Filter = "NodeNetwork XML File (*.nntx)|*.nntx";

            fileWindow.OkClick += new GuiMessage(OnLoadNodeNetworkOk);
        }
 void CloseNodeNetworkClick(Window callingWindow)
 {
     if (mNodeNetwork != null)
     {
         mNodeNetwork.Visible = false;
         mNodeNetwork = null;
     }
 }
 void mAnimationTime_onGUIChange(Window callingWindow)
 {
     if (mAnimationController != null)
     {
         mAnimationController.ElapsedTime =
             ((TimeLine)callingWindow).CurrentValue;
     }
 }
Example #27
0
        void OkButtonClick(Window callingWindow)
        {
            if (OkClick != null)
                OkClick(this);

            Visible = false;
            this.mCursor.WindowClosing = this;
        }
        public static void LoadEmittersClick(FlatRedBall.Gui.Window callingWindow)
        {
            FileWindow tempWindow = GuiManager.AddFileWindow();

            tempWindow.Filter          = "XML Emitter (*.emix)|*.emix";
            tempWindow.CurrentFileType = "emix";
            tempWindow.OkClick        += new GuiMessage(LoadEmitterOK);
        }
Example #29
0
        private static void ClickShowAssemblyTypes(Window callingWindow)
        {
            mAssemblyTypeListDisplayWindow.Visible = true;
            GuiManager.BringToFront(mAssemblyTypeListDisplayWindow);

            mAssemblyTypeListDisplayWindow.ListShowing = EditorData.EditorLogic.CurrentAssembly.GetTypes();

        }
        protected override void SelectCameraConfiguration(Window callingWindow)
        {
            base.SelectCameraConfiguration(callingWindow);

            UpdateBounds();

            UpdateDisplayedProperties();
        }
Example #31
0
        static void AdvancedClick(Window callingWindow)
        {
            mTypesToLoad = new TypesToLoad();
            mLastAsclw = new AdvancedShapeCollectionLoadingWindow(
                GuiManager.Cursor, CreateMbmb(mFileNameToLoad), mTypesToLoad);

            GuiManager.AddWindow(mLastAsclw);
        }
Example #32
0
        void StopPushed(Window callingWindow)
        {
            // Not sure if this'll work in the future, but for now this'll stop everything.
            InstructionManager.PauseEngine(false);
            playButton.Unpress();

            GuiData.TimeLineWindow.IsPlaying = false;

        }
Example #33
0
        private void LoadSceneOk(Window callingWindow)
        {
            FileWindow asFileWindow = callingWindow as FileWindow;

            string fileName = asFileWindow.Results[0];

            EditorData.LoadScene(fileName);

        }
Example #34
0
        public void addEmitterClick(FlatRedBall.Gui.Window callingWindow)
        {
            TextInputWindow tempWindow = GuiManager.ShowTextInputWindow("Enter a name for the new Emitter", "Add Particle");

            tempWindow.Text = "Emitter" + NumberOfEmittersCreated;
            NumberOfEmittersCreated++;

            tempWindow.OkClick += new GuiMessage(addEmitterOkClick);
        }
Example #35
0
		public static void ShiftKeyframeTimesButtonClick(Window callingWindow)
		{
            if (EditorData.EditorLogic.CurrentSprites.Count == 0) return;

            TextInputWindow tiw = GuiManager.ShowTextInputWindow("Shift how many milliseconds?", EditorData.EditorLogic.CurrentSprites[0].Name);
			tiw.OkClick += new GuiMessage(ShiftKeyFrameTextInputOk);
			tiw.format = TextBox.FormatTypes.Decimal;

		}
Example #36
0
        private void SaveEmitterArraysClick(FlatRedBall.Gui.Window callingWindow)
        {
            FileWindow tempWindow = GuiManager.AddFileWindow();

            tempWindow.Filter          = "XML Emitter (*.emix)|*.emix";
            tempWindow.CurrentFileType = "emix";
            tempWindow.saveNameText    = FileManager.RemovePath(EditorData.CurrentEmixFileName);

            if (!string.IsNullOrEmpty(EditorData.CurrentEmixFileName))
            {
                tempWindow.SetDirectory(FileManager.GetDirectory(EditorData.CurrentEmixFileName));
            }

            tempWindow.SetToSave();
            tempWindow.OkClick += SaveEmitterOk;
        }
Example #37
0
        public void addEmitterOkClick(FlatRedBall.Gui.Window callingWindow)
        {
            Emitter newEmitter = new Emitter();

            SpriteManager.AddEmitter(newEmitter);

            ShapeManager.AddPolygon(newEmitter.EmissionBoundary);

            EditorData.SetDefaultValuesOnEmitter(newEmitter);

            EditorData.Emitters.Add(newEmitter);

            newEmitter.Name = ((TextInputWindow)callingWindow).Text;

            newEmitter.Texture = FlatRedBallServices.Load <Texture2D>("content/redball.bmp",
                                                                      AppState.Self.PermanentContentManager);
        }
Example #38
0
        public void EmitterArrayListBoxClick(FlatRedBall.Gui.Window callingWindow)
        {
            ListBoxBase asListBoxBase = callingWindow as ListBoxBase;

            EditorData.SelectEmitter((Emitter)asListBoxBase.GetFirstHighlightedObject());
        }
Example #39
0
 private void clearAllButtonClick(FlatRedBall.Gui.Window callingWindow)
 {
     SpriteManager.RemoveAllParticleSprites();
 }
        public static void NewWorkspace(FlatRedBall.Gui.Window callingWindow)
        {
            // TODO:  Support unloading Scene;

            EditorData.CreateNewWorkspace();
        }
        public static void LoadEmitterOK(FlatRedBall.Gui.Window callingWindow)
        {
            string fileName = ((FileWindow)callingWindow).Results[0];

            AppCommands.Self.File.LoadEmitters(fileName);
        }
 public static void LoadScnxFileWindowOK(FlatRedBall.Gui.Window callingWindow)
 {
     EditorData.LoadScene(((FileWindow)callingWindow).Results[0]);
 }
Example #43
0
        private void SaveEmitterOk(FlatRedBall.Gui.Window callingWindow)
        {
            string fileName = "";

            if (callingWindow is FileWindow)
            {
                fileName      = ((FileWindow)callingWindow).Results[0];
                mLastFileName = fileName;
            }
            else
            {
                fileName = mLastFileName;
            }

            #region Get all of the not-relative textures

            mTexturesNotRelative.Clear();
            mAnimationChainListsNotRelative.Clear();

            string pathOfFile = FileManager.GetDirectory(fileName);

            foreach (Emitter emitter in EditorData.Emitters)
            {
                if (emitter.Texture != null &&
                    !FileManager.IsRelativeTo(emitter.Texture.Name, pathOfFile) &&
                    !mTexturesNotRelative.Contains(emitter.Texture))
                {
                    mTexturesNotRelative.Add(emitter.Texture);
                }

                if (emitter.ParticleBlueprint.AnimationChains != null &&
                    string.IsNullOrEmpty(emitter.ParticleBlueprint.AnimationChains.Name) == false &&
                    !FileManager.IsRelativeTo(emitter.ParticleBlueprint.AnimationChains.Name, pathOfFile) &&
                    !mAnimationChainListsNotRelative.Contains(emitter.ParticleBlueprint.AnimationChains))
                {
                    mAnimationChainListsNotRelative.Add(emitter.ParticleBlueprint.AnimationChains);
                }
            }

            #endregion

            mLastFileName = fileName;

            string message = "The following file has the following non-relative references\n" + fileName;


            CopyTexturesMultiButtonMessageBox mbmb = new CopyTexturesMultiButtonMessageBox();
            mbmb.Text = message;


            mbmb.SaveClick += CopyAssetsToFileFolder;
            //mbmb.AddButton("Cancel Save", null);
            //mbmb.AddButton("Copy textures to relative and reference copies.", new GuiMessage(CopyAssetsToFileFolder));

            foreach (Texture2D texture in mTexturesNotRelative)
            {
                mbmb.AddItem(texture.Name);
            }

            foreach (AnimationChainList animationChainList in mAnimationChainListsNotRelative)
            {
                mbmb.AddItem(animationChainList.Name);
            }
            if (EditorData.EditorProperties.FilesToMakeDotDotRelative.Count != mbmb.ItemsCount)
            {
                mbmb.FilesMarkedDotDotRelative = EditorData.EditorProperties.FilesToMakeDotDotRelative;
                GuiManager.AddDominantWindow(mbmb);
            }
            else
            {
                PerformSave(null);
            }
        }
Example #44
0
 private void DeleteEmitterClick(FlatRedBall.Gui.Window callingWindow)
 {
     EditorData.EditorLogic.DeleteCurrentEmitter();
 }