public void Ctor_PropertyTab_PropertyTab(PropertyTab oldTab, PropertyTab newTab) { var e = new PropertyTabChangedEventArgs(oldTab, newTab); Assert.Equal(oldTab, e.OldTab); Assert.Equal(newTab, e.NewTab); }
private void AddPropertyTab(PropertyTab tab) { RadioToolButton rtb; if (propertyTabs.Count == 0) { selectedTab = tab; rtb = new RadioToolButton(new GLib.SList(IntPtr.Zero), Stock.MissingImage); rtb.Active = true; } else { rtb = new RadioToolButton((RadioToolButton)toolbar.GetNthItem(propertyTabs.Count + FirstTabIndex - 1)); } //load image from PropertyTab's bitmap if (tab.Bitmap != null) { rtb.IconWidget = new Gtk.Image(ImageToPixbuf(tab.Bitmap)); } else { rtb.IconWidget = new Gtk.Image(Stock.MissingImage, IconSize.SmallToolbar); } rtb.SetTooltip(tips, tab.TabName, null); rtb.Toggled += new EventHandler(toolbarClick); toolbar.Insert(rtb, propertyTabs.Count + FirstTabIndex); propertyTabs.Add(tab); }
public EditCanvas(PropertyTab owner, GridItem item) { this.owner = owner; this.item = item; this.editmode = false; this.isreadonly = !this.item.TypeConverter.CanConvertFrom(this.item as ITypeDescriptorContext, typeof(string)) || !this.item.TypeConverter.CanConvertTo(this.item as ITypeDescriptorContext, typeof(string)); }
public CustomMenuItem(PropertyTab ownerTab, string text, EventHandler handler) : base(text) { this.ownerTab = ownerTab; if (handler != null) { base.Click += handler; } }
internal SingleSelectRootGridEntry( PropertyGridView view, object value, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType) : this(view, value, null, baseProvider, host, tab, sortType) { }
internal SingleSelectRootGridEntry(PropertyGridView gridEntryHost, object value, GridEntry parent, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType) : base(gridEntryHost.OwnerGrid, parent) { this.host = host; this.gridEntryHost = gridEntryHost; this.baseProvider = baseProvider; this.tab = tab; this.objValue = value; this.objValueClassName = TypeDescriptor.GetClassName(this.objValue); this.IsExpandable = true; base.PropertySort = sortType; this.InternalExpanded = true; }
protected override void Dispose(bool disposing) { if (disposing) { host = null; baseProvider = null; tab = null; gridEntryHost = null; changeService = null; } this.objValue = null; this.propDefault = null; base.Dispose(disposing); }
internal SingleSelectRootGridEntry(PropertyGridView gridEntryHost, object value, GridEntry parent, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType) : base(parent) { Debug.Assert(value != null, "Can't browse a null object!"); this.host = host; this.gridEntryHost = gridEntryHost; this.baseProvider = baseProvider; this.tab = tab; this.objValue = value; this.IsExpandable = true; // default to categories this.PropertySort = sortType; this.InternalExpanded = true; }
internal SingleSelectRootGridEntry(PropertyGridView gridEntryHost, object value, GridEntry parent, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType) : base(gridEntryHost.OwnerGrid, parent) { Debug.Assert(value is not null, "Can't browse a null object!"); this.host = host; this.gridEntryHost = gridEntryHost; this.baseProvider = baseProvider; this.tab = tab; objValue = value; objValueClassName = TypeDescriptor.GetClassName(objValue); IsExpandable = true; // default to categories PropertySort = sortType; InternalExpanded = true; }
public override void InitTab(SerializedProperty property, List <PropertyTab> tabs) { base.InitTab(property, tabs); var tab1 = new PropertyTab(); tab1.icon = new GUIContent("UI");//EditorGUIUtility.IconContent("Font Icon"); tab1.contents = new List <ItemContent>() { new ItemContent(property, ItemType.Header, "UI Binding") { enableCallback = () => !isEditingScriptableObject(property) }, new ItemContent(property, ItemType.Property, "target") }; tabs.Add(tab1); }
public override void InitTab(SerializedProperty property, List <PropertyTab> tabs) { base.InitTab(property, tabs); var tab1 = new PropertyTab(); tab1.icon = new GUIContent("UI"); //EditorGUIUtility.IconContent("Font Icon"); tab1.contents = new List <ItemContent>() { new ItemContent(property, ItemType.HeaderButton, "Binding", "Find", () => { var attempt = GameObject.Find(property.displayName); TMPro.TextMeshProUGUI temp; if (attempt && (temp = attempt.GetComponent <TMPro.TextMeshProUGUI>())) { tab1.contents[1].property.objectReferenceValue = temp; } else { Debug.LogWarning("Couldn't find any matched SpriteRenderer for (" + property.displayName + ")"); } }) { enableCallback = () => !isEditingScriptableObject(property) }, new ItemContent(property, ItemType.Property, "target") { enableCallback = () => !isEditingScriptableObject(property) }, }; tabs.Add(tab1); tabs.Add(new PropertyTab() { icon = new GUIContent("Events"),//EditorGUIUtility.IconContent("EventSystem Icon"), contents = new List <ItemContent>() { new ItemContent(property, ItemType.Header, "Event"), new ItemContent(property, ItemType.Property, "valueChanged") } }); }
internal SingleSelectRootGridEntry( PropertyGridView ownerGridView, object target, IServiceProvider baseProvider, IDesignerHost host, PropertyTab ownerTab, PropertySort sortType) : base(ownerGridView.OwnerGrid, parent: null) { Debug.Assert(target is not null, "Can't browse a null object!"); _host = host; _ownerGridView = ownerGridView; _baseProvider = baseProvider; _ownerTab = ownerTab; Target = target; _valueClassName = TypeDescriptor.GetClassName(Target); IsExpandable = true; // Default to categories. _propertySort = sortType; InternalExpanded = true; }
void toolbarClick(object sender, EventArgs e) { if (sender == alphButton) { PropertySort = System.Windows.Forms.PropertySort.Alphabetical; } else if (sender == catButton) { PropertySort = System.Windows.Forms.PropertySort.Categorized; } else { int index = toolbar.GetItemIndex((RadioToolButton)sender) - FirstTabIndex; PropertyTab tab = (PropertyTab)propertyTabs[index]; if (selectedTab == tab) { return; } selectedTab = tab; Populate(); } }
public PropertyTabChangedEventArgs(PropertyTab oldTab, PropertyTab newTab) { old_tab = oldTab; new_tab = newTab; }
// this returns an array list of the propertydescriptor arrays, one for each // component // private static ArrayList GetCommonProperties(object[] objs, bool presort, PropertyTab tab, GridEntry parentEntry) { PropertyDescriptorCollection[] propCollections = new PropertyDescriptorCollection[objs.Length]; Attribute[] attrs = new Attribute[parentEntry.BrowsableAttributes.Count]; parentEntry.BrowsableAttributes.CopyTo(attrs, 0); for (int i = 0; i < objs.Length; i++) { PropertyDescriptorCollection pdc = tab.GetProperties(parentEntry, objs[i], attrs); if (presort) { pdc = pdc.Sort(PropertyComparer); } propCollections[i] = pdc; } ArrayList mergedList = new ArrayList(); PropertyDescriptor[] matchArray = new PropertyDescriptor[objs.Length]; // // Merge the property descriptors // int[] posArray = new int[propCollections.Length]; for (int i = 0; i < propCollections[0].Count; i++) { PropertyDescriptor pivotDesc = propCollections[0][i]; bool match = pivotDesc.Attributes[typeof(MergablePropertyAttribute)].IsDefaultAttribute(); for (int j = 1; match && j < propCollections.Length; j++) { if (posArray[j] >= propCollections[j].Count) { match = false; break; } // check to see if we're on a match // PropertyDescriptor jProp = propCollections[j][posArray[j]]; if (pivotDesc.Equals(jProp)) { posArray[j] += 1; if (!jProp.Attributes[typeof(MergablePropertyAttribute)].IsDefaultAttribute()) { match = false; break; } matchArray[j] = jProp; continue; } int jPos = posArray[j]; jProp = propCollections[j][jPos]; match = false; // if we aren't on a match, check all the items until we're past // where the matching item would be while (PropertyComparer.Compare(jProp, pivotDesc) <= 0) { // got a match! if (pivotDesc.Equals(jProp)) { if (!jProp.Attributes[typeof(MergablePropertyAttribute)].IsDefaultAttribute()) { match = false; jPos++; } else { match = true; matchArray[j] = jProp; posArray[j] = jPos + 1; } break; } // try again jPos++; if (jPos < propCollections[j].Count) { jProp = propCollections[j][jPos]; } else { break; } } // if we got here, there is no match, quit for this guy if (!match) { posArray[j] = jPos; break; } } // do we have a match? if (match) { matchArray[0] = pivotDesc; mergedList.Add(matchArray.Clone()); } } return(mergedList); }
public override void InitTab(SerializedProperty property, List <PropertyTab> tabs) { base.InitTab(property, tabs); var tab1 = new PropertyTab(); tab1.icon = new GUIContent(); //EditorGUIUtility.IconContent("Font Icon"); tab1.icon.text = "UI"; tab1.contents = new List <ItemContent>() { new ItemContent(property, ItemType.HeaderButton, "UI Binding", "Find", () => { var attempt = GameObject.Find(property.name); if (attempt) { tab1.contents[1].property.objectReferenceValue = attempt; Debug.Log("Bind (" + property.name + ")"); } else { Debug.LogWarning("Couldn't find any matched UI for (" + property.name + ")"); } }) { enableCallback = () => !isEditingScriptableObject(property) }, new ItemContent(property, ItemType.Property, "target") { enableCallback = () => !isEditingScriptableObject(property) }, new ItemContent(property, ItemType.Header, "Extra"), new ItemContent(property, ItemType.Property, "prefix"), new ItemContent(property, ItemType.Property, "suffix") }; tabs.Add(tab1); tabs.Add(new PropertyTab() { icon = new GUIContent("Events"),//EditorGUIUtility.IconContent("EventSystem Icon"), contents = new List <ItemContent>() { new ItemContent(property, ItemType.Header, "Event"), new ItemContent(property, ItemType.Property, "valueChanged") } }); var tab3 = new PropertyTab(); tab3.icon = new GUIContent("Save");//EditorGUIUtility.IconContent("_Popup"); tab3.contents = new List <ItemContent>() { new ItemContent(property, ItemType.HeaderButton, "Persistance", "Auto", () => { tab3.contents[1].property.boolValue = true; var name = property.serializedObject.targetObject.name; tab3.contents[2].property.stringValue = ToCamelCase(name) + "." + property.propertyPath; // ToCamelCase(name) + property.displayName.Replace(" ",""); }), new ItemContent(property, ItemType.Property, "persistance"), new ItemContent(property, ItemType.Property, "key") { enableIf = property.FindPropertyRelative("persistance"), }, new ItemContent(property, ItemType.HeaderButton, "Player Prefs", "Reset", () => { PlayerPrefs.DeleteKey(property.FindPropertyRelative("key").stringValue); }) { enableIf = property.FindPropertyRelative("persistance"), } }; tabs.Add(tab3); }
public PropertyTabChangedEventArgs(PropertyTab oldTab, PropertyTab newTab) { OldTab = oldTab; NewTab = newTab; }
public static MultiPropertyDescriptorGridEntry[] GetMergedProperties(object[] rgobjs, GridEntry parentEntry, PropertySort sort, PropertyTab tab) { MultiPropertyDescriptorGridEntry[] entryArray = null; try { int length = rgobjs.Length; if ((sort & PropertySort.Alphabetical) != PropertySort.NoSort) { ArrayList list = GetCommonProperties(rgobjs, true, tab, parentEntry); MultiPropertyDescriptorGridEntry[] entryArray2 = new MultiPropertyDescriptorGridEntry[list.Count]; for (int k = 0; k < entryArray2.Length; k++) { entryArray2[k] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[])list[k], false); } return(SortParenEntries(entryArray2)); } object[] destinationArray = new object[length - 1]; Array.Copy(rgobjs, 1, destinationArray, 0, length - 1); ArrayList sortedMergedEntries = GetCommonProperties(destinationArray, true, tab, parentEntry); ArrayList list3 = GetCommonProperties(new object[] { rgobjs[0] }, false, tab, parentEntry); PropertyDescriptor[] baseEntries = new PropertyDescriptor[list3.Count]; for (int i = 0; i < list3.Count; i++) { baseEntries[i] = ((PropertyDescriptor[])list3[i])[0]; } sortedMergedEntries = UnsortedMerge(baseEntries, sortedMergedEntries); MultiPropertyDescriptorGridEntry[] entries = new MultiPropertyDescriptorGridEntry[sortedMergedEntries.Count]; for (int j = 0; j < entries.Length; j++) { entries[j] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[])sortedMergedEntries[j], false); } entryArray = SortParenEntries(entries); } catch { } return(entryArray); }
private static ArrayList GetCommonProperties(object[] objs, bool presort, PropertyTab tab, GridEntry parentEntry) { PropertyDescriptorCollection[] descriptorsArray = new PropertyDescriptorCollection[objs.Length]; Attribute[] array = new Attribute[parentEntry.BrowsableAttributes.Count]; parentEntry.BrowsableAttributes.CopyTo(array, 0); for (int i = 0; i < objs.Length; i++) { PropertyDescriptorCollection descriptors = tab.GetProperties(parentEntry, objs[i], array); if (presort) { descriptors = descriptors.Sort(MultiSelectRootGridEntry.PropertyComparer); } descriptorsArray[i] = descriptors; } ArrayList list = new ArrayList(); PropertyDescriptor[] descriptorArray = new PropertyDescriptor[objs.Length]; int[] numArray = new int[descriptorsArray.Length]; for (int j = 0; j < descriptorsArray[0].Count; j++) { PropertyDescriptor descriptor = descriptorsArray[0][j]; bool flag = descriptor.Attributes[typeof(MergablePropertyAttribute)].IsDefaultAttribute(); for (int k = 1; flag && (k < descriptorsArray.Length); k++) { if (numArray[k] >= descriptorsArray[k].Count) { flag = false; break; } PropertyDescriptor descriptor2 = descriptorsArray[k][numArray[k]]; if (descriptor.Equals(descriptor2)) { numArray[k]++; if (!descriptor2.Attributes[typeof(MergablePropertyAttribute)].IsDefaultAttribute()) { flag = false; break; } descriptorArray[k] = descriptor2; continue; } int num4 = numArray[k]; descriptor2 = descriptorsArray[k][num4]; flag = false; while (MultiSelectRootGridEntry.PropertyComparer.Compare(descriptor2, descriptor) <= 0) { if (descriptor.Equals(descriptor2)) { if (!descriptor2.Attributes[typeof(MergablePropertyAttribute)].IsDefaultAttribute()) { flag = false; num4++; } else { flag = true; descriptorArray[k] = descriptor2; numArray[k] = num4 + 1; } break; } num4++; if (num4 >= descriptorsArray[k].Count) { break; } descriptor2 = descriptorsArray[k][num4]; } if (!flag) { numArray[k] = num4; break; } } if (flag) { descriptorArray[0] = descriptor; list.Add(descriptorArray.Clone()); } } return(list); }
public PropertyTabChangedEventArgs(PropertyTab oldTab, PropertyTab newTab) { this.oldTab = oldTab; this.newTab = newTab; }
public static MultiPropertyDescriptorGridEntry[] GetMergedProperties( object[] objects, GridEntry parentEntry, PropertySort sort, PropertyTab tab) { MultiPropertyDescriptorGridEntry[] result = null; try { int length = objects.Length; if ((sort & PropertySort.Alphabetical) != 0) { ArrayList commonProperties = GetCommonProperties(objects, presort: true, tab, parentEntry); var entries = new MultiPropertyDescriptorGridEntry[commonProperties.Count]; for (int i = 0; i < entries.Length; i++) { entries[i] = new MultiPropertyDescriptorGridEntry( parentEntry.OwnerGrid, parentEntry, objects, (PropertyDescriptor[])commonProperties[i], hide: false); } result = SortParenEntries(entries); } else { object[] sortObjects = new object[length - 1]; Array.Copy(objects, 1, sortObjects, 0, length - 1); ArrayList properties = GetCommonProperties(sortObjects, presort: true, tab, parentEntry); // This will work for just one as well. ArrayList firstProperties = GetCommonProperties(new object[] { objects[0] }, presort: false, tab, parentEntry); var firstPropertyDescriptors = new PropertyDescriptor[firstProperties.Count]; for (int i = 0; i < firstProperties.Count; i++) { firstPropertyDescriptors[i] = ((PropertyDescriptor[])firstProperties[i])[0]; } properties = UnsortedMerge(firstPropertyDescriptors, properties); var entries = new MultiPropertyDescriptorGridEntry[properties.Count]; for (int i = 0; i < entries.Length; i++) { entries[i] = new MultiPropertyDescriptorGridEntry( parentEntry.OwnerGrid, parentEntry, objects, (PropertyDescriptor[])properties[i], hide: false); } result = SortParenEntries(entries); } } catch { } return(result); }
public PropertyTabChangedEventArgs(PropertyTab oldTab, PropertyTab newTab) { throw null; }
private static ArrayList GetCommonProperties(object[] objects, bool presort, PropertyTab tab, GridEntry parentEntry) { var propertyCollections = new PropertyDescriptorCollection[objects.Length]; var attributes = new Attribute[parentEntry.BrowsableAttributes.Count]; parentEntry.BrowsableAttributes.CopyTo(attributes, 0); for (int i = 0; i < objects.Length; i++) { var properties = tab.GetProperties(parentEntry, objects[i], attributes); if (presort) { properties = properties.Sort(s_propertyComparer); } propertyCollections[i] = properties; } ArrayList mergedList = new(); var matchArray = new PropertyDescriptor[objects.Length]; // // Merge the property descriptors // int[] positions = new int[propertyCollections.Length]; for (int i = 0; i < propertyCollections[0].Count; i++) { PropertyDescriptor pivotProperty = propertyCollections[0][i]; bool match = pivotProperty.Attributes[typeof(MergablePropertyAttribute)].IsDefaultAttribute(); for (int j = 1; match && j < propertyCollections.Length; j++) { if (positions[j] >= propertyCollections[j].Count) { match = false; break; } // Check to see if we're on a match. PropertyDescriptor property = propertyCollections[j][positions[j]]; if (pivotProperty.Equals(property)) { positions[j] += 1; if (!property.Attributes[typeof(MergablePropertyAttribute)].IsDefaultAttribute()) { match = false; break; } matchArray[j] = property; continue; } int position = positions[j]; property = propertyCollections[j][position]; match = false; // If we aren't on a match, check all the items until we're past where the matching item would be. while (s_propertyComparer.Compare(property, pivotProperty) <= 0) { // Got a match! if (pivotProperty.Equals(property)) { if (!property.Attributes[typeof(MergablePropertyAttribute)].IsDefaultAttribute()) { match = false; position++; } else { match = true; matchArray[j] = property; positions[j] = position + 1; } break; } // Try again. position++; if (position < propertyCollections[j].Count) { property = propertyCollections[j][position]; } else { break; } } // If we got here, there is no match, quit for this one. if (!match) { positions[j] = position; break; } } // Do we have a match? if (match) { matchArray[0] = pivotProperty; mergedList.Add(matchArray.Clone()); } } return(mergedList); }
internal MultiSelectRootGridEntry(PropertyGridView view, object obj, IServiceProvider baseProvider, IDesignerHost host, PropertyTab tab, PropertySort sortType) : base(view, obj, baseProvider, host, tab, sortType) { }
public static MultiPropertyDescriptorGridEntry[] GetMergedProperties(object[] rgobjs, GridEntry parentEntry, PropertySort sort, PropertyTab tab) { MultiPropertyDescriptorGridEntry[] result = null; try { int cLength = rgobjs.Length; object[] rgobjArgs = new object[1]; if ((sort & PropertySort.Alphabetical) != 0) { ArrayList props = GetCommonProperties(rgobjs, true, tab, parentEntry); MultiPropertyDescriptorGridEntry[] entries = new MultiPropertyDescriptorGridEntry[props.Count]; for (int i = 0; i < entries.Length; i++) { entries[i] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[])props[i], false); } result = SortParenEntries(entries); } else { object[] sortObjs = new object[cLength - 1]; Array.Copy(rgobjs, 1, sortObjs, 0, cLength - 1); ArrayList props = GetCommonProperties(sortObjs, true, tab, parentEntry); // this'll work for just one as well ArrayList firstProps = GetCommonProperties(new object[] { rgobjs[0] }, false, tab, parentEntry); PropertyDescriptor[] firstPds = new PropertyDescriptor[firstProps.Count]; for (int i = 0; i < firstProps.Count; i++) { firstPds[i] = ((PropertyDescriptor[])firstProps[i])[0]; } props = UnsortedMerge(firstPds, props); MultiPropertyDescriptorGridEntry[] entries = new MultiPropertyDescriptorGridEntry[props.Count]; for (int i = 0; i < entries.Length; i++) { entries[i] = new MultiPropertyDescriptorGridEntry(parentEntry.OwnerGrid, parentEntry, rgobjs, (PropertyDescriptor[])props[i], false); } result = SortParenEntries(entries); } } catch { } return(result); }
private record TabInfo(PropertyTab Tab, PropertyTabScope Scope, ToolStripButton Button) {