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,59 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
using System.Windows;
namespace System.ComponentModel {
public class CurrentChangedEventManager : WeakEventManager
{
internal CurrentChangedEventManager ()
{
}
public static void AddListener (ICollectionView source, IWeakEventListener listener)
{
throw new NotImplementedException ();
}
public static void RemoveListener (ICollectionView source, IWeakEventListener listener)
{
throw new NotImplementedException ();
}
protected override void StartListening (object source)
{
throw new NotImplementedException ();
}
protected override void StopListening (object source)
{
throw new NotImplementedException ();
}
}
}

View File

@@ -0,0 +1,63 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
// Brian O'Keefe (zer0keefie@gmail.com)
//
using System;
using System.Windows;
namespace System.ComponentModel {
public class CurrentChangingEventArgs : EventArgs
{
private bool canCancelEvent;
private bool canceled;
public CurrentChangingEventArgs ()
:this(true)
{
}
public CurrentChangingEventArgs (bool isCancelable)
{
canCancelEvent = isCancelable;
canceled = false;
}
public bool Cancel {
get { return canceled; }
set {
if(!IsCancelable && value)
throw new InvalidOperationException("Cannot cancel an event that is not Cancelable.");
canceled = value;
}
}
public bool IsCancelable {
get { return canCancelEvent; }
}
}
}

View File

@@ -0,0 +1,32 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
namespace System.ComponentModel {
public delegate void CurrentChangingEventHandler (object sender, CurrentChangingEventArgs args);
}

View File

@@ -0,0 +1,59 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
using System.Windows;
namespace System.ComponentModel {
public class CurrentChangingEventManager : WeakEventManager
{
internal CurrentChangingEventManager ()
{
}
public static void AddListener (ICollectionView source, IWeakEventListener listener)
{
throw new NotImplementedException ();
}
public static void RemoveListener (ICollectionView source, IWeakEventListener listener)
{
throw new NotImplementedException ();
}
protected override void StartListening (object source)
{
throw new NotImplementedException ();
}
protected override void StopListening (object source)
{
throw new NotImplementedException ();
}
}
}

View File

@@ -0,0 +1,165 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
using System.Windows;
namespace System.ComponentModel {
public sealed class DependencyPropertyDescriptor : PropertyDescriptor {
internal DependencyPropertyDescriptor () : base (null)
{
}
public override AttributeCollection Attributes
{
get { throw new NotImplementedException (); }
}
public override string Category
{
get { throw new NotImplementedException (); }
}
public override Type ComponentType
{
get { throw new NotImplementedException (); }
}
public override TypeConverter Converter
{
get { throw new NotImplementedException (); }
}
public DependencyProperty DependencyProperty
{
get { throw new NotImplementedException (); }
}
public override string Description
{
get { throw new NotImplementedException (); }
}
public override bool DesignTimeOnly
{
get { throw new NotImplementedException (); }
}
public override string DisplayName
{
get { throw new NotImplementedException (); }
}
public bool IsAttached
{
get { throw new NotImplementedException (); }
}
public override bool IsBrowsable
{
get { throw new NotImplementedException (); }
}
public override bool IsLocalizable
{
get { throw new NotImplementedException (); }
}
public override bool IsReadOnly
{
get { throw new NotImplementedException (); }
}
public PropertyMetadata Metadata
{
get { throw new NotImplementedException (); }
}
public override Type PropertyType
{
get { throw new NotImplementedException (); }
}
public override bool SupportsChangeEvents
{
get { throw new NotImplementedException (); }
}
public override void AddValueChanged (object component, EventHandler handler)
{
throw new NotImplementedException ();
}
public override bool CanResetValue (object component)
{
throw new NotImplementedException ();
}
public override bool Equals (object obj)
{
throw new NotImplementedException ();
}
public override PropertyDescriptorCollection GetChildProperties (object instance, Attribute[] filter)
{
throw new NotImplementedException ();
}
public override object GetEditor (Type editorBaseType)
{
throw new NotImplementedException ();
}
public override int GetHashCode ()
{
throw new NotImplementedException ();
}
public override object GetValue (object component)
{
throw new NotImplementedException ();
}
public override void RemoveValueChanged (object component, EventHandler handler)
{
throw new NotImplementedException ();
}
public override void ResetValue (object component)
{
throw new NotImplementedException ();
}
public override void SetValue (object component, object value)
{
throw new NotImplementedException ();
}
public override bool ShouldSerializeValue (object component)
{
throw new NotImplementedException ();
}
public override string ToString ()
{
throw new NotImplementedException ();
}
public static DependencyPropertyDescriptor FromName (string name, Type ownerType, Type targetType)
{
throw new NotImplementedException ();
}
public static DependencyPropertyDescriptor FromProperty (PropertyDescriptor property)
{
throw new NotImplementedException ();
}
public static DependencyPropertyDescriptor FromProperty (DependencyProperty dependencyProperty, Type targetType)
{
throw new NotImplementedException ();
}
public CoerceValueCallback DesignerCoerceValueCallback {
get { throw new NotImplementedException (); }
set { throw new NotImplementedException (); }
}
}
}

