Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@ -0,0 +1,79 @@
//
// System.Drawing.Design.CategoryNameCollection.cs
//
// Authors:
// Alejandro Sánchez Acosta
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Alejandro Sánchez Acosta
// (C) 2003 Andreas Nahr
//
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.Security.Permissions;
namespace System.Drawing.Design
{
[PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
public sealed class CategoryNameCollection : ReadOnlyCollectionBase
{
public CategoryNameCollection (CategoryNameCollection value)
{
if (value == null)
throw new ArgumentNullException ("value");
InnerList.AddRange (value);
}
public CategoryNameCollection (string[] value)
{
if (value == null)
throw new ArgumentNullException ("value");
InnerList.AddRange (value);
}
public string this[int index] {
get {
return (string) InnerList[index];
}
}
public bool Contains (string value)
{
return InnerList.Contains (value);
}
public void CopyTo (string[] array, int index)
{
InnerList.CopyTo (array, index);
}
public int IndexOf (string value)
{
return InnerList.IndexOf (value);
}
}
}

View File

@ -0,0 +1,165 @@
2008-08-06 Sebastien Pouliot <sebastien@ximian.com>
* ToolboxItem.cs: (Initialize) Avoid casting image to Bitmap 2 times.
[Found using Gendarme]
2008-02-16 Ivan N. Zlatev <contact@i-nz.net>
* UITypeEditor.cs: Associate string[] with StringArrayEditor in the
editors table.
[Part of fix for bugs #360666 and #358332]
2007-07-10 Rolf Bjarne Kvinge <RKvinge@novell.com>
* UITypeEditor.cs: Add a table of special editors (types that can't use
attributes to specify the editor) to TypeDescriptor.
2007-06-30 Gert Driesen <drieseng@users.sourceforge.net>
* ToolboxItem.cs: GetType (IDesignerHost) is 2.0 only.
2007-06-08 Ivan N. Zlatev <contact@i-nz.net>
* ToolboxItem.cs: Implement some 2.0 stuff.
Fix events not to get fired twice.
2007-06-06 Alan McGovern <alan.mcgovern@gmail.com>
* ToolboxItem.cs: Fixed typo in event firing
2007-03-14 Ivan N. Zlatev <contact@i-nz.net>
* ToolboxItem.cs: Fixed GetType not to be
dependant on ITypeResolutionService.
2007-03-14 Sebastien Pouliot <sebastien@ximian.com>
* ToolboxItem.cs: Normalize line endings.
2006-11-22 Sebastien Pouliot <sebastien@ximian.com>
* ToolboxItem.cs: Implemented some 2.0 stuff.
2006-11-28 Sebastien Pouliot <sebastien@ximian.com>
* UITypeEditor.cs: Remove MonoTODO (this always returns false).
2006-08-29 Sebastien Pouliot <sebastien@ximian.com>
* ToolboxItem.cs: Fix compiler warning.
2006-05-24 Sebastien Pouliot <sebastien@ximian.com>
* ToolboxItem.cs: Update ComponentType property to match MS result.
2006-05-21 Sebastien Pouliot <sebastien@ximian.com>
* PropertyValueUIHandler.cs: Removed [Serializable] from 2.0 profile.
* PropertyValueUIItemInvokeHandler.cs: Removed [Serializable] from
2.0 profile.
* ToolboxComponentsCreatedEventHandler.cs: Removed [Serializable]
from 2.0 profile.
* ToolboxComponentsCreatingEventHandler.cs: Removed [Serializable]
from 2.0 profile.
* ToolboxItemCreatorCallback.cs: Removed [Serializable] from 2.0
profile.
2006-05-05 Sebastien Pouliot <sebastien@ximian.com>
* IToolboxService.cs: corcompare fix. Added [ComImport] for 2.0.
* ToolboxItem.cs: corcompare fix. Added new overload for
CreateComponentsCore in 2.0
* UITypeEditor.cs: corcompare fix. Added new IsDropDownResizable
property for 2.0.
2005-12-05 Jordi Mas i Hernandez <jordimash@gmail.com>
* ToolboxItem.cs: Add new methods and properties for .Net and
also moved to an internal properties hashtable implementation
* IToolboxItemProvider.cs: New .Net 2.0 interface
2005-09-16 Sebastien Pouliot <sebastien@ximian.com>
* CategoryNameCollection.cs: Added LinkDemand for Unrestricted
permissions. Added null checks in constructors.
* PaintValueEventArgs.cs: Added LinkDemand and InheritanceDemand for
Unrestricted permissions. Added null checks in constructor.
* PropertyValueItem.cs: Added LinkDemand and InheritanceDemand for
Unrestricted permissions. Added null checks in constructor.
* ToolboxComponentsCreatedEventArgs.cs: Added LinkDemand and
InheritanceDemand for Unrestricted permissions.
* ToolboxComponentsCreatingEventArgs.cs: Added LinkDemand and
InheritanceDemand for Unrestricted permissions.
* ToolboxItem.cs: Added LinkDemand and InheritanceDemand for
Unrestricted permissions.
* ToolboxItemCollection.cs: Added LinkDemand for Unrestricted
permissions.
* UITypeEditor.cs: Added LinkDemand and InheritanceDemand for
Unrestricted permissions.
2005-08-24 Michael Hutchinson <m.j.hutchinson@gmail.com>
* ToolboxItem.cs: Implemented retrieving item's bitmap
2005-08-09 Michael Hutchinson <m.j.hutchinson@gmail.com>
* ToolboxItemCollection.cs: Call base constructor
* ToolboxItem: Implemented CreateComponentsCore, GetType, Initialize
2005-08-03 Andrew Skiba <andrews@mainsoft.com>
* UITypeEditor.cs: Added TARGET_JVM support
2003-06-30 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* ToolboxItem.cs: Added serialization/deserialization support
2003-06-18 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* CategoryNameCollection.cs
* ToolboxItemCollection.cs: Implemented
* PropertyValueItem.cs: Implemented
* IDesignerHost.cs: Deleted (not defined in this namespace)
* IToolboxService.cs: Fixed missing imports, added missing interface declarations
* ToolboxComponentsCreatingEventArgs.cs: Fixed missing imports
* ToolboxItem.cs: Fixed missing imports, Partially implemented
* UITypeEditor.cs: Implemented
* UITypeEditorEditStyle.cs: Fixed incorrect values
2003-03-31 Alan Tam <Tam@SiuLung.com>
* UITypeEditor.cs: Added
* PaintValueEventArgs.cs: Fixed typo in namespace
2002-12-01 Alejandro Sánchez Acosta <raciel@es.gnu.org>
* PaintValueEventArgs.cs,
ToolboxComponentsCreatingEventArgs.cs,
PropertyValueItem.cs,
ToolboxComponentsCreatingEventHandler.cs
IDesignerHost.cs,
ToolboxItemCreatorCallback.cs,
ToolboxItem.cs,
ToolboxComponentsCreatedEventArgs.cs
UITypeEditorEditStyle.cs,
IToolboxUser.cs
ToolboxComponentsCreatedEventHandler.cs
CategoryNameCollection.cs : Added
2002-11-20 Alejandro Sánchez Acosta <raciel@es.gnu.org>
* IPropertyValueUIService.cs: Added
* PropertyValueItem.cs: Added
* PropertyValueUIHandler.cs: Added
* PropertyValueUIItemInvokeHandler.cs: Added
* ChangeLog: new file.

View File

@ -0,0 +1,54 @@
// System.Drawing.Design.IPropertyValueUIService.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
//
// (C) Alejandro Sánchez Acosta
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Drawing;
using System.ComponentModel;
namespace System.Drawing.Design
{
public interface IPropertyValueUIService
{
#region Methods
void AddPropertyValueUIHandler (PropertyValueUIHandler newHandler);
PropertyValueUIItem[] GetPropertyUIValueItems (ITypeDescriptorContext context, PropertyDescriptor propDesc);
void NotifyPropertyValueUIItemsChanged ();
void RemovePropertyValueUIHandler (PropertyValueUIHandler newHandler);
#endregion Methods
#region Events
event EventHandler PropertyUIValueItemsChanged;
#endregion Events
}
}

View File

@ -0,0 +1,40 @@
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Authors:
//
// Jordi Mas i Hernandez <jordimash@gmail.com>
//
//
#if NET_2_0
namespace System.Drawing.Design
{
public interface IToolboxItemProvider
{
ToolboxItemCollection Items { get; }
}
}
#endif

View File

@ -0,0 +1,103 @@
//
// System.Drawing.Design.IToolboxService.cs
//
// Authors:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Alejandro Sánchez Acosta
// (C) 2003 Andreas Nahr
// Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.ComponentModel.Design;
using System.Runtime.InteropServices;
namespace System.Drawing.Design {
#if NET_2_0
[ComImport]
#endif
[Guid("4BACD258-DE64-4048-BC4E-FEDBEF9ACB76"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IToolboxService
{
CategoryNameCollection CategoryNames {get;}
string SelectedCategory {get; set;}
void AddCreator (ToolboxItemCreatorCallback creator, string format);
void AddCreator (ToolboxItemCreatorCallback creator, string format, IDesignerHost host);
void AddLinkedToolboxItem (ToolboxItem toolboxItem, IDesignerHost host);
void AddLinkedToolboxItem (ToolboxItem toolboxItem, string category, IDesignerHost host);
void AddToolboxItem (ToolboxItem toolboxItem, String category);
void AddToolboxItem (ToolboxItem toolboxItem);
ToolboxItem DeserializeToolboxItem (object serializedObject);
ToolboxItem DeserializeToolboxItem (object serializedObject, IDesignerHost host);
ToolboxItem GetSelectedToolboxItem ();
ToolboxItem GetSelectedToolboxItem (IDesignerHost host);
ToolboxItemCollection GetToolboxItems ();
ToolboxItemCollection GetToolboxItems (IDesignerHost host);
ToolboxItemCollection GetToolboxItems (String category);
ToolboxItemCollection GetToolboxItems (String category, IDesignerHost host);
bool IsSupported (object serializedObject, ICollection filterAttributes);
bool IsSupported (object serializedObject, IDesignerHost host);
bool IsToolboxItem (object serializedObject);
bool IsToolboxItem (object serializedObject, IDesignerHost host);
void Refresh();
void RemoveCreator (string format);
void RemoveCreator (string format, IDesignerHost host);
void RemoveToolboxItem (ToolboxItem toolboxItem);
void RemoveToolboxItem (ToolboxItem toolboxItem, string category);
void SelectedToolboxItemUsed ();
object SerializeToolboxItem (ToolboxItem toolboxItem);
bool SetCursor ();
void SetSelectedToolboxItem (ToolboxItem toolboxItem);
}
}

View File

@ -0,0 +1,40 @@
// System.Drawing.Design.IToolboxUser.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
//
// (C) Alejandro Sánchez Acosta
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Drawing.Design
{
public interface IToolboxUser
{
bool GetToolSupported (ToolboxItem tool);
void ToolPicked (ToolboxItem tool);
}
}

View File

@ -0,0 +1,85 @@
// System.Drawing.Design.PaintvalueEventArgs.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
//
// (C) Alejandro Sánchez Acosta
//
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.ComponentModel;
using System.Security.Permissions;
namespace System.Drawing.Design
{
[PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
[PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
public class PaintValueEventArgs : EventArgs
{
private ITypeDescriptorContext context;
private object value;
private Graphics graphics;
private Rectangle bounds;
public PaintValueEventArgs(ITypeDescriptorContext context, object value, Graphics graphics, Rectangle bounds)
{
if (graphics == null)
throw new ArgumentNullException ("graphics");
this.context = context;
this.value = value;
this.graphics = graphics;
this.bounds = bounds;
}
public Rectangle Bounds
{
get {
return bounds;
}
}
public ITypeDescriptorContext Context
{
get {
return context;
}
}
public Graphics Graphics
{
get {
return graphics;
}
}
public object Value
{
get {
return value;
}
}
}
}

View File

@ -0,0 +1,89 @@
//
// System.Drawing.Design.PropertyValueItem.cs
//
// Authors:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Alejandro Sánchez Acosta
// (C) 2003 Andreas Nahr
//
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Security.Permissions;
namespace System.Drawing.Design
{
[PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
[PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
public class PropertyValueUIItem
{
private Image uiItemImage;
private PropertyValueUIItemInvokeHandler handler;
private string tooltip;
public PropertyValueUIItem (Image uiItemImage,
PropertyValueUIItemInvokeHandler handler, string tooltip)
{
if (uiItemImage == null)
throw new ArgumentNullException ("uiItemImage");
if (handler == null)
throw new ArgumentNullException ("handler");
this.uiItemImage = uiItemImage;
this.handler = handler;
this.tooltip = tooltip;
}
public virtual Image Image
{
get
{
return uiItemImage;
}
}
public virtual PropertyValueUIItemInvokeHandler InvokeHandler
{
get
{
return handler;
}
}
public virtual string ToolTip
{
get
{
return tooltip;
}
}
public virtual void Reset()
{
// To be overriden in child classes
}
}
}

View File

@ -0,0 +1,38 @@
// System.Drawing.Design.PropertyValueUIHandler.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
//
// (C) Alejandro Sánchez Acosta
// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.ComponentModel;
namespace System.Drawing.Design {
#if ONLY_1_1
[Serializable]
#endif
public delegate void PropertyValueUIHandler (ITypeDescriptorContext context, PropertyDescriptor propDesc, ArrayList valueUIItemList);
}

View File

@ -0,0 +1,40 @@
// System.Drawing.Design.PropertyValueUIItemInvokeHandler.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
//
// (C) Alejandro Sánchez Acosta
// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.ComponentModel;
namespace System.Drawing.Design {
#if ONLY_1_1
[Serializable]
#endif
public delegate void PropertyValueUIItemInvokeHandler (
ITypeDescriptorContext context,
PropertyDescriptor descriptor,
PropertyValueUIItem invokedItem);
}

View File

@ -0,0 +1,54 @@
// System.Drawing.Design.ToolboxComponentsCreatedEventArgs.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
//
// (C) Alejandro Sánchez Acosta
//
//
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.ComponentModel;
using System.Security.Permissions;
namespace System.Drawing.Design
{
[PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
[PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
public class ToolboxComponentsCreatedEventArgs : EventArgs
{
private IComponent[] components;
public ToolboxComponentsCreatedEventArgs (IComponent[] components) {
this.components = components;
}
public IComponent[] Components {
get {
return components;
}
}
}
}

View File

@ -0,0 +1,36 @@
// System.Drawing.Design.IDesignerHost.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
//
// (C) Alejandro Sánchez Acosta
// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Drawing.Design {
#if ONLY_1_1
[Serializable]
#endif
public delegate void ToolboxComponentsCreatedEventHandler (object sender, ToolboxComponentsCreatedEventArgs e);
}

View File

@ -0,0 +1,57 @@
//
// System.Drawing.Design.ToolboxComponentsCreatingEventArgs.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
//
// (C) Alejandro Sánchez Acosta
//
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.ComponentModel.Design;
using System.Security.Permissions;
namespace System.Drawing.Design
{
[PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
[PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
public class ToolboxComponentsCreatingEventArgs : EventArgs
{
private IDesignerHost host;
public ToolboxComponentsCreatingEventArgs (IDesignerHost host)
{
this.host = host;
}
public IDesignerHost DesignerHost {
get {
return host;
}
}
}
}

View File

@ -0,0 +1,35 @@
// System.Drawing.Design.ToolboxComponentsCreatingEventHandler.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
//
// (C) Alejandro Sánchez Acosta
// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Drawing.Design {
#if ONLY_1_1
[Serializable]
#endif
public delegate void ToolboxComponentsCreatingEventHandler (object sender, ToolboxComponentsCreatingEventArgs e);
}

View File

@ -0,0 +1,416 @@
//
// System.Drawing.Design.ToolboxItem.cs
//
// Authors:
// Alejandro Sánchez Acosta
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
// Jordi Mas i Hernandez, jordimash@gmail.com
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) Alejandro Sánchez Acosta
// (C) 2003 Andreas Nahr
// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Reflection;
using System.Runtime.Serialization;
using System.Security.Permissions;
namespace System.Drawing.Design
{
[Serializable]
[PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
[PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
[MonoTODO ("Implementation is incomplete.")]
public class ToolboxItem : ISerializable {
private bool locked = false;
private Hashtable properties = new Hashtable ();
public ToolboxItem ()
{
}
public ToolboxItem (Type toolType)
{
Initialize (toolType);
}
public AssemblyName AssemblyName {
get { return (AssemblyName) properties["AssemblyName"]; }
set { SetValue ("AssemblyName", value); }
}
public Bitmap Bitmap {
get { return (Bitmap) properties["Bitmap"]; }
set { SetValue ("Bitmap", value); }
}
public string DisplayName {
get { return GetValue ("DisplayName"); }
set { SetValue ("DisplayName", value); }
}
public ICollection Filter {
get {
ICollection filter = (ICollection) properties["Filter"];
if (filter == null)
filter = new ToolboxItemFilterAttribute[0];
return filter;
}
set { SetValue ("Filter", value); }
}
#if NET_2_0
public virtual bool Locked {
#else
protected bool Locked {
#endif
get { return locked; }
}
public string TypeName {
get { return GetValue ("TypeName"); }
set { SetValue ("TypeName", value); }
}
#if NET_2_0
public string Company {
get { return (string) properties["Company"]; }
set { SetValue ("Company", value); }
}
public virtual string ComponentType {
get { return ".NET Component"; }
}
public AssemblyName[] DependentAssemblies {
get { return (AssemblyName[]) properties["DependentAssemblies"]; }
set {
AssemblyName[] names = new AssemblyName [value.Length];
for (int i=0; i < names.Length; i++)
names [i] = value [i];
SetValue ("DependentAssemblies", names);
}
}
public string Description {
get { return (string) properties["Description"]; }
set { SetValue ("Description", value); }
}
public bool IsTransient {
get {
object o = properties ["IsTransient"];
return (o == null) ? false : (bool) o;
}
set { SetValue ("IsTransient", value); }
}
public IDictionary Properties {
get { return properties; }
}
public virtual string Version {
get { return string.Empty; }
}
#endif
protected void CheckUnlocked ()
{
if (locked)
throw new InvalidOperationException ("The ToolboxItem is locked");
}
public IComponent[] CreateComponents ()
{
return CreateComponents (null);
}
public IComponent[] CreateComponents (IDesignerHost host)
{
OnComponentsCreating (new ToolboxComponentsCreatingEventArgs (host));
IComponent[] Comp = CreateComponentsCore (host);
OnComponentsCreated (new ToolboxComponentsCreatedEventArgs (Comp));
return Comp;
}
// FIXME - get error handling logic correct
protected virtual IComponent[] CreateComponentsCore (IDesignerHost host)
{
if (host == null)
throw new ArgumentNullException("host");
IComponent[] components;
Type type = GetType(host, AssemblyName, TypeName, true);
if (type == null)
components = new IComponent[] { };
else
components = new IComponent[] { host.CreateComponent(type) };
return components;
}
#if NET_2_0
protected virtual IComponent[] CreateComponentsCore (IDesignerHost host, IDictionary defaultValues)
{
IComponent[] components = CreateComponentsCore (host);
foreach (Component c in components) {
IComponentInitializer initializer = host.GetDesigner (c) as IComponentInitializer;
initializer.InitializeNewComponent (defaultValues);
}
return components;
}
public IComponent[] CreateComponents (IDesignerHost host, IDictionary defaultValues)
{
OnComponentsCreating (new ToolboxComponentsCreatingEventArgs (host));
IComponent[] components = CreateComponentsCore (host, defaultValues);
OnComponentsCreated (new ToolboxComponentsCreatedEventArgs (components));
return components;
}
protected virtual object FilterPropertyValue (string propertyName, object value)
{
switch (propertyName) {
case "AssemblyName":
return (value == null) ? null : (value as ICloneable).Clone ();
case "DisplayName":
case "TypeName":
return (value == null) ? String.Empty : value;
case "Filter":
return (value == null) ? new ToolboxItemFilterAttribute [0] : value;
default:
return value;
}
}
#endif
protected virtual void Deserialize (SerializationInfo info, StreamingContext context)
{
AssemblyName = (AssemblyName)info.GetValue ("AssemblyName", typeof (AssemblyName));
Bitmap = (Bitmap)info.GetValue ("Bitmap", typeof (Bitmap));
Filter = (ICollection)info.GetValue ("Filter", typeof (ICollection));
DisplayName = info.GetString ("DisplayName");
locked = info.GetBoolean ("Locked");
TypeName = info.GetString ("TypeName");
}
// FIXME: too harsh??
public override bool Equals (object obj)
{
ToolboxItem ti = (obj as ToolboxItem);
if (ti == null)
return false;
if (obj == this)
return true;
return (ti.AssemblyName.Equals (AssemblyName) &&
ti.Locked.Equals (locked) &&
ti.TypeName.Equals (TypeName) &&
ti.DisplayName.Equals (DisplayName) &&
ti.Bitmap.Equals (Bitmap));
}
public override int GetHashCode ()
{
// FIXME: other algorithm?
return string.Concat (TypeName, DisplayName).GetHashCode ();
}
#if NET_2_0
public Type GetType (IDesignerHost host)
{
return GetType (host, this.AssemblyName, this.TypeName, false);
}
#endif
protected virtual Type GetType (IDesignerHost host, AssemblyName assemblyName, string typeName, bool reference)
{
if (typeName == null)
throw new ArgumentNullException ("typeName");
if (host == null)
return null;
//get ITypeResolutionService from host, as we have no other IServiceProvider here
ITypeResolutionService typeRes = host.GetService (typeof (ITypeResolutionService)) as ITypeResolutionService;
Type type = null;
if (typeRes != null) {
//TODO: Using Assembly loader to throw errors. Silent fail and return null?
typeRes.GetAssembly (assemblyName, true);
if (reference)
typeRes.ReferenceAssembly (assemblyName);
type = typeRes.GetType (typeName, true);
} else {
Assembly assembly = Assembly.Load (assemblyName);
if (assembly != null)
type = assembly.GetType (typeName);
}
return type;
}
// FIXME - Should we be returning empty bitmap, or null?
public virtual void Initialize (Type type)
{
CheckUnlocked ();
if (type == null)
return;
AssemblyName = type.Assembly.GetName();
DisplayName = type.Name;
TypeName = type.FullName;
// seems to be a right place to create the bitmap
System.Drawing.Image image = null;
foreach (object attribute in type.GetCustomAttributes(true)) {
ToolboxBitmapAttribute tba = attribute as ToolboxBitmapAttribute;
if (tba != null) {
image = tba.GetImage (type);
break;
}
}
//fallback: check for image even if not attribute
if (image == null)
image = ToolboxBitmapAttribute.GetImageFromResource (type, null, false);
if (image != null) {
Bitmap = (image as Bitmap);
if (Bitmap == null)
Bitmap = new Bitmap (image);
}
Filter = type.GetCustomAttributes (typeof (ToolboxItemFilterAttribute), true);
}
void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
{
Serialize (info, context);
}
#if NET_2_0
public virtual void Lock ()
#else
public void Lock ()
#endif
{
locked = true;
}
protected virtual void OnComponentsCreated (ToolboxComponentsCreatedEventArgs args)
{
if (ComponentsCreated != null)
this.ComponentsCreated (this, args);
}
protected virtual void OnComponentsCreating (ToolboxComponentsCreatingEventArgs args)
{
if (ComponentsCreating != null)
this.ComponentsCreating (this, args);
}
protected virtual void Serialize (SerializationInfo info, StreamingContext context)
{
info.AddValue ("AssemblyName", AssemblyName);
info.AddValue ("Bitmap", Bitmap);
info.AddValue ("Filter", Filter);
info.AddValue ("DisplayName", DisplayName);
info.AddValue ("Locked", locked);
info.AddValue ("TypeName", TypeName);
}
public override string ToString()
{
return DisplayName;
}
#if NET_2_0
protected void ValidatePropertyType (string propertyName, object value, Type expectedType, bool allowNull)
{
if (!allowNull && (value == null))
throw new ArgumentNullException ("value");
if ((value != null) && !expectedType.Equals (value.GetType ())) {
string msg = Locale.GetText ("Type mismatch between value ({0}) and expected type ({1}).",
value.GetType (), expectedType);
throw new ArgumentException (msg, "value");
}
}
protected virtual object ValidatePropertyValue (string propertyName, object value)
{
switch (propertyName) {
case "AssemblyName":
ValidatePropertyType (propertyName, value, typeof (AssemblyName), true);
break;
case "Bitmap":
ValidatePropertyType (propertyName, value, typeof (Bitmap), true);
break;
case "Company":
case "Description":
case "DisplayName":
case "TypeName":
ValidatePropertyType (propertyName, value, typeof (string), true);
if (value == null)
value = String.Empty;
break;
case "IsTransient":
ValidatePropertyType (propertyName, value, typeof (bool), false);
break;
case "Filter":
ValidatePropertyType (propertyName, value, typeof (ToolboxItemFilterAttribute[]), true);
if (value == null)
value = new ToolboxItemFilterAttribute [0];
break;
case "DependentAssemblies":
ValidatePropertyType (propertyName, value, typeof (AssemblyName[]), true);
break;
default:
break;
}
return value;
}
private void SetValue (string propertyName, object value)
{
CheckUnlocked ();
properties [propertyName] = ValidatePropertyValue (propertyName, value);
}
#else
private void SetValue (string propertyName, object value)
{
CheckUnlocked ();
properties [propertyName] = value;
}
#endif
private string GetValue (string propertyName)
{
string s = (string) properties [propertyName];
return (s == null) ? String.Empty : s;
}
public event ToolboxComponentsCreatedEventHandler ComponentsCreated;
public event ToolboxComponentsCreatingEventHandler ComponentsCreating;
}
}

View File

@ -0,0 +1,73 @@
//
// System.Drawing.Design.ToolboxItemCollection.cs
//
// Authors:
// Martin Willemoes Hansen (mwh@sysrq.dk)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
// (C) 2003 Andreas Nahr
//
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.Security.Permissions;
namespace System.Drawing.Design
{
[PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
public sealed class ToolboxItemCollection : ReadOnlyCollectionBase
{
public ToolboxItemCollection (ToolboxItem[] value) : base()
{
InnerList.AddRange (value);
}
public ToolboxItemCollection (ToolboxItemCollection value) : base()
{
InnerList.AddRange (value);
}
public ToolboxItem this [int index] {
get { return (ToolboxItem) InnerList[index]; }
}
public bool Contains (ToolboxItem value)
{
return InnerList.Contains (value);
}
public void CopyTo (ToolboxItem[] array, int index)
{
InnerList.CopyTo (array, index);
}
public int IndexOf (ToolboxItem value)
{
return InnerList.IndexOf (value);
}
}
}

View File

@ -0,0 +1,37 @@
// System.Drawing.Design.ToolboxItemCreatorCallback.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@es.gnu.org>
//
// (C) Alejandro Sánchez Acosta
// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Drawing.Design {
#if ONLY_1_1
[Serializable]
#endif
public delegate ToolboxItem ToolboxItemCreatorCallback(
object serializedObject,
string format);
}

View File

@ -0,0 +1,109 @@
//
// System.Drawing.Design.UITypeEditor.cs
//
// Authors:
// Alan Tam Siu Lung <Tam@SiuLung.com>
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Alan Tam Siu Lung <Tam@SiuLung.com>
// (C) 2003 Andreas Nahr
// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.ComponentModel;
using System.Security.Permissions;
using System.Collections;
namespace System.Drawing.Design
{
[PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
[PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
public class UITypeEditor {
static UITypeEditor ()
{
Hashtable editors = new Hashtable ();
editors [typeof (Array)] = "System.ComponentModel.Design.ArrayEditor, " + Consts.AssemblySystem_Design;
editors [typeof (byte [])] = "System.ComponentModel.Design.BinaryEditor, " + Consts.AssemblySystem_Design;
editors [typeof (DateTime)] = "System.ComponentModel.Design.DateTimeEditor, " + Consts.AssemblySystem_Design;
editors [typeof (IList)] = "System.ComponentModel.Design.CollectionEditor, " + Consts.AssemblySystem_Design;
editors [typeof (ICollection)] = "System.ComponentModel.Design.CollectionEditor, " + Consts.AssemblySystem_Design;
editors [typeof (string[])] = "System.Windows.Forms.Design.StringArrayEditor, " + Consts.AssemblySystem_Design;
TypeDescriptor.AddEditorTable (typeof (UITypeEditor), editors);
}
public UITypeEditor()
{
}
public virtual object EditValue (ITypeDescriptorContext context,
IServiceProvider provider, object value)
{
// We already stated that we can't edit ;)
return value;
}
public object EditValue (IServiceProvider provider, object value)
{
return EditValue (null, provider, value);
}
public virtual UITypeEditorEditStyle GetEditStyle (ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.None;
}
public UITypeEditorEditStyle GetEditStyle ()
{
return GetEditStyle (null);
}
public bool GetPaintValueSupported ()
{
return GetPaintValueSupported (null);
}
public virtual bool GetPaintValueSupported (ITypeDescriptorContext context)
{
return false;
}
#if !TARGET_JVM
public void PaintValue (object value, Graphics canvas, Rectangle rectangle)
{
PaintValue (new PaintValueEventArgs (null, value, canvas, rectangle));
}
public virtual void PaintValue (PaintValueEventArgs e)
{
// LAMESPEC: Did not find info in the docs if this should do something here.
// Usually you would expect, that this class gets inherited and this overridden,
// but on the other hand the class is not abstract. Could never observe it did paint anything
return;
}
#endif
#if NET_2_0
public virtual bool IsDropDownResizable {
get { return false; }
}
#endif
}
}

View File

@ -0,0 +1,38 @@
//
// System.Drawing.Design.UITypeEditorEditStyle.cs
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
// Author: Dennis Hayes (dennish@raytek.com)
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Drawing.Design
{
public enum UITypeEditorEditStyle{
DropDown=3,
Modal=2,
None=1
}
}