Beispiel #1
0
 public PropertyTabAttribute(Type tabClass,
                             PropertyTabScope tabScope)
 {
     InitializeArrays
         (new Type[] { tabClass },
         new PropertyTabScope[] { tabScope });
 }
	public PropertyTabAttribute(Type tabClass,
								PropertyTabScope tabScope)
			{
				InitializeArrays
					(new Type[] {tabClass},
					 new PropertyTabScope[] {tabScope});
			}
 /// <devdoc>
 ///    <para>
 ///       Basic constructor that creates a property tab attribute that will create a tab
 ///       of the specified type.
 ///    </para>
 /// </devdoc>
 public PropertyTabAttribute(string tabClassName, PropertyTabScope tabScope) {
     this.tabClassNames = new string[]{ tabClassName};
     if (tabScope < PropertyTabScope.Document) {
         throw new ArgumentException(SR.GetString(SR.PropertyTabAttributeBadPropertyTabScope), "tabScope");
     }
     this.tabScopes  = new PropertyTabScope[]{tabScope};
 }
	public PropertyTabAttribute(String tabClassName,
								PropertyTabScope tabScope)
			{
				InitializeArrays
					(new String[] {tabClassName},
					 new PropertyTabScope[] {tabScope});
			}
Beispiel #5
0
 public PropertyTabAttribute(String tabClassName,
                             PropertyTabScope tabScope)
 {
     InitializeArrays
         (new String[] { tabClassName },
         new PropertyTabScope[] { tabScope });
 }
Beispiel #6
0
 public PropertyTabAttribute(string tabClassName, PropertyTabScope tabScope)
 {
     if (tabClassName == null)
     {
         throw new ArgumentNullException("tabClassName");
     }
     this.InitializeArrays(new string[] { tabClassName }, new PropertyTabScope[] { tabScope });
 }
Beispiel #7
0
 public PropertyTabAttribute(Type tabClass, PropertyTabScope tabScope)
 {
     if (tabClass == null)
     {
         throw new ArgumentNullException("tabClass");
     }
     this.InitializeArrays(new Type[] { tabClass }, new PropertyTabScope[] { tabScope });
 }
Beispiel #8
0
 public void Clear(PropertyTabScope tabScope)
 {
     if (_ownerPropertyGrid is null)
     {
         throw new InvalidOperationException(SR.PropertyGridPropertyTabCollectionReadOnly);
     }
     _ownerPropertyGrid.ClearTabs(tabScope);
 }
Beispiel #9
0
 public void AddTabType(Type propertyTabType, PropertyTabScope tabScope)
 {
     if (_ownerPropertyGrid is null)
     {
         throw new InvalidOperationException(SR.PropertyGridPropertyTabCollectionReadOnly);
     }
     _ownerPropertyGrid.AddTab(propertyTabType, tabScope);
 }
Beispiel #10
0
 /// <summary>
 ///    <para>
 ///       Basic constructor that creates a property tab attribute that will create a tab
 ///       of the specified type.
 ///    </para>
 /// </summary>
 public PropertyTabAttribute(string tabClassName, PropertyTabScope tabScope)
 {
     _tabClassNames = new string[] { tabClassName };
     if (tabScope < PropertyTabScope.Document)
     {
         throw new ArgumentException(SR.Format(SR.PropertyTabAttributeBadPropertyTabScope), nameof(tabScope));
     }
     _tabScopes = new PropertyTabScope[] { tabScope };
 }
Beispiel #11
0
 /// <include file='doc\PropertyTabAttribute.uex' path='docs/doc[@for="PropertyTabAttribute.PropertyTabAttribute4"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Basic constructor that creates a property tab attribute that will create a tab
 ///       of the specified type.
 ///    </para>
 /// </devdoc>
 public PropertyTabAttribute(string tabClassName, PropertyTabScope tabScope)
 {
     this.tabClassNames = new string[] { tabClassName };
     if (tabScope < PropertyTabScope.Document)
     {
         throw new ArgumentException("Scope must be PropertyTabScope.Document or PropertyTabScope.Component");
     }
     this.tabScopes = new PropertyTabScope[] { tabScope };
 }