View File

@@ -0,0 +1,73 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
using System.Collections.ObjectModel;
using System.Globalization;
namespace System.ComponentModel {
public abstract class GroupDescription : INotifyPropertyChanged
{
readonly ObservableCollection<object> groupNames;
protected GroupDescription ()
{
groupNames = new ObservableCollection<object> ();
}
public ObservableCollection<object> GroupNames {
get { return groupNames; }
}
event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged {
add { PropertyChanged += value; }
remove { PropertyChanged -= value; }
}
protected virtual event PropertyChangedEventHandler PropertyChanged;
public virtual bool NamesMatch (object groupName, object itemName)
{
return Equals (groupName, itemName);
}
protected virtual void OnPropertyChanged (PropertyChangedEventArgs e)
{
if (PropertyChanged != null)
PropertyChanged (this, e);
}
[EditorBrowsable (EditorBrowsableState.Never)]
public bool ShouldSerializeGroupNames ()
{
return GroupNames.Count != 0;
}
public abstract object GroupNameFromItem (object item, int level, CultureInfo culture);
}
}

View File

@@ -0,0 +1,65 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Globalization;
namespace System.ComponentModel {
public interface ICollectionView : IEnumerable, INotifyCollectionChanged
{
bool CanFilter { get; }
bool CanGroup { get; }
bool CanSort { get; }
CultureInfo Culture { get; set; }
object CurrentItem { get; }
int CurrentPosition { get; }
Predicate<object> Filter {get; set; }
ObservableCollection<GroupDescription> GroupDescriptions { get; }
ReadOnlyObservableCollection<object> Groups { get; }
bool IsCurrentAfterLast { get; }
bool IsCurrentBeforeFirst { get; }
bool IsEmpty { get; }
SortDescriptionCollection SortDescriptions { get; }
IEnumerable SourceCollection { get; }
event EventHandler CurrentChanged;
event CurrentChangingEventHandler CurrentChanging;
bool Contains (object item);
IDisposable DeferRefresh ();
bool MoveCurrentTo (object item);
bool MoveCurrentToFirst ();
bool MoveCurrentToLast ();
bool MoveCurrentToNext ();
bool MoveCurrentToPosition (int position);
bool MoveCurrentToPrevious ();
void Refresh ();
}
}

View File

@@ -0,0 +1,33 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
namespace System.ComponentModel {
public interface ICollectionViewFactory {
ICollectionView CreateView ();
}
}

View File

