Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / System / ComponentModel / CustomTypeDescriptor.cs / 1 / CustomTypeDescriptor.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.ComponentModel
{
using System;
using System.Security.Permissions;
///
///
[HostProtection(SharedState = true)]
public abstract class CustomTypeDescriptor : ICustomTypeDescriptor
{
private ICustomTypeDescriptor _parent;
///
/// Creates a new CustomTypeDescriptor object. There are two versions
/// of this constructor. The version that takes no parameters simply
/// calls the version that takes a parent and passes null as the
/// parent value. If the parent is null, CustomTypeDescriptor returns
/// the defined default values for each method. If the parent is
/// non-null, CustomTypeDescriptor calls the parent's version of
/// the method.
///
protected CustomTypeDescriptor()
{
}
///
/// Creates a new CustomTypeDescriptor object. There are two versions
/// of this constructor. The version that takes no parameters simply
/// calls the version that takes a parent and passes null as the
/// parent value. If the parent is null, CustomTypeDescriptor returns
/// the defined default values for each method. If the parent is
/// non-null, CustomTypeDescriptor calls the parent's version of
/// the method.
///
protected CustomTypeDescriptor(ICustomTypeDescriptor parent)
{
_parent = parent;
}
///
/// The GetAttributes method returns the type-level attributes for
/// the type this custom type descriptor is providing information for.
/// You must always return a valid collection from this method.
///
public virtual AttributeCollection GetAttributes()
{
if (_parent != null)
{
return _parent.GetAttributes();
}
return AttributeCollection.Empty;
}
///
/// The GetClassName method returns the fully qualified name of the
/// class this type descriptor is representing. Returning null from
/// this method causes the TypeDescriptor object to return the
/// default class name.
///
public virtual string GetClassName()
{
if (_parent != null)
{
return _parent.GetClassName();
}
return null;
}
///
/// The GetComponentName method returns the name of the component instance
/// this type descriptor is describing.
///
public virtual string GetComponentName()
{
if (_parent != null)
{
return _parent.GetComponentName();
}
return null;
}
///
/// The GetConverter method returns a type converter for the type this type
/// descriptor is representing.
///
public virtual TypeConverter GetConverter()
{
if (_parent != null)
{
return _parent.GetConverter();
}
return new TypeConverter();
}
///
/// The GetDefaultEvent method returns the event descriptor for the default
/// event on the object this type descriptor is representing.
///
public virtual EventDescriptor GetDefaultEvent()
{
if (_parent != null)
{
return _parent.GetDefaultEvent();
}
return null;
}
///
/// The GetDefaultProperty method returns the property descriptor for the
/// default property on the object this type descriptor is representing.
///
public virtual PropertyDescriptor GetDefaultProperty()
{
if (_parent != null)
{
return _parent.GetDefaultProperty();
}
return null;
}
///
/// The GetEditor method returns an editor of the given type that is
/// to be associated with the class this type descriptor is representing.
///
public virtual object GetEditor(Type editorBaseType)
{
if (_parent != null)
{
return _parent.GetEditor(editorBaseType);
}
return null;
}
///
/// The GetEvents method returns a collection of event descriptors
/// for the object this type descriptor is representing. An optional
/// attribute array may be provided to filter the collection that is
/// returned. If no parent is provided,this will return an empty
/// event collection.
///
public virtual EventDescriptorCollection GetEvents()
{
if (_parent != null)
{
return _parent.GetEvents();
}
return EventDescriptorCollection.Empty;
}
///
/// The GetEvents method returns a collection of event descriptors
/// for the object this type descriptor is representing. An optional
/// attribute array may be provided to filter the collection that is
/// returned. If no parent is provided,this will return an empty
/// event collection.
///
public virtual EventDescriptorCollection GetEvents(Attribute[] attributes)
{
if (_parent != null)
{
return _parent.GetEvents(attributes);
}
return EventDescriptorCollection.Empty;
}
///
/// The GetProperties method returns a collection of property descriptors
/// for the object this type descriptor is representing. An optional
/// attribute array may be provided to filter the collection that is returned.
/// If no parent is provided,this will return an empty
/// property collection.
///
public virtual PropertyDescriptorCollection GetProperties()
{
if (_parent != null)
{
return _parent.GetProperties();
}
return PropertyDescriptorCollection.Empty;
}
///
/// The GetProperties method returns a collection of property descriptors
/// for the object this type descriptor is representing. An optional
/// attribute array may be provided to filter the collection that is returned.
/// If no parent is provided,this will return an empty
/// property collection.
///
public virtual PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
if (_parent != null)
{
return _parent.GetProperties(attributes);
}
return PropertyDescriptorCollection.Empty;
}
///
/// The GetPropertyOwner method returns an instance of an object that
/// owns the given property for the object this type descriptor is representing.
/// An optional attribute array may be provided to filter the collection that is
/// returned. Returning null from this method causes the TypeDescriptor object
/// to use its default type description services.
///
public virtual object GetPropertyOwner(PropertyDescriptor pd)
{
if (_parent != null)
{
return _parent.GetPropertyOwner(pd);
}
return null;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.ComponentModel
{
using System;
using System.Security.Permissions;
///
///
[HostProtection(SharedState = true)]
public abstract class CustomTypeDescriptor : ICustomTypeDescriptor
{
private ICustomTypeDescriptor _parent;
///
/// Creates a new CustomTypeDescriptor object. There are two versions
/// of this constructor. The version that takes no parameters simply
/// calls the version that takes a parent and passes null as the
/// parent value. If the parent is null, CustomTypeDescriptor returns
/// the defined default values for each method. If the parent is
/// non-null, CustomTypeDescriptor calls the parent's version of
/// the method.
///
protected CustomTypeDescriptor()
{
}
///
/// Creates a new CustomTypeDescriptor object. There are two versions
/// of this constructor. The version that takes no parameters simply
/// calls the version that takes a parent and passes null as the
/// parent value. If the parent is null, CustomTypeDescriptor returns
/// the defined default values for each method. If the parent is
/// non-null, CustomTypeDescriptor calls the parent's version of
/// the method.
///
protected CustomTypeDescriptor(ICustomTypeDescriptor parent)
{
_parent = parent;
}
///
/// The GetAttributes method returns the type-level attributes for
/// the type this custom type descriptor is providing information for.
/// You must always return a valid collection from this method.
///
public virtual AttributeCollection GetAttributes()
{
if (_parent != null)
{
return _parent.GetAttributes();
}
return AttributeCollection.Empty;
}
///
/// The GetClassName method returns the fully qualified name of the
/// class this type descriptor is representing. Returning null from
/// this method causes the TypeDescriptor object to return the
/// default class name.
///
public virtual string GetClassName()
{
if (_parent != null)
{
return _parent.GetClassName();
}
return null;
}
///
/// The GetComponentName method returns the name of the component instance
/// this type descriptor is describing.
///
public virtual string GetComponentName()
{
if (_parent != null)
{
return _parent.GetComponentName();
}
return null;
}
///
/// The GetConverter method returns a type converter for the type this type
/// descriptor is representing.
///
public virtual TypeConverter GetConverter()
{
if (_parent != null)
{
return _parent.GetConverter();
}
return new TypeConverter();
}
///
/// The GetDefaultEvent method returns the event descriptor for the default
/// event on the object this type descriptor is representing.
///
public virtual EventDescriptor GetDefaultEvent()
{
if (_parent != null)
{
return _parent.GetDefaultEvent();
}
return null;
}
///
/// The GetDefaultProperty method returns the property descriptor for the
/// default property on the object this type descriptor is representing.
///
public virtual PropertyDescriptor GetDefaultProperty()
{
if (_parent != null)
{
return _parent.GetDefaultProperty();
}
return null;
}
///
/// The GetEditor method returns an editor of the given type that is
/// to be associated with the class this type descriptor is representing.
///
public virtual object GetEditor(Type editorBaseType)
{
if (_parent != null)
{
return _parent.GetEditor(editorBaseType);
}
return null;
}
///
/// The GetEvents method returns a collection of event descriptors
/// for the object this type descriptor is representing. An optional
/// attribute array may be provided to filter the collection that is
/// returned. If no parent is provided,this will return an empty
/// event collection.
///
public virtual EventDescriptorCollection GetEvents()
{
if (_parent != null)
{
return _parent.GetEvents();
}
return EventDescriptorCollection.Empty;
}
///
/// The GetEvents method returns a collection of event descriptors
/// for the object this type descriptor is representing. An optional
/// attribute array may be provided to filter the collection that is
/// returned. If no parent is provided,this will return an empty
/// event collection.
///
public virtual EventDescriptorCollection GetEvents(Attribute[] attributes)
{
if (_parent != null)
{
return _parent.GetEvents(attributes);
}
return EventDescriptorCollection.Empty;
}
///
/// The GetProperties method returns a collection of property descriptors
/// for the object this type descriptor is representing. An optional
/// attribute array may be provided to filter the collection that is returned.
/// If no parent is provided,this will return an empty
/// property collection.
///
public virtual PropertyDescriptorCollection GetProperties()
{
if (_parent != null)
{
return _parent.GetProperties();
}
return PropertyDescriptorCollection.Empty;
}
///
/// The GetProperties method returns a collection of property descriptors
/// for the object this type descriptor is representing. An optional
/// attribute array may be provided to filter the collection that is returned.
/// If no parent is provided,this will return an empty
/// property collection.
///
public virtual PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
if (_parent != null)
{
return _parent.GetProperties(attributes);
}
return PropertyDescriptorCollection.Empty;
}
///
/// The GetPropertyOwner method returns an instance of an object that
/// owns the given property for the object this type descriptor is representing.
/// An optional attribute array may be provided to filter the collection that is
/// returned. Returning null from this method causes the TypeDescriptor object
/// to use its default type description services.
///
public virtual object GetPropertyOwner(PropertyDescriptor pd)
{
if (_parent != null)
{
return _parent.GetPropertyOwner(pd);
}
return null;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HttpConfigurationSystem.cs
- BigIntegerStorage.cs
- TileBrush.cs
- NoneExcludedImageIndexConverter.cs
- NameScopePropertyAttribute.cs
- IndentedWriter.cs
- TargetParameterCountException.cs
- DynamicActionMessageFilter.cs
- DataGridViewRowHeaderCell.cs
- PageContentCollection.cs
- XPathChildIterator.cs
- IdentityModelStringsVersion1.cs
- WebProxyScriptElement.cs
- CatalogZoneBase.cs
- sitestring.cs
- FirstMatchCodeGroup.cs
- ExpressionReplacer.cs
- FontSizeConverter.cs
- ControlAdapter.cs
- SystemTcpConnection.cs
- ListViewItemMouseHoverEvent.cs
- ObjectDataSourceSelectingEventArgs.cs
- HighlightComponent.cs
- OdbcConnection.cs
- CompositeFontFamily.cs
- StylusPointPropertyId.cs
- TableRowGroupCollection.cs
- DoubleStorage.cs
- ConfigurationConverterBase.cs
- _KerberosClient.cs
- PrintControllerWithStatusDialog.cs
- ProviderBase.cs
- DashStyles.cs
- WebPartHelpVerb.cs
- InvalidEnumArgumentException.cs
- EncoderParameter.cs
- _LoggingObject.cs
- XmlValidatingReader.cs
- BitArray.cs
- UnionExpr.cs
- Symbol.cs
- Missing.cs
- Calendar.cs
- RowParagraph.cs
- PreservationFileReader.cs
- x509utils.cs
- RemotingAttributes.cs
- Double.cs
- EmptyStringExpandableObjectConverter.cs
- LightweightEntityWrapper.cs
- DataControlImageButton.cs
- ButtonChrome.cs
- TextWriterTraceListener.cs
- MouseGestureConverter.cs
- XPathPatternParser.cs
- NavigatorInvalidBodyAccessException.cs
- SmiRequestExecutor.cs
- MemberDomainMap.cs
- counter.cs
- Calendar.cs
- LineGeometry.cs
- SoapAttributes.cs
- ToolStripGripRenderEventArgs.cs
- HostedHttpRequestAsyncResult.cs
- ResourcePool.cs
- SqlCacheDependency.cs
- XmlSchemaImporter.cs
- BackgroundWorker.cs
- MutexSecurity.cs
- StringOutput.cs
- SqlInternalConnectionSmi.cs
- ExecutedRoutedEventArgs.cs
- FacetChecker.cs
- StringUtil.cs
- GlyphRunDrawing.cs
- DesignTimeTemplateParser.cs
- PresentationUIStyleResources.cs
- EventlogProvider.cs
- SerializationSectionGroup.cs
- GeneralTransform3DTo2DTo3D.cs
- ServicePointManager.cs
- KoreanCalendar.cs
- TreeNodeStyleCollection.cs
- RadioButtonStandardAdapter.cs
- XmlDataLoader.cs
- HtmlUtf8RawTextWriter.cs
- WebMessageFormatHelper.cs
- TreeNodeMouseHoverEvent.cs
- VectorCollection.cs
- ThicknessKeyFrameCollection.cs
- M3DUtil.cs
- ComplexPropertyEntry.cs
- BinaryUtilClasses.cs
- PageAdapter.cs
- PromptEventArgs.cs
- DesignSurfaceEvent.cs
- MailBnfHelper.cs
- QueryableDataSourceEditData.cs
- TextTreeRootNode.cs
- translator.cs