Beispiel #12
0
 public PropertyTabAttribute(Type tabClass, PropertyTabScope tabScope)
 {
     this.tabClasses = new Type[] { tabClass };
     if (tabScope < PropertyTabScope.Document)
     {
         throw new ArgumentException(SR.GetString("PropertyTabAttributeBadPropertyTabScope"), "tabScope");
     }
     this.tabScopes = new PropertyTabScope[] { tabScope };
 }
 /// <summary>
 ///    <para>
 ///       Basic constructor that creates a property tab attribute that will create a tab
 ///       of the specified type.
 ///    </para>
 /// </summary>
 public PropertyTabAttribute(Type tabClass, PropertyTabScope tabScope)
 {
     _tabClasses = new Type[] { tabClass };
     if (tabScope < PropertyTabScope.Document)
     {
         throw new ArgumentException(SR.Format(SR.PropertyTabAttributeBadPropertyTabScope), "tabScope");
     }
     _tabScopes = new PropertyTabScope[] { tabScope };
 }
Beispiel #14
0
 /// <summary>
 /// Basic constructor that creates a property tab attribute that will create a tab
 /// of the specified type.
 /// </summary>
 public PropertyTabAttribute(Type tabClass, PropertyTabScope tabScope)
 {
     _tabClasses = new Type[] { tabClass };
     if (tabScope < PropertyTabScope.Document)
     {
         throw new ArgumentException(SR.PropertyTabAttributeBadPropertyTabScope, nameof(tabScope));
     }
     TabScopes = new PropertyTabScope[] { tabScope };
 }
 /// <summary>
 ///    <para>
 ///       Basic constructor that creates a property tab attribute that will create a tab
 ///       of the specified type.
 ///    </para>
 /// </summary>
 public PropertyTabAttribute(string tabClassName, PropertyTabScope tabScope)
 {
     _tabClassNames = new string[] { tabClassName };
     if (tabScope < PropertyTabScope.Document)
     {
         throw new ArgumentException(SR.Format(SR.PropertyTabAttributeBadPropertyTabScope), "tabScope");
     }
     _tabScopes = new PropertyTabScope[] { tabScope };
 }
Beispiel #16
0
 /// <summary>
 /// Basic constructor that creates a property tab attribute that will create a tab
 /// of the specified type.
 /// </summary>
 public PropertyTabAttribute(
     // Using PublicParameterlessConstructor to preserve the type. See https://github.com/mono/linker/issues/1878
     [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] string tabClassName,
     PropertyTabScope tabScope)
 {
     _tabClassNames = new string[] { tabClassName };
     if (tabScope < PropertyTabScope.Document)
     {
         throw new ArgumentException(SR.PropertyTabAttributeBadPropertyTabScope, nameof(tabScope));
     }
     TabScopes = new PropertyTabScope[] { tabScope };
 }
 public PropertyTabAttribute(string tabClassName, PropertyTabScope tabScope)
 {
 }
Beispiel #18
0
			internal void InsertTab (int index, PropertyTab propertyTab, PropertyTabScope tabScope)
			{
				if (propertyTab == null)
					throw new ArgumentNullException ("propertyTab");
				
				if (!this.Contains (propertyTab.GetType ())) {
					property_tabs.Insert (index, propertyTab);
					property_tabs_scopes.Insert (index, tabScope);
				}
			}
Beispiel #19
0
			public void AddTabType (Type propertyTabType, PropertyTabScope tabScope)
			{
				if (propertyTabType == null)
					throw new ArgumentNullException ("propertyTabType");

				// Avoid duplicates
				if (this.Contains (propertyTabType))
					return;
				PropertyTab tab = property_grid.CreatePropertyTab (propertyTabType);
				if (tab != null) {
					property_tabs.Add (tab);
					property_tabs_scopes.Add (tabScope);
				}
				property_grid.RefreshToolbar (this);
			}