@@ -0,0 +1,54 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Author:
// Chris Toshok (toshok@ximian.com)
//
namespace System.ComponentModel {
public interface IEditableCollectionView {
void EditItem (object item);
object AddNew ();
void CancelEdit ();
void CancelNew ();
void CommitEdit ();
void CommitNew ();
void Remove (object item);
void RemoveAt (int index);
object CurrentAddItem { get; }
object CurrentEditItem { get; }
bool CanAddNew { get; }
bool CanCancelEdit { get; }
bool CanRemove { get; }
bool IsAddingNew { get; }
bool IsEditingItem { get; }
NewItemPlaceholderPosition NewItemPlaceholderPosition { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
//
// IEditableCollectionViewAddNewItem.cs
//
// Author:
// Antonius Riha <antoniusriha@gmail.com>
//
// Copyright (c) 2012 Antonius Riha
//
// 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.
#if NET_4_0
namespace System.ComponentModel
{
public interface IEditableCollectionViewAddNewItem : IEditableCollectionView
{
bool CanAddNewItem { get; }
object AddNewItem (object newItem);
}
}
#endif

View File

@@ -0,0 +1,34 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Author:
// Chris Toshok (toshok@ximian.com)
//
using System.Collections.ObjectModel;
namespace System.ComponentModel {
public interface IItemProperties {
ReadOnlyCollection<ItemPropertyInfo> ItemProperties { get; }
}
}

View File

@@ -0,0 +1,52 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Author:
// Chris Toshok (toshok@ximian.com)
//
namespace System.ComponentModel {
public class ItemPropertyInfo {
public ItemPropertyInfo (string name, Type type, object descriptor)
{
Name = name;
PropertyType = type;
Descriptor = descriptor;
}
public string Name {
get;
private set;
}
public Type PropertyType {
get;
private set;
}
public object Descriptor {
get;
private set;
}
}
}

View File

@@ -0,0 +1,34 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Author:
// Chris Toshok (toshok@ximian.com)
//
namespace System.ComponentModel {
public enum NewItemPlaceholderPosition {
None,
AtBeginning,
AtEnd
}
}

View File

@@ -0,0 +1,63 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
using System.Windows;
namespace System.ComponentModel {
public class PropertyChangedEventManager : WeakEventManager
{
internal PropertyChangedEventManager ()
{
}
public static void AddListener (INotifyPropertyChanged source, IWeakEventListener listener, string propertyName)
{
throw new NotImplementedException ();
}
public static void RemoveListener (INotifyPropertyChanged source, IWeakEventListener listener, string propertyName)
{
throw new NotImplementedException ();
}
protected override bool Purge (object source, object data, bool purgeAll)
{
throw new NotImplementedException ();
}
protected override void StartListening (object source)
{
throw new NotImplementedException ();
}
protected override void StopListening (object source)
{
throw new NotImplementedException ();
}
}
}

View File

@@ -0,0 +1,70 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
// Brian O'Keefe (zer0keefie@gmail.com)
//
using System;
namespace System.ComponentModel {
[AttributeUsage (AttributeTargets.Property | AttributeTargets.Method)]
public sealed class PropertyFilterAttribute : Attribute
{
public static readonly PropertyFilterAttribute Default = new PropertyFilterAttribute(PropertyFilterOptions.All);
private PropertyFilterOptions options;
public PropertyFilterAttribute (PropertyFilterOptions filter)
{
options = filter;
}
public PropertyFilterOptions Filter {
get { return options; }
}
public override bool Equals (object value)
{
if (!(value is PropertyFilterAttribute))
return false;
return ((PropertyFilterAttribute)value).options == options;
}
public override int GetHashCode ()
{
return options.GetHashCode ();
}
public override bool Match (object value)
{
if (!(value is PropertyFilterAttribute))
return false;
PropertyFilterOptions other = ((PropertyFilterAttribute)value).options;
PropertyFilterOptions common = other & options;
return common == options;
}
}
}

View File

@@ -0,0 +1,40 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
using System;
namespace System.ComponentModel {
[Flags]
public enum PropertyFilterOptions {
None = 0,
Invalid = 1,
SetValues = 2,
UnsetValues = 4,
Valid = 8,
All = 15
}
}

View File

@@ -0,0 +1,103 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
// Brian O'Keefe (zer0keefie@gmail.com)
//
using System;
namespace System.ComponentModel {
public struct SortDescription
{
private string sortPropertyName;
private ListSortDirection sortDirection;
private bool isSealed;
public SortDescription (string propertyName, ListSortDirection direction)
{
if(direction != ListSortDirection.Ascending && direction != ListSortDirection.Descending)
throw new InvalidEnumArgumentException("direction", (int)direction, typeof(ListSortDirection));
sortPropertyName = propertyName;
sortDirection = direction;
isSealed = false;
}
public static bool operator!= (SortDescription sd1, SortDescription sd2)
{
return !(sd1 == sd2);
}
public static bool operator== (SortDescription sd1, SortDescription sd2)
{
return sd1.sortDirection == sd2.sortDirection && sd1.sortPropertyName == sd2.sortPropertyName;
}
public ListSortDirection Direction {
get { return sortDirection; }
set {
if(isSealed)
throw new InvalidOperationException("Cannot change Direction once the SortDescription has been sealed.");
if(value != ListSortDirection.Ascending && value != ListSortDirection.Descending)
throw new InvalidEnumArgumentException("direction", (int)value, typeof(ListSortDirection));
sortDirection = value;
}
}
public bool IsSealed {
get { return isSealed; }
}
public string PropertyName {
get { return sortPropertyName; }
set {
if(isSealed)
throw new InvalidOperationException("Cannot change Direction once the SortDescription has been sealed.");
sortPropertyName = value;
}
}
public override bool Equals (object obj)
{
if (!(obj is SortDescription))
return false;
return ((SortDescription)obj) == this;
}
public override int GetHashCode ()
{
if(sortPropertyName == null)
return sortDirection.GetHashCode ();
return sortPropertyName.GetHashCode () ^ sortDirection.GetHashCode ();
}
internal void Seal()
{
isSealed = true;
}
}
}

View File

@@ -0,0 +1,114 @@
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Chris Toshok (toshok@ximian.com)
// Brian O'Keefe (zer0keefie@gmail.com)
//
using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
namespace System.ComponentModel {
public class SortDescriptionCollection : Collection<SortDescription>, INotifyCollectionChanged
{
public static readonly SortDescriptionCollection Empty = new SortDescriptionCollection (true);
readonly bool isReadOnly;
public SortDescriptionCollection () : this (false)
{
}
SortDescriptionCollection (bool isReadOnly)
{
this.isReadOnly = isReadOnly;
}
event NotifyCollectionChangedEventHandler INotifyCollectionChanged.CollectionChanged {
add { CollectionChanged += value; }
remove { CollectionChanged -= value; }
}
protected event NotifyCollectionChangedEventHandler CollectionChanged;
protected override void ClearItems ()
{
if (isReadOnly)
throw new NotSupportedException ();
base.ClearItems ();
OnCollectionChanged (NotifyCollectionChangedAction.Reset);
}
protected override void InsertItem (int index, SortDescription item)
{
if (isReadOnly)
throw new NotSupportedException ();
item.Seal ();
base.InsertItem (index, item);
OnCollectionChanged (NotifyCollectionChangedAction.Add, item, index);
}
protected override void RemoveItem (int index)
{
if (isReadOnly)
throw new NotSupportedException ();
SortDescription sd = base [index];
base.RemoveItem (index);
OnCollectionChanged (NotifyCollectionChangedAction.Remove, sd, index);
}
protected override void SetItem (int index, SortDescription item)
{
if (isReadOnly)
throw new NotSupportedException ();
SortDescription old = base [index];
item.Seal ();
base.SetItem (index, item);
OnCollectionChanged (NotifyCollectionChangedAction.Remove, old, index);
OnCollectionChanged (NotifyCollectionChangedAction.Add, item, index);
}
private void OnCollectionChanged (NotifyCollectionChangedAction action)
{
NotifyCollectionChangedEventHandler eh = CollectionChanged;
if (eh != null)
eh (this, new NotifyCollectionChangedEventArgs (action));
}
private void OnCollectionChanged (NotifyCollectionChangedAction action, SortDescription item, int index)
{
NotifyCollectionChangedEventHandler eh = CollectionChanged;
if (eh != null)
eh (this, new NotifyCollectionChangedEventArgs (action, item, index));
}
}
}