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
コード例 #1
0
 private void emitAllClick(FlatRedBall.Gui.Window callingWindow)
 {
     foreach (Emitter emitter in EditorData.Emitters)
     {
         emitter.Emit();
     }
 }
コード例 #2
0
 void toStartButtonClick(Window callingWindow)
 {
     if (ToStartClick != null)
     {
         ToStartClick(this);
     }
 }
コード例 #3
0
 void OnSetButtonClick(Window callingWindow)
 {
     if (SetButtonClick != null)
     {
         SetButtonClick(this);
     }
 }
コード例 #4
0
 void OnEditButtonClick(Window callingWindow)
 {
     if (EditButtonClick != null)
     {
         EditButtonClick(this);
     }
 }
コード例 #5
0
 void SaveInstructionCodeClick(Window callingWindow)
 {
     FileWindow fileWindow = GuiManager.AddFileWindow();
     fileWindow.SetToSave();
     fileWindow.SetFileType("txt");
     fileWindow.OkClick += SaveInstructionCodeOk;
 }
コード例 #6
0
ファイル: ChatWindow.cs プロジェクト: vchelaru/FlatRedBall
        void TextBoxEnter(Window callingWindow)
        {
            AddText(mTextBox.Text);
            mTextBox.Text = "";

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


		}
コード例 #9
0
ファイル: SaveUseWindow.cs プロジェクト: vchelaru/FlatRedBall
 void ComboBoxItemClick(Window callingWindow)
 {
     if (ItemSelect != null)
     {
         ItemSelect(this);
     }
 }
コード例 #10
0
        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;
        }
コード例 #11
0
 private void ShiftSceneOk(Window callingWindow)
 {
     if (OkClick != null)
     {
         OkClick(this);
     }
 }
コード例 #12
0
 void playButtonClick(Window callingWindow)
 {
     if (PlayClick != null)
     {
         PlayClick(this);
     }
 }
コード例 #13
0
ファイル: ToggleButton.cs プロジェクト: vchelaru/FlatRedBall
 void RestoreToStateBefore(Window callingWindow)
 {
     if (this.mCursor.PrimaryDown && this.mCursor.WindowPushed == this)
     {
         this.ButtonPushedState = mStateBeforePrimaryPush;
     }
 }
コード例 #14
0
ファイル: Menu.cs プロジェクト: vchelaru/FlatRedBall
        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;
        }
コード例 #15
0
ファイル: Menu.cs プロジェクト: vchelaru/FlatRedBall
        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;
        }
コード例 #16
0
        public static void LoadScnxButtonClick(FlatRedBall.Gui.Window callingWindow)
        {
            FileWindow tempWindow = GuiManager.AddFileWindow();

            tempWindow.SetFileType("scnx");
            tempWindow.OkClick += new GuiMessage(LoadScnxFileWindowOK);
        }
コード例 #17
0
        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);

                }
            }
        }
コード例 #18
0
        void OnOkButtonClick(Window callingWindow)
        {
            if (OkClick != null)
                OkClick(this);

            GuiManager.RemoveWindow(this);
        }
コード例 #19
0
 void AddSpriteClick(Window callingWindow)
 {
     FileWindow fileWindow = GuiManager.AddFileWindow();
     fileWindow.SetToLoad();
     fileWindow.SetFileType("graphic and animation");
     fileWindow.OkClick += AddSpriteOk;            
 }
コード例 #20
0
ファイル: ListBoxWindow.cs プロジェクト: vchelaru/FlatRedBall
        //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);
        }
コード例 #21
0
 private void ShowObjectDisplayWindowForSelectedObject(Window callingWindow)
 {
     if (SelectedObject != null)
     {
         GuiManager.ObjectDisplayManager.GetObjectDisplayerForObject(SelectedObject);
     }
 }
コード例 #22
0
 void SaveActiveScene(Window callingWindow)
 {
     FileWindow fileWindow = GuiManager.AddFileWindow();
     fileWindow.SetToSave();
     fileWindow.SetFileType("scnx");
     fileWindow.OkClick += SaveActiveSceneOk;
 }
コード例 #23
0
ファイル: GuiMessages.cs プロジェクト: vchelaru/FlatRedBall
		public void ExitOk(Window callingWindow)
		{
#if FRB_XNA
            FlatRedBallServices.Game.Exit();
#else
			GameForm.Exit(form);
#endif
		}
コード例 #24
0
        void LoadNodeNetworkClick(Window callingWindow)
        {
            FileWindow fileWindow = GuiManager.AddFileWindow();
            fileWindow.SetToLoad();
            fileWindow.Filter = "NodeNetwork XML File (*.nntx)|*.nntx";

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

            Visible = false;
            this.mCursor.WindowClosing = this;
        }
コード例 #28
0
        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);
        }
コード例 #29
0
ファイル: GuiData.cs プロジェクト: vchelaru/FlatRedBall
        private static void ClickShowAssemblyTypes(Window callingWindow)
        {
            mAssemblyTypeListDisplayWindow.Visible = true;
            GuiManager.BringToFront(mAssemblyTypeListDisplayWindow);

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

        }
コード例 #30
0
        protected override void SelectCameraConfiguration(Window callingWindow)
        {
            base.SelectCameraConfiguration(callingWindow);

            UpdateBounds();

            UpdateDisplayedProperties();
        }
コード例 #31
0
ファイル: FileLoader.cs プロジェクト: vchelaru/FlatRedBall
        static void AdvancedClick(Window callingWindow)
        {
            mTypesToLoad = new TypesToLoad();
            mLastAsclw = new AdvancedShapeCollectionLoadingWindow(
                GuiManager.Cursor, CreateMbmb(mFileNameToLoad), mTypesToLoad);

            GuiManager.AddWindow(mLastAsclw);
        }
コード例 #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;

        }
コード例 #33
0
ファイル: Menu.cs プロジェクト: vchelaru/FlatRedBall
        private void LoadSceneOk(Window callingWindow)
        {
            FileWindow asFileWindow = callingWindow as FileWindow;

            string fileName = asFileWindow.Results[0];

            EditorData.LoadScene(fileName);

        }
コード例 #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);
        }
コード例 #35
0
ファイル: ToolsMessages.cs プロジェクト: vchelaru/FlatRedBall
		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;

		}
コード例 #36
0
ファイル: Menu.cs プロジェクト: profexorgeek/FlatRedBall
        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;
        }
コード例 #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);
        }
コード例 #38
0
        public void EmitterArrayListBoxClick(FlatRedBall.Gui.Window callingWindow)
        {
            ListBoxBase asListBoxBase = callingWindow as ListBoxBase;

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

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

            AppCommands.Self.File.LoadEmitters(fileName);
        }
コード例 #42
0
 public static void LoadScnxFileWindowOK(FlatRedBall.Gui.Window callingWindow)
 {
     EditorData.LoadScene(((FileWindow)callingWindow).Results[0]);
 }
コード例 #43
0
ファイル: Menu.cs プロジェクト: profexorgeek/FlatRedBall
        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);
            }
        }
コード例 #44
0
 private void DeleteEmitterClick(FlatRedBall.Gui.Window callingWindow)
 {
     EditorData.EditorLogic.DeleteCurrentEmitter();
 }