Beispiel #20
0
		public void RefreshTabs (PropertyTabScope tabScope) 
		{
			property_tabs.Clear (tabScope);
			if (selected_objects != null) {
				Type[] tabTypes = null;
				PropertyTabScope[] tabScopes = null;

				if (events_tab_visible && property_tabs.Contains (typeof (EventsTab)))
					property_tabs.InsertTab (0, properties_tab, PropertyTabScope.Component);

				GetMergedPropertyTabs (selected_objects, out tabTypes, out tabScopes);
				if (tabTypes != null && tabScopes != null && tabTypes.Length > 0) {
					bool selectedTabPreserved = false;
					for (int i=0; i < tabTypes.Length; i++) {
						property_tabs.AddTabType (tabTypes[i], tabScopes[i]);
						if (tabTypes[i] == selected_tab.GetType ())
							selectedTabPreserved = true;
					}
					if (!selectedTabPreserved)
						SelectPropertyTab (properties_tab);
				}
			} else {
				SelectPropertyTab (properties_tab);
			}
			RefreshToolbar (property_tabs);
		}
Beispiel #21
0
			public void Clear (PropertyTabScope tabScope)
			{
				ArrayList toRemove = new ArrayList ();
				for (int i=0; i < property_tabs_scopes.Count; i++) {
					if ((PropertyTabScope)property_tabs_scopes[i] == tabScope)
						toRemove.Add (i);
				}
				foreach (int indexToRemove in toRemove) {
					property_tabs.RemoveAt (indexToRemove);
					property_tabs_scopes.RemoveAt (indexToRemove);
				}
				property_grid.RefreshToolbar (this);
			}
 internal void AddTab(Type tabType, PropertyTabScope scope) {
     AddRefTab(tabType, null, scope, true);
 }
 /// <devdoc>
 /// Clears the tabs of the given scope or smaller.
 /// tabScope must be PropertyTabScope.Component or PropertyTabScope.Document.
 /// </devdoc>
 internal void ClearTabs(PropertyTabScope tabScope) {
     if (tabScope < PropertyTabScope.Document) {
         throw new ArgumentException(SR.GetString(SR.PropertyGridTabScope));
     }
     RemoveTabs(tabScope, true);
 }
