private static void CreateListDisplayWindows() { mAssembliesListDisplayWindow = new ListDisplayWindow(GuiManager.Cursor); GuiManager.AddWindow(mAssembliesListDisplayWindow); mAssembliesListDisplayWindow.ScaleX = 10; mAssembliesListDisplayWindow.ScaleY = 12; mAssembliesListDisplayWindow.HasMoveBar = true; mAssembliesListDisplayWindow.X = mAssembliesListDisplayWindow.ScaleX; mAssembliesListDisplayWindow.Y = mAssembliesListDisplayWindow.ScaleY + 6; mAssembliesListDisplayWindow.Resizable = true; mAssembliesListDisplayWindow.ShowPropertyGridOnStrongSelect = true; mAssembliesListDisplayWindow.ListBox.Highlight += HighlightNewAssembly; mAssembliesListDisplayWindow.ListShowing = EditorData.Assemblies; mAssemblyTypeListDisplayWindow = new ListDisplayWindow(GuiManager.Cursor); mAssemblyTypeListDisplayWindow.Visible = false; GuiManager.AddWindow(mAssemblyTypeListDisplayWindow); mAssemblyTypeListDisplayWindow.ScaleX = 10; mAssemblyTypeListDisplayWindow.ScaleY = 12; mAssemblyTypeListDisplayWindow.HasMoveBar = true; mAssemblyTypeListDisplayWindow.X = mAssembliesListDisplayWindow.ScaleX; mAssemblyTypeListDisplayWindow.Y = 26; mAssemblyTypeListDisplayWindow.Resizable = true; mAssemblyTypeListDisplayWindow.ListBox.StrongSelect += CreateObjectOfSelectedType; mAssemblyTypeListDisplayWindow.HasCloseButton = true; }
private static ListDisplayWindow CreateListDisplayWindowForObject(object objectToCreateWindowFor) { ListDisplayWindow listDisplayWindow = new ListDisplayWindow(GuiManager.Cursor); GuiManager.AddWindow(listDisplayWindow); listDisplayWindow.HasMoveBar = true; listDisplayWindow.HasCloseButton = true; listDisplayWindow.Resizable = true; listDisplayWindow.ListShowing = mObjectToSerialize as IEnumerable; listDisplayWindow.Closing += GuiManager.RemoveWindow; // listDisplayWindow.EnableAddingToList(); Button saveButton = new Button(GuiManager.Cursor); saveButton.Text = "Save Object as XML"; saveButton.ScaleX = 9f; saveButton.Click += XmlSeralizeObject; listDisplayWindow.AddWindow(saveButton); Button loadButton = new Button(GuiManager.Cursor); loadButton.Text = "Load Object from XML"; loadButton.ScaleX = 9f; loadButton.Click += XmlDeserializeObject; listDisplayWindow.AddWindow(loadButton); listDisplayWindow.MinimumScaleX = 10; return(listDisplayWindow); }
/// <summary> /// Shows a ListDisplayWindow with the undos in the UndoManager. This is provided as a convenience function so it /// can be used in MenuStrips. /// </summary> /// <param name="callingWindow">This property will not be used - it's here to match the GuiMessage delegate.</param> public static void ShowListDisplayWindow(Window callingWindow) { #region If the ListDisplayWindow hasn't been created yet, create it if (mInstructionListDisplayWindow == null) { mInstructionListDisplayWindow = new ListDisplayWindow(GuiManager.Cursor); mInstructionListDisplayWindow.ListShowing = mInstructions; mInstructionListDisplayWindow.HasMoveBar = true; mInstructionListDisplayWindow.HasCloseButton = true; mInstructionListDisplayWindow.Resizable = true; mInstructionListDisplayWindow.ScaleX = 9; mInstructionListDisplayWindow.X = SpriteManager.Camera.XEdge * 2 - mInstructionListDisplayWindow.ScaleX; mInstructionListDisplayWindow.Name = "Undos"; GuiManager.AddWindow(mInstructionListDisplayWindow); } #endregion #region Show and bring the ListDisplayWindow to the top mInstructionListDisplayWindow.Visible = true; GuiManager.BringToFront(mInstructionListDisplayWindow); #endregion }
public void CreateExtraWindows() { #region Create the Up/Down to simultaneously set the time for all selected Instructions mSetSelectedInstructionTimeUpDown = new UpDown(GuiManager.Cursor); mSetSelectedInstructionTimeUpDown.MinValue = 0; mSetSelectedInstructionTimeUpDown.ScaleX = 7; mSetSelectedInstructionTimeUpDown.Enabled = false; this.AddWindow(mSetSelectedInstructionTimeUpDown); this.SetLabelForWindow(mSetSelectedInstructionTimeUpDown, "Time:"); mSetSelectedInstructionTimeUpDown.ValueChanged += SetSelectedInstructionTime; #endregion #region Create the ListDisplayWindow to show all instructions mListDisplayWindow = new ListDisplayWindow(GuiManager.Cursor); mListDisplayWindow.ScaleX = 11; mListDisplayWindow.ScaleY = 9; mListDisplayWindow.DrawOuterWindow = false; mListDisplayWindow.ListBox.Click += UpdateUpDownOnClick; this.AddWindow(mListDisplayWindow); #endregion }
public void AddInstructionBlueprint(Window callingWindow) { ListDisplayWindow listWindow = (GetUIElementForMember("Instructions") as InstructionBlueprintListPropertyGrid).ListDisplayWindow; List <InstructionBlueprint> tempList = listWindow.ListShowing as List <InstructionBlueprint>; tempList[tempList.Count - 1].TargetType = typeof(FlatRedBall.Sprite); }
public EnumPropertyGrid(Cursor cursor, ListDisplayWindow windowOfObject, int indexOfObject) : base(cursor, windowOfObject, indexOfObject) { #if !XBOX360 && !WINDOWS_PHONE ExcludeAllMembers(); mComboBox = new ComboBox(mCursor); mComboBox.ScaleX = 15; this.AddWindow(mComboBox); mComboBox.ItemClick += ChangeEnum; Type type = typeof(EnumType); string[] availableValues = Enum.GetNames(type); Array array = Enum.GetValues(type); int i = 0; foreach (object enumValue in array) { string s = availableValues[i]; mComboBox.AddItem(s, enumValue); i++; } #else throw new NotImplementedException("This isn't implemented due to the compact framework limitations on the Enum class. Can prob implement this using reflection if necessary."); #endif }
public ListBoxWindow() : base(GuiManager.Cursor) { #region Set "this" properties. GuiManager.AddWindow(this); SetPositionTL(97.3f, 25.2f); ScaleX = 13.1f; ScaleY = 19.505f; mName = "Keyframes"; mMoveBar = true; MinimumScaleX = ScaleX; MinimumScaleY = 7; this.Resizable = true; this.Resizing += AdjustPositionsAndScales; #endregion #region List Box mInstructionSetListBox = AddCollapseListBox(); mInstructionSetListBox.Highlight += new GuiMessage(UpdateAddButtonVisibility); mInstructionSetListBox.Highlight += HighlightInstructionSetListBox; mInstructionSetListBox.FocusUpdate += InstructionListHotkeyUpdate; #endregion #region AnimationSequence ListDisplayWindow mAnimationSequenceListBox = new ListDisplayWindow(mCursor); this.AddWindow(mAnimationSequenceListBox); mAnimationSequenceListBox.ListBox.Highlight += HighlightAnimationSequenceListBox; mAnimationSequenceListBox.ListBox.StrongSelect += DoubleClickAnimationSequenceListBox; mAnimationSequenceListBox.ListBox.FocusUpdate += new FocusUpdateDelegate(AnimationSequenceFocusUpdate); ListDisplayWindow.SetStringRepresentationMethod(typeof(TimedKeyframeList), GetTimedKeyframeListStringRepresentation); #endregion #region Add Keyframe List Button mAddKeyframeListButton = AddButton(); mAddKeyframeListButton.Text = "Add Animation"; mAddKeyframeListButton.Click += AddKeyframeListClick; // this will call UpdateVisibleWindows #endregion #region Add Keyframe Button mAddKeyframeButton = AddButton(); mAddKeyframeButton.Text = "Add Keyframe"; mAddKeyframeButton.Click += AddKeyframe; #endregion AdjustPositionsAndScales(null); }
private static void CreateAnimationChainListDisplayWindow(Window callingWindow) { ListDisplayWindow listDisplayWindow = callingWindow as ListDisplayWindow; listDisplayWindow.ShowPropertyGridOnStrongSelect = false; listDisplayWindow.ListBox.StrongSelect += SetAnimationChainOnCurrentSprite; }
public StructReferencePropertyGrid(Cursor cursor, ListDisplayWindow windowOfObject, int indexOfObject) : base(cursor) { mListDisplayWindowOfObject = windowOfObject; mIndexOfObject = indexOfObject; foreach (PropertyWindowAssociation pwa in mPropertyWindowAssociations) { pwa.ChangeEvent += UpdateObject; } }
private void CreateListDisplayWindows() { float listDisplayWindowScaleX = 10; float listDisplayWindowScaleY = 16; mSprites = new ListDisplayWindow(this.mCursor); this.ReplaceMemberUIElement("Sprites", mSprites); mSprites.ScaleX = listDisplayWindowScaleX; mSprites.ScaleY = listDisplayWindowScaleY; mSprites.ListBox.Highlight += SpriteListBoxClick; mSprites.ConsiderAttachments = true; SetMemberDisplayName("Sprites", ""); mSpriteFrames = new ListDisplayWindow(this.mCursor); this.ReplaceMemberUIElement("SpriteFrames", mSpriteFrames); mSpriteFrames.ScaleX = listDisplayWindowScaleX; mSpriteFrames.ScaleY = listDisplayWindowScaleY; mSpriteFrames.ListBox.Highlight += SpriteFrameListBoxClick; mSpriteFrames.ConsiderAttachments = true; SetMemberDisplayName("SpriteFrames", ""); mTexts = new ListDisplayWindow(this.mCursor); this.ReplaceMemberUIElement("Texts", mTexts); mTexts.ScaleX = listDisplayWindowScaleX; mTexts.ScaleY = listDisplayWindowScaleY; mTexts.ListBox.Highlight += TextListBoxClick; mTexts.ConsiderAttachments = true; SetMemberDisplayName("Texts", ""); mPositionedModels = new ListDisplayWindow(this.mCursor); this.ReplaceMemberUIElement("PositionedModels", mPositionedModels); mPositionedModels.ScaleX = listDisplayWindowScaleX; mPositionedModels.ScaleY = listDisplayWindowScaleY; mPositionedModels.ListBox.Highlight += PositionedModelListBoxClick; mPositionedModels.ConsiderAttachments = true; SetMemberDisplayName("PositionedModels", ""); mSpriteGrids = new ListDisplayWindow(this.mCursor); this.ReplaceMemberUIElement("SpriteGrids", mSpriteGrids); mSpriteGrids.ScaleX = listDisplayWindowScaleX; mSpriteGrids.ScaleY = listDisplayWindowScaleY; mSpriteGrids.ListBox.Highlight += SpriteGridListBoxClick; SetMemberDisplayName("SpriteGrids", ""); mLights = new ListDisplayWindow(this.mCursor); this.ReplaceMemberUIElement("Lights", mLights); mLights.ScaleX = listDisplayWindowScaleX; mLights.ScaleY = listDisplayWindowScaleY; mLights.ListBox.Highlight += SpriteGridListBoxClick; SetMemberDisplayName("Lights", ""); }
public SpriteRigPropertyGrid(Cursor cursor) : base(cursor) { Name = "SpriteRig"; #region Exclude/Include members ExcludeAllMembers(); IncludeMember("BodySprites", "BodySprites"); IncludeMember("Joints", "Joints"); IncludeMember("Attachments", "Attachments"); #endregion #region Create the BodySprites ListDisplayWindow mBodySpritesListDisplayWindow = new ListDisplayWindow(mCursor); mBodySpritesListDisplayWindow.ScaleX = 8; mBodySpritesListDisplayWindow.ScaleY = 12; mBodySpritesListDisplayWindow.ListBox.Click += BodySpriteListClick; ReplaceMemberUIElement("BodySprites", mBodySpritesListDisplayWindow); this.SetMemberDisplayName("BodySprites", ""); #endregion #region Create the Joints ListDisplayWindow mJointsListDisplayWindow = new ListDisplayWindow(mCursor); mJointsListDisplayWindow.ScaleX = 8; mJointsListDisplayWindow.ScaleY = 12; mJointsListDisplayWindow.ListBox.Click += JointSpriteListClick; ReplaceMemberUIElement("Joints", mJointsListDisplayWindow); this.SetMemberDisplayName("Joints", ""); #endregion #region Create the Attachments ListDisplayWindow mAttachmentsListDisplayWindow = new ListDisplayWindow(mCursor); mAttachmentsListDisplayWindow.ScaleX = 8; mAttachmentsListDisplayWindow.ScaleY = 12; //mAttachmentsListDisplayWindow.ListBox.Click += AttachmentsListDisplayWindowClick; ReplaceMemberUIElement("Attachments", mAttachmentsListDisplayWindow); this.SetMemberDisplayName("Attachments", ""); #endregion X = SpriteManager.Camera.XEdge; Y = SpriteManager.Camera.YEdge; RemoveCategory("Uncategorized"); SelectCategory("BodySprites"); }
public StringPropertyGrid(Cursor cursor, ListDisplayWindow windowOfObject, int indexOfObject) : base(cursor, windowOfObject, indexOfObject) { ExcludeAllMembers(); mTextBox = new TextBox(mCursor); mTextBox.ScaleX = 15; this.AddWindow(mTextBox); mTextBox.LosingFocus += ChangeString; mTextBox.TextChange += ChangeString; mTextBox.EnterPressed += ChangeStringAndClose; }
public FloatPropertyGrid(Cursor cursor, ListDisplayWindow windowOfObject, int indexOfObject) : base(cursor, windowOfObject, indexOfObject) { ExcludeAllMembers(); MinimumScaleY = 2; ScaleY = 2; mUpDown = new UpDown(mCursor); mUpDown.ScaleX = 5; mUpDown.Precision = 7; this.AddWindow(mUpDown); mUpDown.ValueChanged += ChangeFloat; mUpDown.textBox.EnterPressed += ChangeFloatAndClose; }
public static ListDisplayWindow CreateListDisplayWindowForObject(object displayedObject, Cursor cursor) { ListDisplayWindow listDisplayWindow = new ListDisplayWindow(cursor); listDisplayWindow.HasMoveBar = true; listDisplayWindow.HasCloseButton = true; listDisplayWindow.Resizable = true; listDisplayWindow.ShowPropertyGridOnStrongSelect = true; listDisplayWindow.PrependIndex = true; listDisplayWindow.ListShowing = displayedObject as IEnumerable; // try to enable adding and removing - this is so common we're going to make it the default listDisplayWindow.EnableAddingToList(); listDisplayWindow.EnableRemovingFromList(); return(listDisplayWindow); }
private static void CreateObjectOfSelectedType(Window callingWindow) { CollapseListBox collapseListBox = callingWindow as CollapseListBox; Type type = collapseListBox.GetFirstHighlightedObject() as Type; mObjectToSerialize = Activator.CreateInstance(type); mTypeOfObjectToSerialize = type; if (PropertyGrid.IsIEnumerable(type)) { mObjectListDisplayWindow = CreateListDisplayWindowForObject(mObjectToSerialize); } else { mObjectPropertyGrid = CreatePropertyGridForObject(mObjectToSerialize); } }
public BoolPropertyGrid(Cursor cursor, ListDisplayWindow windowOfObject, int indexOfObject) : base(cursor, windowOfObject, indexOfObject) { ExcludeAllMembers(); MinimumScaleY = 2; ScaleY = 2; mTrueFalse = new ComboBox(mCursor); mTrueFalse.ScaleX = 5; mTrueFalse.AddItem("True", true); mTrueFalse.AddItem("False", false); this.AddWindow(mTrueFalse); mTrueFalse.SelectedObject = windowOfObject.Items[indexOfObject]; mTrueFalse.Text = windowOfObject.Items[indexOfObject].ReferenceObject.ToString(); mTrueFalse.ItemClick += ChangeBool; }
public EmitterListBoxWindow(GuiMessages messages) : base(GuiManager.Cursor) { #region this Properties GuiManager.AddWindow(this); SetPositionTL(95.3f, 17.6167374f); ScaleX = 15; ScaleY = 12; MinimumScaleX = 12.5f; MinimumScaleY = 7; HasCloseButton = true; mMoveBar = true; mName = "Emitters"; Resizable = true; Resizing += PositionAndScaleChildrenWindows; #endregion mListDisplayWindow = new ListDisplayWindow(mCursor); this.AddWindow(mListDisplayWindow); mListDisplayWindow.DrawOuterWindow = false; mListDisplayWindow.ListBox.Highlight += new GuiMessage(messages.EmitterArrayListBoxClick); mListDisplayWindow.AllowCopy = true; mListDisplayWindow.AfterItemsPasted += new GuiMessage(mListDisplayWindow_AfterItemsPasted); mListDisplayWindow.ListBox.FocusUpdate += FocusUpdate; mListDisplayWindow.AllowReordering = true; addEmitter = new Button(mCursor); AddWindow(addEmitter); addEmitter.Text = "Add Emitter"; addEmitter.Click += new GuiMessage(addEmitterClick); deleteEmitter = new Button(mCursor); AddWindow(deleteEmitter); deleteEmitter.Text = "Delete Emitter"; deleteEmitter.Click += new GuiMessage(DeleteEmitterClick); PositionAndScaleChildrenWindows(null); }
public NodeNetworkPropertyGrid() : base(GuiManager.Cursor) { GuiManager.AddWindow(this); ExcludeMember("NodeColor"); ExcludeMember("LinkColor"); ExcludeMember("NodeVisibleRepresentation"); ExcludeMember("LayerToDrawOn"); mNodes = new ListDisplayWindow(GuiManager.Cursor); mNodes.Resizable = true; ReplaceMemberUIElement("Nodes", mNodes); mNodes.ListBox.Highlight += SelectNodeInListBox; mNodes.ShowPropertyGridOnStrongSelect = true; mNodes.ScaleY = 5; mNodes.AfterChildWindowCreated += new GuiMessage(mNodes_AfterChildWindowCreated); Name = "NodeNetwork Properties"; }
private void CreateExtraWindows() { #region Create the ListDisplayWindow to show all instructions mListDisplayWindow = new ListDisplayWindow(GuiManager.Cursor); mListDisplayWindow.ScaleX = 11; mListDisplayWindow.ScaleY = 9; mListDisplayWindow.DrawOuterWindow = false; this.AddWindow(mListDisplayWindow); #endregion #region Create the Up/Down to simultaneously set the time for all Instructions mSetAllInstructionTimeUpDown = new UpDown(GuiManager.Cursor); mSetAllInstructionTimeUpDown.MinValue = 0; mSetAllInstructionTimeUpDown.ScaleX = 7; mSetAllInstructionTimeUpDown.Enabled = false; this.AddWindow(mSetAllInstructionTimeUpDown); this.SetLabelForWindow(mSetAllInstructionTimeUpDown, "Time:"); mSetAllInstructionTimeUpDown.ValueChanged += SetAllInstructionTime; #endregion #region Create the mRecordingToggleButton mOverwriteInstructionListButton = new Button(mCursor); mOverwriteInstructionListButton.Text = "Overwrite\nInstructionList"; mOverwriteInstructionListButton.ScaleX = 7; mOverwriteInstructionListButton.ScaleY = 2f; mOverwriteInstructionListButton.Click += OverwriteInstructionListClick; AddWindow(mOverwriteInstructionListButton); #endregion }
internal IObjectDisplayer CreateObjectDisplayer(object displayedObject, Window requestingWindow, string memberName) { IObjectDisplayer objectToReturn = null; PropertyGrid newGrid = null; ListDisplayWindow newListDisplayWindow = null; Type objectType = displayedObject.GetType(); Type propertyGridType; ListDisplayWindow requestingListDisplayWindow = requestingWindow as ListDisplayWindow; PropertyGrid requestingPropertyGrid = requestingWindow as PropertyGrid; #region Get the cursor to use for the new Window Cursor cursor = GuiManager.Cursor; if (requestingWindow != null) { cursor = requestingWindow.mCursor; } #endregion #region Create the IDisplayWindow depending on the type of object passed #region If object is enum if (objectType.IsEnum) { #if SILVERLIGHT throw new NotImplementedException(); #else propertyGridType = typeof(EnumPropertyGrid <>).MakeGenericType(objectType); #if XBOX360 throw new NotImplementedException("No PropertyGrid support in ObjectDisplayManager on 360 currently"); #else // handle enums specially newGrid = Activator.CreateInstance(propertyGridType, cursor, requestingWindow, requestingListDisplayWindow.Items.IndexOf(requestingListDisplayWindow.GetFirstHighlightedItem())) as PropertyGrid; #endif #endif } #endregion #region Else if the object has an associated GUI element else if (PropertyGrid.sPropertyGridTypesForObjectType.ContainsKey(objectType)) { #if XBOX360 throw new NotImplementedException("PropertyGrid creation not supported on 360."); #else if (objectType.IsValueType || objectType == typeof(string)) { newGrid = Activator.CreateInstance( PropertyGrid.sPropertyGridTypesForObjectType[objectType], cursor, requestingWindow, requestingListDisplayWindow.Items.IndexOf(requestingListDisplayWindow.GetFirstHighlightedItem())) as PropertyGrid; } else { Type objectDisplayerType = PropertyGrid.sPropertyGridTypesForObjectType[objectType]; ConstructorInfo ci = objectDisplayerType.GetConstructor(System.Type.EmptyTypes); if (ci != null) { // The IObjectDisplayer has a no-argument constructor objectToReturn = Activator.CreateInstance(objectDisplayerType) as IObjectDisplayer; } else { // The constructor requires arguments, meaning it's probabaly a Window, so let's pass a cursor objectToReturn = Activator.CreateInstance(objectDisplayerType, cursor) as IObjectDisplayer; } if (objectToReturn is PropertyGrid) { newGrid = objectToReturn as PropertyGrid; } else if (objectToReturn is ListDisplayWindow) { newListDisplayWindow = objectToReturn as ListDisplayWindow; } } #endif } #endregion #region Else if the object is an IEnumerable else if (IsIEnumerable(objectType)) { ListDisplayWindow listDisplayWindow = CreateListDisplayWindowForObject(displayedObject, cursor); newListDisplayWindow = listDisplayWindow; } #endregion #region Else if the object is a value type else if (objectType.IsValueType) { #if SILVERLIGHT throw new NotImplementedException(); #else propertyGridType = typeof(StructReferencePropertyGrid <>).MakeGenericType(objectType); #if XBOX360 throw new NotImplementedException("No PropertyGrid support on 360"); #else if (requestingListDisplayWindow != null) { newGrid = Activator.CreateInstance(propertyGridType, cursor, requestingListDisplayWindow, requestingListDisplayWindow.Items.IndexOf(requestingListDisplayWindow.GetFirstHighlightedItem())) as PropertyGrid; } else { newGrid = Activator.CreateInstance( propertyGridType, cursor, requestingPropertyGrid, memberName) as PropertyGrid; } #endif newGrid.ExcludeStaticMembers(); #endif } #endregion #region Else, just create a regular PropertyGrid else { #if SILVERLIGHT throw new NotImplementedException(); #else propertyGridType = typeof(PropertyGrid <>).MakeGenericType(objectType); #if XBOX360 throw new NotImplementedException("No PropertyGrid support on 360"); #else newGrid = Activator.CreateInstance(propertyGridType, cursor) as PropertyGrid; #endif #endif } #endregion #endregion #region Modify the new object based off of settings set at the user level #if !SILVERLIGHT if (PropertyGrid.sPropertyGridMemberSettings.ContainsKey(objectType)) { PropertyGridMemberSettings memberSettings = PropertyGrid.sPropertyGridMemberSettings[objectType]; foreach (string member in memberSettings) { newGrid.ExcludeMember(member); } } #endif Window newWindow = null; if (newGrid != null) { newWindow = newGrid; } else if (newListDisplayWindow != null) { newWindow = newListDisplayWindow; } else if (objectToReturn is Window) { newWindow = objectToReturn as Window; } #if !SILVERLIGHT if (PropertyGrid.sNewWindowCallbacks.ContainsKey(objectType)) { PropertyGrid.sNewWindowCallbacks[objectType](newWindow); } if (PropertyGrid.sNewWindowCallbacksByTypeAsString.ContainsKey(objectType.FullName)) { PropertyGrid.sNewWindowCallbacksByTypeAsString[objectType.FullName](newWindow); } #endif if (AnyNewWindowCreated != null) { ObjectDisplayManager.AnyNewWindowCreated(newWindow); } #endregion if (newGrid != null) { #if SILVERLIGHT throw new NotImplementedException(); #else newGrid.ContentManagerName = ContentManagerName; return(newGrid); #endif } else if (newListDisplayWindow != null) { #if SILVERLIGHT throw new NotImplementedException(); #else newListDisplayWindow.ContentManagerName = ContentManagerName; return(newListDisplayWindow); #endif } else { // This is probably a custom UI element created by the user, so we'll let it slide :) return(objectToReturn); } }
private void CreateListDisplayWindows() { float listDisplayWindowScaleX = 14; float listDisplayWindowScaleY = 16; #region AxisAlignedRectangle PropertyGrid Initialization mAxisAlignedRectangles = new ListDisplayWindow(this.mCursor); mAxisAlignedRectangles.ScaleX = listDisplayWindowScaleX; mAxisAlignedRectangles.ScaleY = listDisplayWindowScaleY; mAxisAlignedRectangles.ListBox.Highlight += AxisAlignedRectangleListBoxClick; mAxisAlignedRectangles.ConsiderAttachments = true; SetMemberDisplayName("AxisAlignedRectangles", ""); #endregion #region AxisAlignedCube PropertyGrid Initialization mAxisAlignedCubes = new ListDisplayWindow(this.mCursor); mAxisAlignedCubes.ScaleX = listDisplayWindowScaleX; mAxisAlignedCubes.ScaleY = listDisplayWindowScaleY; mAxisAlignedCubes.ListBox.Highlight += AxisAlignedCubeListBoxClick; mAxisAlignedCubes.ConsiderAttachments = true; SetMemberDisplayName("AxisAlignedCubes", ""); #endregion #region Circle PropertyGrid Initialization mCircles = new ListDisplayWindow(this.mCursor); mCircles.ScaleX = listDisplayWindowScaleX; mCircles.ScaleY = listDisplayWindowScaleY; mCircles.ListBox.Highlight += CircleListBoxClick; mCircles.ConsiderAttachments = true; SetMemberDisplayName("Circles", ""); #endregion #region Sphere PropertyGrid Initialization mSpheres = new ListDisplayWindow(this.mCursor); mSpheres.ScaleX = listDisplayWindowScaleX; mSpheres.ScaleY = listDisplayWindowScaleY; mSpheres.ListBox.Highlight += SphereListBoxClick; mSpheres.ConsiderAttachments = true; SetMemberDisplayName("Spheres", ""); #endregion #region Polygon PropertyGrid Initialization mPolygons = new ListDisplayWindow(this.mCursor); mPolygons.ScaleX = listDisplayWindowScaleX; mPolygons.ScaleY = listDisplayWindowScaleY; mPolygons.ListBox.Highlight += PolygonListBoxClick; mPolygons.ConsiderAttachments = true; SetMemberDisplayName("Polygons", ""); #endregion #region Replace the UI elements with the newly-created ListDisplayWindows // Call ReplaceMemberUIElement last // because it calls UpdateDisplayedProperties // which calls UpdateToList on all ListDisplayWindows. // If all aren't created before UpdateToList is called, // then we'll get a NullReferenceException. this.ReplaceMemberUIElement("Spheres", mSpheres); this.ReplaceMemberUIElement("Circles", mCircles); this.ReplaceMemberUIElement("AxisAlignedCubes", mAxisAlignedCubes); this.ReplaceMemberUIElement("AxisAlignedRectangles", mAxisAlignedRectangles); this.ReplaceMemberUIElement("Polygons", mPolygons); #endregion }
public SplinePropertyGrid(Cursor cursor) : base(cursor) { #region Exclude Members ExcludeMember("Visible"); ExcludeMember("IsReadOnly"); ExcludeMember("SplinePointVisibleRadius"); ExcludeMember("PathColor"); ExcludeMember("PointColor"); ExcludeMember("Length"); #endregion #region Create the ListDisplayWindow for this mListDisplayWindow = new ListDisplayWindow(cursor); mListDisplayWindow.ScaleX = 10; mListDisplayWindow.ScaleY = 20; Button button = mListDisplayWindow.EnableAddingToList(typeof(SplinePoint)); button.Text = "Add Point"; button.X += 1; button.ScaleX += 1; button = mListDisplayWindow.EnableRemovingFromList(); button.Text = "Remove Point"; button.X += 1; button.ScaleX += 1; mListDisplayWindow.ShowPropertyGridOnStrongSelect = true; mListDisplayWindow.AfterAddItem += AdjustNewSplinePoint; mListDisplayWindow.ListBox.StrongSelectOnHighlight = true; mListDisplayWindow.ListBox.Highlight += NewPointHighlighted; if (mSelectedObject != null) { mListDisplayWindow.ObjectDisplaying = this.ObjectDisplaying; } if (this.mUndoInstructions != null) { mListDisplayWindow.UndoInstructions = mUndoInstructions; } this.AddWindow(mListDisplayWindow, "Points"); this.AfterUpdateDisplayedProperties += UpdateListDisplayWindow; #endregion #region Create the Scale Point Time Button Button scalePointTime = new Button(mCursor); scalePointTime.Text = "Scale Point Time"; scalePointTime.ScaleX = 10; scalePointTime.ScaleY = 1.3f; this.AddWindow(scalePointTime, "Points"); scalePointTime.Click += ScalePointTimeClick; #endregion #region Create the Scale Point Position Button Button scalePointPosition = new Button(mCursor); scalePointPosition.Text = "Scale Point Position"; scalePointPosition.ScaleX = 10; scalePointPosition.ScaleY = 1.3f; this.AddWindow(scalePointPosition, "Points"); scalePointPosition.Click += ScalePointPositionClick; #endregion #region Create the "Set Spline Start to 0" Button Button setSplineStartTo0 = new Button(mCursor); setSplineStartTo0.Text = "Set Spline Start to 0"; setSplineStartTo0.ScaleX = 10; setSplineStartTo0.ScaleY = 1.3f; this.AddWindow(setSplineStartTo0, "Points"); setSplineStartTo0.Click += SetSplineStartTo0Click; #endregion SelectCategory("Uncategorized"); }
private static ListDisplayWindow CreateListDisplayWindowForObject(object objectToCreateWindowFor) { ListDisplayWindow listDisplayWindow = new ListDisplayWindow(GuiManager.Cursor); GuiManager.AddWindow(listDisplayWindow); listDisplayWindow.HasMoveBar = true; listDisplayWindow.HasCloseButton = true; listDisplayWindow.Resizable = true; listDisplayWindow.ListShowing = mObjectToSerialize as IEnumerable; listDisplayWindow.Closing += GuiManager.RemoveWindow; // listDisplayWindow.EnableAddingToList(); Button saveButton = new Button(GuiManager.Cursor); saveButton.Text = "Save Object as XML"; saveButton.ScaleX = 9f; saveButton.Click += XmlSeralizeObject; listDisplayWindow.AddWindow(saveButton); Button loadButton = new Button(GuiManager.Cursor); loadButton.Text = "Load Object from XML"; loadButton.ScaleX = 9f; loadButton.Click += XmlDeserializeObject; listDisplayWindow.AddWindow(loadButton); listDisplayWindow.MinimumScaleX = 10; return listDisplayWindow; }
public static ListDisplayWindow CreateListDisplayWindowForObject(object displayedObject, Cursor cursor) { ListDisplayWindow listDisplayWindow = new ListDisplayWindow(cursor); listDisplayWindow.HasMoveBar = true; listDisplayWindow.HasCloseButton = true; listDisplayWindow.Resizable = true; listDisplayWindow.ShowPropertyGridOnStrongSelect = true; listDisplayWindow.PrependIndex = true; listDisplayWindow.ListShowing = displayedObject as IEnumerable; // try to enable adding and removing - this is so common we're going to make it the default listDisplayWindow.EnableAddingToList(); listDisplayWindow.EnableRemovingFromList(); return listDisplayWindow; }
public RectanglePropertyGrid(Cursor cursor, ListDisplayWindow windowOfObject, int indexOfObject) : base(cursor, windowOfObject, indexOfObject) { ExcludeMembers(); }
public ListWindow(ToolsWindow toolsWindow) : base(GuiManager.Cursor) { #region Set engine and common SpriteEditor references this.messages = GuiData.messages; this.mToolsWindow = toolsWindow; #endregion #region Set "this" properties GuiManager.AddWindow(this); this.ScaleX = 13f; this.ScaleY = 20f; base.SetPositionTL(this.ScaleX, 25.7f); base.HasMoveBar = true; base.HasCloseButton = true; base.mName = "Object List"; base.Resizing += new GuiMessage(this.PositionContainedElements); base.Resizable = true; base.MinimumScaleX = 10f; base.MinimumScaleY = 5f; #endregion #region spriteListBox SpriteListBox = new ListDisplayWindow(GuiManager.Cursor); SpriteListBox.DrawBorders = false; SpriteListBox.ListBox.TakingInput = false; // allows input like delete, keyboard camera movement to fall through SpriteListBox.ListBox.ShiftClickOn = true; SpriteListBox.ListBox.CtrlClickOn = true; this.SpriteListBox.ListBox.Push += new GuiMessage(spriteListBoxClick); this.SpriteListBox.ListBox.DoubleClick += new GuiMessage(spriteListBoxDoubleClick); this.SpriteListBox.Lined = true; this.AddWindow(SpriteListBox); SpriteListBox.ListBox.FocusUpdate += SpriteListFocusUpdate; SpriteListBox.ConsiderAttachments = true; #endregion #region gridListBox property setting SpriteGridListBox = new ListDisplayWindow(GuiManager.Cursor); SpriteGridListBox.DrawBorders = false; this.SpriteGridListBox.Visible = false; this.SpriteGridListBox.ListBox.Push += new GuiMessage(this.GridListBoxClick); this.SpriteGridListBox.ListBox.DoubleClick += new GuiMessage(this.messages.GridListBoxDoubleClick); SpriteGridListBox.ListBox.FocusUpdate += SpriteGridListFocusUpdate; AddWindow(SpriteGridListBox); #endregion #region SpriteFrameListBox SpriteFrameListBox = new ListDisplayWindow(GuiManager.Cursor); SpriteFrameListBox.DrawBorders = false; SpriteFrameListBox.ListBox.TakingInput = false; // allows input like delete, keyboard camera movement to fall through this.SpriteFrameListBox.Visible = false; this.SpriteFrameListBox.ListBox.Push += new GuiMessage(this.FrameListBoxClick); AddWindow(SpriteFrameListBox); SpriteFrameListBox.ConsiderAttachments = true; #endregion #region ModelListBox mModelListBox = new ListDisplayWindow(GuiManager.Cursor); mModelListBox.DrawBorders = false; this.mModelListBox.Visible = false; this.mModelListBox.ListBox.Push += new GuiMessage(this.ModelListBoxClick); this.AddWindow(ModelListBox); mModelListBox.ConsiderAttachments = true; #endregion #region TextListBox mTextListBox = new ListDisplayWindow(GuiManager.Cursor); mTextListBox.DrawBorders = false; mTextListBox.Visible = false; mTextListBox.ListBox.Push += TextListBoxClick; this.AddWindow(mTextListBox); mTextListBox.ConsiderAttachments = true; #endregion #region TextureListBox this.textureListBox = new CollapseListBox(mCursor); AddWindow(textureListBox); this.textureListBox.Visible = false; this.textureListBox.Highlight += new GuiMessage(TextureListBoxClick); this.textureListBox.FocusUpdate += TextureListBoxFocusUpdate; #endregion #region AnimationChain List Box mAnimationChainListWindow = new ListDisplayWindow(GuiManager.Cursor); mAnimationChainListWindow.DrawBorders = false; mAnimationChainListWindow.Visible = false; mAnimationChainListWindow.ListBox.Highlight += AnimationChainListBoxClick; this.AddWindow(mAnimationChainListWindow); #endregion this.PositionContainedElements(this); float buttonScale = 1.3f; #region Create the EditSprites ToggleButton this.editSprites = new ToggleButton(mCursor); AddWindow(editSprites); this.editSprites.ScaleX = this.editSprites.ScaleY = buttonScale; this.editSprites.SetPositionTL(buttonScale + .4f, 1.5f); this.editSprites.Text = "Edit Sprites"; this.editSprites.SetOverlayTextures(3, 1); this.editSprites.Press(); this.editSprites.Click += new GuiMessage(this.EditSpritesClick); #endregion #region Edit SpriteGrids this.editGrids = new ToggleButton(mCursor); AddWindow(editGrids); this.editGrids.ScaleX = this.editGrids.ScaleY = buttonScale; this.editGrids.SetPositionTL(3 * buttonScale + .4f, 1.5f); this.editGrids.Text = "Edit Grids"; this.editGrids.SetOverlayTextures(4, 1); this.editSprites.AddToRadioGroup(this.editGrids); this.editGrids.Click += new GuiMessage(this.EditGridsClick); this.editGrids.SetOneAlwaysDown(true); #endregion #region Edit SpriteFrames toggle button this.editSpriteFrames = new ToggleButton(mCursor); AddWindow(editSpriteFrames); this.editSpriteFrames.ScaleX = this.editSpriteFrames.ScaleY = buttonScale; this.editSpriteFrames.SetPositionTL(5 * buttonScale + .4f, 1.5f); this.editSpriteFrames.Text = "Edit SpriteFrames"; this.editSpriteFrames.SetOverlayTextures(0, 3); this.editSprites.AddToRadioGroup(this.editSpriteFrames); this.editSpriteFrames.Click += new GuiMessage(this.EditFramesClick); this.editSpriteFrames.SetOneAlwaysDown(true); #endregion #region editModels this.editModels = new ToggleButton(mCursor); AddWindow(editModels); this.editModels.ScaleX = this.editModels.ScaleY = buttonScale; this.editModels.SetPositionTL(7 * buttonScale + .4f, 1.5f); this.editModels.Text = "Edit Models"; this.editModels.SetOverlayTextures(4, 3); this.editSprites.AddToRadioGroup(this.editModels); this.editModels.Click += new GuiMessage(this.EditModelsClick); this.editModels.SetOneAlwaysDown(true); #endregion #region EditTexts this.mEditTexts = new ToggleButton(mCursor); AddWindow(mEditTexts); this.mEditTexts.ScaleX = this.mEditTexts.ScaleY = buttonScale; this.mEditTexts.SetPositionTL(9 * buttonScale + .4f, 1.5f); this.mEditTexts.Text = "Edit Texts"; this.mEditTexts.SetOverlayTextures(6, 3); this.editSprites.AddToRadioGroup(this.mEditTexts); this.mEditTexts.Click += new GuiMessage(this.EditTextsClick); this.mEditTexts.SetOneAlwaysDown(true); #endregion #region View Textures icon this.mViewTexturesButton = new Button(mCursor); AddWindow(mViewTexturesButton); this.mViewTexturesButton.ScaleX = this.mViewTexturesButton.ScaleY = buttonScale; this.mViewTexturesButton.SetPositionTL(11 * buttonScale + .4f + .7f, 1.5f); this.mViewTexturesButton.Text = "View Textures"; this.mViewTexturesButton.SetOverlayTextures(2, 3); // no longer a ToggleButton and it shouldn't be part of the group //this.editSprites.AddToRadioGroup(this.editTextures); //this.editTextures.SetOneAlwaysDown(true); this.mViewTexturesButton.Click += new GuiMessage(this.EditTexturesClick); #endregion #region Vew AnimationChains icon this.mViewAnimationChainsButton = new Button(mCursor); AddWindow(mViewAnimationChainsButton); this.mViewAnimationChainsButton.ScaleX = this.mViewAnimationChainsButton.ScaleY = buttonScale; this.mViewAnimationChainsButton.SetPositionTL(13 * buttonScale + .4f + .7f, 1.5f); this.mViewAnimationChainsButton.Text = "View AnimationChains"; this.mViewAnimationChainsButton.SetOverlayTextures(7, 3); // no longer a ToggleButton and it shouldn't be part of the group //this.editSprites.AddToRadioGroup(this.editTextures); //this.editTextures.SetOneAlwaysDown(true); this.mViewAnimationChainsButton.Click += new GuiMessage(this.ViewAnimationChainsClick); #endregion RefreshListsShown(); }
public PositionedModelPropertyGrid(Cursor cursor) : base(cursor) { ExcludeAllMembers(); #region Include Basic Members IncludeMember("X", "Basic"); IncludeMember("Y", "Basic"); IncludeMember("Z", "Basic"); IncludeMember("RotationX", "Basic"); IncludeMember("RotationY", "Basic"); IncludeMember("RotationZ", "Basic"); // IncludeMember("Visible", "Basic"); IncludeMember("CursorSelectable", "Basic"); IncludeMember("Name", "Basic"); IncludeMember("IsAutomaticallyUpdated", "Basic"); IncludeMember("Visible", "Basic"); #endregion #region Include "Scale" members IncludeMember("ScaleX", "Scale"); IncludeMember("ScaleY", "Scale"); IncludeMember("ScaleZ", "Scale"); #if !FRB_MDX IncludeMember("FlipX", "Scale"); IncludeMember("FlipY", "Scale"); IncludeMember("FlipZ", "Scale"); #endif #endregion #region Include "Rendering" members IncludeMember("FaceCullMode", "Rendering"); #endregion #region Include Relative Members IncludeMember("RelativeX", "Relative"); IncludeMember("RelativeY", "Relative"); IncludeMember("RelativeZ", "Relative"); IncludeMember("RelativeRotationX", "Relative"); IncludeMember("RelativeRotationY", "Relative"); IncludeMember("RelativeRotationZ", "Relative"); #endregion #region Include Animation Members #if FRB_XNA //IncludeMember("HasAnimation", "Animation"); //IncludeMember("Animate", "Animation"); //IncludeMember("CurrentAnimation", "Animation"); //mCurrentAnimationComboBox = new ComboBox(GuiManager.Cursor); //mCurrentAnimationComboBox.ScaleX = 6; //ReplaceMemberUIElement("CurrentAnimation", mCurrentAnimationComboBox); mHierarchyFileTextBox = new FileTextBox(GuiManager.Cursor); mHierarchyFileTextBox.ScaleY = 1.5f; mHierarchyFileTextBox.ScaleX = 15; List <string> fileTypes = new List <string>(); fileTypes.Add("wbi"); fileTypes.Add("whe"); mHierarchyFileTextBox.SetFileType(fileTypes); this.AddWindow(mHierarchyFileTextBox, "Animation"); mHierarchyFileTextBox.FileSelect += new GuiMessage(LoadSkeleton); mAnimationListDisplayWindow = new ListDisplayWindow(cursor); mAnimationListDisplayWindow.ScaleX = 15; mAnimationListDisplayWindow.ScaleY = 15; mAnimationListDisplayWindow.ListBox.StrongSelect += new GuiMessage(StrongSelectAnimation); mAnimationListDisplayWindow.ListBox.Highlight += new GuiMessage(ShowAnimationPropertyGrid); this.AddWindow(mAnimationListDisplayWindow, "Animation"); mAddAnimationButton = new Button(GuiManager.Cursor); mAddAnimationButton.Text = "Add Animation"; mAddAnimationButton.ScaleX = 8.5f; mAddAnimationButton.ScaleY = 1.5f; this.AddWindow(mAddAnimationButton, "Animation"); mAddAnimationButton.Click += new GuiMessage(AddAnimationClick); mRemoveAllAnimationDataButton = new Button(cursor); mRemoveAllAnimationDataButton.Text = "Remove All Anim Data"; mRemoveAllAnimationDataButton.ScaleX = 8.5f; mRemoveAllAnimationDataButton.ScaleY = 1.5f; this.AddWindow(mRemoveAllAnimationDataButton, "Animation"); mRemoveAllAnimationDataButton.Click += new GuiMessage(RemoveAllAnimationButtonClick); mAnimationListDisplayWindow.EnableRemovingFromList(); #endif #endregion #region Remove Uncategorized and set default category RemoveCategory("Uncategorized"); SelectCategory("Basic"); #endregion #if FRB_XNA PropertyGrid.SetPropertyGridTypeAssociation(typeof(Animation3DInstance), typeof(Animation3DInstancePropertyGrid)); #endif ShowIColorableProperties(); this.X = this.ScaleX; this.Y = this.ScaleY + Window.MoveBarHeight + 3; }