Beispiel #24
0
 public void AddTabType(Type propertyTabType, PropertyTabScope tabScope)
 {
     throw null;
 }
        /// <include file='doc\PropertyGrid.uex' path='docs/doc[@for="PropertyGrid.RefreshTabs"]/*' />
        /// <devdoc>
        /// Refreshes the tabs of the given scope by deleting them and requerying objects and documents
        /// for them.
        /// </devdoc>
        public void RefreshTabs(PropertyTabScope tabScope) {
            
            if (tabScope < PropertyTabScope.Document) {
                throw new ArgumentException(SR.GetString(SR.PropertyGridTabScope));
            }

            RemoveTabs(tabScope, false);

            // check the component level tabs
            if (tabScope <= PropertyTabScope.Component) {
                if (currentObjects != null && currentObjects.Length > 0) {
                    // get the subset of PropertyTabs that's common to all objects
                    Type[] tabTypes = GetCommonTabs(currentObjects, PropertyTabScope.Component);

                    for (int i = 0; i < tabTypes.Length; i++) {
                        for (int j = 0; j < currentObjects.Length; j++) {
                            AddRefTab(tabTypes[i], currentObjects[j], PropertyTabScope.Component, false);
                        }
                    }
                }
            }

            // check the document level tabs
            if (tabScope <= PropertyTabScope.Document && designerHost != null) {
                IContainer container = designerHost.Container;
                if (container != null) {
                    ComponentCollection components = container.Components;
                    if (components != null) {
                        foreach (IComponent comp in components) {
                            PropertyTabAttribute attribute = (PropertyTabAttribute) TypeDescriptor.GetAttributes(comp.GetType())[typeof(PropertyTabAttribute)];

                            if (attribute != null) {
                                for (int j = 0; j < attribute.TabClasses.Length; j++) {
                                    if (attribute.TabScopes[j] == PropertyTabScope.Document) {
                                        AddRefTab(attribute.TabClasses[j], comp, PropertyTabScope.Document, false);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            SetupToolbar();
        }
 /// <include file='doc\PropertyGrid.uex' path='docs/doc[@for="PropertyGrid.PropertyTabCollection.AddTabType1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void AddTabType(Type propertyTabType, PropertyTabScope tabScope) {
     if (owner == null) {
         throw new InvalidOperationException(SR.GetString(SR.PropertyGridPropertyTabCollectionReadOnly));
     }
     owner.AddTab(propertyTabType, tabScope);
 }
        public PropertyTabAttribute (Type tabClass, PropertyTabScope tabScope) {
            Contract.Requires((int)tabScope >= 2);

          return default(PropertyTabAttribute);
        }
        internal void RemoveTab(int tabIndex, bool setupToolbar) {
            Debug.Assert(viewTabs != null, "Tab array destroyed!");

            if (tabIndex >= viewTabs.Length || tabIndex < 0) {
                throw new ArgumentOutOfRangeException("tabIndex", SR.GetString(SR.PropertyGridBadTabIndex));
            }

            if (viewTabScopes[tabIndex] == PropertyTabScope.Static) {
                throw new ArgumentException(SR.GetString(SR.PropertyGridRemoveStaticTabs));
            }


            if (selectedViewTab == tabIndex) {
                selectedViewTab = PROPERTIES;
            }
            
            // Remove this tab from our "last selected" group
            //
            if (!GetFlag(ReInitTab) && ActiveDesigner != null) {
               int hashCode = ActiveDesigner.GetHashCode();
               if (designerSelections != null && designerSelections.ContainsKey(hashCode) && (int)designerSelections[hashCode] == tabIndex) {
                  designerSelections.Remove(hashCode);
               }
            }

            ToolStripButton selectedButton = viewTabButtons[selectedViewTab];

            PropertyTab[] newTabs = new PropertyTab[viewTabs.Length - 1];
            Array.Copy(viewTabs, 0, newTabs, 0, tabIndex);
            Array.Copy(viewTabs, tabIndex + 1, newTabs, tabIndex, viewTabs.Length - tabIndex - 1);
            viewTabs = newTabs;

            PropertyTabScope[] newTabScopes = new PropertyTabScope[viewTabScopes.Length - 1];
            Array.Copy(viewTabScopes, 0, newTabScopes, 0, tabIndex);
            Array.Copy(viewTabScopes, tabIndex + 1, newTabScopes, tabIndex, viewTabScopes.Length - tabIndex - 1);
            viewTabScopes = newTabScopes;

            viewTabsDirty = true;

            if (setupToolbar) {
                SetupToolbar();
                selectedViewTab = -1;
                SelectViewTabButtonDefault(selectedButton);
            }
        }
 public PropertyTabAttribute(Type tabClass, PropertyTabScope tabScope)
 {
 }
 public PropertyTabAttribute(string tabClassName, PropertyTabScope tabScope)
 {
 }
 public PropertyTabAttribute(Type tabClass, PropertyTabScope tabScope)
 {
 }
Beispiel #32
0
 public PropertyTabAttribute(Type tabClass, PropertyTabScope tabScope)
 {
     Type[]             tabArray   = { tabClass };
     PropertyTabScope[] scopeArray = { tabScope };
     this.InitializeArrays(tabArray, scopeArray);
 }
Beispiel #33
0
 public PropertyTabAttribute(string tabClassName, PropertyTabScope tabScope)
 {
     string[]           tabArray   = { tabClassName };
     PropertyTabScope[] scopeArray = { tabScope };
     this.InitializeArrays(tabArray, scopeArray);
 }
Beispiel #34
0
        public PropertyTabAttribute(Type tabClass, PropertyTabScope tabScope)
        {
            Contract.Requires((int)tabScope >= 2);

            return(default(PropertyTabAttribute));
        }
        internal void AddRefTab(Type tabType, Object component, PropertyTabScope type, bool setupToolbar) {
            PropertyTab tab = null;
            int tabIndex = -1;

            if (viewTabs != null) {
                // check to see if we've already got a tab of this type
                for (int i = 0; i < viewTabs.Length; i++) {
                    Debug.Assert(viewTabs[i] != null, "Null item in tab array!");
                    if (tabType == viewTabs[i].GetType()) {
                        tab = viewTabs[i];
                        tabIndex = i;
                        break;
                    }
                }
            }
            else {
                tabIndex = 0;
            }

            if (tab == null) {
                // the tabs need service providers. The one we hold onto is not good enough,
                // so try to get the one off of the component's site.
                IDesignerHost host = null;
                if (component != null && component is IComponent && ((IComponent) component).Site != null)
                    host = (IDesignerHost) ((IComponent) component).Site.GetService(typeof(IDesignerHost));

                try
                {
                    tab = CreateTab(tabType, host);
                }
                catch (Exception e)
                {
                    Debug.Fail("Bad Tab.  We're not going to show it. ", e.ToString());
                    return;
                }

                // add it at the end of the array
                if (viewTabs != null) {
                    tabIndex = viewTabs.Length;

                    // find the insertion position...special case for event's and properties
                    if (tabType == DefaultTabType) {
                        tabIndex = PROPERTIES;
                    }
                    else if (typeof(EventsTab).IsAssignableFrom(tabType)) {
                        tabIndex = EVENTS;
                    }
                    else {
                        // order tabs alphabetically, we've always got a property tab, so
                        // start after that
                        for (int i = 1; i < viewTabs.Length; i++) {

                            // skip the event tab
                            if (viewTabs[i] is EventsTab) {
                                continue;
                            }

                            if (String.Compare(tab.TabName, viewTabs[i].TabName, false, CultureInfo.InvariantCulture) < 0) {
                                tabIndex = i;
                                break;
                            }
                        }
                    }
                }

                // now add the tab to the tabs array
                PropertyTab[] newTabs = new PropertyTab[viewTabs.Length + 1];
                Array.Copy(viewTabs, 0, newTabs, 0, tabIndex);
                Array.Copy(viewTabs, tabIndex, newTabs, tabIndex + 1, viewTabs.Length - tabIndex);
                newTabs[tabIndex] = tab;
                viewTabs = newTabs;

                viewTabsDirty = true;

                PropertyTabScope[] newTabScopes = new PropertyTabScope[viewTabScopes.Length + 1];
                Array.Copy(viewTabScopes, 0, newTabScopes, 0, tabIndex);
                Array.Copy(viewTabScopes, tabIndex, newTabScopes, tabIndex + 1, viewTabScopes.Length - tabIndex);
                newTabScopes[tabIndex] = type;
                viewTabScopes = newTabScopes;

                Debug.Assert(viewTabs != null, "Tab array destroyed!");
            }

            if (tab != null && component != null) {
                try {
                    Object[] tabComps = tab.Components;
                    int oldArraySize = tabComps == null ? 0 : tabComps.Length;

                    Object[] newComps = new Object[oldArraySize + 1];
                    if (oldArraySize > 0) {
                        Array.Copy(tabComps, newComps, oldArraySize);
                    }
                    newComps[oldArraySize] = component;
                    tab.Components = newComps;
                }
                catch (Exception e) {
                    Debug.Fail("Bad tab. We're going to remove it.", e.ToString());
                    RemoveTab(tabIndex, false);
                }
            }

            if (setupToolbar) {
                SetupToolbar();
                ShowEventsButton(false);
            }
        }        
 public PropertyTabAttribute(string tabClassName, PropertyTabScope tabScope)
 {
     throw new NotImplementedException();
 }
        private static Type[] GetCommonTabs(Object[] objs, PropertyTabScope tabScope) {

            if (objs == null || objs.Length == 0) {
                return new Type[0];
            }

            Type[] tabTypes = new Type[5];
            int    types = 0;
            int    i,j,k;
            PropertyTabAttribute tabAttr = (PropertyTabAttribute) TypeDescriptor.GetAttributes(objs[0])[typeof(PropertyTabAttribute)];

            if (tabAttr == null) {
                return new Type[0];
            }

            // filter out all the types of the current scope
            for (i = 0; i < tabAttr.TabScopes.Length; i++) {
                PropertyTabScope item =  tabAttr.TabScopes[i];

                if (item == tabScope) {
                    if (types == tabTypes.Length) {
                        Type[] newTabs = new Type[types * 2];
                        Array.Copy(tabTypes, 0, newTabs, 0, types);
                        tabTypes = newTabs;
                    }
                    tabTypes[types++] = tabAttr.TabClasses[i];
                }
            }

            if (types == 0) {
                return new Type[0];
            }

            bool found;

            for (i = 1; i < objs.Length && types > 0; i++) {

                // get the tab attribute
                tabAttr = (PropertyTabAttribute) TypeDescriptor.GetAttributes(objs[i])[typeof(PropertyTabAttribute)];

                if (tabAttr == null) {
                    // if this guy has no tabs at all, we can fail right now
                    return new Type[0];
                }

                // make sure this guy has all the items in the array,
                // if not, remove the items he doesn't have
                for (j = 0; j < types; j++) {
                    found = false;
                    for (k = 0; k < tabAttr.TabClasses.Length; k++) {
                        if (tabAttr.TabClasses[k] == tabTypes[j]) {
                            found = true;
                            break;
                        }
                    }

                    // if we didn't find an item, remove it from the list
                    if (!found) {
                        // swap in with the last item and decrement
                        tabTypes[j] = tabTypes[types-1];
                        tabTypes[types-1] = null;
                        types--;

                        // recheck this item since we'll be ending sooner
                        j--;
                    }
                }
            }

            Type[] returnTypes = new Type[types];
            if (types > 0) {
                Array.Copy(tabTypes, 0, returnTypes, 0, types);
            }
            return returnTypes;
        }
Beispiel #38
0
		private void GetMergedPropertyTabs (object[] objects, out Type[] tabTypes, out PropertyTabScope[] tabScopes)
		{
			tabTypes = null;
			tabScopes = null;
			if (objects == null || objects.Length == 0)
				return;

			ArrayList intersection = null;
			ArrayList scopes = new ArrayList ();
			for (int i=0; i < objects.Length; i++) {
				if (objects[i] == null)
					continue;
				PropertyTabAttribute tabAttribute = (PropertyTabAttribute)TypeDescriptor.GetAttributes (objects[i])[typeof (PropertyTabAttribute)];
				if (tabAttribute == null || tabAttribute.TabClasses == null || tabAttribute.TabClasses.Length == 0)
					return;

				ArrayList new_intersection = new ArrayList ();
				scopes.Clear ();
				IList currentIntersection = (i == 0 ? (IList)tabAttribute.TabClasses : (IList)intersection);
				for (int j=0; j < currentIntersection.Count; j++) {
					if ((Type)intersection[j] == tabAttribute.TabClasses[j]) {
						new_intersection.Add (tabAttribute.TabClasses[j]);
						scopes.Add (tabAttribute.TabScopes[j]);
					}
				}
				intersection = new_intersection;
			}

			tabTypes = new Type[intersection.Count];
			intersection.CopyTo (tabTypes);
			tabScopes = new PropertyTabScope[tabTypes.Length];
			scopes.CopyTo (tabScopes);
		}
        // removes all the tabs with a classification greater than or equal to the specified classification.
        // for example, removing PropertyTabScope.Document will remove PropertyTabScope.Document and PropertyTabScope.Component tabs
        internal void RemoveTabs(PropertyTabScope classification, bool setupToolbar) {
            if (classification == PropertyTabScope.Static) {
                throw new ArgumentException(SR.GetString(SR.PropertyGridRemoveStaticTabs));
            }
            
            // in case we've been disposed
            if (viewTabButtons == null || viewTabs == null || viewTabScopes == null) {
                return;
            }

            ToolStripButton selectedButton = (selectedViewTab >=0 && selectedViewTab < viewTabButtons.Length ? viewTabButtons[selectedViewTab] : null);

            for (int i = viewTabs.Length-1; i >= 0; i--) {
                if (viewTabScopes[i] >= classification) {

                    // adjust the selected view tab because we're deleting.
                    if (selectedViewTab == i) {
                        selectedViewTab = -1;
                    }
                    else if (selectedViewTab > i) {
                        selectedViewTab--;
                    }
                    
                    PropertyTab[] newTabs = new PropertyTab[viewTabs.Length - 1];
                    Array.Copy(viewTabs, 0, newTabs, 0, i);
                    Array.Copy(viewTabs, i + 1, newTabs, i, viewTabs.Length - i - 1);
                    viewTabs = newTabs;

                    PropertyTabScope[] newTabScopes = new PropertyTabScope[viewTabScopes.Length - 1];
                    Array.Copy(viewTabScopes, 0, newTabScopes, 0, i);
                    Array.Copy(viewTabScopes, i + 1, newTabScopes, i, viewTabScopes.Length - i - 1);
                    viewTabScopes = newTabScopes;

                    viewTabsDirty = true;
                }
            }

            if (setupToolbar && viewTabsDirty) {
                SetupToolbar();

                Debug.Assert(viewTabs != null && viewTabs.Length > 0, "Holy Moly!  We don't have any tabs left!");

                selectedViewTab = -1;
                SelectViewTabButtonDefault(selectedButton);

                // clear the component refs of the tabs
                for (int i = 0; i < viewTabs.Length; i++) {
                    viewTabs[i].Components = new Object[0];
                }
            }
        }
 /// <devdoc>
 ///    <para>
 ///       Utiliity function to set the types of tab classes this PropertyTabAttribute specifies.
 ///    </para>
 /// </devdoc>
 protected void InitializeArrays(Type[] tabClasses, PropertyTabScope[] tabScopes) {
     InitializeArrays(null, tabClasses, tabScopes);
 }
        internal void RemoveTab(Type tabType) {
            PropertyTab tab = null;
            int tabIndex = -1;
            for (int i = 0; i < viewTabs.Length; i++) {
                if (tabType == viewTabs[i].GetType()) {
                    tab = viewTabs[i];
                    tabIndex = i;
                    break;
                }
            }

            // just quit if the tab isn't present.
            if (tabIndex == -1) {
                return;
            }

            PropertyTab[] newTabs = new PropertyTab[viewTabs.Length - 1];
            Array.Copy(viewTabs, 0, newTabs, 0, tabIndex);
            Array.Copy(viewTabs, tabIndex + 1, newTabs, tabIndex, viewTabs.Length - tabIndex - 1);
            viewTabs = newTabs;

            PropertyTabScope[] newTabScopes = new PropertyTabScope[viewTabScopes.Length - 1];
            Array.Copy(viewTabScopes, 0, newTabScopes, 0, tabIndex);
            Array.Copy(viewTabScopes, tabIndex + 1, newTabScopes, tabIndex, viewTabScopes.Length - tabIndex - 1);
            viewTabScopes = newTabScopes;
            
            viewTabsDirty = true;
            SetupToolbar();
        }
Beispiel #42
0
		protected void InitializeArrays (string[] tabClassNames, PropertyTabScope[] tabScopes)
		{
			if (tabScopes == null)
				throw new ArgumentNullException ("tabScopes");
			if (tabClassNames == null)
				throw new ArgumentNullException ("tabClassNames");

			scopes = tabScopes;
			tabs = new Type[tabClassNames.Length];
			for (int i = 0; i < tabClassNames.Length; i++)
				tabs[i] = GetTypeFromName (tabClassNames[i]);
		}
 /// <include file='doc\PropertyGrid.uex' path='docs/doc[@for="PropertyGrid.PropertyTabCollection.Clear"]/*' />
 /// <devdoc>
 /// Clears the tabs of the given scope or smaller.
 /// tabScope must be PropertyTabScope.Component or PropertyTabScope.Document.
 /// </devdoc>
 public void Clear(PropertyTabScope tabScope) {
     if (owner == null) {
         throw new InvalidOperationException(SR.GetString(SR.PropertyGridPropertyTabCollectionReadOnly));
     }
     owner.ClearTabs(tabScope);
 }
Beispiel #44
0
		protected void InitializeArrays (Type[] tabClasses, PropertyTabScope[] tabScopes)
		{
			if (tabScopes == null)
				throw new ArgumentNullException ("tabScopes");
			if (tabClasses == null)
				throw new ArgumentNullException ("tabClasses");
			if (tabClasses.Length != tabScopes.Length)
				throw new ArgumentException ("tabClasses.Length != tabScopes.Length");

			tabs = tabClasses;
			scopes = tabScopes;
		}
Beispiel #45
0
 public void RefreshTabs(PropertyTabScope tabScope)
 {
     throw null;
 }
Beispiel #46
0
		public PropertyTabAttribute (string tabClassName, PropertyTabScope tabScope)
		{
			if (tabClassName == null)
				throw new ArgumentNullException ("tabClassName");
			this.InitializeArrays (new string[] { tabClassName }, new PropertyTabScope[] { tabScope });
		}
Beispiel #47
0
 public void Clear(PropertyTabScope tabScope)
 {
     throw null;
 }
Beispiel #48
0
		public PropertyTabAttribute (Type tabClass, PropertyTabScope tabScope)
		{
			if (tabClass == null)
				throw new ArgumentNullException ("tabClass");
			this.InitializeArrays (new Type[] { tabClass }, new PropertyTabScope[] { tabScope });
		}
 /// <devdoc>
 ///    <para>
 ///       Utiliity function to set the types of tab classes this PropertyTabAttribute specifies.
 ///    </para>
 /// </devdoc>
 protected void InitializeArrays(string[] tabClassNames, PropertyTabScope[] tabScopes) {
     InitializeArrays(tabClassNames, null, tabScopes);
 }
 public PropertyTabAttribute(Type tabClass, PropertyTabScope tabScope)
 {
     throw new NotImplementedException();
 }
        private void InitializeArrays(string[] tabClassNames, Type[] tabClasses, PropertyTabScope[] tabScopes) {
        
            if (tabClasses != null) {
                if (tabScopes != null && tabClasses.Length != tabScopes.Length) {
                    throw new ArgumentException(SR.GetString(SR.PropertyTabAttributeArrayLengthMismatch));
                }
                this.tabClasses = (Type[])tabClasses.Clone();
            }
            else if (tabClassNames != null) {
                if (tabScopes != null && tabClasses.Length != tabScopes.Length) {
                    throw new ArgumentException(SR.GetString(SR.PropertyTabAttributeArrayLengthMismatch));
                }
                this.tabClassNames = (string[])tabClassNames.Clone();
                this.tabClasses = null;
            }
            else if (this.tabClasses == null && this.tabClassNames == null) {
                throw new ArgumentException(SR.GetString(SR.PropertyTabAttributeParamsBothNull));
            }
            
            if (tabScopes != null) {
                for (int i = 0; i < tabScopes.Length; i++) {
                    if (tabScopes[i] < PropertyTabScope.Document) {
                        throw new ArgumentException(SR.GetString(SR.PropertyTabAttributeBadPropertyTabScope));
                    }
                }
                this.tabScopes = (PropertyTabScope[])tabScopes.Clone();
            }
            else {
                this.tabScopes = new PropertyTabScope[tabClasses.Length];

                for (int i = 0; i < TabScopes.Length; i++) {
                    this.tabScopes[i] = PropertyTabScope.Component;
                }
            }
        }
 private record TabInfo(PropertyTab Tab, PropertyTabScope Scope, ToolStripButton Button)
 {