diff options
Diffstat (limited to 'src')
173 files changed, 11445 insertions, 0 deletions
diff --git a/src/FPF/Directory.Build.props b/src/FPF/Directory.Build.props new file mode 100644 index 0000000..548aff7 --- /dev/null +++ b/src/FPF/Directory.Build.props @@ -0,0 +1,18 @@ +<Project> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.props" /> + + <PropertyGroup> + + <NoWarn>67;114;3001;3002;3009;$(NoWarn)</NoWarn> + <AssemblyAttributeClsCompliant>false</AssemblyAttributeClsCompliant> + + <BaseOutputPath>$(RepoBinPath)FPF\</BaseOutputPath> + <OutputPath>$(BaseOutputPath)$(Configuration)\</OutputPath> + + <SignAssembly>true</SignAssembly> + <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)winfx3.pub</AssemblyOriginatorKeyFile> + <PublicSign>true</PublicSign> + + <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/src/FPF/Directory.Build.targets b/src/FPF/Directory.Build.targets new file mode 100644 index 0000000..b3d5603 --- /dev/null +++ b/src/FPF/Directory.Build.targets @@ -0,0 +1,6 @@ +<Project> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.targets" /> + <PropertyGroup> + <PackageId>Microsoft.VisualStudio.FPF.$(AssemblyName)</PackageId> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/src/FPF/PresentationCore/PresentationCore.csproj b/src/FPF/PresentationCore/PresentationCore.csproj new file mode 100644 index 0000000..e8cefc0 --- /dev/null +++ b/src/FPF/PresentationCore/PresentationCore.csproj @@ -0,0 +1,10 @@ +<Project Sdk="Xamarin.Mac.Sdk"> + <PropertyGroup> + <TargetFramework>$(TargetFramework)</TargetFramework> + </PropertyGroup> + <ItemGroup> + <ProjectReference Include="..\UIAutomationProvider\UIAutomationProvider.csproj" /> + <ProjectReference Include="..\UIAutomationTypes\UIAutomationTypes.csproj" /> + <ProjectReference Include="..\WindowsBase\WindowsBase.csproj" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/src/FPF/PresentationCore/Properties/AssemblyInfo.cs b/src/FPF/PresentationCore/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8341535 --- /dev/null +++ b/src/FPF/PresentationCore/Properties/AssemblyInfo.cs @@ -0,0 +1,7 @@ +using System; +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: CLSCompliant(true)] +[assembly: AssemblyVersion("4.0.0.0")] +[assembly:InternalsVisibleTo("PresentationFramework, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Clipboard.cs b/src/FPF/PresentationCore/System.Windows.Clipboard.cs new file mode 100644 index 0000000..f45967c --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Clipboard.cs @@ -0,0 +1,63 @@ +using AppKit; +using Foundation; + +namespace System.Windows +{ + public static class Clipboard + { + static readonly NSPasteboard pasteboard = NSPasteboard.GeneralPasteboard; + static readonly string[] textTypes = { DataFormats.UnicodeText }; + + public static bool ContainsText() + => pasteboard.CanReadItemWithDataConformingToTypes(textTypes); + + public static void SetDataObject(object data, bool copy) + { + if (data is DataObject dataObject) + { + pasteboard.ClearContents(); + + foreach (var item in dataObject.Items) + { + switch (item.Data) + { + case string stringData: + pasteboard.SetStringForType( + stringData, + item.Format); + break; + case bool boolItem: + pasteboard.SetDataForType( + NSData.FromArray(new byte[] { boolItem ? (byte)1 : (byte)0 }), + item.Format); + break; + } + } + } + } + + public static IDataObject GetDataObject() + { + var dataObject = new DataObject (); + // Beside copying and pasting UnicodeText to/from pasteboard + // editor inserts booleans like "VisualStudioEditorOperationsLineCutCopyClipboardTag" + // which allows editor to know whole line was copied into pasteboard so on paste + // it inserts line into new line, so we enumerate over all types and if length == 1 + // we just assume it's boolean we set in method above + foreach (var type in pasteboard.Types) + { + if (type == DataFormats.UnicodeText) + { + dataObject.SetText (pasteboard.GetStringForType (type)); + continue; + } + var data = pasteboard.GetDataForType (type); + if (data != null && data.Length == 1) + { + dataObject.SetData (type, data: data [0] != 0); + } + } + return dataObject; + } + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.DataFormats.cs b/src/FPF/PresentationCore/System.Windows.DataFormats.cs new file mode 100644 index 0000000..a997a38 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.DataFormats.cs @@ -0,0 +1,28 @@ +namespace System.Windows +{ + public static class DataFormats + { + public static readonly string Text = "public.utf8-plain-text"; + public static readonly string UnicodeText = "public.utf8-plain-text"; + public static readonly string Rtf = "public.rtf"; + public static readonly string Html = "public.html"; + public static readonly string CommaSeparatedValue = "public.utf8-tab-separated-values-text"; + + internal static string ConvertToDataFormats(TextDataFormat textDataformat) + { + switch (textDataformat) + { + case TextDataFormat.Text: + return Text; + case TextDataFormat.UnicodeText: + return UnicodeText; + case TextDataFormat.Rtf: + return Rtf; + case TextDataFormat.Html: + return Html; + default: + return UnicodeText; + } + } + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.DataObject.cs b/src/FPF/PresentationCore/System.Windows.DataObject.cs new file mode 100644 index 0000000..6dc13dc --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.DataObject.cs @@ -0,0 +1,91 @@ +using System.Collections.Generic; + +namespace System.Windows +{ + public interface IDataObject + { + bool GetDataPresent(string format, bool autoConvert); + bool GetDataPresent(Type format); + bool GetDataPresent(string format); + object GetData(string format); + object GetData(string format, bool autoConvert); + string[] GetFormats(); + } + + public sealed class DataObject : IDataObject + { + public readonly struct DataItem + { + public readonly string Format; + public readonly object Data; + + public DataItem (string format, object data) + { + Format = format; + Data = data; + } + } + + readonly List<DataItem> items = new List<DataItem>(4); + public IReadOnlyList<DataItem> Items => items; + + public void SetData(string format, object data) + => items.Add(new DataItem(format, data)); + + public void SetText(string textData) + => SetText(textData, TextDataFormat.UnicodeText); + + public void SetText(string textData, TextDataFormat format) + => SetData(DataFormats.ConvertToDataFormats(format), textData); + + public bool GetDataPresent(Type format) + { + if (format == typeof(string)) + return GetDataPresent(DataFormats.Text); + + return GetDataPresent(format.FullName); + } + + public bool GetDataPresent(string format) + => GetDataPresent(format, true); + + public bool GetDataPresent(string format, bool autoConvert) + { + foreach (var item in items) + { + if (string.Equals(item.Format, format, StringComparison.OrdinalIgnoreCase)) + return true; + } + + return false; + } + + public object GetData(string format) + => GetData(format, true); + + public object GetData(string format, bool autoConvert) + { + foreach (var item in items) + { + if (string.Equals(item.Format, format, StringComparison.OrdinalIgnoreCase)) + { + if (item.Data is string tsv && + string.Equals(item.Format, DataFormats.CommaSeparatedValue)) + return tsv.Replace('\t', ','); + + return item.Data; + } + } + + return null; + } + + public string[] GetFormats() + { + var formats = new string[items.Count]; + for (int i = 0; i < items.Count; i++) + formats[i] = items[i].Format; + return formats; + } + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.DragEventArgs.cs b/src/FPF/PresentationCore/System.Windows.DragEventArgs.cs new file mode 100644 index 0000000..dcd7938 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.DragEventArgs.cs @@ -0,0 +1,10 @@ +namespace System.Windows +{ + public class DragEventArgs : System.Windows.RoutedEventArgs + { + + + + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.FontStyle.cs b/src/FPF/PresentationCore/System.Windows.FontStyle.cs new file mode 100644 index 0000000..6558730 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.FontStyle.cs @@ -0,0 +1,11 @@ +namespace System.Windows +{ + public struct FontStyle + { + public static bool operator ==(FontStyle p1, FontStyle p2) { return true; } + public static bool operator !=(FontStyle p1, FontStyle p2) { return false; } + + public override bool Equals(object obj) => true; + public override int GetHashCode() => 0; + } +} diff --git a/src/FPF/PresentationCore/System.Windows.FontStyles.cs b/src/FPF/PresentationCore/System.Windows.FontStyles.cs new file mode 100644 index 0000000..46c28ec --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.FontStyles.cs @@ -0,0 +1,10 @@ +namespace System.Windows +{ + public abstract class FontStyles : System.Object + { + + public static System.Windows.FontStyle Italic { get { return new FontStyle(); } } + public static System.Windows.FontStyle Normal { get { return new FontStyle(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.FontWeight.cs b/src/FPF/PresentationCore/System.Windows.FontWeight.cs new file mode 100644 index 0000000..0d094c9 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.FontWeight.cs @@ -0,0 +1,206 @@ +namespace System.Windows +{ + public struct FontWeight : IFormattable + { + internal FontWeight(int weight) + { + // We want the default zero value of new FontWeight() to correspond to FontWeights.Normal. + // Therefore, the _weight value is shifted by 400 relative to the OpenType weight value. + _weight = weight - 400; + } + + /// <summary> + /// Creates a new FontWeight object that corresponds to the OpenType usWeightClass value. + /// </summary> + /// <param name="weightValue">An integer value between 1 and 999 that corresponds + /// to the usWeightClass definition in the OpenType specification.</param> + /// <returns>A new FontWeight object that corresponds to the weightValue parameter.</returns> + // Important note: when changing this method signature please make sure to update FontWeightConverter accordingly. + public static FontWeight FromOpenTypeWeight(int weightValue) + { + if (weightValue < 1 || weightValue > 999) + throw new ArgumentOutOfRangeException(); + return new FontWeight(weightValue); + } + + /// <summary> + /// Obtains OpenType usWeightClass value that corresponds to the FontWeight object. + /// </summary> + /// <returns>An integer value between 1 and 999 that corresponds + /// to the usWeightClass definition in the OpenType specification.</returns> + // Important note: when changing this method signature please make sure to update FontWeightConverter accordingly. + public int ToOpenTypeWeight() + { + return RealWeight; + } + + /// <summary> + /// Compares two font weight values and returns an indication of their relative values. + /// </summary> + /// <param name="left">First object to compare.</param> + /// <param name="right">Second object to compare.</param> + /// <returns>A 32-bit signed integer indicating the lexical relationship between the two comparands. + /// When the return value is less than zero this means that left is less than right. + /// When the return value is zero this means that left is equal to right. + /// When the return value is greater than zero this means that left is greater than right. + /// </returns> + public static int Compare(FontWeight left, FontWeight right) + { + return left._weight - right._weight; + } + + /// <summary> + /// Checks whether a font weight is less than another. + /// </summary> + /// <param name="left">First object to compare.</param> + /// <param name="right">Second object to compare.</param> + /// <returns>True if left is less than right, false otherwise.</returns> + public static bool operator <(FontWeight left, FontWeight right) + { + return Compare(left, right) < 0; + } + + /// <summary> + /// Checks whether a font weight is less or equal than another. + /// </summary> + /// <param name="left">First object to compare.</param> + /// <param name="right">Second object to compare.</param> + /// <returns>True if left is less or equal than right, false otherwise.</returns> + public static bool operator <=(FontWeight left, FontWeight right) + { + return Compare(left, right) <= 0; + } + + /// <summary> + /// Checks whether a font weight is greater than another. + /// </summary> + /// <param name="left">First object to compare.</param> + /// <param name="right">Second object to compare.</param> + /// <returns>True if left is greater than right, false otherwise.</returns> + public static bool operator >(FontWeight left, FontWeight right) + { + return Compare(left, right) > 0; + } + + /// <summary> + /// Checks whether a font weight is greater or equal than another. + /// </summary> + /// <param name="left">First object to compare.</param> + /// <param name="right">Second object to compare.</param> + /// <returns>True if left is greater or equal than right, false otherwise.</returns> + public static bool operator >=(FontWeight left, FontWeight right) + { + return Compare(left, right) >= 0; + } + + /// <summary> + /// Checks whether two font weight objects are equal. + /// </summary> + /// <param name="left">First object to compare.</param> + /// <param name="right">Second object to compare.</param> + /// <returns>Returns true when the font weight values are equal for both objects, + /// and false otherwise.</returns> + public static bool operator ==(FontWeight left, FontWeight right) + { + return Compare(left, right) == 0; + } + + /// <summary> + /// Checks whether two font weight objects are not equal. + /// </summary> + /// <param name="left">First object to compare.</param> + /// <param name="right">Second object to compare.</param> + /// <returns>Returns false when the font weight values are equal for both objects, + /// and true otherwise.</returns> + public static bool operator !=(FontWeight left, FontWeight right) + { + return !(left == right); + } + + /// <summary> + /// Checks whether the object is equal to another FontWeight object. + /// </summary> + /// <param name="obj">FontWeight object to compare with.</param> + /// <returns>Returns true when the object is equal to the input object, + /// and false otherwise.</returns> + public bool Equals(FontWeight obj) + { + return this == obj; + } + + /// <summary> + /// Checks whether an object is equal to another character hit object. + /// </summary> + /// <param name="obj">FontWeight object to compare with.</param> + /// <returns>Returns true when the object is equal to the input object, + /// and false otherwise.</returns> + public override bool Equals(object obj) + { + if (!(obj is FontWeight)) + return false; + return this == (FontWeight)obj; + } + + /// <summary> + /// Compute hash code for this object. + /// </summary> + /// <returns>A 32-bit signed integer hash code.</returns> + public override int GetHashCode() + { + return RealWeight; + } + + /// <summary> + /// Creates a string representation of this object based on the current culture. + /// </summary> + /// <returns> + /// A string representation of this object. + /// </returns> + public override string ToString() + { + // Delegate to the internal method which implements all ToString calls. + return ConvertToString(null, null); + } + + /// <summary> + /// Creates a string representation of this object based on the format string + /// and IFormatProvider passed in. + /// If the provider is null, the CurrentCulture is used. + /// See the documentation for IFormattable for more information. + /// </summary> + /// <returns> + /// A string representation of this object. + /// </returns> + string IFormattable.ToString(string format, IFormatProvider provider) + { + // Delegate to the internal method which implements all ToString calls. + return ConvertToString(format, provider); + } + + /// <summary> + /// Creates a string representation of this object based on the format string + /// and IFormatProvider passed in. + /// If the provider is null, the CurrentCulture is used. + /// See the documentation for IFormattable for more information. + /// </summary> + /// <returns> + /// A string representation of this object. + /// </returns> + private string ConvertToString(string format, IFormatProvider provider) + { + throw new NotImplementedException(); + } + + /// <summary> + /// We want the default zero value of new FontWeight() to correspond to FontWeights.Normal. + /// Therefore, _weight value is shifted by 400 relative to the OpenType weight value. + /// </summary> + private int RealWeight { + get { + return _weight + 400; + } + } + + private int _weight; + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.FontWeights.cs b/src/FPF/PresentationCore/System.Windows.FontWeights.cs new file mode 100644 index 0000000..dca1e0f --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.FontWeights.cs @@ -0,0 +1,12 @@ +namespace System.Windows +{ + public abstract class FontWeights : System.Object + { + + + public static System.Windows.FontWeight Bold { get { return new FontWeight(); } } + public static System.Windows.FontWeight Normal { get { return new FontWeight(); } } + public static System.Windows.FontWeight Regular { get { return new FontWeight(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.GiveFeedbackEventArgs.cs b/src/FPF/PresentationCore/System.Windows.GiveFeedbackEventArgs.cs new file mode 100644 index 0000000..776c7da --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.GiveFeedbackEventArgs.cs @@ -0,0 +1,6 @@ +namespace System.Windows +{ + public class GiveFeedbackEventArgs : System.Windows.RoutedEventArgs + { + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.IInputElement.cs b/src/FPF/PresentationCore/System.Windows.IInputElement.cs new file mode 100644 index 0000000..e7fe80c --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.IInputElement.cs @@ -0,0 +1,6 @@ +namespace System.Windows +{ + public interface IInputElement + { + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Input.InputEventArgs.cs b/src/FPF/PresentationCore/System.Windows.Input.InputEventArgs.cs new file mode 100644 index 0000000..3ff7fe5 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Input.InputEventArgs.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Input +{ + public class InputEventArgs : System.Windows.RoutedEventArgs + { + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Input.InputLanguageEventArgs.cs b/src/FPF/PresentationCore/System.Windows.Input.InputLanguageEventArgs.cs new file mode 100644 index 0000000..09061c6 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Input.InputLanguageEventArgs.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Input +{ + public abstract class InputLanguageEventArgs : System.EventArgs + { + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Input.MouseButton.cs b/src/FPF/PresentationCore/System.Windows.Input.MouseButton.cs new file mode 100644 index 0000000..e22e8c0 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Input.MouseButton.cs @@ -0,0 +1,11 @@ +namespace System.Windows.Input +{ + public enum MouseButton + { Left, + Middle, + Right, + XButton1, + XButton2, + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Input.MouseButtonEventArgs.cs b/src/FPF/PresentationCore/System.Windows.Input.MouseButtonEventArgs.cs new file mode 100644 index 0000000..3709e5f --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Input.MouseButtonEventArgs.cs @@ -0,0 +1,12 @@ +namespace System.Windows.Input +{ + public class MouseButtonEventArgs : System.Windows.Input.MouseEventArgs + { + + + public System.Int32 ClickCount { get { throw new System.NotImplementedException(); } } + public System.Windows.Input.MouseButton ChangedButton { get { throw new System.NotImplementedException(); } } + public System.Windows.Input.MouseButtonState ButtonState { get { throw new System.NotImplementedException(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Input.MouseButtonState.cs b/src/FPF/PresentationCore/System.Windows.Input.MouseButtonState.cs new file mode 100644 index 0000000..a4d6b09 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Input.MouseButtonState.cs @@ -0,0 +1,8 @@ +namespace System.Windows.Input +{ + public enum MouseButtonState + { Released, + Pressed, + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Input.MouseEventArgs.cs b/src/FPF/PresentationCore/System.Windows.Input.MouseEventArgs.cs new file mode 100644 index 0000000..cef60a9 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Input.MouseEventArgs.cs @@ -0,0 +1,14 @@ +namespace System.Windows.Input +{ + public class MouseEventArgs : System.Windows.Input.InputEventArgs + { + + + + + public System.Windows.Point GetPosition(object param0){throw new System.NotImplementedException();} + public System.Windows.Input.MouseButtonState LeftButton { get { throw new System.NotImplementedException(); } } + public System.Windows.Input.MouseButtonState MiddleButton { get { throw new System.NotImplementedException(); } } + public System.Windows.Input.MouseButtonState RightButton { get { throw new System.NotImplementedException(); } } + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Input.MouseWheelEventArgs.cs b/src/FPF/PresentationCore/System.Windows.Input.MouseWheelEventArgs.cs new file mode 100644 index 0000000..10cee09 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Input.MouseWheelEventArgs.cs @@ -0,0 +1,8 @@ +namespace System.Windows.Input +{ + public class MouseWheelEventArgs : System.Windows.Input.MouseEventArgs + { + public System.Int32 Delta { get { throw new System.NotImplementedException(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Input.TouchEventArgs.cs b/src/FPF/PresentationCore/System.Windows.Input.TouchEventArgs.cs new file mode 100644 index 0000000..9a2df37 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Input.TouchEventArgs.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Input +{ + public class TouchEventArgs : System.Windows.Input.InputEventArgs + { + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Animation.Animatable.cs b/src/FPF/PresentationCore/System.Windows.Media.Animation.Animatable.cs new file mode 100644 index 0000000..52cc7b1 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Animation.Animatable.cs @@ -0,0 +1,11 @@ +namespace System.Windows.Media.Animation +{ + public abstract class Animatable : System.Windows.Freezable + { public virtual void BeginAnimation(System.Windows.DependencyProperty param0, System.Windows.Media.Animation.AnimationTimeline param1){throw new System.NotImplementedException();} + + protected override Freezable CreateInstanceCore() + { + return null; + } + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Animation.AnimationTimeline.cs b/src/FPF/PresentationCore/System.Windows.Media.Animation.AnimationTimeline.cs new file mode 100644 index 0000000..adbae0e --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Animation.AnimationTimeline.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Media.Animation +{ + public abstract class AnimationTimeline : System.Windows.Media.Animation.Timeline + { + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Animation.RepeatBehavior.cs b/src/FPF/PresentationCore/System.Windows.Media.Animation.RepeatBehavior.cs new file mode 100644 index 0000000..2246d6b --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Animation.RepeatBehavior.cs @@ -0,0 +1,9 @@ +namespace System.Windows.Media.Animation +{ + public struct RepeatBehavior + { public RepeatBehavior(System.Double param0){} + + public static System.Windows.Media.Animation.RepeatBehavior Forever { get { throw new System.NotImplementedException(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Animation.Timeline.cs b/src/FPF/PresentationCore/System.Windows.Media.Animation.Timeline.cs new file mode 100644 index 0000000..1c7aaf4 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Animation.Timeline.cs @@ -0,0 +1,10 @@ +namespace System.Windows.Media.Animation +{ + public abstract class Timeline : System.Windows.Media.Animation.Animatable + { + + public event System.EventHandler Completed; + public System.Windows.Media.Animation.RepeatBehavior RepeatBehavior { set { throw new System.NotImplementedException(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.BitmapScalingMode.cs b/src/FPF/PresentationCore/System.Windows.Media.BitmapScalingMode.cs new file mode 100644 index 0000000..83b709c --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.BitmapScalingMode.cs @@ -0,0 +1,12 @@ +namespace System.Windows.Media +{ + public enum BitmapScalingMode + { Unspecified, + LowQuality, + HighQuality, + Linear, + Fant, + NearestNeighbor, + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Brush.cs b/src/FPF/PresentationCore/System.Windows.Media.Brush.cs new file mode 100644 index 0000000..677e0a4 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Brush.cs @@ -0,0 +1,11 @@ +namespace System.Windows.Media +{ + public abstract class Brush : System.Windows.Media.Animation.Animatable + { + public System.String ToString(System.IFormatProvider param0){throw new System.NotImplementedException();} + + public new System.Windows.Media.Brush Clone() { return this; } + public System.Double Opacity { get; set; } = 1.0; + + } +} diff --git a/src/FPF/PresentationCore/System.Windows.Media.Brushes.cs b/src/FPF/PresentationCore/System.Windows.Media.Brushes.cs new file mode 100644 index 0000000..dc99d71 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Brushes.cs @@ -0,0 +1,21 @@ +namespace System.Windows.Media +{ + public class Brushes : System.Object + { + static SolidColorBrush pink = new SolidColorBrush(Colors.Pink); + public static System.Windows.Media.SolidColorBrush Black { get => pink; } + public static System.Windows.Media.SolidColorBrush Blue { get => pink; } + public static System.Windows.Media.SolidColorBrush DarkGray { get => pink; } + public static System.Windows.Media.SolidColorBrush Gray { get => pink; } + public static System.Windows.Media.SolidColorBrush LightBlue { get => pink; } + public static System.Windows.Media.SolidColorBrush LightGray { get => pink; } + public static System.Windows.Media.SolidColorBrush LightYellow { get => pink; } + public static System.Windows.Media.SolidColorBrush PaleVioletRed { get => pink; } + public static System.Windows.Media.SolidColorBrush Red { get => pink; } + public static System.Windows.Media.SolidColorBrush Transparent { get; } = new SolidColorBrush(Colors.Transparent); + public static System.Windows.Media.SolidColorBrush White { get => pink; } + public static System.Windows.Media.SolidColorBrush Yellow { get => pink; } + public static System.Windows.Media.SolidColorBrush Green { get => pink; } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Color.cs b/src/FPF/PresentationCore/System.Windows.Media.Color.cs new file mode 100644 index 0000000..1af2af3 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Color.cs @@ -0,0 +1,694 @@ +using System.Runtime.InteropServices; +using System.Text; + +namespace System.Windows.Media +{ + public struct Color : IFormattable, IEquatable<Color> + { + //------------------------------------------------------ + // + // Constructors + // + //------------------------------------------------------ + + #region Constructors + + + + ///<summary> + /// FromAValues - general constructor for multichannel color values with explicit alpha channel and color context, i.e. spectral colors + ///</summary> + public static Color FromAValues(float a, float[] values, Uri profileUri) + { + throw new NotImplementedException(); + } + + ///<summary> + /// FromValues - general color constructor for multichannel color values with opaque alpha channel and explicit color context, i.e. spectral colors + ///</summary> + public static Color FromValues(float[] values, Uri profileUri) + { + Color c1 = Color.FromAValues(1.0f, values, profileUri); + + return c1; + } + + ///<summary> + /// Color - sRgb legacy interface, assumes Rgb values are sRgb + ///</summary> + internal static Color FromUInt32(uint argb)// internal legacy sRGB interface + { + Color c1 = new Color(); + + c1.sRgbColor.a = (byte)((argb & 0xff000000) >> 24); + c1.sRgbColor.r = (byte)((argb & 0x00ff0000) >> 16); + c1.sRgbColor.g = (byte)((argb & 0x0000ff00) >> 8); + c1.sRgbColor.b = (byte)(argb & 0x000000ff); + c1.scRgbColor.a = (float)c1.sRgbColor.a / 255.0f; + c1.scRgbColor.r = sRgbToScRgb(c1.sRgbColor.r); // note that context is undefined and thus unloaded + c1.scRgbColor.g = sRgbToScRgb(c1.sRgbColor.g); + c1.scRgbColor.b = sRgbToScRgb(c1.sRgbColor.b); + c1.context = null; + + c1.isFromScRgb = false; + + return c1; + } + + ///<summary> + /// FromScRgb + ///</summary> + public static Color FromScRgb(float a, float r, float g, float b) + { + Color c1 = new Color(); + + c1.scRgbColor.r = r; + c1.scRgbColor.g = g; + c1.scRgbColor.b = b; + c1.scRgbColor.a = a; + if (a < 0.0f) { + a = 0.0f; + } else if (a > 1.0f) { + a = 1.0f; + } + + c1.sRgbColor.a = (byte)((a * 255.0f) + 0.5f); + c1.sRgbColor.r = ScRgbTosRgb(c1.scRgbColor.r); + c1.sRgbColor.g = ScRgbTosRgb(c1.scRgbColor.g); + c1.sRgbColor.b = ScRgbTosRgb(c1.scRgbColor.b); + c1.context = null; + + c1.isFromScRgb = true; + + return c1; + } + + ///<summary> + /// Color - sRgb legacy interface, assumes Rgb values are sRgb, alpha channel is linear 1.0 gamma + ///</summary> + public static Color FromArgb(byte a, byte r, byte g, byte b)// legacy sRGB interface, bytes are required to properly round trip + { + Color c1 = new Color(); + + c1.scRgbColor.a = (float)a / 255.0f; + c1.scRgbColor.r = sRgbToScRgb(r); // note that context is undefined and thus unloaded + c1.scRgbColor.g = sRgbToScRgb(g); + c1.scRgbColor.b = sRgbToScRgb(b); + c1.context = null; + c1.sRgbColor.a = a; + c1.sRgbColor.r = ScRgbTosRgb(c1.scRgbColor.r); + c1.sRgbColor.g = ScRgbTosRgb(c1.scRgbColor.g); + c1.sRgbColor.b = ScRgbTosRgb(c1.scRgbColor.b); + + c1.isFromScRgb = false; + + return c1; + } + + ///<summary> + /// Color - sRgb legacy interface, assumes Rgb values are sRgb + ///</summary> + public static Color FromRgb(byte r, byte g, byte b)// legacy sRGB interface, bytes are required to properly round trip + { + Color c1 = Color.FromArgb(0xff, r, g, b); + return c1; + } + #endregion Constructors + + //------------------------------------------------------ + // + // Public Methods + // + //------------------------------------------------------ + + #region Public Methods + ///<summary> + /// GetHashCode + ///</summary> + public override int GetHashCode() + { + return this.scRgbColor.GetHashCode(); //^this.context.GetHashCode(); + } + + /// <summary> + /// Creates a string representation of this object based on the current culture. + /// </summary> + /// <returns> + /// A string representation of this object. + /// </returns> + public override string ToString() + { + // Delegate to the internal method which implements all ToString calls. + + string format = isFromScRgb ? c_scRgbFormat : null; + + return ConvertToString(format, null); + } + + /// <summary> + /// Creates a string representation of this object based on the IFormatProvider + /// passed in. If the provider is null, the CurrentCulture is used. + /// </summary> + /// <returns> + /// A string representation of this object. + /// </returns> + public string ToString(IFormatProvider provider) + { + // Delegate to the internal method which implements all ToString calls. + + string format = isFromScRgb ? c_scRgbFormat : null; + + return ConvertToString(format, provider); + } + + /// <summary> + /// Creates a string representation of this object based on the format string + /// and IFormatProvider passed in. + /// If the provider is null, the CurrentCulture is used. + /// See the documentation for IFormattable for more information. + /// </summary> + /// <returns> + /// A string representation of this object. + /// </returns> + string IFormattable.ToString(string format, IFormatProvider provider) + { + // Delegate to the internal method which implements all ToString calls. + return ConvertToString(format, provider); + } + + /// <summary> + /// Creates a string representation of this object based on the format string + /// and IFormatProvider passed in. + /// If the provider is null, the CurrentCulture is used. + /// See the documentation for IFormattable for more information. + /// </summary> + /// <returns> + /// A string representation of this object. + /// </returns> + internal string ConvertToString(string format, IFormatProvider provider) + { + throw new NotImplementedException(); + } + + /// <summary> + /// Compares two colors for fuzzy equality. This function + /// helps compensate for the fact that float values can + /// acquire error when operated upon + /// </summary> + /// <param name='color1'>The first color to compare</param> + /// <param name='color2'>The second color to compare</param> + /// <returns>Whether or not the two colors are equal</returns> + public static bool AreClose(Color color1, Color color2) + { + return color1.IsClose(color2); + } + + /// <summary> + /// Compares two colors for fuzzy equality. This function + /// helps compensate for the fact that float values can + /// acquire error when operated upon + /// </summary> + /// <param name='color'>The color to compare to this</param> + /// <returns>Whether or not the two colors are equal</returns> + private bool IsClose(Color color) + { + throw new NotImplementedException(); ; + } + + ///<summary> + /// Clamp - the color channels to the gamut [0..1]. If a channel is out + /// of gamut, it will be set to 1, which represents full saturation. + /// todo: sync up context values if they exist + ///</summary> + public void Clamp() + { + scRgbColor.r = (scRgbColor.r < 0) ? 0 : (scRgbColor.r > 1.0f) ? 1.0f : scRgbColor.r; + scRgbColor.g = (scRgbColor.g < 0) ? 0 : (scRgbColor.g > 1.0f) ? 1.0f : scRgbColor.g; + scRgbColor.b = (scRgbColor.b < 0) ? 0 : (scRgbColor.b > 1.0f) ? 1.0f : scRgbColor.b; + scRgbColor.a = (scRgbColor.a < 0) ? 0 : (scRgbColor.a > 1.0f) ? 1.0f : scRgbColor.a; + sRgbColor.a = (byte)(scRgbColor.a * 255f); + sRgbColor.r = ScRgbTosRgb(scRgbColor.r); + sRgbColor.g = ScRgbTosRgb(scRgbColor.g); + sRgbColor.b = ScRgbTosRgb(scRgbColor.b); + + // + } + + ///<summary> + /// GetNativeColorValues - return color values from color context + ///</summary> + public float[] GetNativeColorValues() + { + if (context != null) { + return (float[])nativeColorValue.Clone(); + } else { + throw new InvalidOperationException(); + } + } + #endregion Public Methods + + //------------------------------------------------------ + // + // Public Operators + // + //------------------------------------------------------ + + #region Public Operators + ///<summary> + /// Addition operator - Adds each channel of the second color to each channel of the + /// first and returns the result + ///</summary> + public static Color operator +(Color color1, Color color2) + { + throw new NotImplementedException(); + } + + ///<summary> + /// Addition method - Adds each channel of the second color to each channel of the + /// first and returns the result + ///</summary> + public static Color Add(Color color1, Color color2) + { + return (color1 + color2); + } + + /// <summary> + /// Subtract operator - substracts each channel of the second color from each channel of the + /// first and returns the result + /// </summary> + /// <param name='color1'>The minuend</param> + /// <param name='color2'>The subtrahend</param> + /// <returns>Returns the unclamped differnce</returns> + public static Color operator -(Color color1, Color color2) + { + + throw new NotImplementedException(); + } + + ///<summary> + /// Subtract method - subtracts each channel of the second color from each channel of the + /// first and returns the result + ///</summary> + public static Color Subtract(Color color1, Color color2) + { + return (color1 - color2); + } + + /// <summary> + /// Multiplication operator - Multiplies each channel of the color by a coefficient and returns the result + /// </summary> + /// <param name='color'>The color</param> + /// <param name='coefficient'>The coefficient</param> + /// <returns>Returns the unclamped product</returns> + public static Color operator *(Color color, float coefficient) + { + Color c1 = FromScRgb(color.scRgbColor.a * coefficient, color.scRgbColor.r * coefficient, color.scRgbColor.g * coefficient, color.scRgbColor.b * coefficient); + + if (color.context == null) { + return c1; + } else { + c1.context = color.context; + +#pragma warning disable 6506 // c1.context is obviously not null + c1.ComputeNativeValues(0); +#pragma warning restore 6506 + } + + return c1; + } + + ///<summary> + /// Multiplication method - Multiplies each channel of the color by a coefficient and returns the result + ///</summary> + public static Color Multiply(Color color, float coefficient) + { + return (color * coefficient); + } + + ///<summary> + /// Equality method for two colors - return true of colors are equal, otherwise returns false + ///</summary> + public static bool Equals(Color color1, Color color2) + { + return (color1 == color2); + } + + /// <summary> + /// Compares two colors for exact equality. Note that float values can acquire error + /// when operated upon, such that an exact comparison between two values which are logically + /// equal may fail. see cref="AreClose" for a "fuzzy" version of this comparison. + /// </summary> + /// <param name='color'>The color to compare to "this"</param> + /// <returns>Whether or not the two colors are equal</returns> + public bool Equals(Color color) + { + return this == color; + } + + /// <summary> + /// Compares two colors for exact equality. Note that float values can acquire error + /// when operated upon, such that an exact comparison between two vEquals(color);alues which are logically + /// equal may fail. see cref="AreClose" for a "fuzzy" version of this comparison. + /// </summary> + /// <param name='o'>The object to compare to "this"</param> + /// <returns>Whether or not the two colors are equal</returns> + public override bool Equals(object o) + { + if (o is Color) { + Color color = (Color)o; + + return (this == color); + } else { + return false; + } + } + + ///<summary> + /// IsEqual operator - Compares two colors for exact equality. Note that float values can acquire error + /// when operated upon, such that an exact comparison between two values which are logically + /// equal may fail. see cref="AreClose". + ///</summary> + public static bool operator ==(Color color1, Color color2) + { + if (color1.scRgbColor.r != color2.scRgbColor.r) { + return false; + } + + if (color1.scRgbColor.g != color2.scRgbColor.g) { + return false; + } + + if (color1.scRgbColor.b != color2.scRgbColor.b) { + return false; + } + + if (color1.scRgbColor.a != color2.scRgbColor.a) { + return false; + } + + return true; + } + + ///<summary> + /// != + ///</summary> + public static bool operator !=(Color color1, Color color2) + { + return (!(color1 == color2)); + } + #endregion Public Operators + + //------------------------------------------------------ + // + // Public Properties + // + //------------------------------------------------------ + + #region Public Properties + + + ///<summary> + /// A + ///</summary> + public byte A { + get { + return sRgbColor.a; + } + set { + scRgbColor.a = (float)value / 255.0f; + sRgbColor.a = value; + } + } + + /// <value>The Red channel as a byte whose range is [0..255]. + /// the value is not allowed to be out of range</value> + /// <summary> + /// R + /// </summary> + public byte R { + get { + return sRgbColor.r; + } + set { + if (context == null) { + scRgbColor.r = sRgbToScRgb(value); + sRgbColor.r = value; + } else { + throw new InvalidOperationException(); + } + } + } + + ///<value>The Green channel as a byte whose range is [0..255]. + /// the value is not allowed to be out of range</value><summary> + /// G + ///</summary> + public byte G { + get { + return sRgbColor.g; + } + set { + if (context == null) { + scRgbColor.g = sRgbToScRgb(value); + sRgbColor.g = value; + } else { + throw new InvalidOperationException(); + } + } + } + + ///<value>The Blue channel as a byte whose range is [0..255]. + /// the value is not allowed to be out of range</value><summary> + /// B + ///</summary> + public byte B { + get { + return sRgbColor.b; + } + set { + if (context == null) { + scRgbColor.b = sRgbToScRgb(value); + sRgbColor.b = value; + } else { + throw new InvalidOperationException(); + } + } + } + + ///<value>The Alpha channel as a float whose range is [0..1]. + /// the value is allowed to be out of range</value><summary> + /// ScA + ///</summary> + public float ScA { + get { + return scRgbColor.a; + } + set { + scRgbColor.a = value; + if (value < 0.0f) { + sRgbColor.a = 0; + } else if (value > 1.0f) { + sRgbColor.a = (byte)255; + } else { + sRgbColor.a = (byte)(value * 255f); + } + } + } + + ///<value>The Red channel as a float whose range is [0..1]. + /// the value is allowed to be out of range</value> + ///<summary> + /// ScR + ///</summary> + public float ScR { + get { + return scRgbColor.r; + // throw new ArgumentException(SR.Get(SRID.Color_ColorContextNotsRgb_or_ScRgb, null)); + } + set { + if (context == null) { + scRgbColor.r = value; + sRgbColor.r = ScRgbTosRgb(value); + } else { + throw new InvalidOperationException(); + } + } + } + + ///<value>The Green channel as a float whose range is [0..1]. + /// the value is allowed to be out of range</value><summary> + /// ScG + ///</summary> + public float ScG { + get { + return scRgbColor.g; + // throw new ArgumentException(SR.Get(SRID.Color_ColorContextNotsRgb_or_ScRgb, null)); + } + set { + if (context == null) { + scRgbColor.g = value; + sRgbColor.g = ScRgbTosRgb(value); + } else { + throw new InvalidOperationException(); + } + } + } + + ///<value>The Blue channel as a float whose range is [0..1]. + /// the value is allowed to be out of range</value><summary> + /// ScB + ///</summary> + public float ScB { + get { + return scRgbColor.b; + // throw new ArgumentException(SR.Get(SRID.Color_ColorContextNotsRgb_or_ScRgb, null)); + } + set { + if (context == null) { + scRgbColor.b = value; + sRgbColor.b = ScRgbTosRgb(value); + } else { + throw new InvalidOperationException(); + } + } + } + + #endregion Public Properties + + //------------------------------------------------------ + // + // Public Events + // + //------------------------------------------------------ + //------------------------------------------------------ + // + // Public Events + // + //------------------------------------------------------ + //------------------------------------------------------ + // + // Protected Methods + // + //------------------------------------------------------ + //------------------------------------------------------ + // + // Internal Properties + // + //------------------------------------------------------ + //------------------------------------------------------ + // + // Internal Events + // + //------------------------------------------------------ + //------------------------------------------------------ + // + // Internal Methods + // + //------------------------------------------------------ + //------------------------------------------------------ + // + // Private Methods + // + //------------------------------------------------------ + #region Private Methods + + ///<summary> + /// private helper function to set context values from a color value with a set context and ScRgb values + ///</summary> + private static float sRgbToScRgb(byte bval) + { + float val = ((float)bval / 255.0f); + + if (!(val > 0.0)) // Handles NaN case too. (Though, NaN isn't actually + // possible in this case.) + { + return (0.0f); + } else if (val <= 0.04045) { + return (val / 12.92f); + } else if (val < 1.0f) { + return (float)Math.Pow(((double)val + 0.055) / 1.055, 2.4); + } else { + return (1.0f); + } + } + + ///<summary> + /// private helper function to set context values from a color value with a set context and ScRgb values + ///</summary> + /// + private static byte ScRgbTosRgb(float val) + { + if (!(val > 0.0)) // Handles NaN case too + { + return (0); + } else if (val <= 0.0031308) { + return ((byte)((255.0f * val * 12.92f) + 0.5f)); + } else if (val < 1.0) { + return ((byte)((255.0f * ((1.055f * (float)Math.Pow((double)val, (1.0 / 2.4))) - 0.055f)) + 0.5f)); + } else { + return (255); + } + } + + ///<summary> + /// private helper function to set context values from a color value with a set context and ScRgb values + ///</summary> + /// + private void ComputeScRgbValues() + { + throw new NotImplementedException(); + } + + private void ComputeNativeValues(int numChannels) + { + throw new NotImplementedException(); + } + + #endregion Private Methods + + //------------------------------------------------------ + // + // Private Properties + // + //------------------------------------------------------ + //------------------------------------------------------ + // + // Private Events + // + //------------------------------------------------------ + //------------------------------------------------------ + // + // Private Fields + // + //------------------------------------------------------ + + #region Private Fields + + [MarshalAs(UnmanagedType.Interface)] + object context; + + private struct MILColorF // this structure is the "milrendertypes.h" structure and should be identical for performance + { + public float a, r, g, b; + }; + + private MILColorF scRgbColor; + + private struct MILColor + { + public byte a, r, g, b; + } + + private MILColor sRgbColor; + +#pragma warning disable 649 + private float[] nativeColorValue; +#pragma warning restore 649 + + private bool isFromScRgb; + + private const string c_scRgbFormat = "R"; + + #endregion Private Fields + } +} diff --git a/src/FPF/PresentationCore/System.Windows.Media.Colors.cs b/src/FPF/PresentationCore/System.Windows.Media.Colors.cs new file mode 100644 index 0000000..fc3e487 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Colors.cs @@ -0,0 +1,1905 @@ +using System.Collections.Generic; + +namespace System.Windows.Media +{ + /// Enum containing handles to all known colors + /// Since the first element is 0, second is 1, etc, we can use this to index + /// directly into an array + internal enum KnownColor : uint + { + // We've reserved the value "1" as unknown. If for some odd reason "1" is added to the + // list, redefined UnknownColor + + AliceBlue = 0xFFF0F8FF, + AntiqueWhite = 0xFFFAEBD7, + Aqua = 0xFF00FFFF, + Aquamarine = 0xFF7FFFD4, + Azure = 0xFFF0FFFF, + Beige = 0xFFF5F5DC, + Bisque = 0xFFFFE4C4, + Black = 0xFF000000, + BlanchedAlmond = 0xFFFFEBCD, + Blue = 0xFF0000FF, + BlueViolet = 0xFF8A2BE2, + Brown = 0xFFA52A2A, + BurlyWood = 0xFFDEB887, + CadetBlue = 0xFF5F9EA0, + Chartreuse = 0xFF7FFF00, + Chocolate = 0xFFD2691E, + Coral = 0xFFFF7F50, + CornflowerBlue = 0xFF6495ED, + Cornsilk = 0xFFFFF8DC, + Crimson = 0xFFDC143C, + Cyan = 0xFF00FFFF, + DarkBlue = 0xFF00008B, + DarkCyan = 0xFF008B8B, + DarkGoldenrod = 0xFFB8860B, + DarkGray = 0xFFA9A9A9, + DarkGreen = 0xFF006400, + DarkKhaki = 0xFFBDB76B, + DarkMagenta = 0xFF8B008B, + DarkOliveGreen = 0xFF556B2F, + DarkOrange = 0xFFFF8C00, + DarkOrchid = 0xFF9932CC, + DarkRed = 0xFF8B0000, + DarkSalmon = 0xFFE9967A, + DarkSeaGreen = 0xFF8FBC8F, + DarkSlateBlue = 0xFF483D8B, + DarkSlateGray = 0xFF2F4F4F, + DarkTurquoise = 0xFF00CED1, + DarkViolet = 0xFF9400D3, + DeepPink = 0xFFFF1493, + DeepSkyBlue = 0xFF00BFFF, + DimGray = 0xFF696969, + DodgerBlue = 0xFF1E90FF, + Firebrick = 0xFFB22222, + FloralWhite = 0xFFFFFAF0, + ForestGreen = 0xFF228B22, + Fuchsia = 0xFFFF00FF, + Gainsboro = 0xFFDCDCDC, + GhostWhite = 0xFFF8F8FF, + Gold = 0xFFFFD700, + Goldenrod = 0xFFDAA520, + Gray = 0xFF808080, + Green = 0xFF008000, + GreenYellow = 0xFFADFF2F, + Honeydew = 0xFFF0FFF0, + HotPink = 0xFFFF69B4, + IndianRed = 0xFFCD5C5C, + Indigo = 0xFF4B0082, + Ivory = 0xFFFFFFF0, + Khaki = 0xFFF0E68C, + Lavender = 0xFFE6E6FA, + LavenderBlush = 0xFFFFF0F5, + LawnGreen = 0xFF7CFC00, + LemonChiffon = 0xFFFFFACD, + LightBlue = 0xFFADD8E6, + LightCoral = 0xFFF08080, + LightCyan = 0xFFE0FFFF, + LightGoldenrodYellow = 0xFFFAFAD2, + LightGreen = 0xFF90EE90, + LightGray = 0xFFD3D3D3, + LightPink = 0xFFFFB6C1, + LightSalmon = 0xFFFFA07A, + LightSeaGreen = 0xFF20B2AA, + LightSkyBlue = 0xFF87CEFA, + LightSlateGray = 0xFF778899, + LightSteelBlue = 0xFFB0C4DE, + LightYellow = 0xFFFFFFE0, + Lime = 0xFF00FF00, + LimeGreen = 0xFF32CD32, + Linen = 0xFFFAF0E6, + Magenta = 0xFFFF00FF, + Maroon = 0xFF800000, + MediumAquamarine = 0xFF66CDAA, + MediumBlue = 0xFF0000CD, + MediumOrchid = 0xFFBA55D3, + MediumPurple = 0xFF9370DB, + MediumSeaGreen = 0xFF3CB371, + MediumSlateBlue = 0xFF7B68EE, + MediumSpringGreen = 0xFF00FA9A, + MediumTurquoise = 0xFF48D1CC, + MediumVioletRed = 0xFFC71585, + MidnightBlue = 0xFF191970, + MintCream = 0xFFF5FFFA, + MistyRose = 0xFFFFE4E1, + Moccasin = 0xFFFFE4B5, + NavajoWhite = 0xFFFFDEAD, + Navy = 0xFF000080, + OldLace = 0xFFFDF5E6, + Olive = 0xFF808000, + OliveDrab = 0xFF6B8E23, + Orange = 0xFFFFA500, + OrangeRed = 0xFFFF4500, + Orchid = 0xFFDA70D6, + PaleGoldenrod = 0xFFEEE8AA, + PaleGreen = 0xFF98FB98, + PaleTurquoise = 0xFFAFEEEE, + PaleVioletRed = 0xFFDB7093, + PapayaWhip = 0xFFFFEFD5, + PeachPuff = 0xFFFFDAB9, + Peru = 0xFFCD853F, + Pink = 0xFFFFC0CB, + Plum = 0xFFDDA0DD, + PowderBlue = 0xFFB0E0E6, + Purple = 0xFF800080, + Red = 0xFFFF0000, + RosyBrown = 0xFFBC8F8F, + RoyalBlue = 0xFF4169E1, + SaddleBrown = 0xFF8B4513, + Salmon = 0xFFFA8072, + SandyBrown = 0xFFF4A460, + SeaGreen = 0xFF2E8B57, + SeaShell = 0xFFFFF5EE, + Sienna = 0xFFA0522D, + Silver = 0xFFC0C0C0, + SkyBlue = 0xFF87CEEB, + SlateBlue = 0xFF6A5ACD, + SlateGray = 0xFF708090, + Snow = 0xFFFFFAFA, + SpringGreen = 0xFF00FF7F, + SteelBlue = 0xFF4682B4, + Tan = 0xFFD2B48C, + Teal = 0xFF008080, + Thistle = 0xFFD8BFD8, + Tomato = 0xFFFF6347, + Transparent = 0x00FFFFFF, + Turquoise = 0xFF40E0D0, + Violet = 0xFFEE82EE, + Wheat = 0xFFF5DEB3, + White = 0xFFFFFFFF, + WhiteSmoke = 0xFFF5F5F5, + Yellow = 0xFFFFFF00, + YellowGreen = 0xFF9ACD32, + UnknownColor = 0x00000001 + } + + internal static class KnownColors + { +#if !PBTCOMPILER + + static KnownColors() + { + Array knownColorValues = Enum.GetValues(typeof(KnownColor)); + foreach (KnownColor colorValue in knownColorValues) { + string aRGBString = String.Format("#{0,8:X8}", (uint)colorValue); + s_knownArgbColors[aRGBString] = colorValue; + } + } + + /// Return the solid color brush from a color string. If there's no match, null + public static SolidColorBrush ColorStringToKnownBrush(string s) + { + if (null != s) { + KnownColor result = ColorStringToKnownColor(s); + + // If the result is UnknownColor, that means this string wasn't found + if (result != KnownColor.UnknownColor) { + // Otherwise, return the appropriate SolidColorBrush + return SolidColorBrushFromUint((uint)result); + } + } + return null; + } + + public static bool IsKnownSolidColorBrush(SolidColorBrush scp) + { + lock (s_solidColorBrushCache) { + return s_solidColorBrushCache.ContainsValue(scp); + } + } + + public static SolidColorBrush SolidColorBrushFromUint(uint argb) + { + SolidColorBrush scp = null; + + lock (s_solidColorBrushCache) { + // Attempt to retrieve the color. If it fails create it. + if (!s_solidColorBrushCache.TryGetValue(argb, out scp)) { + scp = new SolidColorBrush(Color.FromUInt32(argb)); + scp.Freeze(); + s_solidColorBrushCache[argb] = scp; + } +#if DEBUG + else { + s_count++; + } +#endif + } + + return scp; + } +#endif + + /// Return the KnownColor from a color string. If there's no match, KnownColor.UnknownColor + internal static KnownColor ColorStringToKnownColor(string colorString) + { + if (null != colorString) { + // We use invariant culture because we don't globalize our color names + string colorUpper = colorString.ToUpper(System.Globalization.CultureInfo.InvariantCulture); + + // Use String.Equals because it does explicit equality + // StartsWith/EndsWith are culture sensitive and are 4-7 times slower than Equals + + switch (colorUpper.Length) { + case 3: + if (colorUpper.Equals("RED")) return KnownColor.Red; + if (colorUpper.Equals("TAN")) return KnownColor.Tan; + break; + case 4: + switch (colorUpper[0]) { + case 'A': + if (colorUpper.Equals("AQUA")) return KnownColor.Aqua; + break; + case 'B': + if (colorUpper.Equals("BLUE")) return KnownColor.Blue; + break; + case 'C': + if (colorUpper.Equals("CYAN")) return KnownColor.Cyan; + break; + case 'G': + if (colorUpper.Equals("GOLD")) return KnownColor.Gold; + if (colorUpper.Equals("GRAY")) return KnownColor.Gray; + break; + case 'L': + if (colorUpper.Equals("LIME")) return KnownColor.Lime; + break; + case 'N': + if (colorUpper.Equals("NAVY")) return KnownColor.Navy; + break; + case 'P': + if (colorUpper.Equals("PERU")) return KnownColor.Peru; + if (colorUpper.Equals("PINK")) return KnownColor.Pink; + if (colorUpper.Equals("PLUM")) return KnownColor.Plum; + break; + case 'S': + if (colorUpper.Equals("SNOW")) return KnownColor.Snow; + break; + case 'T': + if (colorUpper.Equals("TEAL")) return KnownColor.Teal; + break; + } + break; + case 5: + switch (colorUpper[0]) { + case 'A': + if (colorUpper.Equals("AZURE")) return KnownColor.Azure; + break; + case 'B': + if (colorUpper.Equals("BEIGE")) return KnownColor.Beige; + if (colorUpper.Equals("BLACK")) return KnownColor.Black; + if (colorUpper.Equals("BROWN")) return KnownColor.Brown; + break; + case 'C': + if (colorUpper.Equals("CORAL")) return KnownColor.Coral; + break; + case 'G': + if (colorUpper.Equals("GREEN")) return KnownColor.Green; + break; + case 'I': + if (colorUpper.Equals("IVORY")) return KnownColor.Ivory; + break; + case 'K': + if (colorUpper.Equals("KHAKI")) return KnownColor.Khaki; + break; + case 'L': + if (colorUpper.Equals("LINEN")) return KnownColor.Linen; + break; + case 'O': + if (colorUpper.Equals("OLIVE")) return KnownColor.Olive; + break; + case 'W': + if (colorUpper.Equals("WHEAT")) return KnownColor.Wheat; + if (colorUpper.Equals("WHITE")) return KnownColor.White; + break; + } + break; + case 6: + switch (colorUpper[0]) { + case 'B': + if (colorUpper.Equals("BISQUE")) return KnownColor.Bisque; + break; + case 'I': + if (colorUpper.Equals("INDIGO")) return KnownColor.Indigo; + break; + case 'M': + if (colorUpper.Equals("MAROON")) return KnownColor.Maroon; + break; + case 'O': + if (colorUpper.Equals("ORANGE")) return KnownColor.Orange; + if (colorUpper.Equals("ORCHID")) return KnownColor.Orchid; + break; + case 'P': + if (colorUpper.Equals("PURPLE")) return KnownColor.Purple; + break; + case 'S': + if (colorUpper.Equals("SALMON")) return KnownColor.Salmon; + if (colorUpper.Equals("SIENNA")) return KnownColor.Sienna; + if (colorUpper.Equals("SILVER")) return KnownColor.Silver; + break; + case 'T': + if (colorUpper.Equals("TOMATO")) return KnownColor.Tomato; + break; + case 'V': + if (colorUpper.Equals("VIOLET")) return KnownColor.Violet; + break; + case 'Y': + if (colorUpper.Equals("YELLOW")) return KnownColor.Yellow; + break; + } + break; + case 7: + switch (colorUpper[0]) { + case 'C': + if (colorUpper.Equals("CRIMSON")) return KnownColor.Crimson; + break; + case 'D': + if (colorUpper.Equals("DARKRED")) return KnownColor.DarkRed; + if (colorUpper.Equals("DIMGRAY")) return KnownColor.DimGray; + break; + case 'F': + if (colorUpper.Equals("FUCHSIA")) return KnownColor.Fuchsia; + break; + case 'H': + if (colorUpper.Equals("HOTPINK")) return KnownColor.HotPink; + break; + case 'M': + if (colorUpper.Equals("MAGENTA")) return KnownColor.Magenta; + break; + case 'O': + if (colorUpper.Equals("OLDLACE")) return KnownColor.OldLace; + break; + case 'S': + if (colorUpper.Equals("SKYBLUE")) return KnownColor.SkyBlue; + break; + case 'T': + if (colorUpper.Equals("THISTLE")) return KnownColor.Thistle; + break; + } + break; + case 8: + switch (colorUpper[0]) { + case 'C': + if (colorUpper.Equals("CORNSILK")) return KnownColor.Cornsilk; + break; + case 'D': + if (colorUpper.Equals("DARKBLUE")) return KnownColor.DarkBlue; + if (colorUpper.Equals("DARKCYAN")) return KnownColor.DarkCyan; + if (colorUpper.Equals("DARKGRAY")) return KnownColor.DarkGray; + if (colorUpper.Equals("DEEPPINK")) return KnownColor.DeepPink; + break; + case 'H': + if (colorUpper.Equals("HONEYDEW")) return KnownColor.Honeydew; + break; + case 'L': + if (colorUpper.Equals("LAVENDER")) return KnownColor.Lavender; + break; + case 'M': + if (colorUpper.Equals("MOCCASIN")) return KnownColor.Moccasin; + break; + case 'S': + if (colorUpper.Equals("SEAGREEN")) return KnownColor.SeaGreen; + if (colorUpper.Equals("SEASHELL")) return KnownColor.SeaShell; + break; + } + break; + case 9: + switch (colorUpper[0]) { + case 'A': + if (colorUpper.Equals("ALICEBLUE")) return KnownColor.AliceBlue; + break; + case 'B': + if (colorUpper.Equals("BURLYWOOD")) return KnownColor.BurlyWood; + break; + case 'C': + if (colorUpper.Equals("CADETBLUE")) return KnownColor.CadetBlue; + if (colorUpper.Equals("CHOCOLATE")) return KnownColor.Chocolate; + break; + case 'D': + if (colorUpper.Equals("DARKGREEN")) return KnownColor.DarkGreen; + if (colorUpper.Equals("DARKKHAKI")) return KnownColor.DarkKhaki; + break; + case 'F': + if (colorUpper.Equals("FIREBRICK")) return KnownColor.Firebrick; + break; + case 'G': + if (colorUpper.Equals("GAINSBORO")) return KnownColor.Gainsboro; + if (colorUpper.Equals("GOLDENROD")) return KnownColor.Goldenrod; + break; + case 'I': + if (colorUpper.Equals("INDIANRED")) return KnownColor.IndianRed; + break; + case 'L': + if (colorUpper.Equals("LAWNGREEN")) return KnownColor.LawnGreen; + if (colorUpper.Equals("LIGHTBLUE")) return KnownColor.LightBlue; + if (colorUpper.Equals("LIGHTCYAN")) return KnownColor.LightCyan; + if (colorUpper.Equals("LIGHTGRAY")) return KnownColor.LightGray; + if (colorUpper.Equals("LIGHTPINK")) return KnownColor.LightPink; + if (colorUpper.Equals("LIMEGREEN")) return KnownColor.LimeGreen; + break; + case 'M': + if (colorUpper.Equals("MINTCREAM")) return KnownColor.MintCream; + if (colorUpper.Equals("MISTYROSE")) return KnownColor.MistyRose; + break; + case 'O': + if (colorUpper.Equals("OLIVEDRAB")) return KnownColor.OliveDrab; + if (colorUpper.Equals("ORANGERED")) return KnownColor.OrangeRed; + break; + case 'P': + if (colorUpper.Equals("PALEGREEN")) return KnownColor.PaleGreen; + if (colorUpper.Equals("PEACHPUFF")) return KnownColor.PeachPuff; + break; + case 'R': + if (colorUpper.Equals("ROSYBROWN")) return KnownColor.RosyBrown; + if (colorUpper.Equals("ROYALBLUE")) return KnownColor.RoyalBlue; + break; + case 'S': + if (colorUpper.Equals("SLATEBLUE")) return KnownColor.SlateBlue; + if (colorUpper.Equals("SLATEGRAY")) return KnownColor.SlateGray; + if (colorUpper.Equals("STEELBLUE")) return KnownColor.SteelBlue; + break; + case 'T': + if (colorUpper.Equals("TURQUOISE")) return KnownColor.Turquoise; + break; + } + break; + case 10: + switch (colorUpper[0]) { + case 'A': + if (colorUpper.Equals("AQUAMARINE")) return KnownColor.Aquamarine; + break; + case 'B': + if (colorUpper.Equals("BLUEVIOLET")) return KnownColor.BlueViolet; + break; + case 'C': + if (colorUpper.Equals("CHARTREUSE")) return KnownColor.Chartreuse; + break; + case 'D': + if (colorUpper.Equals("DARKORANGE")) return KnownColor.DarkOrange; + if (colorUpper.Equals("DARKORCHID")) return KnownColor.DarkOrchid; + if (colorUpper.Equals("DARKSALMON")) return KnownColor.DarkSalmon; + if (colorUpper.Equals("DARKVIOLET")) return KnownColor.DarkViolet; + if (colorUpper.Equals("DODGERBLUE")) return KnownColor.DodgerBlue; + break; + case 'G': + if (colorUpper.Equals("GHOSTWHITE")) return KnownColor.GhostWhite; + break; + case 'L': + if (colorUpper.Equals("LIGHTCORAL")) return KnownColor.LightCoral; + if (colorUpper.Equals("LIGHTGREEN")) return KnownColor.LightGreen; + break; + case 'M': + if (colorUpper.Equals("MEDIUMBLUE")) return KnownColor.MediumBlue; + break; + case 'P': + if (colorUpper.Equals("PAPAYAWHIP")) return KnownColor.PapayaWhip; + if (colorUpper.Equals("POWDERBLUE")) return KnownColor.PowderBlue; + break; + case 'S': + if (colorUpper.Equals("SANDYBROWN")) return KnownColor.SandyBrown; + break; + case 'W': + if (colorUpper.Equals("WHITESMOKE")) return KnownColor.WhiteSmoke; + break; + } + break; + case 11: + switch (colorUpper[0]) { + case 'D': + if (colorUpper.Equals("DARKMAGENTA")) return KnownColor.DarkMagenta; + if (colorUpper.Equals("DEEPSKYBLUE")) return KnownColor.DeepSkyBlue; + break; + case 'F': + if (colorUpper.Equals("FLORALWHITE")) return KnownColor.FloralWhite; + if (colorUpper.Equals("FORESTGREEN")) return KnownColor.ForestGreen; + break; + case 'G': + if (colorUpper.Equals("GREENYELLOW")) return KnownColor.GreenYellow; + break; + case 'L': + if (colorUpper.Equals("LIGHTSALMON")) return KnownColor.LightSalmon; + if (colorUpper.Equals("LIGHTYELLOW")) return KnownColor.LightYellow; + break; + case 'N': + if (colorUpper.Equals("NAVAJOWHITE")) return KnownColor.NavajoWhite; + break; + case 'S': + if (colorUpper.Equals("SADDLEBROWN")) return KnownColor.SaddleBrown; + if (colorUpper.Equals("SPRINGGREEN")) return KnownColor.SpringGreen; + break; + case 'T': + if (colorUpper.Equals("TRANSPARENT")) return KnownColor.Transparent; + break; + case 'Y': + if (colorUpper.Equals("YELLOWGREEN")) return KnownColor.YellowGreen; + break; + } + break; + case 12: + switch (colorUpper[0]) { + case 'A': + if (colorUpper.Equals("ANTIQUEWHITE")) return KnownColor.AntiqueWhite; + break; + case 'D': + if (colorUpper.Equals("DARKSEAGREEN")) return KnownColor.DarkSeaGreen; + break; + case 'L': + if (colorUpper.Equals("LIGHTSKYBLUE")) return KnownColor.LightSkyBlue; + if (colorUpper.Equals("LEMONCHIFFON")) return KnownColor.LemonChiffon; + break; + case 'M': + if (colorUpper.Equals("MEDIUMORCHID")) return KnownColor.MediumOrchid; + if (colorUpper.Equals("MEDIUMPURPLE")) return KnownColor.MediumPurple; + if (colorUpper.Equals("MIDNIGHTBLUE")) return KnownColor.MidnightBlue; + break; + } + break; + case 13: + switch (colorUpper[0]) { + case 'D': + if (colorUpper.Equals("DARKSLATEBLUE")) return KnownColor.DarkSlateBlue; + if (colorUpper.Equals("DARKSLATEGRAY")) return KnownColor.DarkSlateGray; + if (colorUpper.Equals("DARKGOLDENROD")) return KnownColor.DarkGoldenrod; + if (colorUpper.Equals("DARKTURQUOISE")) return KnownColor.DarkTurquoise; + break; + case 'L': + if (colorUpper.Equals("LIGHTSEAGREEN")) return KnownColor.LightSeaGreen; + if (colorUpper.Equals("LAVENDERBLUSH")) return KnownColor.LavenderBlush; + break; + case 'P': + if (colorUpper.Equals("PALEGOLDENROD")) return KnownColor.PaleGoldenrod; + if (colorUpper.Equals("PALETURQUOISE")) return KnownColor.PaleTurquoise; + if (colorUpper.Equals("PALEVIOLETRED")) return KnownColor.PaleVioletRed; + break; + } + break; + case 14: + switch (colorUpper[0]) { + case 'B': + if (colorUpper.Equals("BLANCHEDALMOND")) return KnownColor.BlanchedAlmond; + break; + case 'C': + if (colorUpper.Equals("CORNFLOWERBLUE")) return KnownColor.CornflowerBlue; + break; + case 'D': + if (colorUpper.Equals("DARKOLIVEGREEN")) return KnownColor.DarkOliveGreen; + break; + case 'L': + if (colorUpper.Equals("LIGHTSLATEGRAY")) return KnownColor.LightSlateGray; + if (colorUpper.Equals("LIGHTSTEELBLUE")) return KnownColor.LightSteelBlue; + break; + case 'M': + if (colorUpper.Equals("MEDIUMSEAGREEN")) return KnownColor.MediumSeaGreen; + break; + } + break; + case 15: + if (colorUpper.Equals("MEDIUMSLATEBLUE")) return KnownColor.MediumSlateBlue; + if (colorUpper.Equals("MEDIUMTURQUOISE")) return KnownColor.MediumTurquoise; + if (colorUpper.Equals("MEDIUMVIOLETRED")) return KnownColor.MediumVioletRed; + break; + case 16: + if (colorUpper.Equals("MEDIUMAQUAMARINE")) return KnownColor.MediumAquamarine; + break; + case 17: + if (colorUpper.Equals("MEDIUMSPRINGGREEN")) return KnownColor.MediumSpringGreen; + break; + case 20: + if (colorUpper.Equals("LIGHTGOLDENRODYELLOW")) return KnownColor.LightGoldenrodYellow; + break; + } + } + // colorString was null or not found + return KnownColor.UnknownColor; + } + +#if !PBTCOMPILER + internal static KnownColor ArgbStringToKnownColor(string argbString) + { + string argbUpper = argbString.Trim().ToUpper(System.Globalization.CultureInfo.InvariantCulture); + + KnownColor color; + if (s_knownArgbColors.TryGetValue(argbUpper, out color)) + return color; + + return KnownColor.UnknownColor; + } +#if DEBUG + private static int s_count = 0; +#endif + + private static Dictionary<uint, SolidColorBrush> s_solidColorBrushCache = new Dictionary<uint, SolidColorBrush>(); + private static Dictionary<string, KnownColor> s_knownArgbColors = new Dictionary<string, KnownColor>(); +#endif + } + +#if !PBTCOMPILER + /// <summary> + /// Colors - A collection of well-known Colors + /// </summary> + public sealed class Colors + { + #region Constructors + + // Colors only has static members, so it shouldn't be constructable. + private Colors() + { + } + + #endregion Constructors + + #region static Known Colors + + /// <summary> + /// Well-known color: AliceBlue + /// </summary> + public static Color AliceBlue { + get { + return Color.FromUInt32((uint)KnownColor.AliceBlue); + } + } + + /// <summary> + /// Well-known color: AntiqueWhite + /// </summary> + public static Color AntiqueWhite { + get { + return Color.FromUInt32((uint)KnownColor.AntiqueWhite); + } + } + + /// <summary> + /// Well-known color: Aqua + /// </summary> + public static Color Aqua { + get { + return Color.FromUInt32((uint)KnownColor.Aqua); + } + } + + /// <summary> + /// Well-known color: Aquamarine + /// </summary> + public static Color Aquamarine { + get { + return Color.FromUInt32((uint)KnownColor.Aquamarine); + } + } + + /// <summary> + /// Well-known color: Azure + /// </summary> + public static Color Azure { + get { + return Color.FromUInt32((uint)KnownColor.Azure); + } + } + + /// <summary> + /// Well-known color: Beige + /// </summary> + public static Color Beige { + get { + return Color.FromUInt32((uint)KnownColor.Beige); + } + } + + /// <summary> + /// Well-known color: Bisque + /// </summary> + public static Color Bisque { + get { + return Color.FromUInt32((uint)KnownColor.Bisque); + } + } + + /// <summary> + /// Well-known color: Black + /// </summary> + public static Color Black { + get { + return Color.FromUInt32((uint)KnownColor.Black); + } + } + + /// <summary> + /// Well-known color: BlanchedAlmond + /// </summary> + public static Color BlanchedAlmond { + get { + return Color.FromUInt32((uint)KnownColor.BlanchedAlmond); + } + } + + /// <summary> + /// Well-known color: Blue + /// </summary> + public static Color Blue { + get { + return Color.FromUInt32((uint)KnownColor.Blue); + } + } + + /// <summary> + /// Well-known color: BlueViolet + /// </summary> + public static Color BlueViolet { + get { + return Color.FromUInt32((uint)KnownColor.BlueViolet); + } + } + + /// <summary> + /// Well-known color: Brown + /// </summary> + public static Color Brown { + get { + return Color.FromUInt32((uint)KnownColor.Brown); + } + } + + /// <summary> + /// Well-known color: BurlyWood + /// </summary> + public static Color BurlyWood { + get { + return Color.FromUInt32((uint)KnownColor.BurlyWood); + } + } + + /// <summary> + /// Well-known color: CadetBlue + /// </summary> + public static Color CadetBlue { + get { + return Color.FromUInt32((uint)KnownColor.CadetBlue); + } + } + + /// <summary> + /// Well-known color: Chartreuse + /// </summary> + public static Color Chartreuse { + get { + return Color.FromUInt32((uint)KnownColor.Chartreuse); + } + } + + /// <summary> + /// Well-known color: Chocolate + /// </summary> + public static Color Chocolate { + get { + return Color.FromUInt32((uint)KnownColor.Chocolate); + } + } + + /// <summary> + /// Well-known color: Coral + /// </summary> + public static Color Coral { + get { + return Color.FromUInt32((uint)KnownColor.Coral); + } + } + + /// <summary> + /// Well-known color: CornflowerBlue + /// </summary> + public static Color CornflowerBlue { + get { + return Color.FromUInt32((uint)KnownColor.CornflowerBlue); + } + } + + /// <summary> + /// Well-known color: Cornsilk + /// </summary> + public static Color Cornsilk { + get { + return Color.FromUInt32((uint)KnownColor.Cornsilk); + } + } + + /// <summary> + /// Well-known color: Crimson + /// </summary> + public static Color Crimson { + get { + return Color.FromUInt32((uint)KnownColor.Crimson); + } + } + + /// <summary> + /// Well-known color: Cyan + /// </summary> + public static Color Cyan { + get { + return Color.FromUInt32((uint)KnownColor.Cyan); + } + } + + /// <summary> + /// Well-known color: DarkBlue + /// </summary> + public static Color DarkBlue { + get { + return Color.FromUInt32((uint)KnownColor.DarkBlue); + } + } + + /// <summary> + /// Well-known color: DarkCyan + /// </summary> + public static Color DarkCyan { + get { + return Color.FromUInt32((uint)KnownColor.DarkCyan); + } + } + + /// <summary> + /// Well-known color: DarkGoldenrod + /// </summary> + public static Color DarkGoldenrod { + get { + return Color.FromUInt32((uint)KnownColor.DarkGoldenrod); + } + } + + /// <summary> + /// Well-known color: DarkGray + /// </summary> + public static Color DarkGray { + get { + return Color.FromUInt32((uint)KnownColor.DarkGray); + } + } + + /// <summary> + /// Well-known color: DarkGreen + /// </summary> + public static Color DarkGreen { + get { + return Color.FromUInt32((uint)KnownColor.DarkGreen); + } + } + + /// <summary> + /// Well-known color: DarkKhaki + /// </summary> + public static Color DarkKhaki { + get { + return Color.FromUInt32((uint)KnownColor.DarkKhaki); + } + } + + /// <summary> + /// Well-known color: DarkMagenta + /// </summary> + public static Color DarkMagenta { + get { + return Color.FromUInt32((uint)KnownColor.DarkMagenta); + } + } + + /// <summary> + /// Well-known color: DarkOliveGreen + /// </summary> + public static Color DarkOliveGreen { + get { + return Color.FromUInt32((uint)KnownColor.DarkOliveGreen); + } + } + + /// <summary> + /// Well-known color: DarkOrange + /// </summary> + public static Color DarkOrange { + get { + return Color.FromUInt32((uint)KnownColor.DarkOrange); + } + } + + /// <summary> + /// Well-known color: DarkOrchid + /// </summary> + public static Color DarkOrchid { + get { + return Color.FromUInt32((uint)KnownColor.DarkOrchid); + } + } + + /// <summary> + /// Well-known color: DarkRed + /// </summary> + public static Color DarkRed { + get { + return Color.FromUInt32((uint)KnownColor.DarkRed); + } + } + + /// <summary> + /// Well-known color: DarkSalmon + /// </summary> + public static Color DarkSalmon { + get { + return Color.FromUInt32((uint)KnownColor.DarkSalmon); + } + } + + /// <summary> + /// Well-known color: DarkSeaGreen + /// </summary> + public static Color DarkSeaGreen { + get { + return Color.FromUInt32((uint)KnownColor.DarkSeaGreen); + } + } + + /// <summary> + /// Well-known color: DarkSlateBlue + /// </summary> + public static Color DarkSlateBlue { + get { + return Color.FromUInt32((uint)KnownColor.DarkSlateBlue); + } + } + + /// <summary> + /// Well-known color: DarkSlateGray + /// </summary> + public static Color DarkSlateGray { + get { + return Color.FromUInt32((uint)KnownColor.DarkSlateGray); + } + } + + /// <summary> + /// Well-known color: DarkTurquoise + /// </summary> + public static Color DarkTurquoise { + get { + return Color.FromUInt32((uint)KnownColor.DarkTurquoise); + } + } + + /// <summary> + /// Well-known color: DarkViolet + /// </summary> + public static Color DarkViolet { + get { + return Color.FromUInt32((uint)KnownColor.DarkViolet); + } + } + + /// <summary> + /// Well-known color: DeepPink + /// </summary> + public static Color DeepPink { + get { + return Color.FromUInt32((uint)KnownColor.DeepPink); + } + } + + /// <summary> + /// Well-known color: DeepSkyBlue + /// </summary> + public static Color DeepSkyBlue { + get { + return Color.FromUInt32((uint)KnownColor.DeepSkyBlue); + } + } + + /// <summary> + /// Well-known color: DimGray + /// </summary> + public static Color DimGray { + get { + return Color.FromUInt32((uint)KnownColor.DimGray); + } + } + + /// <summary> + /// Well-known color: DodgerBlue + /// </summary> + public static Color DodgerBlue { + get { + return Color.FromUInt32((uint)KnownColor.DodgerBlue); + } + } + + /// <summary> + /// Well-known color: Firebrick + /// </summary> + public static Color Firebrick { + get { + return Color.FromUInt32((uint)KnownColor.Firebrick); + } + } + + /// <summary> + /// Well-known color: FloralWhite + /// </summary> + public static Color FloralWhite { + get { + return Color.FromUInt32((uint)KnownColor.FloralWhite); + } + } + + /// <summary> + /// Well-known color: ForestGreen + /// </summary> + public static Color ForestGreen { + get { + return Color.FromUInt32((uint)KnownColor.ForestGreen); + } + } + + /// <summary> + /// Well-known color: Fuchsia + /// </summary> + public static Color Fuchsia { + get { + return Color.FromUInt32((uint)KnownColor.Fuchsia); + } + } + + /// <summary> + /// Well-known color: Gainsboro + /// </summary> + public static Color Gainsboro { + get { + return Color.FromUInt32((uint)KnownColor.Gainsboro); + } + } + + /// <summary> + /// Well-known color: GhostWhite + /// </summary> + public static Color GhostWhite { + get { + return Color.FromUInt32((uint)KnownColor.GhostWhite); + } + } + + /// <summary> + /// Well-known color: Gold + /// </summary> + public static Color Gold { + get { + return Color.FromUInt32((uint)KnownColor.Gold); + } + } + + /// <summary> + /// Well-known color: Goldenrod + /// </summary> + public static Color Goldenrod { + get { + return Color.FromUInt32((uint)KnownColor.Goldenrod); + } + } + + /// <summary> + /// Well-known color: Gray + /// </summary> + public static Color Gray { + get { + return Color.FromUInt32((uint)KnownColor.Gray); + } + } + + /// <summary> + /// Well-known color: Green + /// </summary> + public static Color Green { + get { + return Color.FromUInt32((uint)KnownColor.Green); + } + } + + /// <summary> + /// Well-known color: GreenYellow + /// </summary> + public static Color GreenYellow { + get { + return Color.FromUInt32((uint)KnownColor.GreenYellow); + } + } + + /// <summary> + /// Well-known color: Honeydew + /// </summary> + public static Color Honeydew { + get { + return Color.FromUInt32((uint)KnownColor.Honeydew); + } + } + + /// <summary> + /// Well-known color: HotPink + /// </summary> + public static Color HotPink { + get { + return Color.FromUInt32((uint)KnownColor.HotPink); + } + } + + /// <summary> + /// Well-known color: IndianRed + /// </summary> + public static Color IndianRed { + get { + return Color.FromUInt32((uint)KnownColor.IndianRed); + } + } + + /// <summary> + /// Well-known color: Indigo + /// </summary> + public static Color Indigo { + get { + return Color.FromUInt32((uint)KnownColor.Indigo); + } + } + + /// <summary> + /// Well-known color: Ivory + /// </summary> + public static Color Ivory { + get { + return Color.FromUInt32((uint)KnownColor.Ivory); + } + } + + /// <summary> + /// Well-known color: Khaki + /// </summary> + public static Color Khaki { + get { + return Color.FromUInt32((uint)KnownColor.Khaki); + } + } + + /// <summary> + /// Well-known color: Lavender + /// </summary> + public static Color Lavender { + get { + return Color.FromUInt32((uint)KnownColor.Lavender); + } + } + + /// <summary> + /// Well-known color: LavenderBlush + /// </summary> + public static Color LavenderBlush { + get { + return Color.FromUInt32((uint)KnownColor.LavenderBlush); + } + } + + /// <summary> + /// Well-known color: LawnGreen + /// </summary> + public static Color LawnGreen { + get { + return Color.FromUInt32((uint)KnownColor.LawnGreen); + } + } + + /// <summary> + /// Well-known color: LemonChiffon + /// </summary> + public static Color LemonChiffon { + get { + return Color.FromUInt32((uint)KnownColor.LemonChiffon); + } + } + + /// <summary> + /// Well-known color: LightBlue + /// </summary> + public static Color LightBlue { + get { + return Color.FromUInt32((uint)KnownColor.LightBlue); + } + } + + /// <summary> + /// Well-known color: LightCoral + /// </summary> + public static Color LightCoral { + get { + return Color.FromUInt32((uint)KnownColor.LightCoral); + } + } + + /// <summary> + /// Well-known color: LightCyan + /// </summary> + public static Color LightCyan { + get { + return Color.FromUInt32((uint)KnownColor.LightCyan); + } + } + + /// <summary> + /// Well-known color: LightGoldenrodYellow + /// </summary> + public static Color LightGoldenrodYellow { + get { + return Color.FromUInt32((uint)KnownColor.LightGoldenrodYellow); + } + } + + /// <summary> + /// Well-known color: LightGray + /// </summary> + public static Color LightGray { + get { + return Color.FromUInt32((uint)KnownColor.LightGray); + } + } + + /// <summary> + /// Well-known color: LightGreen + /// </summary> + public static Color LightGreen { + get { + return Color.FromUInt32((uint)KnownColor.LightGreen); + } + } + + /// <summary> + /// Well-known color: LightPink + /// </summary> + public static Color LightPink { + get { + return Color.FromUInt32((uint)KnownColor.LightPink); + } + } + + /// <summary> + /// Well-known color: LightSalmon + /// </summary> + public static Color LightSalmon { + get { + return Color.FromUInt32((uint)KnownColor.LightSalmon); + } + } + + /// <summary> + /// Well-known color: LightSeaGreen + /// </summary> + public static Color LightSeaGreen { + get { + return Color.FromUInt32((uint)KnownColor.LightSeaGreen); + } + } + + /// <summary> + /// Well-known color: LightSkyBlue + /// </summary> + public static Color LightSkyBlue { + get { + return Color.FromUInt32((uint)KnownColor.LightSkyBlue); + } + } + + /// <summary> + /// Well-known color: LightSlateGray + /// </summary> + public static Color LightSlateGray { + get { + return Color.FromUInt32((uint)KnownColor.LightSlateGray); + } + } + + /// <summary> + /// Well-known color: LightSteelBlue + /// </summary> + public static Color LightSteelBlue { + get { + return Color.FromUInt32((uint)KnownColor.LightSteelBlue); + } + } + + /// <summary> + /// Well-known color: LightYellow + /// </summary> + public static Color LightYellow { + get { + return Color.FromUInt32((uint)KnownColor.LightYellow); + } + } + + /// <summary> + /// Well-known color: Lime + /// </summary> + public static Color Lime { + get { + return Color.FromUInt32((uint)KnownColor.Lime); + } + } + + /// <summary> + /// Well-known color: LimeGreen + /// </summary> + public static Color LimeGreen { + get { + return Color.FromUInt32((uint)KnownColor.LimeGreen); + } + } + + /// <summary> + /// Well-known color: Linen + /// </summary> + public static Color Linen { + get { + return Color.FromUInt32((uint)KnownColor.Linen); + } + } + + /// <summary> + /// Well-known color: Magenta + /// </summary> + public static Color Magenta { + get { + return Color.FromUInt32((uint)KnownColor.Magenta); + } + } + + /// <summary> + /// Well-known color: Maroon + /// </summary> + public static Color Maroon { + get { + return Color.FromUInt32((uint)KnownColor.Maroon); + } + } + + /// <summary> + /// Well-known color: MediumAquamarine + /// </summary> + public static Color MediumAquamarine { + get { + return Color.FromUInt32((uint)KnownColor.MediumAquamarine); + } + } + + /// <summary> + /// Well-known color: MediumBlue + /// </summary> + public static Color MediumBlue { + get { + return Color.FromUInt32((uint)KnownColor.MediumBlue); + } + } + + /// <summary> + /// Well-known color: MediumOrchid + /// </summary> + public static Color MediumOrchid { + get { + return Color.FromUInt32((uint)KnownColor.MediumOrchid); + } + } + + /// <summary> + /// Well-known color: MediumPurple + /// </summary> + public static Color MediumPurple { + get { + return Color.FromUInt32((uint)KnownColor.MediumPurple); + } + } + + /// <summary> + /// Well-known color: MediumSeaGreen + /// </summary> + public static Color MediumSeaGreen { + get { + return Color.FromUInt32((uint)KnownColor.MediumSeaGreen); + } + } + + /// <summary> + /// Well-known color: MediumSlateBlue + /// </summary> + public static Color MediumSlateBlue { + get { + return Color.FromUInt32((uint)KnownColor.MediumSlateBlue); + } + } + + /// <summary> + /// Well-known color: MediumSpringGreen + /// </summary> + public static Color MediumSpringGreen { + get { + return Color.FromUInt32((uint)KnownColor.MediumSpringGreen); + } + } + + /// <summary> + /// Well-known color: MediumTurquoise + /// </summary> + public static Color MediumTurquoise { + get { + return Color.FromUInt32((uint)KnownColor.MediumTurquoise); + } + } + + /// <summary> + /// Well-known color: MediumVioletRed + /// </summary> + public static Color MediumVioletRed { + get { + return Color.FromUInt32((uint)KnownColor.MediumVioletRed); + } + } + + /// <summary> + /// Well-known color: MidnightBlue + /// </summary> + public static Color MidnightBlue { + get { + return Color.FromUInt32((uint)KnownColor.MidnightBlue); + } + } + + /// <summary> + /// Well-known color: MintCream + /// </summary> + public static Color MintCream { + get { + return Color.FromUInt32((uint)KnownColor.MintCream); + } + } + + /// <summary> + /// Well-known color: MistyRose + /// </summary> + public static Color MistyRose { + get { + return Color.FromUInt32((uint)KnownColor.MistyRose); + } + } + + /// <summary> + /// Well-known color: Moccasin + /// </summary> + public static Color Moccasin { + get { + return Color.FromUInt32((uint)KnownColor.Moccasin); + } + } + + /// <summary> + /// Well-known color: NavajoWhite + /// </summary> + public static Color NavajoWhite { + get { + return Color.FromUInt32((uint)KnownColor.NavajoWhite); + } + } + + /// <summary> + /// Well-known color: Navy + /// </summary> + public static Color Navy { + get { + return Color.FromUInt32((uint)KnownColor.Navy); + } + } + + /// <summary> + /// Well-known color: OldLace + /// </summary> + public static Color OldLace { + get { + return Color.FromUInt32((uint)KnownColor.OldLace); + } + } + + /// <summary> + /// Well-known color: Olive + /// </summary> + public static Color Olive { + get { + return Color.FromUInt32((uint)KnownColor.Olive); + } + } + + /// <summary> + /// Well-known color: OliveDrab + /// </summary> + public static Color OliveDrab { + get { + return Color.FromUInt32((uint)KnownColor.OliveDrab); + } + } + + /// <summary> + /// Well-known color: Orange + /// </summary> + public static Color Orange { + get { + return Color.FromUInt32((uint)KnownColor.Orange); + } + } + + /// <summary> + /// Well-known color: OrangeRed + /// </summary> + public static Color OrangeRed { + get { + return Color.FromUInt32((uint)KnownColor.OrangeRed); + } + } + + /// <summary> + /// Well-known color: Orchid + /// </summary> + public static Color Orchid { + get { + return Color.FromUInt32((uint)KnownColor.Orchid); + } + } + + /// <summary> + /// Well-known color: PaleGoldenrod + /// </summary> + public static Color PaleGoldenrod { + get { + return Color.FromUInt32((uint)KnownColor.PaleGoldenrod); + } + } + + /// <summary> + /// Well-known color: PaleGreen + /// </summary> + public static Color PaleGreen { + get { + return Color.FromUInt32((uint)KnownColor.PaleGreen); + } + } + + /// <summary> + /// Well-known color: PaleTurquoise + /// </summary> + public static Color PaleTurquoise { + get { + return Color.FromUInt32((uint)KnownColor.PaleTurquoise); + } + } + + /// <summary> + /// Well-known color: PaleVioletRed + /// </summary> + public static Color PaleVioletRed { + get { + return Color.FromUInt32((uint)KnownColor.PaleVioletRed); + } + } + + /// <summary> + /// Well-known color: PapayaWhip + /// </summary> + public static Color PapayaWhip { + get { + return Color.FromUInt32((uint)KnownColor.PapayaWhip); + } + } + + /// <summary> + /// Well-known color: PeachPuff + /// </summary> + public static Color PeachPuff { + get { + return Color.FromUInt32((uint)KnownColor.PeachPuff); + } + } + + /// <summary> + /// Well-known color: Peru + /// </summary> + public static Color Peru { + get { + return Color.FromUInt32((uint)KnownColor.Peru); + } + } + + /// <summary> + /// Well-known color: Pink + /// </summary> + public static Color Pink { + get { + return Color.FromUInt32((uint)KnownColor.Pink); + } + } + + /// <summary> + /// Well-known color: Plum + /// </summary> + public static Color Plum { + get { + return Color.FromUInt32((uint)KnownColor.Plum); + } + } + + /// <summary> + /// Well-known color: PowderBlue + /// </summary> + public static Color PowderBlue { + get { + return Color.FromUInt32((uint)KnownColor.PowderBlue); + } + } + + /// <summary> + /// Well-known color: Purple + /// </summary> + public static Color Purple { + get { + return Color.FromUInt32((uint)KnownColor.Purple); + } + } + + /// <summary> + /// Well-known color: Red + /// </summary> + public static Color Red { + get { + return Color.FromUInt32((uint)KnownColor.Red); + } + } + + /// <summary> + /// Well-known color: RosyBrown + /// </summary> + public static Color RosyBrown { + get { + return Color.FromUInt32((uint)KnownColor.RosyBrown); + } + } + + /// <summary> + /// Well-known color: RoyalBlue + /// </summary> + public static Color RoyalBlue { + get { + return Color.FromUInt32((uint)KnownColor.RoyalBlue); + } + } + + /// <summary> + /// Well-known color: SaddleBrown + /// </summary> + public static Color SaddleBrown { + get { + return Color.FromUInt32((uint)KnownColor.SaddleBrown); + } + } + + /// <summary> + /// Well-known color: Salmon + /// </summary> + public static Color Salmon { + get { + return Color.FromUInt32((uint)KnownColor.Salmon); + } + } + + /// <summary> + /// Well-known color: SandyBrown + /// </summary> + public static Color SandyBrown { + get { + return Color.FromUInt32((uint)KnownColor.SandyBrown); + } + } + + /// <summary> + /// Well-known color: SeaGreen + /// </summary> + public static Color SeaGreen { + get { + return Color.FromUInt32((uint)KnownColor.SeaGreen); + } + } + + /// <summary> + /// Well-known color: SeaShell + /// </summary> + public static Color SeaShell { + get { + return Color.FromUInt32((uint)KnownColor.SeaShell); + } + } + + /// <summary> + /// Well-known color: Sienna + /// </summary> + public static Color Sienna { + get { + return Color.FromUInt32((uint)KnownColor.Sienna); + } + } + + /// <summary> + /// Well-known color: Silver + /// </summary> + public static Color Silver { + get { + return Color.FromUInt32((uint)KnownColor.Silver); + } + } + + /// <summary> + /// Well-known color: SkyBlue + /// </summary> + public static Color SkyBlue { + get { + return Color.FromUInt32((uint)KnownColor.SkyBlue); + } + } + + /// <summary> + /// Well-known color: SlateBlue + /// </summary> + public static Color SlateBlue { + get { + return Color.FromUInt32((uint)KnownColor.SlateBlue); + } + } + + /// <summary> + /// Well-known color: SlateGray + /// </summary> + public static Color SlateGray { + get { + return Color.FromUInt32((uint)KnownColor.SlateGray); + } + } + + /// <summary> + /// Well-known color: Snow + /// </summary> + public static Color Snow { + get { + return Color.FromUInt32((uint)KnownColor.Snow); + } + } + + /// <summary> + /// Well-known color: SpringGreen + /// </summary> + public static Color SpringGreen { + get { + return Color.FromUInt32((uint)KnownColor.SpringGreen); + } + } + + /// <summary> + /// Well-known color: SteelBlue + /// </summary> + public static Color SteelBlue { + get { + return Color.FromUInt32((uint)KnownColor.SteelBlue); + } + } + + /// <summary> + /// Well-known color: Tan + /// </summary> + public static Color Tan { + get { + return Color.FromUInt32((uint)KnownColor.Tan); + } + } + + /// <summary> + /// Well-known color: Teal + /// </summary> + public static Color Teal { + get { + return Color.FromUInt32((uint)KnownColor.Teal); + } + } + + /// <summary> + /// Well-known color: Thistle + /// </summary> + public static Color Thistle { + get { + return Color.FromUInt32((uint)KnownColor.Thistle); + } + } + + /// <summary> + /// Well-known color: Tomato + /// </summary> + public static Color Tomato { + get { + return Color.FromUInt32((uint)KnownColor.Tomato); + } + } + + /// <summary> + /// Well-known color: Transparent + /// </summary> + public static Color Transparent { + get { + return Color.FromUInt32((uint)KnownColor.Transparent); + } + } + + /// <summary> + /// Well-known color: Turquoise + /// </summary> + public static Color Turquoise { + get { + return Color.FromUInt32((uint)KnownColor.Turquoise); + } + } + + /// <summary> + /// Well-known color: Violet + /// </summary> + public static Color Violet { + get { + return Color.FromUInt32((uint)KnownColor.Violet); + } + } + + /// <summary> + /// Well-known color: Wheat + /// </summary> + public static Color Wheat { + get { + return Color.FromUInt32((uint)KnownColor.Wheat); + } + } + + /// <summary> + /// Well-known color: White + /// </summary> + public static Color White { + get { + return Color.FromUInt32((uint)KnownColor.White); + } + } + + /// <summary> + /// Well-known color: WhiteSmoke + /// </summary> + public static Color WhiteSmoke { + get { + return Color.FromUInt32((uint)KnownColor.WhiteSmoke); + } + } + + /// <summary> + /// Well-known color: Yellow + /// </summary> + public static Color Yellow { + get { + return Color.FromUInt32((uint)KnownColor.Yellow); + } + } + + /// <summary> + /// Well-known color: YellowGreen + /// </summary> + public static Color YellowGreen { + get { + return Color.FromUInt32((uint)KnownColor.YellowGreen); + } + } + + #endregion static Known Colors + } +#endif +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.DashStyle.cs b/src/FPF/PresentationCore/System.Windows.Media.DashStyle.cs new file mode 100644 index 0000000..cb0ef52 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.DashStyle.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace System.Windows.Media +{ + public class DashStyle + { + public double Offset { get; } + public double [] Dashes { get; } + + public DashStyle (IEnumerable<double> dashes, Double offset) + { + Offset = offset; + if (dashes is double [] arr) + Dashes = arr; + else + Dashes = dashes.ToArray (); + } + } +} diff --git a/src/FPF/PresentationCore/System.Windows.Media.FillRule.cs b/src/FPF/PresentationCore/System.Windows.Media.FillRule.cs new file mode 100644 index 0000000..3c65882 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.FillRule.cs @@ -0,0 +1,8 @@ +namespace System.Windows.Media +{ + public enum FillRule + { EvenOdd, + Nonzero, + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.GeneralTransform.cs b/src/FPF/PresentationCore/System.Windows.Media.GeneralTransform.cs new file mode 100644 index 0000000..57ead83 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.GeneralTransform.cs @@ -0,0 +1,8 @@ +namespace System.Windows.Media +{ + public abstract class GeneralTransform : System.Windows.Media.Animation.Animatable + { public System.Windows.Point Transform(System.Windows.Point param0){throw new System.NotImplementedException();} + public abstract System.Windows.Rect TransformBounds(System.Windows.Rect param0); + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Geometry.cs b/src/FPF/PresentationCore/System.Windows.Media.Geometry.cs new file mode 100644 index 0000000..0cd52b8 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Geometry.cs @@ -0,0 +1,17 @@ +namespace System.Windows.Media +{ + public abstract class Geometry : System.Windows.Media.Animation.Animatable + { public abstract System.Boolean IsEmpty(); + + + public static System.Windows.Media.Geometry Parse(System.String param0) { throw new System.NotImplementedException(); } + public System.Windows.Media.IntersectionDetail FillContainsWithDetail(System.Windows.Media.Geometry param0) { throw new System.NotImplementedException(); } + public System.Windows.Media.PathGeometry GetOutlinedPathGeometry() { throw new System.NotImplementedException(); } + + + public System.Windows.Media.Transform Transform { get { throw new System.NotImplementedException(); } set { throw new System.NotImplementedException(); } } + public static System.Windows.Media.Geometry Empty { get; } = new GeometryGroup(); + public virtual System.Windows.Rect Bounds { get { throw new System.NotImplementedException(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.GeometryCollection.cs b/src/FPF/PresentationCore/System.Windows.Media.GeometryCollection.cs new file mode 100644 index 0000000..c7698b7 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.GeometryCollection.cs @@ -0,0 +1,7 @@ +namespace System.Windows.Media +{ + public class GeometryCollection : System.Windows.Media.Animation.Animatable + { public virtual void Add(System.Windows.Media.Geometry param0){throw new System.NotImplementedException();} + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.GeometryGroup.cs b/src/FPF/PresentationCore/System.Windows.Media.GeometryGroup.cs new file mode 100644 index 0000000..3bfc123 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.GeometryGroup.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Linq; + +namespace System.Windows.Media +{ + public class GeometryGroup : System.Windows.Media.Geometry + { + public List<Geometry> Children { get; } = new List<Geometry>(); + + public override Rect Bounds + { + get + { + if (Children.Count == 0) + return Rect.Empty; + var union = Children[0].Bounds; + foreach (var c in Children.Skip(1)) + union.Union(c.Bounds); + return union; + } + } + public override bool IsEmpty() + { + return !Children.Any(c => !c.IsEmpty()); + } + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.ImageSource.cs b/src/FPF/PresentationCore/System.Windows.Media.ImageSource.cs new file mode 100644 index 0000000..a35f459 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.ImageSource.cs @@ -0,0 +1,10 @@ +namespace System.Windows.Media +{ + public abstract class ImageSource : System.Windows.Media.Animation.Animatable + { + + public abstract System.Double Height { get; } + public abstract System.Double Width { get; } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Imaging.BitmapImage.cs b/src/FPF/PresentationCore/System.Windows.Media.Imaging.BitmapImage.cs new file mode 100644 index 0000000..2e0796b --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Imaging.BitmapImage.cs @@ -0,0 +1,15 @@ +namespace System.Windows.Media.Imaging +{ + public class BitmapImage : System.Windows.Media.Imaging.BitmapSource + { public BitmapImage(){} + public virtual void BeginInit(){throw new System.NotImplementedException();} + public virtual void EndInit(){throw new System.NotImplementedException();} + + + public System.IO.Stream StreamSource { set { throw new System.NotImplementedException(); } } + + public override double Height => throw new NotImplementedException(); + + public override double Width => throw new NotImplementedException(); + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Imaging.BitmapSource.cs b/src/FPF/PresentationCore/System.Windows.Media.Imaging.BitmapSource.cs new file mode 100644 index 0000000..5ea7a9e --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Imaging.BitmapSource.cs @@ -0,0 +1,5 @@ +namespace System.Windows.Media.Imaging +{ + public abstract class BitmapSource : System.Windows.Media.ImageSource + {} +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.IntersectionDetail.cs b/src/FPF/PresentationCore/System.Windows.Media.IntersectionDetail.cs new file mode 100644 index 0000000..ecf2468 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.IntersectionDetail.cs @@ -0,0 +1,11 @@ +namespace System.Windows.Media +{ + public enum IntersectionDetail + { NotCalculated, + Empty, + FullyInside, + FullyContains, + Intersects, + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.PathFigure.cs b/src/FPF/PresentationCore/System.Windows.Media.PathFigure.cs new file mode 100644 index 0000000..2fa79a9 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.PathFigure.cs @@ -0,0 +1,14 @@ +namespace System.Windows.Media +{ + public class PathFigure : System.Windows.Media.Animation.Animatable + { public PathFigure(){} + public PathFigure(System.Windows.Point param0, System.Collections.Generic.IEnumerable<System.Windows.Media.PathSegment> param1, System.Boolean param2){} + + + + public System.Boolean IsClosed { set { throw new System.NotImplementedException(); } } + public System.Windows.Point StartPoint { set { throw new System.NotImplementedException(); } } + public System.Windows.Media.PathSegmentCollection Segments { get { throw new System.NotImplementedException(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.PathFigureCollection.cs b/src/FPF/PresentationCore/System.Windows.Media.PathFigureCollection.cs new file mode 100644 index 0000000..670519d --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.PathFigureCollection.cs @@ -0,0 +1,7 @@ +namespace System.Windows.Media +{ + public class PathFigureCollection : System.Windows.Media.Animation.Animatable + { public virtual void Add(System.Windows.Media.PathFigure param0){throw new System.NotImplementedException();} + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.PathGeometry.cs b/src/FPF/PresentationCore/System.Windows.Media.PathGeometry.cs new file mode 100644 index 0000000..e60c849 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.PathGeometry.cs @@ -0,0 +1,17 @@ +namespace System.Windows.Media +{ + public class PathGeometry : System.Windows.Media.Geometry + { public PathGeometry(){} + public PathGeometry(System.Collections.Generic.IEnumerable<System.Windows.Media.PathFigure> param0){} + public void AddGeometry(System.Windows.Media.Geometry param0){throw new System.NotImplementedException();} + + public override bool IsEmpty() + { + throw new NotImplementedException(); + } + + public System.Windows.Media.FillRule FillRule { set { throw new System.NotImplementedException(); } } + public System.Windows.Media.PathFigureCollection Figures { get { throw new System.NotImplementedException(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.PathSegment.cs b/src/FPF/PresentationCore/System.Windows.Media.PathSegment.cs new file mode 100644 index 0000000..b23eabe --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.PathSegment.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Media +{ + public abstract class PathSegment : System.Windows.Media.Animation.Animatable + { + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.PathSegmentCollection.cs b/src/FPF/PresentationCore/System.Windows.Media.PathSegmentCollection.cs new file mode 100644 index 0000000..07af3b2 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.PathSegmentCollection.cs @@ -0,0 +1,7 @@ +namespace System.Windows.Media +{ + public class PathSegmentCollection : System.Windows.Media.Animation.Animatable + { public virtual void Add(System.Windows.Media.PathSegment param0){throw new System.NotImplementedException();} + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Pen.cs b/src/FPF/PresentationCore/System.Windows.Media.Pen.cs new file mode 100644 index 0000000..48df6cc --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Pen.cs @@ -0,0 +1,23 @@ +namespace System.Windows.Media +{ + public class Pen : Animation.Animatable + { + public Brush Brush { get; set; } + public double Thickness { get; set; } + public PenLineCap EndLineCap { get; set; } + public PenLineJoin LineJoin { get; set; } + public double MiterLimit { get; set; } + public PenLineCap StartLineCap { get; set; } + public DashStyle DashStyle { get; set; } + + public Pen () { } + + public Pen (Brush brush, double thickness) + { + Thickness = thickness; + Brush = brush; + } + + public new Pen Clone () { throw new NotImplementedException (); } + } +} diff --git a/src/FPF/PresentationCore/System.Windows.Media.PenLineCap.cs b/src/FPF/PresentationCore/System.Windows.Media.PenLineCap.cs new file mode 100644 index 0000000..301aec5 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.PenLineCap.cs @@ -0,0 +1,10 @@ +namespace System.Windows.Media +{ + public enum PenLineCap + { Flat, + Square, + Round, + Triangle, + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.PenLineJoin.cs b/src/FPF/PresentationCore/System.Windows.Media.PenLineJoin.cs new file mode 100644 index 0000000..6ee6427 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.PenLineJoin.cs @@ -0,0 +1,9 @@ +namespace System.Windows.Media +{ + public enum PenLineJoin + { Miter, + Bevel, + Round, + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.RectangleGeometry.cs b/src/FPF/PresentationCore/System.Windows.Media.RectangleGeometry.cs new file mode 100644 index 0000000..cbd4481 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.RectangleGeometry.cs @@ -0,0 +1,18 @@ +namespace System.Windows.Media +{ + public class RectangleGeometry : System.Windows.Media.Geometry + { + public Rect Rectangle; + public RectangleGeometry(Rect rectangle) + { + this.Rectangle = rectangle; + } + + public override Rect Bounds => Rectangle; + + public override bool IsEmpty() + { + return Rectangle.IsEmpty; + } + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.SolidColorBrush.cs b/src/FPF/PresentationCore/System.Windows.Media.SolidColorBrush.cs new file mode 100644 index 0000000..b26bfa4 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.SolidColorBrush.cs @@ -0,0 +1,14 @@ +namespace System.Windows.Media +{ + public class SolidColorBrush : System.Windows.Media.Brush + { + public SolidColorBrush(System.Windows.Media.Color color) + { + this.Color = color; + } + + public new System.Windows.Media.SolidColorBrush Clone() { return new SolidColorBrush(Color); } + public System.Windows.Media.Color Color { get; set; } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.TextEffectCollection.cs b/src/FPF/PresentationCore/System.Windows.Media.TextEffectCollection.cs new file mode 100644 index 0000000..732e3bb --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.TextEffectCollection.cs @@ -0,0 +1,7 @@ +namespace System.Windows.Media +{ + public class TextEffectCollection : System.Windows.Media.Animation.Animatable + { public TextEffectCollection(){} + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.TextFormatting.TextRunProperties.cs b/src/FPF/PresentationCore/System.Windows.Media.TextFormatting.TextRunProperties.cs new file mode 100644 index 0000000..da49466 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.TextFormatting.TextRunProperties.cs @@ -0,0 +1,34 @@ +//----------------------------------------------------------------------- +// +// Microsoft Windows Client Platform +// Copyright (C) Microsoft Corporation +// +// File: TextRunProperties.cs +// +// Contents: Text run properties +// +// Spec: http://team/sites/Avalon/Specs/Text%20Formatting%20API.doc +// +// Created: 1-7-2005 Worachai Chaoweeraprasit (wchao) +// +//------------------------------------------------------------------------ + + +using System; +using System.Globalization; +using System.Windows; + +namespace System.Windows.Media.TextFormatting +{ + /// <summary> + /// Properties that can change from one run to the next, such as typeface or foreground brush. + /// </summary> + /// <remarks> + /// The client provides a concrete implementation of this abstract run properties class. This + /// allows client to implement their run properties the way that fits with their run formatting + /// store. + /// </remarks> + public abstract class TextRunProperties + { + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Transform.cs b/src/FPF/PresentationCore/System.Windows.Media.Transform.cs new file mode 100644 index 0000000..3cc4852 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Transform.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Media +{ + public abstract class Transform : System.Windows.Media.GeneralTransform + { + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Media.Typeface.cs b/src/FPF/PresentationCore/System.Windows.Media.Typeface.cs new file mode 100644 index 0000000..e1a3eef --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Media.Typeface.cs @@ -0,0 +1,9 @@ +namespace System.Windows.Media +{ + public class Typeface : System.Object + { + public System.Windows.FontStyle Style { get; set; } + public System.Windows.FontWeight Weight { get; set; } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.QueryContinueDragEventArgs.cs b/src/FPF/PresentationCore/System.Windows.QueryContinueDragEventArgs.cs new file mode 100644 index 0000000..bd90c9c --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.QueryContinueDragEventArgs.cs @@ -0,0 +1,10 @@ +namespace System.Windows +{ + public class QueryContinueDragEventArgs : System.Windows.RoutedEventArgs + { + + + public System.Boolean EscapePressed { get { throw new System.NotImplementedException(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.RoutedEvent.cs b/src/FPF/PresentationCore/System.Windows.RoutedEvent.cs new file mode 100644 index 0000000..a685cc5 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.RoutedEvent.cs @@ -0,0 +1,6 @@ +namespace System.Windows +{ + public class RoutedEvent : System.Object + { + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.RoutedEventArgs.cs b/src/FPF/PresentationCore/System.Windows.RoutedEventArgs.cs new file mode 100644 index 0000000..8325f4e --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.RoutedEventArgs.cs @@ -0,0 +1,15 @@ +namespace System.Windows +{ + public class RoutedEventArgs : System.EventArgs + { + + + + + public System.Boolean Handled { get { throw new System.NotImplementedException(); } set { throw new System.NotImplementedException(); } } + public System.Object OriginalSource { get { throw new System.NotImplementedException(); } } + public System.Object Source { get { throw new System.NotImplementedException(); } } + public System.Windows.RoutedEvent RoutedEvent { set { throw new System.NotImplementedException(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.TextDataFormat.cs b/src/FPF/PresentationCore/System.Windows.TextDataFormat.cs new file mode 100644 index 0000000..f7313e2 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.TextDataFormat.cs @@ -0,0 +1,12 @@ +namespace System.Windows +{ + public enum TextDataFormat + { Text, + UnicodeText, + Rtf, + Html, + CommaSeparatedValue, + Xaml, + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.TextDecorationCollection.cs b/src/FPF/PresentationCore/System.Windows.TextDecorationCollection.cs new file mode 100644 index 0000000..ebc3301 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.TextDecorationCollection.cs @@ -0,0 +1,6 @@ +namespace System.Windows +{ + public class TextDecorationCollection : System.Windows.Media.Animation.Animatable + { + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationCore/System.Windows.Visibility.cs b/src/FPF/PresentationCore/System.Windows.Visibility.cs new file mode 100644 index 0000000..bb4de51 --- /dev/null +++ b/src/FPF/PresentationCore/System.Windows.Visibility.cs @@ -0,0 +1,9 @@ +namespace System.Windows +{ + public enum Visibility + { Visible, + Hidden, + Collapsed, + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationFramework/PresentationFramework.csproj b/src/FPF/PresentationFramework/PresentationFramework.csproj new file mode 100644 index 0000000..10e9077 --- /dev/null +++ b/src/FPF/PresentationFramework/PresentationFramework.csproj @@ -0,0 +1,9 @@ +<Project Sdk="Xamarin.Mac.Sdk"> + <PropertyGroup> + <TargetFramework>$(TargetFramework)</TargetFramework> + </PropertyGroup> + <ItemGroup> + <ProjectReference Include="..\PresentationCore\PresentationCore.csproj" /> + <ProjectReference Include="..\WindowsBase\WindowsBase.csproj" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/src/FPF/PresentationFramework/Properties/AssemblyInfo.cs b/src/FPF/PresentationFramework/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ca0bd7d --- /dev/null +++ b/src/FPF/PresentationFramework/Properties/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System; +using System.Reflection; + +[assembly: CLSCompliant(true)] +[assembly: AssemblyVersion("4.0.0.0")]
\ No newline at end of file diff --git a/src/FPF/PresentationFramework/System.Windows.ResourceDictionary.cs b/src/FPF/PresentationFramework/System.Windows.ResourceDictionary.cs new file mode 100644 index 0000000..6444913 --- /dev/null +++ b/src/FPF/PresentationFramework/System.Windows.ResourceDictionary.cs @@ -0,0 +1,101 @@ +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Linq; + +namespace System.Windows +{ + public class ResourceDictionary : System.Object, IDictionary + { + public System.Boolean Contains(System.Object param0) { + if (innerDictionary.ContainsKey (param0)) + return true; + if (_mergedDictionaries != null) { + for (int i = MergedDictionaries.Count - 1; i >= 0; i--) { + var mergedDictionary = MergedDictionaries[i]; + if (mergedDictionary != null && mergedDictionary.Contains(param0)) + return true; + } + } + return false; + } + + public ResourceDictionary() { } + public void Add(System.Object param0, System.Object param1) { innerDictionary[param0] = param1; } + + public void Clear() + { + innerDictionary.Clear(); + } + + public IDictionaryEnumerator GetEnumerator() + { + throw new NotImplementedException(); + } + + public void Remove(object key) + { + innerDictionary.Remove(key); + } + + public void CopyTo(Array array, int index) + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return innerDictionary.GetEnumerator(); + } + + private ObservableCollection<ResourceDictionary> _mergedDictionaries = null; + public System.Collections.ObjectModel.Collection<System.Windows.ResourceDictionary> MergedDictionaries { + get { + if (_mergedDictionaries == null) { + _mergedDictionaries = new ObservableCollection<ResourceDictionary>(); + } + return _mergedDictionaries; + } + } + + public bool IsFixedSize => throw new NotImplementedException(); + + public bool IsReadOnly => throw new NotImplementedException(); + + public ICollection Keys => innerDictionary.Keys; + + public ICollection Values => innerDictionary.Values; + + public int Count => throw new NotImplementedException(); + + public bool IsSynchronized => throw new NotImplementedException(); + + public object SyncRoot => throw new NotImplementedException(); + + public bool HasImplicitDataTemplates { get; set; } + public bool HasImplicitStyles { get; private set; } + public bool IsThemeDictionary { get; private set; } + public bool IsInitialized { get; private set; } + public bool InvalidatesImplicitDataTemplateResources { get; private set; } + + Dictionary<object, object> innerDictionary = new Dictionary<object, object>(); + + public object this[object key] { + get { + if (innerDictionary.TryGetValue(key, out var val)) + return val; + for (int i = MergedDictionaries.Count - 1; i >= 0; i--) + { + var merged = MergedDictionaries [i]; + val = merged [key]; + if (val != null) + return val; + } + + return null; + } + set { innerDictionary[key] = value; } + } + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationFramework/System.Windows.ResourceDictionaryLocation.cs b/src/FPF/PresentationFramework/System.Windows.ResourceDictionaryLocation.cs new file mode 100644 index 0000000..b471f0d --- /dev/null +++ b/src/FPF/PresentationFramework/System.Windows.ResourceDictionaryLocation.cs @@ -0,0 +1,9 @@ +namespace System.Windows +{ + public enum ResourceDictionaryLocation + { None, + SourceAssembly, + ExternalAssembly, + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationFramework/System.Windows.SystemColors.cs b/src/FPF/PresentationFramework/System.Windows.SystemColors.cs new file mode 100644 index 0000000..a6adb3d --- /dev/null +++ b/src/FPF/PresentationFramework/System.Windows.SystemColors.cs @@ -0,0 +1,30 @@ +namespace System.Windows +{ + public abstract class SystemColors : System.Object + { + static System.Windows.Media.Color pinkColor = new Media.Color { + R = 255, G = 192, B = 203, A = 255 + }; + public static System.Windows.Media.Color ControlColor { get { return pinkColor; } } + public static System.Windows.Media.Color ControlTextColor { get { return pinkColor; } } + public static System.Windows.Media.Color GrayTextColor { get { return pinkColor; } } + public static System.Windows.Media.Color HighlightColor { get { return pinkColor; } } + public static System.Windows.Media.Color HighlightTextColor { get { return pinkColor; } } + public static System.Windows.Media.SolidColorBrush ActiveBorderBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush ActiveCaptionBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush ControlBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush ControlDarkBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush ControlLightBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush ControlLightLightBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush GrayTextBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush HighlightBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush HotTrackBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush InfoBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush InfoTextBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush WindowBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush WindowFrameBrush { get { return new Media.SolidColorBrush(pinkColor); } } + public static System.Windows.Media.SolidColorBrush WindowTextBrush { + get { return new Windows.Media.SolidColorBrush(new Media.Color { R = 0, G = 0, B = 0, A = 255 }); } + } + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationFramework/System.Windows.SystemParameters.cs b/src/FPF/PresentationFramework/System.Windows.SystemParameters.cs new file mode 100644 index 0000000..f24e07b --- /dev/null +++ b/src/FPF/PresentationFramework/System.Windows.SystemParameters.cs @@ -0,0 +1,25 @@ +namespace System.Windows +{ + public abstract class SystemParameters : System.Object + { + + + + + + + + + + + public static System.Boolean HighContrast { get { return false; } } + public static System.Boolean IsMenuDropRightAligned { get { throw new System.NotImplementedException(); } } + public static System.Boolean MenuDropAlignment { get { throw new System.NotImplementedException(); } } + public static System.Double MinimumHorizontalDragDistance { get { return 5; } } + public static System.Double MinimumVerticalDragDistance { get { return 5; } } + public static System.Double PrimaryScreenHeight { get { throw new System.NotImplementedException(); } } + public static System.Double PrimaryScreenWidth { get { throw new System.NotImplementedException(); } } + public static System.Int32 WheelScrollLines { get { throw new System.NotImplementedException(); } } + public static System.Windows.Rect WorkArea { get { throw new System.NotImplementedException(); } } + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationFramework/System.Windows.ThemeInfoAttribute.cs b/src/FPF/PresentationFramework/System.Windows.ThemeInfoAttribute.cs new file mode 100644 index 0000000..2b6a550 --- /dev/null +++ b/src/FPF/PresentationFramework/System.Windows.ThemeInfoAttribute.cs @@ -0,0 +1,7 @@ +namespace System.Windows +{ + public class ThemeInfoAttribute : System.Attribute + { public ThemeInfoAttribute(System.Windows.ResourceDictionaryLocation param0, System.Windows.ResourceDictionaryLocation param1){} + + } +}
\ No newline at end of file diff --git a/src/FPF/PresentationFramework/System.Windows.Thickness.cs b/src/FPF/PresentationFramework/System.Windows.Thickness.cs new file mode 100644 index 0000000..bd7be9b --- /dev/null +++ b/src/FPF/PresentationFramework/System.Windows.Thickness.cs @@ -0,0 +1,215 @@ +//--------------------------------------------------------------------------- +// +// Copyright (C) Microsoft Corporation. All rights reserved. +// +// File: Thickness.cs +// +// Description: Contains the Thickness (double x4) value type. +// +// History: +// 06/02/2003 : greglett - created. +// +//--------------------------------------------------------------------------- + +using System.ComponentModel; +using System.Globalization; + +namespace System.Windows +{ + /// <summary> + /// Thickness is a value type used to describe the thickness of frame around a rectangle. + /// It contains four doubles each corresponding to a side: Left, Top, Right, Bottom. + /// </summary> + public struct Thickness : IEquatable<Thickness> + { + //------------------------------------------------------------------- + // + // Constructors + // + //------------------------------------------------------------------- + + #region Constructors + /// <summary> + /// This constructur builds a Thickness with a specified value on every side. + /// </summary> + /// <param name="uniformLength">The specified uniform length.</param> + public Thickness(double uniformLength) + { + _Left = _Top = _Right = _Bottom = uniformLength; + } + + /// <summary> + /// This constructor builds a Thickness with the specified number of pixels on each side. + /// </summary> + /// <param name="left">The thickness for the left side.</param> + /// <param name="top">The thickness for the top side.</param> + /// <param name="right">The thickness for the right side.</param> + /// <param name="bottom">The thickness for the bottom side.</param> + public Thickness(double left, double top, double right, double bottom) + { + _Left = left; + _Top = top; + _Right = right; + _Bottom = bottom; + } + + + #endregion + + + //------------------------------------------------------------------- + // + // Public Methods + // + //------------------------------------------------------------------- + + #region Public Methods + + /// <summary> + /// This function compares to the provided object for type and value equality. + /// </summary> + /// <param name="obj">Object to compare</param> + /// <returns>True if object is a Thickness and all sides of it are equal to this Thickness'.</returns> + public override bool Equals(object obj) + { + if (obj is Thickness) + { + Thickness otherObj = (Thickness)obj; + return (this == otherObj); + } + return (false); + } + + /// <summary> + /// Compares this instance of Thickness with another instance. + /// </summary> + /// <param name="thickness">Thickness instance to compare.</param> + /// <returns><c>true</c>if this Thickness instance has the same value + /// and unit type as thickness.</returns> + public bool Equals(Thickness thickness) + { + return (this == thickness); + } + + /// <summary> + /// This function returns a hash code. + /// </summary> + /// <returns>Hash code</returns> + public override int GetHashCode() + { + return _Left.GetHashCode() ^ _Top.GetHashCode() ^ _Right.GetHashCode() ^ _Bottom.GetHashCode(); + } + + #endregion + + + //------------------------------------------------------------------- + // + // Public Operators + // + //------------------------------------------------------------------- + + #region Public Operators + + /// <summary> + /// Overloaded operator to compare two Thicknesses for equality. + /// </summary> + /// <param name="t1">first Thickness to compare</param> + /// <param name="t2">second Thickness to compare</param> + /// <returns>True if all sides of the Thickness are equal, false otherwise</returns> + // SEEALSO + public static bool operator ==(Thickness t1, Thickness t2) + { + return ((t1._Left == t2._Left || (double.IsNaN(t1._Left) && double.IsNaN(t2._Left))) + && (t1._Top == t2._Top || (double.IsNaN(t1._Top) && double.IsNaN(t2._Top))) + && (t1._Right == t2._Right || (double.IsNaN(t1._Right) && double.IsNaN(t2._Right))) + && (t1._Bottom == t2._Bottom || (double.IsNaN(t1._Bottom) && double.IsNaN(t2._Bottom))) + ); + } + + /// <summary> + /// Overloaded operator to compare two Thicknesses for inequality. + /// </summary> + /// <param name="t1">first Thickness to compare</param> + /// <param name="t2">second Thickness to compare</param> + /// <returns>False if all sides of the Thickness are equal, true otherwise</returns> + // SEEALSO + public static bool operator !=(Thickness t1, Thickness t2) + { + return (!(t1 == t2)); + } + + #endregion + + + //------------------------------------------------------------------- + // + // Public Properties + // + //------------------------------------------------------------------- + + #region Public Properties + + /// <summary>This property is the Length on the thickness' left side</summary> + public double Left + { + get { return _Left; } + set { _Left = value; } + } + + /// <summary>This property is the Length on the thickness' top side</summary> + public double Top + { + get { return _Top; } + set { _Top = value; } + } + + /// <summary>This property is the Length on the thickness' right side</summary> + public double Right + { + get { return _Right; } + set { _Right = value; } + } + + /// <summary>This property is the Length on the thickness' bottom side</summary> + public double Bottom + { + get { return _Bottom; } + set { _Bottom = value; } + } + #endregion + + //------------------------------------------------------------------- + // + // INternal API + // + //------------------------------------------------------------------- + + #region Internal API + + internal Size Size + { + get + { + return new Size(_Left + _Right, _Top + _Bottom); + } + } + + #endregion + + //------------------------------------------------------------------- + // + // Private Fields + // + //------------------------------------------------------------------- + + #region Private Fields + + private double _Left; + private double _Top; + private double _Right; + private double _Bottom; + + #endregion + } +}
\ No newline at end of file diff --git a/src/FPF/README.md b/src/FPF/README.md new file mode 100644 index 0000000..0ea55f0 --- /dev/null +++ b/src/FPF/README.md @@ -0,0 +1,19 @@ +# FPF: Fake Presentation Foundation + +FPF stubs just enough of the WPF APIs that the editor depends on. Notably +we require some primitives such as `Color`, `Brush`, `Point`, etc. This is +a very minimal approach to bootstrap the editor on macOS, and over time we +anticipate eliminating this support layer entirely. + +For `WindowsBase`, we have simply imported a subset of +[Mono's version][mwb] and made changes to the `Dispatcher` to use macOS' +[Grand Central Dispatch][gcd], since the editor uses this extensively, +we wanted it to be highly performant. + +For the other assemblies we generated necessary stubs and filled in the +basic primitives. + +FPF depends on Xamarin.Mac to build at this point. + +[mwb]: https://github.com/mono/mono/tree/master/mcs/class/WindowsBase +[gcd]: https://developer.apple.com/documentation/dispatch
\ No newline at end of file diff --git a/src/FPF/UIAutomationClient/Properties/AssemblyInfo.cs b/src/FPF/UIAutomationClient/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ca0bd7d --- /dev/null +++ b/src/FPF/UIAutomationClient/Properties/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System; +using System.Reflection; + +[assembly: CLSCompliant(true)] +[assembly: AssemblyVersion("4.0.0.0")]
\ No newline at end of file diff --git a/src/FPF/UIAutomationClient/System.Windows.Automation.AutomationElement.cs b/src/FPF/UIAutomationClient/System.Windows.Automation.AutomationElement.cs new file mode 100644 index 0000000..83e0cfc --- /dev/null +++ b/src/FPF/UIAutomationClient/System.Windows.Automation.AutomationElement.cs @@ -0,0 +1,7 @@ +namespace System.Windows.Automation +{ + public class AutomationElement : System.Object + { public static System.Object NotSupported; + + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationClient/System.Windows.Automation.TextPattern.cs b/src/FPF/UIAutomationClient/System.Windows.Automation.TextPattern.cs new file mode 100644 index 0000000..624a50a --- /dev/null +++ b/src/FPF/UIAutomationClient/System.Windows.Automation.TextPattern.cs @@ -0,0 +1,15 @@ +namespace System.Windows.Automation +{ + public class TextPattern + { public static System.Object MixedAttributeValue; + public static System.Windows.Automation.AutomationTextAttribute BackgroundColorAttribute; + public static System.Windows.Automation.AutomationTextAttribute CultureAttribute; + public static System.Windows.Automation.AutomationTextAttribute FontNameAttribute; + public static System.Windows.Automation.AutomationTextAttribute FontSizeAttribute; + public static System.Windows.Automation.AutomationTextAttribute FontWeightAttribute; + public static System.Windows.Automation.AutomationTextAttribute ForegroundColorAttribute; + public static System.Windows.Automation.AutomationTextAttribute IsItalicAttribute; + public static System.Windows.Automation.AutomationTextAttribute IsReadOnlyAttribute; + + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationClient/UIAutomationClient.csproj b/src/FPF/UIAutomationClient/UIAutomationClient.csproj new file mode 100644 index 0000000..e179f75 --- /dev/null +++ b/src/FPF/UIAutomationClient/UIAutomationClient.csproj @@ -0,0 +1,8 @@ +<Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <TargetFramework>$(TargetFramework)</TargetFramework> + </PropertyGroup> + <ItemGroup> + <ProjectReference Include="..\UIAutomationTypes\UIAutomationTypes.csproj" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/src/FPF/UIAutomationClient/mono_crash.37136.0.json b/src/FPF/UIAutomationClient/mono_crash.37136.0.json new file mode 100644 index 0000000..efe0e67 --- /dev/null +++ b/src/FPF/UIAutomationClient/mono_crash.37136.0.json @@ -0,0 +1,161 @@ +{ + "protocol_version" : "0.0.1", + "configuration" : { + "version" : "5.14.0.105 (2018-04/6d28c8f9621 Fri May 25 04:39:29 EDT 2018)", + "tlc" : "normal", + "sigsgev" : "altstack", + "notifications" : "kqueue", + "architecture" : "x86", + "disabled_features" : "none", + "smallconfig" : "disabled", + "bigarrays" : "disabled", + "softdebug" : "enabled", + "interpreter" : "enabled", + "llvm_support" : "3.6.0svn-mono-master/8b1520c8aae" + }, + "memory" : { + "Resident Size" : "53284864", + "Virtual Size" : "769011712", + "minor_gc_time" : "101615", + "major_gc_time" : "50380", + "minor_gc_count" : "2", + "major_gc_count" : "1", + "major_gc_time_concurrent" : "0" + }, + "threads" : [ + { + "is_managed" : false, + "managed_thread_ptr" : "0x7ca02a3c", + "thread_info_addr" : "0x7f1f8000", + "native_thread_id" : "0xa983e1c0", + "ctx" : { + "IP" : "0xa73bd476", + "SP" : "0xbff00e1c", + "BP" : "0xbff00e68" + }, + "unmanaged_frames" : [ + { + "native_address" : "0xbfc6f" + }, + { + "native_address" : "0x21588a" + }, + { + "native_address" : "0x126a89" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "0x266968" + }, + { + "native_address" : "0x14cc5" + }, + { + "native_address" : "0x8657d" + }, + { + "native_address" : "0x2297" + }, + { + "native_address" : "0x20c5" + } + ] + }, + { + "is_managed" : false, + "managed_thread_ptr" : "0x7d9fe23c", + "thread_info_addr" : "0x7d9fd000", + "thread_name" : "Finalizer", + "native_thread_id" : "0xb060b000", + "ctx" : { + "IP" : "0x377158", + "SP" : "0xb060aac0", + "BP" : "0xb060aac8" + }, + "managed_frames" : [ + { + "native_address" : "0x278158" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper managed-to-native) System.Runtime.InteropServices.GCHandle:CheckCurrentDomain (int)" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x600466e", + "native_offset" : "0x23", + "il_offset" : "0x00018" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004678", + "native_offset" : "0x17", + "il_offset" : "0x00000" + }, + { + "is_managed" : "true", + "assembly" : "System", + "token" : "0x60033aa", + "native_offset" : "0x23", + "il_offset" : "0x00000" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper native-to-managed) System.IO.Compression.DeflateStreamNative:UnmanagedWrite (intptr,int,intptr)" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper managed-to-native) System.IO.Compression.DeflateStreamNative:CloseZStream (intptr)" + }, + { + "is_managed" : "true", + "assembly" : "System", + "token" : "0x6004142", + "native_offset" : "0x13", + "il_offset" : "0x00000" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004637", + "native_offset" : "0x1bc", + "il_offset" : "0x000a3" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004636", + "native_offset" : "0x23", + "il_offset" : "0x00008" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004630", + "native_offset" : "0x2b", + "il_offset" : "0x0000a" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004629", + "native_offset" : "0x18", + "il_offset" : "0x00000" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper runtime-invoke) object:runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)" + } + ] + } + ]} diff --git a/src/FPF/UIAutomationClient/mono_crash.37787.0.json b/src/FPF/UIAutomationClient/mono_crash.37787.0.json new file mode 100644 index 0000000..200f64e --- /dev/null +++ b/src/FPF/UIAutomationClient/mono_crash.37787.0.json @@ -0,0 +1,161 @@ +{ + "protocol_version" : "0.0.1", + "configuration" : { + "version" : "5.14.0.105 (2018-04/6d28c8f9621 Fri May 25 04:39:29 EDT 2018)", + "tlc" : "normal", + "sigsgev" : "altstack", + "notifications" : "kqueue", + "architecture" : "x86", + "disabled_features" : "none", + "smallconfig" : "disabled", + "bigarrays" : "disabled", + "softdebug" : "enabled", + "interpreter" : "enabled", + "llvm_support" : "3.6.0svn-mono-master/8b1520c8aae" + }, + "memory" : { + "Resident Size" : "53465088", + "Virtual Size" : "765874176", + "minor_gc_time" : "101566", + "major_gc_time" : "38486", + "minor_gc_count" : "2", + "major_gc_count" : "1", + "major_gc_time_concurrent" : "0" + }, + "threads" : [ + { + "is_managed" : false, + "managed_thread_ptr" : "0x7c17de3c", + "thread_info_addr" : "0x79981600", + "native_thread_id" : "0xa983e1c0", + "ctx" : { + "IP" : "0xa73bd476", + "SP" : "0xbff87e1c", + "BP" : "0xbff87e68" + }, + "unmanaged_frames" : [ + { + "native_address" : "0xbfc6f" + }, + { + "native_address" : "0x21588a" + }, + { + "native_address" : "0x126a89" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "0x266968" + }, + { + "native_address" : "0x14cc5" + }, + { + "native_address" : "0x8657d" + }, + { + "native_address" : "0x2297" + }, + { + "native_address" : "0x20c5" + } + ] + }, + { + "is_managed" : false, + "managed_thread_ptr" : "0x7c18043c", + "thread_info_addr" : "0x7c18b400", + "thread_name" : "Finalizer", + "native_thread_id" : "0xb0329000", + "ctx" : { + "IP" : "0x2f0158", + "SP" : "0xb0328ac0", + "BP" : "0xb0328ac8" + }, + "managed_frames" : [ + { + "native_address" : "0x278158" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper managed-to-native) System.Runtime.InteropServices.GCHandle:CheckCurrentDomain (int)" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x600466e", + "native_offset" : "0x23", + "il_offset" : "0x00018" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004678", + "native_offset" : "0x17", + "il_offset" : "0x00000" + }, + { + "is_managed" : "true", + "assembly" : "System", + "token" : "0x60033aa", + "native_offset" : "0x23", + "il_offset" : "0x00000" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper native-to-managed) System.IO.Compression.DeflateStreamNative:UnmanagedWrite (intptr,int,intptr)" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper managed-to-native) System.IO.Compression.DeflateStreamNative:CloseZStream (intptr)" + }, + { + "is_managed" : "true", + "assembly" : "System", + "token" : "0x6004142", + "native_offset" : "0x13", + "il_offset" : "0x00000" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004637", + "native_offset" : "0x1bc", + "il_offset" : "0x000a3" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004636", + "native_offset" : "0x23", + "il_offset" : "0x00008" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004630", + "native_offset" : "0x2b", + "il_offset" : "0x0000a" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004629", + "native_offset" : "0x18", + "il_offset" : "0x00000" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper runtime-invoke) object:runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)" + } + ] + } + ]} diff --git a/src/FPF/UIAutomationClient/mono_crash.38209.0.json b/src/FPF/UIAutomationClient/mono_crash.38209.0.json new file mode 100644 index 0000000..749c904 --- /dev/null +++ b/src/FPF/UIAutomationClient/mono_crash.38209.0.json @@ -0,0 +1,161 @@ +{ + "protocol_version" : "0.0.1", + "configuration" : { + "version" : "5.14.0.105 (2018-04/6d28c8f9621 Fri May 25 04:39:29 EDT 2018)", + "tlc" : "normal", + "sigsgev" : "altstack", + "notifications" : "kqueue", + "architecture" : "x86", + "disabled_features" : "none", + "smallconfig" : "disabled", + "bigarrays" : "disabled", + "softdebug" : "enabled", + "interpreter" : "enabled", + "llvm_support" : "3.6.0svn-mono-master/8b1520c8aae" + }, + "memory" : { + "Resident Size" : "53084160", + "Virtual Size" : "766926848", + "minor_gc_time" : "111180", + "major_gc_time" : "39731", + "minor_gc_count" : "2", + "major_gc_count" : "1", + "major_gc_time_concurrent" : "0" + }, + "threads" : [ + { + "is_managed" : false, + "managed_thread_ptr" : "0x7d22a03c", + "thread_info_addr" : "0x7d235400", + "native_thread_id" : "0xa983e1c0", + "ctx" : { + "IP" : "0xa73bd476", + "SP" : "0xbff3ae1c", + "BP" : "0xbff3ae68" + }, + "unmanaged_frames" : [ + { + "native_address" : "0xbfc6f" + }, + { + "native_address" : "0x21588a" + }, + { + "native_address" : "0x126a89" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "0x266968" + }, + { + "native_address" : "0x14cc5" + }, + { + "native_address" : "0x8657d" + }, + { + "native_address" : "0x2297" + }, + { + "native_address" : "0x20c5" + } + ] + }, + { + "is_managed" : false, + "managed_thread_ptr" : "0x7f228c3c", + "thread_info_addr" : "0x7f228000", + "thread_name" : "Finalizer", + "native_thread_id" : "0xb0465000", + "ctx" : { + "IP" : "0x33d158", + "SP" : "0xb0464ac0", + "BP" : "0xb0464ac8" + }, + "managed_frames" : [ + { + "native_address" : "0x278158" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper managed-to-native) System.Runtime.InteropServices.GCHandle:CheckCurrentDomain (int)" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x600466e", + "native_offset" : "0x23", + "il_offset" : "0x00018" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004678", + "native_offset" : "0x17", + "il_offset" : "0x00000" + }, + { + "is_managed" : "true", + "assembly" : "System", + "token" : "0x60033aa", + "native_offset" : "0x23", + "il_offset" : "0x00000" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper native-to-managed) System.IO.Compression.DeflateStreamNative:UnmanagedWrite (intptr,int,intptr)" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper managed-to-native) System.IO.Compression.DeflateStreamNative:CloseZStream (intptr)" + }, + { + "is_managed" : "true", + "assembly" : "System", + "token" : "0x6004142", + "native_offset" : "0x13", + "il_offset" : "0x00000" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004637", + "native_offset" : "0x1bc", + "il_offset" : "0x000a3" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004636", + "native_offset" : "0x23", + "il_offset" : "0x00008" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004630", + "native_offset" : "0x2b", + "il_offset" : "0x0000a" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004629", + "native_offset" : "0x18", + "il_offset" : "0x00000" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper runtime-invoke) object:runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)" + } + ] + } + ]} diff --git a/src/FPF/UIAutomationClient/mono_crash.39174.0.json b/src/FPF/UIAutomationClient/mono_crash.39174.0.json new file mode 100644 index 0000000..526f810 --- /dev/null +++ b/src/FPF/UIAutomationClient/mono_crash.39174.0.json @@ -0,0 +1,164 @@ +{ + "protocol_version" : "0.0.1", + "configuration" : { + "version" : "5.14.0.105 (2018-04/6d28c8f9621 Fri May 25 04:39:29 EDT 2018)", + "tlc" : "normal", + "sigsgev" : "altstack", + "notifications" : "kqueue", + "architecture" : "x86", + "disabled_features" : "none", + "smallconfig" : "disabled", + "bigarrays" : "disabled", + "softdebug" : "enabled", + "interpreter" : "enabled", + "llvm_support" : "3.6.0svn-mono-master/8b1520c8aae" + }, + "memory" : { + "Resident Size" : "53665792", + "Virtual Size" : "765874176", + "minor_gc_time" : "118023", + "major_gc_time" : "52511", + "minor_gc_count" : "2", + "major_gc_count" : "1", + "major_gc_time_concurrent" : "0" + }, + "threads" : [ + { + "is_managed" : false, + "managed_thread_ptr" : "0x7d24503c", + "thread_info_addr" : "0x7e23b800", + "native_thread_id" : "0xa983e1c0", + "ctx" : { + "IP" : "0xa73bd476", + "SP" : "0xbffd021c", + "BP" : "0xbffd0268" + }, + "unmanaged_frames" : [ + { + "native_address" : "0xbfc6f" + }, + { + "native_address" : "0x21588a" + }, + { + "native_address" : "0x126a89" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "0x266968" + }, + { + "native_address" : "0x14cc5" + }, + { + "native_address" : "0x8657d" + }, + { + "native_address" : "0x2297" + }, + { + "native_address" : "0x20c5" + }, + { + "native_address" : "outside mono-sgen" + } + ] + }, + { + "is_managed" : false, + "managed_thread_ptr" : "0x7da36e3c", + "thread_info_addr" : "0x7da36200", + "thread_name" : "Finalizer", + "native_thread_id" : "0xb06a2000", + "ctx" : { + "IP" : "0x2a8158", + "SP" : "0xb06a1ac0", + "BP" : "0xb06a1ac8" + }, + "managed_frames" : [ + { + "native_address" : "0x278158" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper managed-to-native) System.Runtime.InteropServices.GCHandle:CheckCurrentDomain (int)" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x600466e", + "native_offset" : "0x23", + "il_offset" : "0x00018" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004678", + "native_offset" : "0x17", + "il_offset" : "0x00000" + }, + { + "is_managed" : "true", + "assembly" : "System", + "token" : "0x60033aa", + "native_offset" : "0x23", + "il_offset" : "0x00000" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper native-to-managed) System.IO.Compression.DeflateStreamNative:UnmanagedWrite (intptr,int,intptr)" + }, + { + "native_address" : "outside mono-sgen" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper managed-to-native) System.IO.Compression.DeflateStreamNative:CloseZStream (intptr)" + }, + { + "is_managed" : "true", + "assembly" : "System", + "token" : "0x6004142", + "native_offset" : "0x13", + "il_offset" : "0x00000" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004637", + "native_offset" : "0x1bc", + "il_offset" : "0x000a3" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004636", + "native_offset" : "0x23", + "il_offset" : "0x00008" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004630", + "native_offset" : "0x2b", + "il_offset" : "0x0000a" + }, + { + "is_managed" : "true", + "assembly" : "mscorlib", + "token" : "0x6004629", + "native_offset" : "0x18", + "il_offset" : "0x00000" + }, + { + "native_address" : "outside mono-sgen", + "unmanaged_name" : "(wrapper runtime-invoke) object:runtime_invoke_virtual_void__this__ (object,intptr,intptr,intptr)" + } + ] + } + ]} diff --git a/src/FPF/UIAutomationProvider/Properties/AssemblyInfo.cs b/src/FPF/UIAutomationProvider/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ca0bd7d --- /dev/null +++ b/src/FPF/UIAutomationProvider/Properties/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System; +using System.Reflection; + +[assembly: CLSCompliant(true)] +[assembly: AssemblyVersion("4.0.0.0")]
\ No newline at end of file diff --git a/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.AutomationInteropProvider.cs b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.AutomationInteropProvider.cs new file mode 100644 index 0000000..399ba9d --- /dev/null +++ b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.AutomationInteropProvider.cs @@ -0,0 +1,8 @@ +namespace System.Windows.Automation.Provider +{ + public abstract class AutomationInteropProvider : System.Object + { + public static System.Boolean ClientsAreListening { get { throw new System.NotImplementedException(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.IRawElementProviderSimple.cs b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.IRawElementProviderSimple.cs new file mode 100644 index 0000000..2292ca2 --- /dev/null +++ b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.IRawElementProviderSimple.cs @@ -0,0 +1,7 @@ +namespace System.Windows.Automation.Provider +{ + public interface IRawElementProviderSimple + { System.Object GetPropertyValue(System.Int32 param0); + + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ISelectionItemProvider.cs b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ISelectionItemProvider.cs new file mode 100644 index 0000000..12bc0e0 --- /dev/null +++ b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ISelectionItemProvider.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Automation.Provider +{ + public interface ISelectionItemProvider + { + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ISelectionProvider.cs b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ISelectionProvider.cs new file mode 100644 index 0000000..0ecbb29 --- /dev/null +++ b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ISelectionProvider.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Automation.Provider +{ + public interface ISelectionProvider + { + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ITextProvider.cs b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ITextProvider.cs new file mode 100644 index 0000000..2e8068b --- /dev/null +++ b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ITextProvider.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Automation.Provider +{ + public interface ITextProvider + { + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ITextRangeProvider.cs b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ITextRangeProvider.cs new file mode 100644 index 0000000..869918b --- /dev/null +++ b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.ITextRangeProvider.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Automation.Provider +{ + public interface ITextRangeProvider + { + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.IValueProvider.cs b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.IValueProvider.cs new file mode 100644 index 0000000..e31790e --- /dev/null +++ b/src/FPF/UIAutomationProvider/System.Windows.Automation.Provider.IValueProvider.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Automation.Provider +{ + public interface IValueProvider + { + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationProvider/UIAutomationProvider.csproj b/src/FPF/UIAutomationProvider/UIAutomationProvider.csproj new file mode 100644 index 0000000..e6e8e6b --- /dev/null +++ b/src/FPF/UIAutomationProvider/UIAutomationProvider.csproj @@ -0,0 +1,5 @@ +<Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <TargetFramework>$(TargetFramework)</TargetFramework> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/src/FPF/UIAutomationTypes/Properties/AssemblyInfo.cs b/src/FPF/UIAutomationTypes/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ca0bd7d --- /dev/null +++ b/src/FPF/UIAutomationTypes/Properties/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System; +using System.Reflection; + +[assembly: CLSCompliant(true)] +[assembly: AssemblyVersion("4.0.0.0")]
\ No newline at end of file diff --git a/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationElementIdentifiers.cs b/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationElementIdentifiers.cs new file mode 100644 index 0000000..d55027f --- /dev/null +++ b/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationElementIdentifiers.cs @@ -0,0 +1,7 @@ +namespace System.Windows.Automation +{ + public abstract class AutomationElementIdentifiers : System.Object + { public static System.Windows.Automation.AutomationProperty BoundingRectangleProperty; + + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationIdentifier.cs b/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationIdentifier.cs new file mode 100644 index 0000000..c5e2017 --- /dev/null +++ b/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationIdentifier.cs @@ -0,0 +1,8 @@ +namespace System.Windows.Automation +{ + public class AutomationIdentifier : System.Object + { + public System.Int32 Id { get { throw new System.NotImplementedException(); } } + + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationProperty.cs b/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationProperty.cs new file mode 100644 index 0000000..e477d8e --- /dev/null +++ b/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationProperty.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Automation +{ + public class AutomationProperty : System.Windows.Automation.AutomationIdentifier + { + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationTextAttribute.cs b/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationTextAttribute.cs new file mode 100644 index 0000000..6aaa162 --- /dev/null +++ b/src/FPF/UIAutomationTypes/System.Windows.Automation.AutomationTextAttribute.cs @@ -0,0 +1,6 @@ +namespace System.Windows.Automation +{ + public class AutomationTextAttribute : System.Windows.Automation.AutomationIdentifier + { + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationTypes/System.Windows.Automation.SelectionItemPatternIdentifiers.cs b/src/FPF/UIAutomationTypes/System.Windows.Automation.SelectionItemPatternIdentifiers.cs new file mode 100644 index 0000000..b12dd05 --- /dev/null +++ b/src/FPF/UIAutomationTypes/System.Windows.Automation.SelectionItemPatternIdentifiers.cs @@ -0,0 +1,7 @@ +namespace System.Windows.Automation +{ + public abstract class SelectionItemPatternIdentifiers : System.Object + { public static System.Windows.Automation.AutomationProperty IsSelectedProperty; + + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationTypes/System.Windows.Automation.SupportedTextSelection.cs b/src/FPF/UIAutomationTypes/System.Windows.Automation.SupportedTextSelection.cs new file mode 100644 index 0000000..d2c7bd7 --- /dev/null +++ b/src/FPF/UIAutomationTypes/System.Windows.Automation.SupportedTextSelection.cs @@ -0,0 +1,9 @@ +namespace System.Windows.Automation +{ + public enum SupportedTextSelection + { None, + Single, + Multiple, + + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationTypes/System.Windows.Automation.Text.TextPatternRangeEndpoint.cs b/src/FPF/UIAutomationTypes/System.Windows.Automation.Text.TextPatternRangeEndpoint.cs new file mode 100644 index 0000000..81745f2 --- /dev/null +++ b/src/FPF/UIAutomationTypes/System.Windows.Automation.Text.TextPatternRangeEndpoint.cs @@ -0,0 +1,8 @@ +namespace System.Windows.Automation.Text +{ + public enum TextPatternRangeEndpoint + { Start, + End, + + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationTypes/System.Windows.Automation.Text.TextUnit.cs b/src/FPF/UIAutomationTypes/System.Windows.Automation.Text.TextUnit.cs new file mode 100644 index 0000000..b3ac854 --- /dev/null +++ b/src/FPF/UIAutomationTypes/System.Windows.Automation.Text.TextUnit.cs @@ -0,0 +1,13 @@ +namespace System.Windows.Automation.Text +{ + public enum TextUnit + { Character, + Format, + Word, + Line, + Paragraph, + Page, + Document, + + } +}
\ No newline at end of file diff --git a/src/FPF/UIAutomationTypes/UIAutomationTypes.csproj b/src/FPF/UIAutomationTypes/UIAutomationTypes.csproj new file mode 100644 index 0000000..e6e8e6b --- /dev/null +++ b/src/FPF/UIAutomationTypes/UIAutomationTypes.csproj @@ -0,0 +1,5 @@ +<Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <TargetFramework>$(TargetFramework)</TargetFramework> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/src/FPF/WindowsBase/Assembly/AssemblyInfo.cs b/src/FPF/WindowsBase/Assembly/AssemblyInfo.cs new file mode 100644 index 0000000..0e831d2 --- /dev/null +++ b/src/FPF/WindowsBase/Assembly/AssemblyInfo.cs @@ -0,0 +1,81 @@ +// +// AssemblyInfo.cs +// +// Author: +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) 2003 Ximian, Inc. http://www.ximian.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; +using System.Reflection; +using System.Resources; +using System.Security; +using System.Security.Permissions; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows.Markup; + +[assembly: AssemblyCompany (Consts.MonoCompany)] +[assembly: AssemblyProduct (Consts.MonoProduct)] +[assembly: AssemblyCopyright (Consts.MonoCopyright)] +[assembly: AssemblyVersion (Consts.FxVersion)] +[assembly: AssemblyFileVersion (Consts.FxFileVersion)] + +[assembly: NeutralResourcesLanguage ("en")] +[assembly: CLSCompliant (true)] +[assembly: AssemblyDelaySign (true)] + +[assembly: ComVisible (false)] +[assembly: AllowPartiallyTrustedCallers] + +[assembly: SecurityCritical] + +[assembly: XmlnsPrefixAttribute ("http://schemas.microsoft.com/xps/2005/06", "metro")] +[assembly: XmlnsPrefixAttribute ("http://schemas.microsoft.com/netfx/2007/xaml/presentation", "wpf")] +[assembly: XmlnsPrefixAttribute ("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "av")] + +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/xps/2005/06", "System.Windows.Media")] +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/xps/2005/06", "System.Windows.Input")] +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/xps/2005/06", "System.Windows")] + +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/winfx/2006/xaml", "System.Windows.Markup")] + +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Media")] +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows.Input")] +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Windows")] +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "System.Diagnostics")] + +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/winfx/2006/xaml/composite-font", "System.Windows.Media")] + +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/netfx/2007/xaml/presentation", "System.Windows.Media")] +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/netfx/2007/xaml/presentation", "System.Windows.Input")] +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/netfx/2007/xaml/presentation", "System.Windows")] +[assembly: XmlnsDefinitionAttribute ("http://schemas.microsoft.com/netfx/2007/xaml/presentation", "System.Diagnostics")] + +#if !MOBILE +[assembly: TypeForwardedTo (typeof (ValueSerializerAttribute))] +#endif + diff --git a/src/FPF/WindowsBase/Consts.cs b/src/FPF/WindowsBase/Consts.cs new file mode 100644 index 0000000..c901887 --- /dev/null +++ b/src/FPF/WindowsBase/Consts.cs @@ -0,0 +1,125 @@ +// +// Consts.cs.in +// +// Author: +// Kornél Pál <http://www.kornelpal.hu/> +// +// Copyright (C) 2005-2006 Kornél Pál +// + +// +// 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. +// + +static class Consts +{ + // + // Use these assembly version constants to make code more maintainable. + // + + public const string MonoVersion = "@MONO_VERSION@"; + public const string MonoCompany = "Mono development team"; + public const string MonoProduct = "Mono Common Language Infrastructure"; + public const string MonoCopyright = "(c) Various Mono authors"; + public const int MonoCorlibVersion = 0; + +#if MOBILE + // Versions of .NET Framework for Silverlight 4.0 + public const string FxVersion = "2.0.5.0"; + public const string VsVersion = "9.0.0.0"; // unused, but needed for compilation + public const string FxFileVersion = "4.0.50524.0"; + public const string EnvironmentVersion = FxFileVersion; + + public const string VsFileVersion = "9.0.50727.42"; // unused, but needed for compilation +#elif NET_4_6 + public const string FxVersion = "4.0.0.0"; + public const string FxFileVersion = "4.6.57.0"; + public const string EnvironmentVersion = "4.0.30319.42000"; + + public const string VsVersion = "0.0.0.0"; // Useless ? + public const string VsFileVersion = "11.0.0.0"; // TODO: +#elif NET_4_5 + public const string FxVersion = "4.0.0.0"; + public const string FxFileVersion = "4.0.30319.17020"; + public const string EnvironmentVersion = FxFileVersion; + + public const string VsVersion = "0.0.0.0"; // Useless ? + public const string VsFileVersion = "11.0.0.0"; // TODO: +#elif NET_4_0 + #error Profile NET_4_0 is not supported. +#elif NET_3_5 + #error Profile NET_3_5 is not supported. +#elif NET_3_0 + #error Profile NET_3_0 is not supported. +#elif NET_2_0 + #error Profile NET_2_0 is not supported. +#elif NET_1_1 + #error Profile NET_1_1 is not supported. +#elif NET_1_0 + #error Profile NET_1_0 is not supported. +#else +#error No profile symbols defined. +#endif + +#if MOBILE + const string PublicKeyToken = "7cec85d7bea7798e"; +#else + const string PublicKeyToken = "b77a5c561934e089"; +#endif + + // + // Use these assembly name constants to make code more maintainable. + // + + public const string AssemblyI18N = "I18N, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=0738eb9f132ed756"; + public const string AssemblyMicrosoft_JScript = "Microsoft.JScript, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblyMicrosoft_VisualStudio = "Microsoft.VisualStudio, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblyMicrosoft_VisualStudio_Web = "Microsoft.VisualStudio.Web, Version=" + VsVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblyMicrosoft_VSDesigner = "Microsoft.VSDesigner, Version=" + VsVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblyMono_Http = "Mono.Http, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=0738eb9f132ed756"; + public const string AssemblyMono_Posix = "Mono.Posix, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=0738eb9f132ed756"; + public const string AssemblyMono_Security = "Mono.Security, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=0738eb9f132ed756"; + public const string AssemblyMono_Messaging_RabbitMQ = "Mono.Messaging.RabbitMQ, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=0738eb9f132ed756"; + public const string AssemblyCorlib = "mscorlib, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=" + PublicKeyToken; + public const string AssemblySystem = "System, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b77a5c561934e089"; + public const string AssemblySystem_Data = "System.Data, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b77a5c561934e089"; + public const string AssemblySystem_Design = "System.Design, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblySystem_DirectoryServices = "System.DirectoryServices, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblySystem_Drawing = "System.Drawing, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblySystem_Drawing_Design = "System.Drawing.Design, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblySystem_Messaging = "System.Messaging, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblySystem_Security = "System.Security, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblySystem_ServiceProcess = "System.ServiceProcess, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblySystem_Web = "System.Web, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; + public const string AssemblySystem_Windows_Forms = "System.Windows.Forms, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b77a5c561934e089"; +#if NET_4_0 + public const string AssemblySystem_2_0 = "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; + public const string AssemblySystemCore_3_5 = "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; + public const string AssemblySystem_Core = "System.Core, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b77a5c561934e089"; + public const string WindowsBase_3_0 = "WindowsBase, Version=3.0.0.0, PublicKeyToken=31bf3856ad364e35"; + public const string AssemblyWindowsBase = "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; + public const string AssemblyPresentationCore_3_5 = "PresentationCore, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; + public const string AssemblyPresentationCore_4_0 = "PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; + public const string AssemblyPresentationFramework_3_5 = "PresentationFramework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; + public const string AssemblySystemServiceModel_3_0 = "System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; +#elif MOBILE + public const string AssemblySystem_Core = "System.Core, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b77a5c561934e089"; +#endif +} diff --git a/src/FPF/WindowsBase/MonoTODOAttribute.cs b/src/FPF/WindowsBase/MonoTODOAttribute.cs new file mode 100644 index 0000000..33bf695 --- /dev/null +++ b/src/FPF/WindowsBase/MonoTODOAttribute.cs @@ -0,0 +1,101 @@ +// +// MonoTODOAttribute.cs +// +// Authors: +// Ravi Pratap (ravi@ximian.com) +// Eyal Alaluf <eyala@mainsoft.com> +// +// (C) Ximian, Inc. http://www.ximian.com +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// Copyright (C) 2006 Mainsoft, Inc (http://www.mainsoft.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 { +#pragma warning disable 436 + [AttributeUsage (AttributeTargets.All, AllowMultiple=true)] + internal class MonoTODOAttribute : Attribute { + + string comment; + + public MonoTODOAttribute () + { + } + + public MonoTODOAttribute (string comment) + { + this.comment = comment; + } + + public string Comment { + get { return comment; } + } + } + + [AttributeUsage (AttributeTargets.All, AllowMultiple=true)] + internal class MonoDocumentationNoteAttribute : MonoTODOAttribute { + + public MonoDocumentationNoteAttribute (string comment) + : base (comment) + { + } + } + + [AttributeUsage (AttributeTargets.All, AllowMultiple=true)] + internal class MonoExtensionAttribute : MonoTODOAttribute { + + public MonoExtensionAttribute (string comment) + : base (comment) + { + } + } + + [AttributeUsage (AttributeTargets.All, AllowMultiple=true)] + internal class MonoInternalNoteAttribute : MonoTODOAttribute { + + public MonoInternalNoteAttribute (string comment) + : base (comment) + { + } + } + + [AttributeUsage (AttributeTargets.All, AllowMultiple=true)] + internal class MonoLimitationAttribute : MonoTODOAttribute { + + public MonoLimitationAttribute (string comment) + : base (comment) + { + } + } + + [AttributeUsage (AttributeTargets.All, AllowMultiple=true)] + internal class MonoNotSupportedAttribute : MonoTODOAttribute { + + public MonoNotSupportedAttribute (string comment) + : base (comment) + { + } + } +#pragma warning restore 436 +} diff --git a/src/FPF/WindowsBase/System.Collections.Specialized/CollectionChangedEventManager.cs b/src/FPF/WindowsBase/System.Collections.Specialized/CollectionChangedEventManager.cs new file mode 100644 index 0000000..5cdf2f8 --- /dev/null +++ b/src/FPF/WindowsBase/System.Collections.Specialized/CollectionChangedEventManager.cs @@ -0,0 +1,80 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.Windows; + +namespace System.Collections.Specialized { + + public class CollectionChangedEventManager : WeakEventManager + { + internal CollectionChangedEventManager () + { + } + + public static void AddListener (INotifyCollectionChanged source, IWeakEventListener listener) + { + CurrentManager.ProtectedAddListener (source, listener); + } + + public static void RemoveListener (INotifyCollectionChanged source, IWeakEventListener listener) + { + CurrentManager.ProtectedAddListener (source, listener); + } + + protected override void StartListening (object source) + { + INotifyCollectionChanged inotify = (INotifyCollectionChanged) source; + inotify.CollectionChanged += OnCollectionChanged; + } + + protected override void StopListening (object source) + { + INotifyCollectionChanged inotify = (INotifyCollectionChanged) source; + inotify.CollectionChanged -= OnCollectionChanged; + } + + private void OnCollectionChanged (object sender, NotifyCollectionChangedEventArgs e) + { + DeliverEvent (sender, e); + } + + private static object CurrentManagerLock = new object (); + + private static CollectionChangedEventManager CurrentManager { + get { + lock (CurrentManagerLock) { + CollectionChangedEventManager manager = (CollectionChangedEventManager)GetCurrentManager (typeof (CollectionChangedEventManager)); + if (manager == null) { + manager = new CollectionChangedEventManager (); + SetCurrentManager (typeof (CollectionChangedEventManager), manager); + } + return manager; + } + } + } + } +} + diff --git a/src/FPF/WindowsBase/System.Collections.Specialized/INotifyCollectionChanged.cs b/src/FPF/WindowsBase/System.Collections.Specialized/INotifyCollectionChanged.cs new file mode 100644 index 0000000..a6a2e57 --- /dev/null +++ b/src/FPF/WindowsBase/System.Collections.Specialized/INotifyCollectionChanged.cs @@ -0,0 +1,30 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + + +using System.Collections.Specialized; +using System.Runtime.CompilerServices; +[assembly:TypeForwardedTo (typeof (INotifyCollectionChanged))] + diff --git a/src/FPF/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedAction.cs b/src/FPF/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedAction.cs new file mode 100644 index 0000000..f9a24bb --- /dev/null +++ b/src/FPF/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedAction.cs @@ -0,0 +1,30 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + + +using System.Collections.Specialized; +using System.Runtime.CompilerServices; +[assembly:TypeForwardedTo (typeof (NotifyCollectionChangedAction))] + diff --git a/src/FPF/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventArgs.cs b/src/FPF/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventArgs.cs new file mode 100644 index 0000000..993f547 --- /dev/null +++ b/src/FPF/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventArgs.cs @@ -0,0 +1,31 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// Brian O'Keefe (zer0keefie@gmail.com) +// + + +using System.Collections.Specialized; +using System.Runtime.CompilerServices; +[assembly:TypeForwardedTo (typeof (NotifyCollectionChangedEventArgs))] + diff --git a/src/FPF/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventHandler.cs b/src/FPF/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventHandler.cs new file mode 100644 index 0000000..8fa9fb0 --- /dev/null +++ b/src/FPF/WindowsBase/System.Collections.Specialized/NotifyCollectionChangedEventHandler.cs @@ -0,0 +1,30 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + + +using System.Collections.Specialized; +using System.Runtime.CompilerServices; +[assembly:TypeForwardedTo (typeof (NotifyCollectionChangedEventHandler))] + diff --git a/src/FPF/WindowsBase/System.IO/FileFormatException.cs b/src/FPF/WindowsBase/System.IO/FileFormatException.cs new file mode 100644 index 0000000..38ae5d5 --- /dev/null +++ b/src/FPF/WindowsBase/System.IO/FileFormatException.cs @@ -0,0 +1,95 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// Miguel de Icaza (miguel@ximian.com) +// + +using System; +using System.Runtime.Serialization; +using System.Security; + +namespace System.IO { + + [Serializable] + public class FileFormatException : FormatException, ISerializable + { + Uri source_uri; + + public FileFormatException () : base () + { + } + + public FileFormatException (string message) : base (message) + { + } + + public FileFormatException (Uri sourceUri) + { + this.source_uri = sourceUri; + } + + protected FileFormatException (SerializationInfo info, StreamingContext context) + : base (info, context) + { + if (info == null) + throw new ArgumentNullException ("info"); + + source_uri = (Uri) info.GetValue ("sourceUri", typeof (Uri)); + } + + public FileFormatException (string message, Exception innerException) + : base (message, innerException) + { + } + + public FileFormatException (Uri sourceUri, Exception innerException) + : base ("", innerException) + { + source_uri = sourceUri; + } + + public FileFormatException (Uri sourceUri, string message) + : base (message) + { + source_uri = sourceUri; + } + + public FileFormatException (Uri sourceUri, string message, Exception innerException) + : base (message, innerException) + { + source_uri = sourceUri; + } + + public Uri SourceUri { + get { return source_uri; } + } + + [SecurityCritical] + public override void GetObjectData (SerializationInfo info, StreamingContext context) + { + base.GetObjectData (info, context); + info.AddValue ("sourceUri", source_uri); + } + } +} + diff --git a/src/FPF/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs b/src/FPF/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs new file mode 100644 index 0000000..acaa7b2 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs @@ -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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System.Globalization; +using System.Windows.Markup; + +namespace System.Windows.Converters { + + public class Int32RectValueSerializer : ValueSerializer + { + public override bool CanConvertFromString (string value, IValueSerializerContext context) + { + return true; + } + + public override bool CanConvertToString (object value, IValueSerializerContext context) + { + return value is Int32Rect; + } + + public override object ConvertFromString (string value, IValueSerializerContext context) + { + if (value == null) + throw new NotSupportedException ("value != null"); + return Int32Rect.Parse (value); + } + + public override string ConvertToString (object value, IValueSerializerContext context) + { + if (value is Int32Rect int32Rect) + return int32Rect.ToString (CultureInfo.InvariantCulture); + return base.ConvertToString (value, context); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows.Converters/PointValueSerializer.cs b/src/FPF/WindowsBase/System.Windows.Converters/PointValueSerializer.cs new file mode 100644 index 0000000..150c2e8 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Converters/PointValueSerializer.cs @@ -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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System.Globalization; +using System.Windows.Markup; + +namespace System.Windows.Converters { + + public class PointValueSerializer : ValueSerializer + { + public override bool CanConvertFromString (string value, IValueSerializerContext context) + { + return true; + } + + public override bool CanConvertToString (object value, IValueSerializerContext context) + { + return value is Point; + } + + public override object ConvertFromString (string value, IValueSerializerContext context) + { + if (value == null) + throw new NotSupportedException ("value != null"); + return Point.Parse (value); + } + + public override string ConvertToString (object value, IValueSerializerContext context) + { + if (value is Point point) + return point.ToString (CultureInfo.InvariantCulture); + return base.ConvertToString (value, context); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows.Converters/RectValueSerializer.cs b/src/FPF/WindowsBase/System.Windows.Converters/RectValueSerializer.cs new file mode 100644 index 0000000..623c0d6 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Converters/RectValueSerializer.cs @@ -0,0 +1,58 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// +using System.Globalization; +using System.Windows.Markup; + +namespace System.Windows.Converters { + + public class RectValueSerializer : ValueSerializer + { + public override bool CanConvertFromString (string value, IValueSerializerContext context) + { + return true; + } + + public override bool CanConvertToString (object value, IValueSerializerContext context) + { + return value is Rect; + } + + public override object ConvertFromString (string value, IValueSerializerContext context) + { + if (value == null) + throw new NotSupportedException ("value != null"); + return Rect.Parse (value); + } + + public override string ConvertToString (object value, IValueSerializerContext context) + { + if (value is Rect rect) + return rect.ToString (CultureInfo.InvariantCulture); + return base.ConvertToString (value, context); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs b/src/FPF/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs new file mode 100644 index 0000000..2765b73 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs @@ -0,0 +1,61 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.Diagnostics; +using System.Globalization; +using System.Windows.Markup; + +namespace System.Windows.Converters { + + public class SizeValueSerializer : ValueSerializer + { + public override bool CanConvertFromString (string value, IValueSerializerContext context) + { + return true; + } + + public override bool CanConvertToString (object value, IValueSerializerContext context) + { + return value is Size; + } + + public override object ConvertFromString (string value, IValueSerializerContext context) + { + if (value == null) + throw new NotSupportedException ("value != null"); + return Size.Parse (value); + } + + public override string ConvertToString (object value, IValueSerializerContext context) + { + if (value is Size size) + return size.ToString (CultureInfo.InvariantCulture); + return base.ConvertToString (value, context); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs b/src/FPF/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs new file mode 100644 index 0000000..6ec7ae6 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs @@ -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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System.Globalization; +using System.Windows.Markup; + +namespace System.Windows.Converters { + + public class VectorValueSerializer : ValueSerializer + { + public override bool CanConvertFromString (string value, IValueSerializerContext context) + { + return true; + } + + public override bool CanConvertToString (object value, IValueSerializerContext context) + { + return value is Vector; + } + + public override object ConvertFromString (string value, IValueSerializerContext context) + { + if (value == null) + throw new NotSupportedException ("value != null"); + return Vector.Parse (value); + } + + public override string ConvertToString (object value, IValueSerializerContext context) + { + if (value is Vector vector) + return vector.ToString (CultureInfo.InvariantCulture); + return base.ConvertToString (value, context); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows.Data/DataSourceProvider.cs b/src/FPF/WindowsBase/System.Windows.Data/DataSourceProvider.cs new file mode 100644 index 0000000..2f0c66e --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Data/DataSourceProvider.cs @@ -0,0 +1,126 @@ +// 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.ComponentModel; +using System.Windows.Threading; + +namespace System.Windows.Data { + + public abstract class DataSourceProvider : INotifyPropertyChanged, ISupportInitialize + { + protected DataSourceProvider () + { + throw new NotImplementedException (); + } + + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public object Data { + get { throw new NotImplementedException (); } + } + + protected Dispatcher Dispatcher { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + public Exception Error { + get { throw new NotImplementedException (); } + } + + [DefaultValue (true)] + public bool IsInitialLoadEnabled { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + protected bool IsRefreshDeferred { + get { throw new NotImplementedException (); } + } + + public event EventHandler DataChanged; + + protected virtual event PropertyChangedEventHandler PropertyChanged; + + event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged { + add { PropertyChanged += value; } + remove { PropertyChanged -= value; } + } + + protected virtual void BeginInit () + { + throw new NotImplementedException (); + } + void ISupportInitialize.BeginInit () + { + BeginInit (); + } + + protected virtual void EndInit () + { + throw new NotImplementedException (); + } + void ISupportInitialize.EndInit () + { + EndInit (); + } + + protected virtual void BeginQuery () + { + throw new NotImplementedException (); + } + + public virtual IDisposable DeferRefresh () + { + throw new NotImplementedException (); + } + + public void InitialLoad () + { + throw new NotImplementedException (); + } + + protected virtual void OnPropertyChanged (PropertyChangedEventArgs e) + { + throw new NotImplementedException (); + } + + protected void OnQueryFinished (object newData) + { + throw new NotImplementedException (); + } + + protected virtual void OnQueryFinished (object newData, Exception error, DispatcherOperationCallback completionWork, object callbackArguments) + { + throw new NotImplementedException (); + } + + public void Refresh () + { + throw new NotImplementedException (); + } + } +} + diff --git a/src/FPF/WindowsBase/System.Windows.Input/FocusNavigationDirection.cs b/src/FPF/WindowsBase/System.Windows.Input/FocusNavigationDirection.cs new file mode 100644 index 0000000..45e22bf --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Input/FocusNavigationDirection.cs @@ -0,0 +1,41 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@novell.com) +// + +using System; + +namespace System.Windows.Input { + + public enum FocusNavigationDirection + { + Next, + Previous, + First, + Last, + Left, + Right, + Up, + Down + } +} diff --git a/src/FPF/WindowsBase/System.Windows.Input/Key.cs b/src/FPF/WindowsBase/System.Windows.Input/Key.cs new file mode 100644 index 0000000..40f1a93 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Input/Key.cs @@ -0,0 +1,239 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.ComponentModel; +using System.Windows.Markup; + +namespace System.Windows.Input { + + [ValueSerializer (typeof (KeyValueSerializer))] + [TypeConverter (typeof (KeyConverter))] + public enum Key + { + None, + Cancel, + Back, + Tab, + LineFeed, + Clear, + Return, + Enter = Return, + Pause, + CapsLock, + Capital = CapsLock, + HangulMode, + KanaMode = HangulMode, + JunjaMode, + FinalMode, + KanjiMode, + HanjaMode = KanjiMode, + Escape, + ImeConvert, + ImeNonConvert, + ImeAccept, + ImeModeChange, + Space, + PageUp, + Prior = PageUp, + PageDown, + Next = PageDown, + End, + Home, + Left, + Up, + Right, + Down, + Select, + Print, + Execute, + PrintScreen, + Snapshot = PrintScreen, + Insert, + Delete, + Help, + D0, + D1, + D2, + D3, + D4, + D5, + D6, + D7, + D8, + D9, + A, + B, + C, + D, + E, + F, + G, + H, + I, + J, + K, + L, + M, + N, + O, + P, + Q, + R, + S, + T, + U, + V, + W, + X, + Y, + Z, + LWin, + RWin, + Apps, + Sleep, + NumPad0, + NumPad1, + NumPad2, + NumPad3, + NumPad4, + NumPad5, + NumPad6, + NumPad7, + NumPad8, + NumPad9, + Multiply, + Add, + Separator, + Subtract, + Decimal, + Divide, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + F11, + F12, + F13, + F14, + F15, + F16, + F17, + F18, + F19, + F20, + F21, + F22, + F23, + F24, + NumLock, + Scroll, + LeftShift, + RightShift, + LeftCtrl, + RightCtrl, + LeftAlt, + RightAlt, + BrowserBack, + BrowserForward, + BrowserRefresh, + BrowserStop, + BrowserSearch, + BrowserFavorites, + BrowserHome, + VolumeMute, + VolumeDown, + VolumeUp, + MediaNextTrack, + MediaPreviousTrack, + MediaStop, + MediaPlayPause, + LaunchMail, + SelectMedia, + LaunchApplication1, + LaunchApplication2, + Oem1, + OemSemicolon = Oem1, + OemPlus, + OemComma, + OemMinus, + OemPeriod, + Oem2, + OemQuestion = Oem2, + Oem3, + OemTilde = Oem3, + AbntC1, + AbntC2, + Oem4, + OemOpenBrackets = Oem4, + Oem5, + OemPipe = Oem5, + Oem6, + OemCloseBrackets = Oem6, + Oem7, + OemQuotes = Oem7, + Oem8, + Oem102, + OemBackslash = Oem102, + ImeProcessed, + System, + OemAttn, + DbeAlphanumeric = OemAttn, + OemFinish, + DbeKatakana = OemFinish, + OemCopy, + DbeHiragana = OemCopy, + OemAuto, + DbeSbcsChar = OemAuto, + OemEnlw, + DbeDbcsChar = OemEnlw, + OemBackTab, + DbeRoman = OemBackTab, + Attn, + DbeNoRoman = Attn, + CrSel, + DbeEnterWordRegisterMode = CrSel, + ExSel, + DbeEnterImeConfigureMode = ExSel, + EraseEof, + DbeFlushString = EraseEof, + Play, + DbeCodeInput = Play, + Zoom, + DbeNoCodeInput = Zoom, + NoName, + DbeDetermineString = NoName, + Pa1, + DbeEnterDialogConversionMode = Pa1, + OemClear, + DeadCharProcessed + } +} diff --git a/src/FPF/WindowsBase/System.Windows.Input/KeyConverter.cs b/src/FPF/WindowsBase/System.Windows.Input/KeyConverter.cs new file mode 100644 index 0000000..4855371 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Input/KeyConverter.cs @@ -0,0 +1,56 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.ComponentModel; +using System.Globalization; + +namespace System.Windows.Input { + + public class KeyConverter : TypeConverter + { + public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + throw new NotImplementedException (); + } + + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + throw new NotImplementedException (); + } + + public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object source) + { + throw new NotImplementedException (); + } + + public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + throw new NotImplementedException (); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows.Input/KeyInterop.cs b/src/FPF/WindowsBase/System.Windows.Input/KeyInterop.cs new file mode 100644 index 0000000..b69e13d --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Input/KeyInterop.cs @@ -0,0 +1,43 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; + +namespace System.Windows.Input { + + public static class KeyInterop + { + public static Key KeyFromVirtualKey (int virtualKey) + { + throw new NotImplementedException (); + } + + public static int VirtualKeyFromKey (Key key) + { + throw new NotImplementedException (); + } + } + +} diff --git a/src/FPF/WindowsBase/System.Windows.Input/KeyValueSerializer.cs b/src/FPF/WindowsBase/System.Windows.Input/KeyValueSerializer.cs new file mode 100644 index 0000000..d7b3d07 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Input/KeyValueSerializer.cs @@ -0,0 +1,55 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.Windows.Markup; + +namespace System.Windows.Input { + + public class KeyValueSerializer : ValueSerializer + { + public override bool CanConvertFromString (string value, IValueSerializerContext context) + { + throw new NotImplementedException (); + } + + public override bool CanConvertToString (object value, IValueSerializerContext context) + { + throw new NotImplementedException (); + } + + public override object ConvertFromString (string value, IValueSerializerContext context) + { + throw new NotImplementedException (); + } + + public override string ConvertToString (object value, IValueSerializerContext context) + { + throw new NotImplementedException (); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows.Input/ModifierKeys.cs b/src/FPF/WindowsBase/System.Windows.Input/ModifierKeys.cs new file mode 100644 index 0000000..cd78943 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Input/ModifierKeys.cs @@ -0,0 +1,43 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.ComponentModel; +using System.Windows.Markup; + +namespace System.Windows.Input { + + [Flags] + [ValueSerializer (typeof (ModifierKeysValueSerializer))] + [TypeConverter (typeof (ModifierKeysConverter))] + public enum ModifierKeys { + None = 0, + Alt = 1, + Control = 2, + Shift = 4, + Windows = 8 + } +} + diff --git a/src/FPF/WindowsBase/System.Windows.Input/ModifierKeysConverter.cs b/src/FPF/WindowsBase/System.Windows.Input/ModifierKeysConverter.cs new file mode 100644 index 0000000..3752b9d --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Input/ModifierKeysConverter.cs @@ -0,0 +1,61 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.ComponentModel; +using System.Globalization; + +namespace System.Windows.Input { + + public class ModifierKeysConverter : TypeConverter + { + public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + throw new NotImplementedException (); + } + + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + throw new NotImplementedException (); + } + + public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object source) + { + throw new NotImplementedException (); + } + + public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + throw new NotImplementedException (); + } + + public static bool IsDefinedModifierKeys (ModifierKeys modifierKeys) + { + throw new NotImplementedException (); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows.Input/ModifierKeysValueSerializer.cs b/src/FPF/WindowsBase/System.Windows.Input/ModifierKeysValueSerializer.cs new file mode 100644 index 0000000..11310ad --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Input/ModifierKeysValueSerializer.cs @@ -0,0 +1,55 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.Windows.Markup; + +namespace System.Windows.Input { + + public class ModifierKeysValueSerializer : ValueSerializer + { + public override bool CanConvertFromString (string value, IValueSerializerContext context) + { + throw new NotImplementedException (); + } + + public override bool CanConvertToString (object value, IValueSerializerContext context) + { + throw new NotImplementedException (); + } + + public override object ConvertFromString (string value, IValueSerializerContext context) + { + throw new NotImplementedException (); + } + + public override string ConvertToString (object value, IValueSerializerContext context) + { + throw new NotImplementedException (); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows.Input/TraversalRequest.cs b/src/FPF/WindowsBase/System.Windows.Input/TraversalRequest.cs new file mode 100644 index 0000000..a132971 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Input/TraversalRequest.cs @@ -0,0 +1,49 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@novell.com) +// + +using System; + +namespace System.Windows.Input { + + public class TraversalRequest + { + bool wrapped; + FocusNavigationDirection focusNavigationDirection; + + public TraversalRequest (FocusNavigationDirection focusNavigationDirection) + { + this.focusNavigationDirection = focusNavigationDirection; + } + + public FocusNavigationDirection FocusNavigationDirection { + get { return focusNavigationDirection; } + } + + public bool Wrapped { + get { return wrapped; } + set { wrapped = value; } + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows.Interop/ComponentDispatcher.cs b/src/FPF/WindowsBase/System.Windows.Interop/ComponentDispatcher.cs new file mode 100644 index 0000000..0665b4d --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Interop/ComponentDispatcher.cs @@ -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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.Security; + +namespace System.Windows.Interop { + + public static class ComponentDispatcher + { + public static MSG CurrentKeyboardMessage { + [SecurityCritical] + get { throw new NotImplementedException (); } + } + + public static bool IsThreadModal { + [SecurityCritical] + get { throw new NotImplementedException (); } + } + + public static event EventHandler EnterThreadModal; + public static event EventHandler LeaveThreadModal; + public static event ThreadMessageEventHandler ThreadFilterMessage; + public static event EventHandler ThreadIdle; + public static event ThreadMessageEventHandler ThreadPreprocessMessage; + + [SecurityCritical] + public static void PopModal() + { + throw new NotImplementedException (); + } + + [SecurityCritical] + public static void PushModal() + { + throw new NotImplementedException (); + } + + [SecurityCritical] + public static void RaiseIdle() + { + throw new NotImplementedException (); + } + + [SecurityCritical] + public static bool RaiseThreadMessage (ref MSG msg) + { + throw new NotImplementedException (); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows.Interop/IKeyboardInputSink.cs b/src/FPF/WindowsBase/System.Windows.Interop/IKeyboardInputSink.cs new file mode 100644 index 0000000..fa8f4fe --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Interop/IKeyboardInputSink.cs @@ -0,0 +1,55 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.Security; +using System.Windows.Input; + +namespace System.Windows.Interop { + + public interface IKeyboardInputSink + { + IKeyboardInputSite KeyboardInputSite { + get; + [SecurityCritical] + set; + } + + bool TabInto (TraversalRequest request); + bool HasFocusWithin (); + + [SecurityCritical] + bool OnMnemonic (ref MSG msg, ModifierKeys modifiers); + + [SecurityCritical] + IKeyboardInputSite RegisterKeyboardInputSink (IKeyboardInputSink sink); + + [SecurityCritical] + bool TranslateAccelerator (ref MSG msg, ModifierKeys modifiers); + + [SecurityCritical] + bool TranslateChar (ref MSG msg, ModifierKeys modifiers); + } +} diff --git a/src/FPF/WindowsBase/System.Windows.Interop/IKeyboardInputSite.cs b/src/FPF/WindowsBase/System.Windows.Interop/IKeyboardInputSite.cs new file mode 100644 index 0000000..8ffa1e0 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Interop/IKeyboardInputSite.cs @@ -0,0 +1,42 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.Security; +using System.Windows.Input; + +namespace System.Windows.Interop { + + public interface IKeyboardInputSite + { + IKeyboardInputSink Sink { get; } + + bool OnNoMoreTabStops (TraversalRequest request); + + [SecurityCritical] + void Unregister (); + } + +} diff --git a/src/FPF/WindowsBase/System.Windows.Interop/MSG.cs b/src/FPF/WindowsBase/System.Windows.Interop/MSG.cs new file mode 100644 index 0000000..abcbd52 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Interop/MSG.cs @@ -0,0 +1,84 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.Security; + +namespace System.Windows.Interop { + + [Serializable] + public struct MSG + { + public IntPtr hwnd { + [SecurityCritical] + get { throw new NotImplementedException (); } + [SecurityCritical] + set { throw new NotImplementedException (); } + } + + public IntPtr lParam { + [SecurityCritical] + get { throw new NotImplementedException (); } + [SecurityCritical] + set { throw new NotImplementedException (); } + } + + + public IntPtr wParam { + [SecurityCritical] + get { throw new NotImplementedException (); } + [SecurityCritical] + set { throw new NotImplementedException (); } + } + public int message { + [SecurityCritical] + get { throw new NotImplementedException (); } + [SecurityCritical] + set { throw new NotImplementedException (); } + } + + public int pt_x { + [SecurityCritical] + get { throw new NotImplementedException (); } + [SecurityCritical] + set { throw new NotImplementedException (); } + } + + public int pt_y { + [SecurityCritical] + get { throw new NotImplementedException (); } + [SecurityCritical] + set { throw new NotImplementedException (); } + } + + public int time { + [SecurityCritical] + get { throw new NotImplementedException (); } + [SecurityCritical] + set { throw new NotImplementedException (); } + } + } +} + diff --git a/src/FPF/WindowsBase/System.Windows.Interop/ThreadMessageEventHandler.cs b/src/FPF/WindowsBase/System.Windows.Interop/ThreadMessageEventHandler.cs new file mode 100644 index 0000000..638c8e3 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Interop/ThreadMessageEventHandler.cs @@ -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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; + +namespace System.Windows.Interop { + + public delegate void ThreadMessageEventHandler (ref MSG msg, ref bool handled); + +} diff --git a/src/FPF/WindowsBase/System.Windows.Media.Converters/MatrixValueSerializer.cs b/src/FPF/WindowsBase/System.Windows.Media.Converters/MatrixValueSerializer.cs new file mode 100644 index 0000000..5a7b951 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Media.Converters/MatrixValueSerializer.cs @@ -0,0 +1,60 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.Globalization; +using System.Windows.Markup; + +namespace System.Windows.Media.Converters { + + public class MatrixValueSerializer : ValueSerializer + { + public override bool CanConvertFromString (string value, IValueSerializerContext context) + { + return true; + } + + public override bool CanConvertToString (object value, IValueSerializerContext context) + { + return value is Matrix; + } + + public override object ConvertFromString (string value, IValueSerializerContext context) + { + if (value == null) + throw new NotSupportedException ("value != null"); + return Matrix.Parse (value); + } + + public override string ConvertToString (object value, IValueSerializerContext context) + { + if (value is Matrix matrix) + return matrix.ToString (CultureInfo.InvariantCulture); + return base.ConvertToString (value, context); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows.Media/DisableDpiAwarenessAttribute.cs b/src/FPF/WindowsBase/System.Windows.Media/DisableDpiAwarenessAttribute.cs new file mode 100644 index 0000000..00c2be5 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Media/DisableDpiAwarenessAttribute.cs @@ -0,0 +1,35 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; + +namespace System.Windows.Media { + + [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = false)] + public sealed class DisableDpiAwarenessAttribute : Attribute + { + } +} + diff --git a/src/FPF/WindowsBase/System.Windows.Media/Matrix.cs b/src/FPF/WindowsBase/System.Windows.Media/Matrix.cs new file mode 100644 index 0000000..49e0548 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Media/Matrix.cs @@ -0,0 +1,456 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.ComponentModel; +using System.Globalization; +using System.Windows.Markup; +using System.Windows.Media.Converters; +using System.Windows.Threading; + +namespace System.Windows.Media { + + [Serializable] + [TypeConverter (typeof(MatrixConverter))] + [ValueSerializer (typeof (MatrixValueSerializer))] + public struct Matrix : IFormattable { + + double _m11; + double _m12; + double _m21; + double _m22; + double _offsetX; + double _offsetY; + + public Matrix (double m11, + double m12, + double m21, + double m22, + double offsetX, + double offsetY) + { + this._m11 = m11; + this._m12 = m12; + this._m21 = m21; + this._m22 = m22; + this._offsetX = offsetX; + this._offsetY = offsetY; + } + + public void Append (Matrix matrix) + { + double _m11; + double _m21; + double _m12; + double _m22; + double _offsetX; + double _offsetY; + + _m11 = this._m11 * matrix.M11 + this._m12 * matrix.M21; + _m12 = this._m11 * matrix.M12 + this._m12 * matrix.M22; + _m21 = this._m21 * matrix.M11 + this._m22 * matrix.M21; + _m22 = this._m21 * matrix.M12 + this._m22 * matrix.M22; + + _offsetX = this._offsetX * matrix.M11 + this._offsetY * matrix.M21 + matrix.OffsetX; + _offsetY = this._offsetX * matrix.M12 + this._offsetY * matrix.M22 + matrix.OffsetY; + + this._m11 = _m11; + this._m12 = _m12; + this._m21 = _m21; + this._m22 = _m22; + this._offsetX = _offsetX; + this._offsetY = _offsetY; + } + + public bool Equals (Matrix value) + { + return (_m11 == value.M11 && + _m12 == value.M12 && + _m21 == value.M21 && + _m22 == value.M22 && + _offsetX == value.OffsetX && + _offsetY == value.OffsetY); + } + + public override bool Equals (object o) + { + if (!(o is Matrix)) + return false; + + return Equals ((Matrix)o); + } + + public static bool Equals (Matrix matrix1, + Matrix matrix2) + { + return matrix1.Equals (matrix2); + } + + public override int GetHashCode () + { + unchecked + { + var hashCode = _m11.GetHashCode (); + hashCode = (hashCode * 397) ^ _m12.GetHashCode (); + hashCode = (hashCode * 397) ^ _m21.GetHashCode (); + hashCode = (hashCode * 397) ^ _m22.GetHashCode (); + hashCode = (hashCode * 397) ^ _offsetX.GetHashCode (); + hashCode = (hashCode * 397) ^ _offsetY.GetHashCode (); + return hashCode; + } + } + + public void Invert () + { + if (!HasInverse) + throw new InvalidOperationException ("Transform is not invertible."); + + double d = Determinant; + + /* 1/(ad-bc)[d -b; -c a] */ + + double _m11 = this._m22; + double _m12 = -this._m12; + double _m21 = -this._m21; + double _m22 = this._m11; + + double _offsetX = this._m21 * this._offsetY - this._m22 * this._offsetX; + double _offsetY = this._m12 * this._offsetX - this._m11 * this._offsetY; + + this._m11 = _m11 / d; + this._m12 = _m12 / d; + this._m21 = _m21 / d; + this._m22 = _m22 / d; + this._offsetX = _offsetX / d; + this._offsetY = _offsetY / d; + } + + public static Matrix Multiply (Matrix trans1, + Matrix trans2) + { + Matrix m = trans1; + m.Append (trans2); + return m; + } + + public static bool operator == (Matrix matrix1, + Matrix matrix2) + { + return matrix1.Equals (matrix2); + } + + public static bool operator != (Matrix matrix1, + Matrix matrix2) + { + return !matrix1.Equals (matrix2); + } + + public static Matrix operator * (Matrix trans1, + Matrix trans2) + { + Matrix result = trans1; + result.Append (trans2); + return result; + } + + public static Matrix Parse (string source) + { + if (source == null) + throw new ArgumentNullException ("source"); + Matrix value; + if (source.Trim () == "Identity") + { + value = Identity; + } + else + { + var tokenizer = new NumericListTokenizer (source, CultureInfo.InvariantCulture); + double m11; + double m12; + double m21; + double m22; + double offsetX; + double offsetY; + if (double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out m11) + && double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out m12) + && double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out m21) + && double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out m22) + && double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out offsetX) + && double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out offsetY)) + { + if (!tokenizer.HasNoMoreTokens ()) + { + throw new InvalidOperationException ("Invalid Matrix format: " + source); + } + value = new Matrix (m11, m12, m21, m22, offsetX, offsetY); + } + else + { + throw new FormatException (string.Format ("Invalid Matrix format: {0}", source)); + } + } + return value; + } + + public void Prepend (Matrix matrix) + { + double _m11; + double _m21; + double _m12; + double _m22; + double _offsetX; + double _offsetY; + + _m11 = matrix.M11 * this._m11 + matrix.M12 * this._m21; + _m12 = matrix.M11 * this._m12 + matrix.M12 * this._m22; + _m21 = matrix.M21 * this._m11 + matrix.M22 * this._m21; + _m22 = matrix.M21 * this._m12 + matrix.M22 * this._m22; + + _offsetX = matrix.OffsetX * this._m11 + matrix.OffsetY * this._m21 + this._offsetX; + _offsetY = matrix.OffsetX * this._m12 + matrix.OffsetY * this._m22 + this._offsetY; + + this._m11 = _m11; + this._m12 = _m12; + this._m21 = _m21; + this._m22 = _m22; + this._offsetX = _offsetX; + this._offsetY = _offsetY; + } + + public void Rotate (double angle) + { + // R_theta==[costheta -sintheta; sintheta costheta], + double theta = angle * Math.PI / 180; + + Matrix r_theta = new Matrix (Math.Cos (theta), Math.Sin(theta), + -Math.Sin (theta), Math.Cos(theta), + 0, 0); + + Append (r_theta); + } + + public void RotateAt (double angle, + double centerX, + double centerY) + { + Translate (-centerX, -centerY); + Rotate (angle); + Translate (centerX, centerY); + } + + public void RotateAtPrepend (double angle, + double centerX, + double centerY) + { + Matrix m = Matrix.Identity; + m.RotateAt (angle, centerX, centerY); + Prepend (m); + } + + public void RotatePrepend (double angle) + { + Matrix m = Matrix.Identity; + m.Rotate (angle); + Prepend (m); + } + + public void Scale (double scaleX, + double scaleY) + { + Matrix scale = new Matrix (scaleX, 0, + 0, scaleY, + 0, 0); + + Append (scale); + } + + public void ScaleAt (double scaleX, + double scaleY, + double centerX, + double centerY) + { + Translate (-centerX, -centerY); + Scale (scaleX, scaleY); + Translate (centerX, centerY); + } + + public void ScaleAtPrepend (double scaleX, + double scaleY, + double centerX, + double centerY) + { + Matrix m = Matrix.Identity; + m.ScaleAt (scaleX, scaleY, centerX, centerY); + Prepend (m); + } + + public void ScalePrepend (double scaleX, + double scaleY) + { + Matrix m = Matrix.Identity; + m.Scale (scaleX, scaleY); + Prepend (m); + } + + public void SetIdentity () + { + _m11 = _m22 = 1.0; + _m12 = _m21 = 0.0; + _offsetX = _offsetY = 0.0; + } + + public void Skew (double skewX, + double skewY) + { + Matrix skew_m = new Matrix (1, Math.Tan (skewY * Math.PI / 180), + Math.Tan (skewX * Math.PI / 180), 1, + 0, 0); + Append (skew_m); + } + + public void SkewPrepend (double skewX, + double skewY) + { + Matrix m = Matrix.Identity; + m.Skew (skewX, skewY); + Prepend (m); + } + + public override string ToString () + { + return ToString (null); + } + + public string ToString (IFormatProvider provider) + { + return ToString (null, provider); + } + + string IFormattable.ToString (string format, + IFormatProvider provider) + { + return ToString (provider); + } + + private string ToString (string format, IFormatProvider provider) + { + if (IsIdentity) + return "Identity"; + + if (provider == null) + provider = CultureInfo.CurrentCulture; + + if (format == null) + format = string.Empty; + + var separator = NumericListTokenizer.GetSeparator (provider); + + var matrixFormat = string.Format ( + "{{0:{0}}}{1}{{1:{0}}}{1}{{2:{0}}}{1}{{3:{0}}}{1}{{4:{0}}}{1}{{5:{0}}}", + format, separator); + return string.Format (provider, matrixFormat, + _m11, _m12, _m21, _m22, _offsetX, _offsetY); + } + + public Point Transform (Point point) + { + return Point.Multiply (point, this); + } + + public void Transform (Point[] points) + { + for (int i = 0; i < points.Length; i ++) + points[i] = Transform (points[i]); + } + + public Vector Transform (Vector vector) + { + return Vector.Multiply (vector, this); + } + + public void Transform (Vector[] vectors) + { + for (int i = 0; i < vectors.Length; i ++) + vectors[i] = Transform (vectors[i]); + } + + public void Translate (double offsetX, + double offsetY) + { + this._offsetX += offsetX; + this._offsetY += offsetY; + } + + public void TranslatePrepend (double offsetX, + double offsetY) + { + Matrix m = Matrix.Identity; + m.Translate (offsetX, offsetY); + Prepend (m); + } + + public double Determinant { + get { return _m11 * _m22 - _m12 * _m21; } + } + + public bool HasInverse { + get { return Determinant != 0; } + } + + public static Matrix Identity { + get { return new Matrix (1.0, 0.0, 0.0, 1.0, 0.0, 0.0); } + } + + public bool IsIdentity { + get { return Equals (Matrix.Identity); } + } + + public double M11 { + get { return _m11; } + set { _m11 = value; } + } + public double M12 { + get { return _m12; } + set { _m12 = value; } + } + public double M21 { + get { return _m21; } + set { _m21 = value; } + } + public double M22 { + get { return _m22; } + set { _m22 = value; } + } + public double OffsetX { + get { return _offsetX; } + set { _offsetX = value; } + } + public double OffsetY { + get { return _offsetY; } + set { _offsetY = value; } + } + } + +} diff --git a/src/FPF/WindowsBase/System.Windows.Media/MatrixConverter.cs b/src/FPF/WindowsBase/System.Windows.Media/MatrixConverter.cs new file mode 100644 index 0000000..596d211 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Media/MatrixConverter.cs @@ -0,0 +1,58 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.ComponentModel; +using System.Globalization; + +namespace System.Windows.Media { + + public sealed class MatrixConverter : TypeConverter + { + public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof (string); + } + + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + return destinationType == typeof (string); + } + + public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) + { + if (!(value is string)) + throw new NotSupportedException ("MatrixConverter only supports converting from strings"); + return Matrix.Parse ((string)value); + } + + public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + return ((Matrix)value).ToString (culture); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows.Threading/Dispatcher.cs b/src/FPF/WindowsBase/System.Windows.Threading/Dispatcher.cs new file mode 100644 index 0000000..56a796c --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Threading/Dispatcher.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace System.Windows.Threading +{ + public sealed class Dispatcher + { + public Thread Thread { get; } + + internal DispatcherSynchronizationContext DefaultSynchronizationContext { get; } + + public event DispatcherUnhandledExceptionEventHandler UnhandledException; + + internal void OnUnhandledException(Exception exception) + { + var unhandledException = UnhandledException; + if (unhandledException != null) + { + var args = new DispatcherUnhandledExceptionEventArgs(this, exception); + + unhandledException(this, args); + + if (args.Handled) + return; + } + + throw new Exception( + $"Unhandled exception in dispatcher thread {Thread.ManagedThreadId} '{Thread.Name}'", + exception); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool CheckAccess() + => Thread.CurrentThread == Thread; + + [EditorBrowsable(EditorBrowsableState.Never)] + public void VerifyAccess() + { + if (Thread.CurrentThread != Thread) + throw new InvalidOperationException("Invoked from a different thread"); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + static void ValidateArguments(Delegate method, DispatcherPriority priority) + { + if (method == null) + throw new ArgumentNullException(nameof(method)); + + if (priority < 0 || priority > DispatcherPriority.Send) + throw new InvalidEnumArgumentException(nameof(priority)); + + if (priority == DispatcherPriority.Inactive) + throw new ArgumentException("priority must not be inactive", nameof(priority)); + } + + public DispatcherOperation BeginInvoke (DispatcherPriority priority, Delegate method, object arg) + => BeginInvoke (method, priority, arg); + + public DispatcherOperation BeginInvoke(Delegate method, params object[] args) + => BeginInvoke(method, DispatcherPriority.Normal, args); + + public DispatcherOperation BeginInvoke(Delegate method, DispatcherPriority priority, params object[] args) + { + ValidateArguments(method, priority); + return new DispatcherOperation( + this, + method, + priority, + args, + CancellationToken.None, + null).BeginInvoke(); + } + + public DispatcherOperation InvokeAsync(Action callback) + => InvokeAsync(callback, DispatcherPriority.Normal, null, default); + + public DispatcherOperation InvokeAsync(Action callback, DispatcherPriority priority) + => InvokeAsync(callback, priority, null, default); + + public DispatcherOperation InvokeAsync(Action callback, DispatcherPriority priority, CancellationToken cancellationToken) + => InvokeAsync(callback, priority, null, cancellationToken); + + DispatcherOperation InvokeAsync(Delegate method, DispatcherPriority priority, object[] args, CancellationToken cancellationToken) + { + ValidateArguments(method, priority); + return new DispatcherOperation( + this, + method, + priority, + args, + cancellationToken, + new DispatcherOperationTaskSource()).InvokeAsync(); + } + + public void Invoke(Action callback) + => Invoke(callback, DispatcherPriority.Send, CancellationToken.None, Timeout.InfiniteTimeSpan); + + public void Invoke(Action callback, DispatcherPriority priority) + => Invoke(callback, priority, CancellationToken.None, Timeout.InfiniteTimeSpan); + + void Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken) + => Invoke(callback, priority, cancellationToken, Timeout.InfiniteTimeSpan); + + void Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout) + { + ValidateArguments(callback, priority); + new DispatcherOperation( + this, + callback, + priority, + null, + cancellationToken, + null).Invoke(timeout); + } + + #region Adapted directly from WPF Dispatcher + + Dispatcher() + { + tlsDispatcher = this; // use TLS for ownership only + Thread = Thread.CurrentThread; + + lock (globalLock) + dispatchers.Add(new WeakReference(this)); + + DefaultSynchronizationContext = new DispatcherSynchronizationContext(this); + } + + [ThreadStatic] + static Dispatcher tlsDispatcher; // use TLS for ownership only + + static readonly object globalLock = new object(); + static readonly List<WeakReference> dispatchers = new List<WeakReference>(); + static WeakReference possibleDispatcher = new WeakReference(null); + + public static Dispatcher CurrentDispatcher + => FromThread(Thread.CurrentThread) ?? new Dispatcher(); + + public static Dispatcher FromThread(Thread thread) + { + if (thread == null) + return null; + + lock (globalLock) + { + Dispatcher dispatcher = null; + + dispatcher = possibleDispatcher.Target as Dispatcher; + if (dispatcher == null || dispatcher.Thread != thread) + { + dispatcher = null; + + for (int i = 0; i < dispatchers.Count; i++) + { + if (dispatchers[i].Target is Dispatcher dispatcherForThread) + { + if (dispatcherForThread.Thread == thread) + dispatcher = dispatcherForThread; + } + else + { + dispatchers.RemoveAt(i); + i--; + } + } + + if (dispatcher != null) + { + if (possibleDispatcher.IsAlive) + possibleDispatcher.Target = dispatcher; + else + possibleDispatcher = new WeakReference(dispatcher); + } + } + + return dispatcher; + } + } + + #endregion + } +}
\ No newline at end of file diff --git a/src/FPF/WindowsBase/System.Windows.Threading/DispatcherEventArgs.cs b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherEventArgs.cs new file mode 100644 index 0000000..02347c5 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherEventArgs.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace System.Windows.Threading +{ + public class DispatcherEventArgs : EventArgs + { + public Dispatcher Dispatcher { get; } + + internal DispatcherEventArgs(Dispatcher dispatcher) + => Dispatcher = dispatcher; + } +}
\ No newline at end of file diff --git a/src/FPF/WindowsBase/System.Windows.Threading/DispatcherObject.cs b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherObject.cs new file mode 100644 index 0000000..3782345 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherObject.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.ComponentModel; + +namespace System.Windows.Threading +{ + public abstract class DispatcherObject + { + [EditorBrowsable(EditorBrowsableState.Never)] + public Dispatcher Dispatcher { get; } + + protected DispatcherObject () + => Dispatcher = Dispatcher.CurrentDispatcher; + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool CheckAccess() + => Dispatcher.CheckAccess(); + + [EditorBrowsable(EditorBrowsableState.Never)] + public void VerifyAccess() + => Dispatcher.VerifyAccess(); + } +}
\ No newline at end of file diff --git a/src/FPF/WindowsBase/System.Windows.Threading/DispatcherOperation.cs b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherOperation.cs new file mode 100644 index 0000000..96a3915 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherOperation.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; + +using CoreFoundation; + +namespace System.Windows.Threading +{ + public enum DispatcherOperationStatus + { + Pending, + Aborted, + Completed, + Executing + } + + public delegate object DispatcherOperationCallback(object arg); + + public sealed class DispatcherOperation + { + readonly Delegate method; + readonly object[] args; + readonly CancellationToken cancellationToken; + readonly DispatcherOperationTaskSource taskSource; + + public Dispatcher Dispatcher { get; } + public DispatcherPriority Priority { get; } + + Exception exception; + public object Result { get; private set; } + public DispatcherOperationStatus Status { get; private set; } + + public event EventHandler Aborted; + public event EventHandler Completed; + + internal DispatcherOperation( + Dispatcher dispatcher, + Delegate method, + DispatcherPriority priority, + object[] args, + CancellationToken cancellationToken, + DispatcherOperationTaskSource taskSource) + { + Dispatcher = dispatcher; + this.method = method; + Priority = priority; + this.args = args; + this.cancellationToken = cancellationToken; + this.taskSource = taskSource; + Status = DispatcherOperationStatus.Pending; + } + + internal DispatcherOperation BeginInvoke() + { + DispatchQueue.MainQueue.DispatchAsync(() => + { + CoreInvoke(beginInvokeBehavior: true); + if (exception != null) + Dispatcher.OnUnhandledException(exception); + }); + + return this; + } + + internal DispatcherOperation InvokeAsync() + { + if (taskSource == null) + throw new InvalidOperationException(); + + DispatchQueue.MainQueue.DispatchAsync(() => + { + try + { + CoreInvoke(beginInvokeBehavior: false); + } + catch (OperationCanceledException) + { + taskSource.SetCanceled(); + return; + } + + if (cancellationToken.IsCancellationRequested) + taskSource.SetCanceled(); + else if (exception != null) + taskSource.SetException(exception); + else + taskSource.SetResult(); + }); + + return this; + } + + internal void Invoke(TimeSpan timeout) + { + if (timeout != Timeout.InfiniteTimeSpan) + throw new NotSupportedException("timeouts are not supported"); + + DispatchQueue.MainQueue.DispatchSync( + () => CoreInvoke(beginInvokeBehavior: false)); + + if (exception != null) + throw exception; + } + + void CoreInvoke(bool beginInvokeBehavior) + { + Status = DispatcherOperationStatus.Executing; + + var oldSynchronizationContext = SynchronizationContext.Current; + + try + { + SynchronizationContext.SetSynchronizationContext(Dispatcher.DefaultSynchronizationContext); + + try + { + if (method is Action action) + action(); + else + Result = method.DynamicInvoke(args); + } + catch (Exception e) + { + exception = e; + } + + if (beginInvokeBehavior) + { + if (exception is OperationCanceledException) + { + Status = DispatcherOperationStatus.Aborted; + exception = null; + Aborted?.Invoke(this, EventArgs.Empty); + } + else + { + Status = DispatcherOperationStatus.Completed; + Completed?.Invoke(this, EventArgs.Empty); + } + } + } + finally + { + SynchronizationContext.SetSynchronizationContext(oldSynchronizationContext); + } + } + + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Never)] + public TaskAwaiter GetAwaiter() + { + if (taskSource == null) + throw new InvalidOperationException(); + + return taskSource.GetTask().GetAwaiter(); + } + + public Task Task + { + get + { + if (taskSource == null) + throw new InvalidOperationException(); + + return taskSource.GetTask(); + } + } + } +}
\ No newline at end of file diff --git a/src/FPF/WindowsBase/System.Windows.Threading/DispatcherOperationTaskSource.cs b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherOperationTaskSource.cs new file mode 100644 index 0000000..627be8d --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherOperationTaskSource.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading.Tasks; + +namespace System.Windows.Threading +{ + sealed class DispatcherOperationTaskSource + { + readonly TaskCompletionSource<bool> taskCompletionSource = new TaskCompletionSource<bool>(); + + public Task GetTask() + => taskCompletionSource.Task; + + public void SetCanceled() + => taskCompletionSource.SetCanceled(); + + public void SetResult() + => taskCompletionSource.SetResult(true); + + public void SetException(Exception exception) + => taskCompletionSource.SetException(exception); + } +}
\ No newline at end of file diff --git a/src/FPF/WindowsBase/System.Windows.Threading/DispatcherPriority.cs b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherPriority.cs new file mode 100644 index 0000000..d15c798 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherPriority.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace System.Windows.Threading +{ + public enum DispatcherPriority + { + Invalid = -1, + Inactive = 0, + SystemIdle = 1, + ApplicationIdle = 2, + ContextIdle = 3, + Background = 4, + Input = 5, + Loaded = 6, + Render = 7, + DataBind = 8, + Normal = 9, + Send = 10, + } +}
\ No newline at end of file diff --git a/src/FPF/WindowsBase/System.Windows.Threading/DispatcherSynchronizationContext.cs b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherSynchronizationContext.cs new file mode 100644 index 0000000..687c786 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherSynchronizationContext.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading; + +namespace System.Windows.Threading +{ + public sealed class DispatcherSynchronizationContext : SynchronizationContext + { + readonly Dispatcher dispatcher; + readonly DispatcherPriority priority; + + public DispatcherSynchronizationContext(Dispatcher dispatcher, DispatcherPriority priority) + { + this.dispatcher = dispatcher + ?? throw new ArgumentNullException(nameof(dispatcher)); + this.priority = priority; + } + + public DispatcherSynchronizationContext(Dispatcher dispatcher) : this(dispatcher, DispatcherPriority.Normal) + { + } + + public DispatcherSynchronizationContext() : this(Dispatcher.CurrentDispatcher) + { + } + + public override SynchronizationContext CreateCopy() + => new DispatcherSynchronizationContext(dispatcher, priority); + + public override void Post(SendOrPostCallback d, object state) + => dispatcher.BeginInvoke(d, priority, state); + + public override void Send(SendOrPostCallback d, object state) + => dispatcher.Invoke(() => d(state), priority); + } +}
\ No newline at end of file diff --git a/src/FPF/WindowsBase/System.Windows.Threading/DispatcherTimer.cs b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherTimer.cs new file mode 100644 index 0000000..bef8f76 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherTimer.cs @@ -0,0 +1,141 @@ +// 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) 2006 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Miguel de Icaza (miguel@novell.com) +// +using System; +using System.Collections; +using System.Threading; + +namespace System.Windows.Threading { + public class DispatcherTimer { + DispatcherPriority priority; + Dispatcher target_dispatcher; + long interval; + EventHandler callback; + Timer timer; + object tag; + + public DispatcherTimer () + : this (DispatcherPriority.Background, Dispatcher.CurrentDispatcher) + { + } + + public DispatcherTimer (DispatcherPriority priority) + : this (priority, Dispatcher.CurrentDispatcher) + { + } + + public DispatcherTimer (DispatcherPriority priority, Dispatcher dispatcher) + : this (TimeSpan.Zero, priority, null, dispatcher) + { + } + + public DispatcherTimer (TimeSpan interval, DispatcherPriority priority, + EventHandler callback, Dispatcher dispatcher) + { + this.priority = priority; + this.target_dispatcher = dispatcher; + this.interval = interval.Ticks; + this.callback = callback; + } + + public void Start () + { + if (timer == null){ + long repeat_interval = interval; + if (repeat_interval == 0) + repeat_interval = 1; + timer = new Timer (new TimerCallback (timer_tick), + null, new TimeSpan (interval), + new TimeSpan (repeat_interval)); + } + } + + void timer_tick (object state) + { + target_dispatcher.BeginInvoke ((ThreadStart) delegate { + EventHandler h = Tick; + if (h != null) + h (this, EventArgs.Empty); + if (callback != null) + callback (this, EventArgs.Empty); + }, priority); + } + + public void Stop () + { + if (timer == null) + return; + + timer.Dispose (); + timer = null; + } + + public Dispatcher Dispatcher { + get { + return target_dispatcher; + } + } + + public TimeSpan Interval { + get { + return new TimeSpan (interval); + } + + set { + if (interval == value.Ticks) + return; + + interval = value.Ticks; + + if (timer != null) + timer.Change (new TimeSpan (interval), + new TimeSpan (interval)); + } + } + + public bool IsEnabled { + get { + return timer != null; + } + + set { + if (value && timer == null) + Start (); + if (value == false && timer != null) + Stop (); + } + } + + public object Tag { + get { + return tag; + } + + set { + tag = value; + } + } + public event EventHandler Tick; + } +} diff --git a/src/FPF/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionEventArgs.cs b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionEventArgs.cs new file mode 100644 index 0000000..43f0f2a --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherUnhandledExceptionEventArgs.cs @@ -0,0 +1,16 @@ +namespace System.Windows.Threading +{ + public delegate void DispatcherUnhandledExceptionEventHandler( + object sender, + DispatcherUnhandledExceptionEventArgs e); + + public sealed class DispatcherUnhandledExceptionEventArgs : DispatcherEventArgs + { + public Exception Exception { get; } + public bool Handled { get; set; } + + internal DispatcherUnhandledExceptionEventArgs(Dispatcher dispatcher, Exception exception) + : base(dispatcher) + => Exception = exception; + } +}
\ No newline at end of file diff --git a/src/FPF/WindowsBase/System.Windows/AttachedPropertyBrowsableAttribute.cs b/src/FPF/WindowsBase/System.Windows/AttachedPropertyBrowsableAttribute.cs new file mode 100644 index 0000000..e78ac8c --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/AttachedPropertyBrowsableAttribute.cs @@ -0,0 +1,36 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; + +namespace System.Windows { + + public abstract class AttachedPropertyBrowsableAttribute : Attribute + { + protected AttachedPropertyBrowsableAttribute () + { + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/AttachedPropertyBrowsableForTypeAttribute.cs b/src/FPF/WindowsBase/System.Windows/AttachedPropertyBrowsableForTypeAttribute.cs new file mode 100644 index 0000000..d1f77f6 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/AttachedPropertyBrowsableForTypeAttribute.cs @@ -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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; + +namespace System.Windows { + + [AttributeUsage (AttributeTargets.Method, AllowMultiple = true)] + public sealed class AttachedPropertyBrowsableForTypeAttribute : AttachedPropertyBrowsableAttribute + { + Type targetType; + + public AttachedPropertyBrowsableForTypeAttribute (Type targetType) + { + this.targetType = targetType; + } + + public Type TargetType { + get { return targetType; } + } + + public override object TypeId { + get { throw new NotImplementedException (); } + } + + public override bool Equals (object obj) + { + throw new NotImplementedException (); + } + + public override int GetHashCode () + { + throw new NotImplementedException (); + } + } + +} diff --git a/src/FPF/WindowsBase/System.Windows/AttachedPropertyBrowsableWhenAttributePresentAttribute.cs b/src/FPF/WindowsBase/System.Windows/AttachedPropertyBrowsableWhenAttributePresentAttribute.cs new file mode 100644 index 0000000..6796520 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/AttachedPropertyBrowsableWhenAttributePresentAttribute.cs @@ -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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; + +namespace System.Windows { + + [AttributeUsage (AttributeTargets.Method, AllowMultiple = false)] + public sealed class AttachedPropertyBrowsableWhenAttributePresentAttribute : AttachedPropertyBrowsableAttribute + { + Type attributeType; + + public AttachedPropertyBrowsableWhenAttributePresentAttribute (Type attributeType) + { + this.attributeType = attributeType; + } + + public Type AttributeType { + get { return attributeType; } + } + + public override bool Equals (object obj) + { + throw new NotImplementedException (); + } + + public override int GetHashCode () + { + throw new NotImplementedException (); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/CoerceValueCallback.cs b/src/FPF/WindowsBase/System.Windows/CoerceValueCallback.cs new file mode 100644 index 0000000..33eee8c --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/CoerceValueCallback.cs @@ -0,0 +1,29 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +namespace System.Windows { + + public delegate object CoerceValueCallback (DependencyObject d, object baseValue); +} diff --git a/src/FPF/WindowsBase/System.Windows/DependencyObject.cs b/src/FPF/WindowsBase/System.Windows/DependencyObject.cs new file mode 100644 index 0000000..8eb923a --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/DependencyObject.cs @@ -0,0 +1,145 @@ +// +// DependencyObject.cs +// +// Author: +// Iain McCoy (iain@mccoy.id.au) +// Chris Toshok (toshok@ximian.com) +// +// (C) 2005 Iain McCoy +// (C) 2007 Novell, Inc. +// +// 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.Generic; +using System.Windows.Threading; + +namespace System.Windows { + public class DependencyObject : DispatcherObject { + private static Dictionary<Type,Dictionary<string,DependencyProperty>> propertyDeclarations = new Dictionary<Type,Dictionary<string,DependencyProperty>>(); + private Dictionary<DependencyProperty,object> properties = new Dictionary<DependencyProperty,object>(); + + [MonoTODO] + public bool IsSealed { + get { return false; } + } + + public DependencyObjectType DependencyObjectType { + get { return DependencyObjectType.FromSystemType (GetType()); } + } + + public void ClearValue(DependencyProperty dp) + { + if (IsSealed) + throw new InvalidOperationException ("Cannot manipulate property values on a sealed DependencyObject"); + + properties[dp] = null; + } + + public void ClearValue(DependencyPropertyKey key) + { + ClearValue (key.DependencyProperty); + } + + public void CoerceValue (DependencyProperty dp) + { + PropertyMetadata pm = dp.GetMetadata (this); + if (pm.CoerceValueCallback != null) + pm.CoerceValueCallback (this, GetValue (dp)); + } + + public sealed override bool Equals (object obj) + { + return base.Equals(obj); + } + + public sealed override int GetHashCode () + { + return base.GetHashCode(); + } + + [MonoTODO] + public LocalValueEnumerator GetLocalValueEnumerator() + { + return new LocalValueEnumerator(properties); + } + + public object GetValue(DependencyProperty dp) + { + object val = properties.ContainsKey (dp) ? properties [dp] : null; + return val == null ? dp.DefaultMetadata.DefaultValue : val; + } + + [MonoTODO] + public void InvalidateProperty(DependencyProperty dp) + { + throw new NotImplementedException("InvalidateProperty(DependencyProperty dp)"); + } + + protected virtual void OnPropertyChanged(DependencyPropertyChangedEventArgs e) + { + PropertyMetadata pm = e.Property.GetMetadata (this); + if (pm.PropertyChangedCallback != null) + pm.PropertyChangedCallback (this, e); + } + + public object ReadLocalValue(DependencyProperty dp) + { + object val = properties.ContainsKey (dp) ? properties [dp] : null; + return val == null ? DependencyProperty.UnsetValue : val; + } + + public void SetValue(DependencyProperty dp, object value) + { + if (IsSealed) + throw new InvalidOperationException ("Cannot manipulate property values on a sealed DependencyObject"); + + if (!dp.IsValidType (value)) + throw new ArgumentException ("value not of the correct type for this DependencyProperty"); + + ValidateValueCallback validate = dp.ValidateValueCallback; + if (validate != null && !validate(value)) + throw new Exception("Value does not validate"); + else + properties[dp] = value; + } + + public void SetValue(DependencyPropertyKey key, object value) + { + SetValue (key.DependencyProperty, value); + } + + protected virtual bool ShouldSerializeProperty (DependencyProperty dp) + { + throw new NotImplementedException (); + } + + internal static void register(Type t, DependencyProperty dp) + { + if (!propertyDeclarations.ContainsKey (t)) + propertyDeclarations[t] = new Dictionary<string,DependencyProperty>(); + Dictionary<string,DependencyProperty> typeDeclarations = propertyDeclarations[t]; + if (!typeDeclarations.ContainsKey(dp.Name)) + typeDeclarations[dp.Name] = dp; + else + throw new ArgumentException("A property named " + dp.Name + " already exists on " + t.Name); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/DependencyObjectType.cs b/src/FPF/WindowsBase/System.Windows/DependencyObjectType.cs new file mode 100644 index 0000000..53ec8ab --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/DependencyObjectType.cs @@ -0,0 +1,89 @@ +// 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. +// +// (C) 2005 Iain McCoy +// (C) 2007 Novell, Inc. +// +// Authors: +// Iain McCoy (iain@mccoy.id.au) +// Chris Toshok (toshok@ximian.com) +// +// + +using System.Collections.Generic; + +namespace System.Windows { + public class DependencyObjectType { + + private static Dictionary<Type,DependencyObjectType> typeMap = new Dictionary<Type,DependencyObjectType>(); + private static int current_id; + + private int id; + private Type systemType; + + private DependencyObjectType (int id, Type systemType) + { + this.id = id; + this.systemType = systemType; + } + + public DependencyObjectType BaseType { + get { return DependencyObjectType.FromSystemType (systemType.BaseType); } + } + + public int Id { + get { return id; } + } + + public string Name { + get { return systemType.Name; } + } + + public Type SystemType { + get { return systemType; } + } + + public static DependencyObjectType FromSystemType(Type systemType) + { + if (typeMap.ContainsKey (systemType)) + return typeMap[systemType]; + + DependencyObjectType dot; + + typeMap[systemType] = dot = new DependencyObjectType (current_id++, systemType); + + return dot; + } + + public bool IsInstanceOfType(DependencyObject dependencyObject) + { + return systemType.IsInstanceOfType (dependencyObject); + } + + public bool IsSubclassOf(DependencyObjectType dependencyObjectType) + { + return systemType.IsSubclassOf (dependencyObjectType.SystemType); + } + + public override int GetHashCode () + { + throw new NotImplementedException (); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/DependencyProperty.cs b/src/FPF/WindowsBase/System.Windows/DependencyProperty.cs new file mode 100644 index 0000000..71a1ead --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/DependencyProperty.cs @@ -0,0 +1,229 @@ +// 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. +// +// (C) 2005 Iain McCoy +// +// Copyright (c) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Iain McCoy (iain@mccoy.id.au) +// Chris Toshok (toshok@ximian.com) +// + +using System.Collections.Generic; + +namespace System.Windows { + public sealed class DependencyProperty { + private Dictionary<Type,PropertyMetadata> metadataByType = new Dictionary<Type,PropertyMetadata>(); + + public static readonly object UnsetValue = new object (); + + private DependencyProperty (bool isAttached, string name, Type propertyType, Type ownerType, + PropertyMetadata defaultMetadata, + ValidateValueCallback validateValueCallback) + { + IsAttached = isAttached; + DefaultMetadata = (defaultMetadata == null ? new PropertyMetadata() : defaultMetadata); + Name = name; + OwnerType = ownerType; + PropertyType = propertyType; + ValidateValueCallback = validateValueCallback; + } + + internal bool IsAttached { get; set; } + public bool ReadOnly { get; private set; } + public PropertyMetadata DefaultMetadata { get; private set; } + public string Name { get; private set; } + public Type OwnerType { get; private set; } + public Type PropertyType { get; private set; } + public ValidateValueCallback ValidateValueCallback { get; private set; } + + public int GlobalIndex { + get { throw new NotImplementedException (); } + } + + + public DependencyProperty AddOwner(Type ownerType) + { + return AddOwner (ownerType, null); + } + + public DependencyProperty AddOwner(Type ownerType, PropertyMetadata typeMetadata) + { + if (typeMetadata == null) typeMetadata = new PropertyMetadata (); + OverrideMetadata (ownerType, typeMetadata); + + // MS seems to always return the same DependencyProperty + return this; + } + + public PropertyMetadata GetMetadata(Type forType) + { + if (metadataByType.ContainsKey (forType)) + return metadataByType[forType]; + return null; + } + + public PropertyMetadata GetMetadata(DependencyObject dependencyObject) + { + if (metadataByType.ContainsKey (dependencyObject.GetType())) + return metadataByType[dependencyObject.GetType()]; + return null; + } + + public PropertyMetadata GetMetadata(DependencyObjectType dependencyObjectType) + { + if (metadataByType.ContainsKey (dependencyObjectType.SystemType)) + return metadataByType[dependencyObjectType.SystemType]; + return null; + } + + + public bool IsValidType(object value) + { + return PropertyType.IsInstanceOfType (value); + } + + public bool IsValidValue(object value) + { + if (!IsValidType (value)) + return false; + if (ValidateValueCallback == null) + return true; + return ValidateValueCallback (value); + } + + public void OverrideMetadata(Type forType, PropertyMetadata typeMetadata) + { + if (forType == null) + throw new ArgumentNullException ("forType"); + if (typeMetadata == null) + throw new ArgumentNullException ("typeMetadata"); + + if (ReadOnly) + throw new InvalidOperationException (String.Format ("Cannot override metadata on readonly property '{0}' without using a DependencyPropertyKey", Name)); + + typeMetadata.DoMerge (DefaultMetadata, this, forType); + metadataByType.Add (forType, typeMetadata); + } + + public void OverrideMetadata (Type forType, PropertyMetadata typeMetadata, DependencyPropertyKey key) + { + if (forType == null) + throw new ArgumentNullException ("forType"); + if (typeMetadata == null) + throw new ArgumentNullException ("typeMetadata"); + + + // further checking? should we check + // key.DependencyProperty == this? + + typeMetadata.DoMerge (DefaultMetadata, this, forType); + metadataByType.Add (forType, typeMetadata); + } + + public override string ToString () + { + return Name; + } + + public override int GetHashCode () + { + return Name.GetHashCode() ^ PropertyType.GetHashCode() ^ OwnerType.GetHashCode(); + } + + public static DependencyProperty Register(string name, Type propertyType, Type ownerType) + { + return Register(name, propertyType, ownerType, null, null); + } + + public static DependencyProperty Register(string name, Type propertyType, Type ownerType, + PropertyMetadata typeMetadata) + { + return Register(name, propertyType, ownerType, typeMetadata, null); + } + + public static DependencyProperty Register(string name, Type propertyType, Type ownerType, + PropertyMetadata typeMetadata, + ValidateValueCallback validateValueCallback) + { + if (typeMetadata == null) + typeMetadata = new PropertyMetadata(); + + DependencyProperty dp = new DependencyProperty(false, name, propertyType, ownerType, + typeMetadata, validateValueCallback); + DependencyObject.register(ownerType, dp); + + dp.OverrideMetadata (ownerType, typeMetadata); + + return dp; + } + + public static DependencyProperty RegisterAttached(string name, Type propertyType, Type ownerType) + { + return RegisterAttached(name, propertyType, ownerType, null, null); + } + + public static DependencyProperty RegisterAttached(string name, Type propertyType, Type ownerType, + PropertyMetadata defaultMetadata) + { + return RegisterAttached(name, propertyType, ownerType, defaultMetadata, null); + } + + public static DependencyProperty RegisterAttached(string name, Type propertyType, Type ownerType, + PropertyMetadata defaultMetadata, + ValidateValueCallback validateValueCallback) + { + DependencyProperty dp = new DependencyProperty(true, name, propertyType, ownerType, + defaultMetadata, validateValueCallback); + DependencyObject.register(ownerType, dp); + return dp; + } + + public static DependencyPropertyKey RegisterAttachedReadOnly(string name, Type propertyType, Type ownerType, + PropertyMetadata defaultMetadata) + { + throw new NotImplementedException("RegisterAttachedReadOnly(string name, Type propertyType, Type ownerType, PropertyMetadata defaultMetadata)"); + } + + public static DependencyPropertyKey RegisterAttachedReadOnly(string name, Type propertyType, Type ownerType, + PropertyMetadata defaultMetadata, + ValidateValueCallback validateValueCallback) + { + throw new NotImplementedException("RegisterAttachedReadOnly(string name, Type propertyType, Type ownerType, PropertyMetadata defaultMetadata, ValidateValueCallback validateValueCallback)"); + } + + public static DependencyPropertyKey RegisterReadOnly(string name, Type propertyType, Type ownerType, + PropertyMetadata typeMetadata) + { + return RegisterReadOnly (name, propertyType, ownerType, typeMetadata, null); + } + + + public static DependencyPropertyKey RegisterReadOnly(string name, Type propertyType, Type ownerType, + PropertyMetadata typeMetadata, + ValidateValueCallback validateValueCallback) + { + DependencyProperty prop = Register (name, propertyType, ownerType, typeMetadata, validateValueCallback); + prop.ReadOnly = true; + return new DependencyPropertyKey (prop); + } + + } +} diff --git a/src/FPF/WindowsBase/System.Windows/DependencyPropertyChangedEventArgs.cs b/src/FPF/WindowsBase/System.Windows/DependencyPropertyChangedEventArgs.cs new file mode 100644 index 0000000..782e881 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/DependencyPropertyChangedEventArgs.cs @@ -0,0 +1,83 @@ +// +// DependencyPropertyChangedEventArgs.cs +// +// Author: +// Chris Toshok (toshok@ximian.com) +// +// (C) 2007 Novell, Inc. +// +// 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.Windows { + public struct DependencyPropertyChangedEventArgs { + + public DependencyPropertyChangedEventArgs (DependencyProperty property, object oldValue, object newValue) + : this () + { + this.Property = property; + this.OldValue = oldValue; + this.NewValue = newValue; + } + + public object NewValue { + get; private set; + } + + public object OldValue { + get; private set; + } + + public DependencyProperty Property { + get; private set; + } + + public override bool Equals (object obj) + { + if (!(obj is DependencyPropertyChangedEventArgs)) + return false; + + return Equals ((DependencyPropertyChangedEventArgs)obj); + } + + public bool Equals (DependencyPropertyChangedEventArgs args) + { + return (Property == args.Property && + NewValue == args.NewValue && + OldValue == args.OldValue); + } + + public static bool operator != (DependencyPropertyChangedEventArgs left, DependencyPropertyChangedEventArgs right) + { + throw new NotImplementedException (); + } + + public static bool operator == (DependencyPropertyChangedEventArgs left, DependencyPropertyChangedEventArgs right) + { + throw new NotImplementedException (); + } + + public override int GetHashCode() + { + throw new NotImplementedException (); + } + + } +} diff --git a/src/FPF/WindowsBase/System.Windows/DependencyPropertyChangedEventHandler.cs b/src/FPF/WindowsBase/System.Windows/DependencyPropertyChangedEventHandler.cs new file mode 100644 index 0000000..7673af4 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/DependencyPropertyChangedEventHandler.cs @@ -0,0 +1,31 @@ +// +// DependencyPropertyChangedEventHandler.cs +// +// Author: +// Chris Toshok (toshok@ximian.com) +// +// (C) 2007 Novell, Inc. +// +// 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.Windows { + public delegate void DependencyPropertyChangedEventHandler (object sender, DependencyPropertyChangedEventArgs e); +} diff --git a/src/FPF/WindowsBase/System.Windows/DependencyPropertyKey.cs b/src/FPF/WindowsBase/System.Windows/DependencyPropertyKey.cs new file mode 100644 index 0000000..7f530ed --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/DependencyPropertyKey.cs @@ -0,0 +1,46 @@ +// +// DependencyPropertyKey.cs +// +// Author: +// Iain McCoy (iain@mccoy.id.au) +// +// (C) 2005 Iain McCoy +// +// 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.Windows { + public sealed class DependencyPropertyKey { + internal DependencyPropertyKey (DependencyProperty dependencyProperty) + { + this.dependencyProperty = dependencyProperty; + } + + private DependencyProperty dependencyProperty; + public DependencyProperty DependencyProperty { + get { return dependencyProperty; } + } + + public void OverrideMetadata(Type forType, PropertyMetadata typeMetadata) + { + dependencyProperty.OverrideMetadata (forType, typeMetadata, this); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/Expression.cs b/src/FPF/WindowsBase/System.Windows/Expression.cs new file mode 100644 index 0000000..d3a02f0 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/Expression.cs @@ -0,0 +1,39 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.ComponentModel; + +namespace System.Windows { + + [TypeConverter (typeof (ExpressionConverter))] + public class Expression + { + internal Expression () + { + } + } + +} diff --git a/src/FPF/WindowsBase/System.Windows/ExpressionConverter.cs b/src/FPF/WindowsBase/System.Windows/ExpressionConverter.cs new file mode 100644 index 0000000..480424e --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/ExpressionConverter.cs @@ -0,0 +1,60 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +using System; +using System.ComponentModel; +using System.Globalization; + +namespace System.Windows { + + public class ExpressionConverter : TypeConverter + { + public ExpressionConverter () + { + } + + public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + throw new NotImplementedException (); + } + + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + throw new NotImplementedException (); + } + + public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) + { + throw new NotImplementedException (); + } + + public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + throw new NotImplementedException (); + } + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows/Freezable.cs b/src/FPF/WindowsBase/System.Windows/Freezable.cs new file mode 100644 index 0000000..f11dac2 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/Freezable.cs @@ -0,0 +1,147 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +namespace System.Windows { + + public abstract class Freezable : DependencyObject { + protected Freezable () { + } + + public Freezable Clone () + { + throw new NotImplementedException (); + } + + protected virtual void CloneCore (Freezable sourceFreezable) + { + throw new NotImplementedException (); + } + + public Freezable CloneCurrentValue () + { + throw new NotImplementedException (); + } + + protected virtual void CloneCurrentValueCore (Freezable sourceFreezable) + { + throw new NotImplementedException (); + } + + protected Freezable CreateInstance () + { + throw new NotImplementedException (); + } + + protected abstract Freezable CreateInstanceCore (); + + public void Freeze () + { + IsFrozen = true; + } + + protected static bool Freeze (Freezable freezable, + bool isChecking) + { + throw new NotImplementedException (); + } + + protected virtual bool FreezeCore (bool isChecking) + { + IsFrozen = true; + return true; + } + + public Freezable GetAsFrozen () + { + throw new NotImplementedException (); + } + + protected virtual void GetAsFrozenCore (Freezable sourceFreezable) + { + throw new NotImplementedException (); + } + + public Freezable GetCurrentValueAsFrozen () + { + throw new NotImplementedException (); + } + + protected virtual void GetCurrentValueAsFrozenCore (Freezable sourceFreezable) + { + throw new NotImplementedException (); + } + + protected virtual void OnChanged () + { + throw new NotImplementedException (); + } + + protected void OnFreezablePropertyChanged (DependencyObject oldValue, + DependencyObject newValue) + + { + throw new NotImplementedException (); + } + + protected void OnFreezablePropertyChanged (DependencyObject oldValue, + DependencyObject newValue, + DependencyProperty property) + { + throw new NotImplementedException (); + } + + protected override void OnPropertyChanged (DependencyPropertyChangedEventArgs e) + { + throw new NotImplementedException (); + } + + protected void ReadPreamble () + { + throw new NotImplementedException (); + } + + protected void WritePostscript () + { + throw new NotImplementedException (); + } + + protected void WritePreamble () + { + throw new NotImplementedException (); + } + + public bool CanFreeze { + get { return FreezeCore (true); } + } + + public bool IsFrozen { + get; private set; + } + + public event EventHandler Changed; + } + +} + diff --git a/src/FPF/WindowsBase/System.Windows/IWeakEventListener.cs b/src/FPF/WindowsBase/System.Windows/IWeakEventListener.cs new file mode 100644 index 0000000..95c2365 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/IWeakEventListener.cs @@ -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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok <toshok@novell.com> +// + +using System; + +namespace System.Windows { + public interface IWeakEventListener { + bool ReceiveWeakEvent (Type managerType, object sender, EventArgs e); + } +} diff --git a/src/FPF/WindowsBase/System.Windows/Int32Rect.cs b/src/FPF/WindowsBase/System.Windows/Int32Rect.cs new file mode 100644 index 0000000..815fee0 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/Int32Rect.cs @@ -0,0 +1,193 @@ +// +// DependencyPropertyChangedEventArgs.cs +// +// Author: +// Chris Toshok (toshok@ximian.com) +// +// (C) 2007 Novell, Inc. +// +// 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.Globalization; +using System.Windows.Converters; +using System.Windows.Markup; + +namespace System.Windows { + + [Serializable] + [TypeConverter (typeof(Int32RectConverter))] + [ValueSerializer (typeof(Int32RectValueSerializer))] + public struct Int32Rect : IFormattable + { + int _x, _y, _width, _height; + + public Int32Rect (int x, int y, int width, int height) + { + this._x = x; + this._y = y; + this._width = width; + this._height = height; + } + + public static bool operator != (Int32Rect int32Rect1, Int32Rect int32Rect2) + { + return !int32Rect1.Equals(int32Rect2); + } + + public static bool operator == (Int32Rect int32Rect1, Int32Rect int32Rect2) + { + return int32Rect1.Equals(int32Rect2); + } + + public static Int32Rect Empty { + get { return new Int32Rect (0, 0, 0, 0); } + } + + public int Height { + get { return _height; } + set { _height = value; } + } + + public bool IsEmpty { + get { return _width == 0 && _height == 0; } + } + + public int Width { + get { return _width; } + set { _width = value; } + } + + public int X { + get { return _x; } + set { _x = value; } + } + + public int Y { + get { return _y; } + set { _y = value; } + } + + public bool Equals (Int32Rect value) + { + return (_x == value._x && + _y == value._y && + _width == value._width && + _height == value._height); + } + + public override bool Equals (object o) + { + if (!(o is Int32Rect)) + return false; + + return Equals ((Int32Rect)o); + } + + public static bool Equals (Int32Rect int32Rect1, Int32Rect int32Rect2) + { + return int32Rect1.Equals (int32Rect2); + } + + public override int GetHashCode () + { + unchecked + { + var hashCode = _x; + hashCode = (hashCode * 397) ^ _y; + hashCode = (hashCode * 397) ^ _width; + hashCode = (hashCode * 397) ^ _height; + return hashCode; + } + } + + public static Int32Rect Parse (string source) + { + if (source == null) + throw new ArgumentNullException ("source"); + Int32Rect value; + if (source.Trim () == "Empty") + { + value = Empty; + } + else + { + var tokenizer = new NumericListTokenizer (source, CultureInfo.InvariantCulture); + int x; + int y; + int width; + int height; + if (int.TryParse (tokenizer.GetNextToken (), NumberStyles.Integer, CultureInfo.InvariantCulture, out x) + && int.TryParse (tokenizer.GetNextToken (), NumberStyles.Integer, CultureInfo.InvariantCulture, out y) + && int.TryParse (tokenizer.GetNextToken (), NumberStyles.Integer, CultureInfo.InvariantCulture, out width) + && int.TryParse (tokenizer.GetNextToken (), NumberStyles.Integer, CultureInfo.InvariantCulture, out height)) + { + if (!tokenizer.HasNoMoreTokens ()) + { + throw new InvalidOperationException ("Invalid Int32Rect format: " + source); + } + value = new Int32Rect (x, y, width, height); + } + else + { + throw new FormatException (string.Format ("Invalid Int32Rect format: {0}", source)); + } + } + return value; + } + + public override string ToString () + { + return ToString (null); + } + + public string ToString (IFormatProvider provider) + { + return ToString (null, provider); + } + + string IFormattable.ToString (string format, IFormatProvider provider) + { + return ToString (provider); + } + + private string ToString (string format, IFormatProvider provider) + { + if (IsEmpty) + return "Empty"; + + if (provider == null) + provider = CultureInfo.CurrentCulture; + + if (format == null) + format = string.Empty; + + var separator = NumericListTokenizer.GetSeparator (provider); + + var rectFormat = string.Format ( + "{{0:{0}}}{1}{{1:{0}}}{1}{{2:{0}}}{1}{{3:{0}}}", + format, separator); + return string.Format (provider, rectFormat, + _x, _y, _width, _height); + } + } +} + diff --git a/src/FPF/WindowsBase/System.Windows/Int32RectConverter.cs b/src/FPF/WindowsBase/System.Windows/Int32RectConverter.cs new file mode 100644 index 0000000..990b385 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/Int32RectConverter.cs @@ -0,0 +1,57 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok <toshok@novell.com> +// + +using System; +using System.ComponentModel; +using System.Globalization; + +namespace System.Windows { + + public sealed class Int32RectConverter : TypeConverter + { + public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof (string); + } + + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + return destinationType == typeof (string); + } + + public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) + { + if (!(value is string)) + throw new NotSupportedException ("Int32RectConvert only supports converting from strings"); + + return Int32Rect.Parse ((string)value); + } + + public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + return ((Int32Rect)value).ToString (culture); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/LocalValueEntry.cs b/src/FPF/WindowsBase/System.Windows/LocalValueEntry.cs new file mode 100644 index 0000000..8ef695a --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/LocalValueEntry.cs @@ -0,0 +1,68 @@ +// +// LocalValueEntry.cs +// +// Author: +// Iain McCoy (iain@mccoy.id.au) +// +// (C) 2005 Iain McCoy +// +// 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.Windows { + public struct LocalValueEntry { + private DependencyProperty property; + private object value; + + internal LocalValueEntry(DependencyProperty property, object value) + { + this.property = property; + this.value = value; + } + + public DependencyProperty Property { + get { return property; } + } + + public object Value { + get { return value; } + } + + public static bool operator != (LocalValueEntry obj1, LocalValueEntry obj2) + { + throw new NotImplementedException (); + } + + public static bool operator == (LocalValueEntry obj1, LocalValueEntry obj2) + { + throw new NotImplementedException (); + } + + public override bool Equals (object obj) + { + throw new NotImplementedException (); + } + + public override int GetHashCode () + { + throw new NotImplementedException (); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/LocalValueEnumerator.cs b/src/FPF/WindowsBase/System.Windows/LocalValueEnumerator.cs new file mode 100644 index 0000000..bbabfca --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/LocalValueEnumerator.cs @@ -0,0 +1,88 @@ +// +// LocalValueEnumerator.cs +// +// Author: +// Iain McCoy (iain@mccoy.id.au) +// +// (C) 2005 Iain McCoy +// +// 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.Collections.Generic; + +namespace System.Windows { + public struct LocalValueEnumerator : IEnumerator { + private IDictionaryEnumerator propertyEnumerator; + private Dictionary<DependencyProperty,object> properties; + + private int count; + + internal LocalValueEnumerator(Dictionary<DependencyProperty,object> properties) + { + this.count = properties.Count; + this.properties = properties; + this.propertyEnumerator = properties.GetEnumerator(); + } + + public int Count { + get { return count; } + } + + public LocalValueEntry Current { + get { return new LocalValueEntry((DependencyProperty)propertyEnumerator.Key, + propertyEnumerator.Value); } + } + object IEnumerator.Current { + get { return this.Current; } + } + + public bool MoveNext() + { + return propertyEnumerator.MoveNext(); + } + public void Reset() + { + propertyEnumerator.Reset(); + } + + public static bool operator != (LocalValueEnumerator obj1, LocalValueEnumerator obj2) + { + throw new NotImplementedException (); + } + + public static bool operator == (LocalValueEnumerator obj1, LocalValueEnumerator obj2) + { + throw new NotImplementedException (); + } + + public override bool Equals (object obj) + { + throw new NotImplementedException (); + } + + public override int GetHashCode () + { + throw new NotImplementedException (); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/NumericListTokenizer.cs b/src/FPF/WindowsBase/System.Windows/NumericListTokenizer.cs new file mode 100644 index 0000000..81905ec --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/NumericListTokenizer.cs @@ -0,0 +1,102 @@ +using System.Globalization; + +namespace System.Windows +{ + /// <summary> + /// Helper class for parsing serialized data structures from the System.Windows namespace. + /// </summary> + internal class NumericListTokenizer + { + private readonly string _str; + private readonly char _separator; + private int _position; + + private enum Symbol + { + Token, + Separator, + Whitspace, + EndOfLine + } + + public NumericListTokenizer (string str, IFormatProvider formatProvider) + { + _str = str ?? throw new ArgumentNullException (nameof(str)); + _separator = GetSeparator (formatProvider ?? throw new ArgumentNullException (nameof(formatProvider))); + } + + public static char GetSeparator (IFormatProvider formatProvider) + { + // By convention, string representations of target classes always use ';' as a separator + // if the decimal number separator is ','. Otherwise, the separator is ','. + return NumberFormatInfo.GetInstance (formatProvider).NumberDecimalSeparator != "," ? ',' : ';'; + } + + private Symbol GetCurrentSymbol () + { + if (_position >= _str.Length) + return Symbol.EndOfLine; + if (_str[_position] == _separator) + return Symbol.Separator; + if (char.IsWhiteSpace (_str, _position)) + return Symbol.Whitspace; + return Symbol.Token; + } + + private void SkipAllWhitespaces () + { + while (GetCurrentSymbol () == Symbol.Whitspace) + { + _position++; + } + } + + private void SkipNextDelimeter () + { + SkipAllWhitespaces (); + switch (GetCurrentSymbol ()) + { + case Symbol.Token: + return; + case Symbol.Separator: + _position++; + SkipAllWhitespaces (); + return; + default: + throw new InvalidOperationException ("Separator not found"); + } + } + + public bool HasNoMoreTokens () + { + SkipAllWhitespaces (); + return GetCurrentSymbol () == Symbol.EndOfLine; + } + + public string GetNextToken () + { + var length = 0; + if (_position == 0) + { + SkipAllWhitespaces (); + } + else + { + SkipNextDelimeter (); + } + + while (GetCurrentSymbol () == Symbol.Token) + { + _position++; + length++; + } + + if (length == 0) + { + throw new InvalidOperationException ("Next token not found"); + } + + return _str.Substring (_position - length, length); + } + } +}
\ No newline at end of file diff --git a/src/FPF/WindowsBase/System.Windows/Point.cs b/src/FPF/WindowsBase/System.Windows/Point.cs new file mode 100644 index 0000000..af57f92 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/Point.cs @@ -0,0 +1,196 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@novell.com) +// + +using System; +using System.ComponentModel; +using System.Windows.Converters; +using System.Windows.Markup; +using System.Windows.Media; +using System.Globalization; + +namespace System.Windows { + + [Serializable] + [TypeConverter (typeof (PointConverter))] + [ValueSerializer (typeof (PointValueSerializer))] + public struct Point : IFormattable + { + public Point (double x, double y) + { + this._x = x; + this._y = y; + } + + public double X { + get { return _x; } + set { _x = value; } + } + + public double Y { + get { return _y; } + set { _y = value; } + } + + public override bool Equals (object o) + { + if (!(o is Point)) + return false; + return Equals ((Point)o); + } + + public bool Equals (Point value) + { + return _x == value.X && _y == value.Y; + } + + public override int GetHashCode () + { + return (_x.GetHashCode() ^ _y.GetHashCode()); + } + + + public void Offset (double offsetX, double offsetY) + { + _x += offsetX; + _y += offsetY; + } + + public static Point Add (Point point, Vector vector) + { + return new Point (point.X + vector.X, point.Y + vector.Y); + } + + public static bool Equals (Point point1, Point point2) + { + return point1.Equals (point2); + } + + public static Point Multiply (Point point, Matrix matrix) + { + return new Point (point.X * matrix.M11 + point.Y * matrix.M21 + matrix.OffsetX, + point.X * matrix.M12 + point.Y * matrix.M22 + matrix.OffsetY); + } + + public static Vector Subtract (Point point1, Point point2) + { + return new Vector (point1.X - point2.X, point1.Y - point2.Y); + } + + public static Point Subtract (Point point, Vector vector) + { + return new Point (point.X - vector.X, point.Y - vector.Y); + } + + /* operators */ + + public static Vector operator -(Point point1, Point point2) + { + return Subtract (point1, point2); + } + + public static Point operator -(Point point, Vector vector) + { + return Subtract (point, vector); + } + + public static Point operator + (Point point, Vector vector) + { + return Add (point, vector); + } + + public static Point operator * (Point point, Matrix matrix) + { + return Multiply (point, matrix); + } + + public static bool operator != (Point point1, Point point2) + { + return !point1.Equals(point2); + } + + public static bool operator == (Point point1, Point point2) + { + return point1.Equals(point2); + } + + public static explicit operator Size (Point point) + { + return new Size (point.X, point.Y); + } + + public static explicit operator Vector (Point point) + { + return new Vector (point.X, point.Y); + } + + public static Point Parse (string source) + { + if (source == null) + throw new ArgumentNullException ("source"); + var tokenizer = new NumericListTokenizer (source, CultureInfo.InvariantCulture); + double x; + double y; + if (!double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out x) || + !double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out y)) + { + throw new FormatException (string.Format ("Invalid Point format: {0}", source)); + } + if (!tokenizer.HasNoMoreTokens ()) + { + throw new InvalidOperationException ("Invalid Point format: " + source); + } + return new Point(x, y); + } + + public override string ToString () + { + return this.ToString(null, null); + } + + public string ToString (IFormatProvider provider) + { + return this.ToString(null, provider); + } + + private string ToString(string format,IFormatProvider formatProvider) + { + if (formatProvider == null) + formatProvider = CultureInfo.CurrentCulture; + if (format == null) + format = string.Empty; + var separator = NumericListTokenizer.GetSeparator (formatProvider); + var pointFormat = string.Format ("{{0:{0}}}{1}{{1:{0}}}", format, separator); + return string.Format (formatProvider, pointFormat, _x, _y); + } + + string IFormattable.ToString (string format, IFormatProvider formatProvider) + { + return this.ToString(format, formatProvider); + } + + double _x; + double _y; + } +} diff --git a/src/FPF/WindowsBase/System.Windows/PointConverter.cs b/src/FPF/WindowsBase/System.Windows/PointConverter.cs new file mode 100644 index 0000000..eef6c52 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/PointConverter.cs @@ -0,0 +1,57 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok <toshok@novell.com> +// + +using System; +using System.ComponentModel; +using System.Globalization; + +namespace System.Windows { + + public sealed class PointConverter : TypeConverter + { + public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof (string); + } + + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + return destinationType == typeof (string); + } + + public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) + { + if (!(value is string)) + throw new NotSupportedException ("PointConverter only supports converting from strings"); + + return Point.Parse ((string)value); + } + + public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + return ((Point)value).ToString (culture); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/PropertyChangedCallback.cs b/src/FPF/WindowsBase/System.Windows/PropertyChangedCallback.cs new file mode 100644 index 0000000..dfcfee2 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/PropertyChangedCallback.cs @@ -0,0 +1,29 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +namespace System.Windows { + + public delegate void PropertyChangedCallback (DependencyObject d, DependencyPropertyChangedEventArgs e); +} diff --git a/src/FPF/WindowsBase/System.Windows/PropertyMetadata.cs b/src/FPF/WindowsBase/System.Windows/PropertyMetadata.cs new file mode 100644 index 0000000..1432b0b --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/PropertyMetadata.cs @@ -0,0 +1,121 @@ +// 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. +// +// (C) 2005 Iain McCoy +// +// Copyright (c) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Iain McCoy (iain@mccoy.id.au) +// Chris Toshok (toshok@ximian.com) +// + +namespace System.Windows { + public class PropertyMetadata { + private object defaultValue; + private bool isSealed; + private PropertyChangedCallback propertyChangedCallback; + private CoerceValueCallback coerceValueCallback; + + protected bool IsSealed { + get { return isSealed; } + } + + public object DefaultValue { + get { return defaultValue; } + set { + if (IsSealed) + throw new InvalidOperationException ("Cannot change metadata once it has been applied to a property"); + if (value == DependencyProperty.UnsetValue) + throw new ArgumentException ("Cannot set property metadata's default value to 'Unset'"); + + defaultValue = value; + } + } + + public PropertyChangedCallback PropertyChangedCallback { + get { return propertyChangedCallback; } + set { + if (IsSealed) + throw new InvalidOperationException ("Cannot change metadata once it has been applied to a property"); + propertyChangedCallback = value; + } + } + + public CoerceValueCallback CoerceValueCallback { + get { return coerceValueCallback; } + set { + if (IsSealed) + throw new InvalidOperationException ("Cannot change metadata once it has been applied to a property"); + coerceValueCallback = value; + } + } + + public PropertyMetadata() + : this (null, null, null) + { + } + + public PropertyMetadata(object defaultValue) + : this (defaultValue, null, null) + { + } + + public PropertyMetadata (PropertyChangedCallback propertyChangedCallback) + : this (null, propertyChangedCallback, null) + { + } + + public PropertyMetadata (object defaultValue, PropertyChangedCallback propertyChangedCallback) + : this (defaultValue, propertyChangedCallback, null) + { + } + + public PropertyMetadata (object defaultValue, PropertyChangedCallback propertyChangedCallback, CoerceValueCallback coerceValueCallback) + { + if (defaultValue == DependencyProperty.UnsetValue) + throw new ArgumentException ("Cannot initialize property metadata's default value to 'Unset'"); + + this.defaultValue = defaultValue; + this.propertyChangedCallback = propertyChangedCallback; + this.coerceValueCallback = coerceValueCallback; + } + + protected virtual void Merge (PropertyMetadata baseMetadata, DependencyProperty dp) + { + if (defaultValue == null) + defaultValue = baseMetadata.defaultValue; + if (propertyChangedCallback == null) + propertyChangedCallback = baseMetadata.propertyChangedCallback; + if (coerceValueCallback == null) + coerceValueCallback = baseMetadata.coerceValueCallback; + } + + protected virtual void OnApply (DependencyProperty dp, Type targetType) + { + } + + internal void DoMerge (PropertyMetadata baseMetadata, DependencyProperty dp, Type targetType) + { + Merge (baseMetadata, dp); + OnApply (dp, targetType); + isSealed = true; + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/Rect.cs b/src/FPF/WindowsBase/System.Windows/Rect.cs new file mode 100644 index 0000000..6e2e3d9 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/Rect.cs @@ -0,0 +1,501 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok <toshok@novell.com> +// Sebastien Pouliot <sebastien@ximian.com> +// + +using System.ComponentModel; +using System.Globalization; +using System.Windows.Converters; +using System.Windows.Markup; +using System.Windows.Media; + +namespace System.Windows { + + [Serializable] + [ValueSerializer (typeof (RectValueSerializer))] + [TypeConverter (typeof (RectConverter))] + public struct Rect : IFormattable + { + public Rect (Size size) + { + _x = _y = 0.0; + _width = size.Width; + _height = size.Height; + } + + public Rect (Point point, Vector vector) : this (point, Point.Add (point, vector)) + { } + + public Rect (Point point1, Point point2) + { + if (point1.X < point2.X) { + _x = point1.X; + _width = point2.X - point1.X; + } + else { + _x = point2.X; + _width = point1.X - point2.X; + } + + if (point1.Y < point2.Y) { + _y = point1.Y; + _height = point2.Y - point1.Y; + } + else { + _y = point2.Y; + _height = point1.Y - point2.Y; + } + } + + public Rect (double x, double y, double width, double height) + { + if (width < 0 || height < 0) + throw new ArgumentException ("width and height must be non-negative."); + this._x = x; + this._y = y; + this._width = width; + this._height = height; + } + + public Rect (Point location, Size size) + { + _x = location.X; + _y = location.Y; + _width = size.Width; + _height = size.Height; + } + + public bool Equals (Rect value) + { + return (_x == value.X && + _y == value.Y && + _width == value.Width && + _height == value.Height); + } + + public static bool operator != (Rect rect1, Rect rect2) + { + return !(rect1.Location == rect2.Location && rect1.Size == rect2.Size); + } + + public static bool operator == (Rect rect1, Rect rect2) + { + return rect1.Location == rect2.Location && rect1.Size == rect2.Size; + } + + public override bool Equals (object o) + { + if (!(o is Rect)) + return false; + + return Equals ((Rect)o); + } + + public static bool Equals (Rect rect1, Rect rect2) + { + return rect1.Equals (rect2); + } + + public override int GetHashCode () + { + unchecked + { + var hashCode = _x.GetHashCode (); + hashCode = (hashCode * 397) ^ _y.GetHashCode (); + hashCode = (hashCode * 397) ^ _width.GetHashCode (); + hashCode = (hashCode * 397) ^ _height.GetHashCode (); + return hashCode; + } + } + + public bool Contains (Rect rect) + { + if (rect.Left < this.Left || + rect.Right > this.Right) + return false; + + if (rect.Top < this.Top || + rect.Bottom > this.Bottom) + return false; + + return true; + } + + public bool Contains (double x, double y) + { + if (x < Left || x > Right) + return false; + if (y < Top || y > Bottom) + return false; + + return true; + } + + public bool Contains (Point point) + { + return Contains (point.X, point.Y); + } + + public static Rect Inflate (Rect rect, double width, double height) + { + if (width < rect.Width * -2) + return Rect.Empty; + if (height < rect.Height * -2) + return Rect.Empty; + + Rect result = rect; + result.Inflate (width, height); + return result; + } + + public static Rect Inflate (Rect rect, Size size) + { + return Rect.Inflate (rect, size.Width, size.Height); + } + + public void Inflate (double width, double height) + { + // XXX any error checking like in the static case? + _x -= width; + _y -= height; + + this._width += 2*width; + this._height += 2*height; + } + + public void Inflate (Size size) + { + Inflate (size.Width, size.Height); + } + + public bool IntersectsWith(Rect rect) + { + return !((Left >= rect.Right) || (Right <= rect.Left) || + (Top >= rect.Bottom) || (Bottom <= rect.Top)); + } + + public void Intersect(Rect rect) + { + double _x = Math.Max (this._x, rect._x); + double _y = Math.Max (this._y, rect._y); + double _width = Math.Min (Right, rect.Right) - _x; + double _height = Math.Min (Bottom, rect.Bottom) - _y; + + if (_width < 0 || _height < 0) { + this._x = this._y = Double.PositiveInfinity; + this._width = this._height = Double.NegativeInfinity; + } + else { + this._x = _x; + this._y = _y; + this._width = _width; + this._height = _height; + } + } + + public static Rect Intersect(Rect rect1, Rect rect2) + { + Rect result = rect1; + result.Intersect (rect2); + return result; + } + + public void Offset(double offsetX, double offsetY) + { + _x += offsetX; + _y += offsetY; + } + + public static Rect Offset(Rect rect, double offsetX, double offsetY) + { + Rect result = rect; + result.Offset (offsetX, offsetY); + return result; + } + + public void Offset (Vector offsetVector) + { + _x += offsetVector.X; + _y += offsetVector.Y; + } + + public static Rect Offset (Rect rect, Vector offsetVector) + { + Rect result = rect; + result.Offset (offsetVector); + return result; + } + + public void Scale(double scaleX, double scaleY) + { + _x *= scaleX; + _y *= scaleY; + _width *= scaleX; + _height *= scaleY; + } + + public void Transform (Matrix matrix) + { + throw new NotImplementedException (); + } + + public static Rect Transform (Rect rect, Matrix matrix) + { + Rect result = rect; + result.Transform (matrix); + return result; + } + + public static Rect Union(Rect rect1, Rect rect2) + { + Rect result = rect1; + result.Union (rect2); + return result; + } + + public static Rect Union(Rect rect, Point point) + { + Rect result = rect; + result.Union (point); + return result; + } + + public void Union(Rect rect) + { + var left = Math.Min (Left, rect.Left); + var top = Math.Min (Top, rect.Top); + var right = Math.Max (Right, rect.Right); + var bottom = Math.Max (Bottom, rect.Bottom); + + _x = left; + _y = top; + _width = right - left; + _height = bottom - top; + } + + public void Union(Point point) + { + Union (new Rect (point, point)); + } + + public static Rect Parse (string source) + { + if (source == null) + throw new ArgumentNullException ("source"); + Rect value; + if (source.Trim () == "Empty") + { + value = Empty; + } + else + { + var tokenizer = new NumericListTokenizer (source, CultureInfo.InvariantCulture); + double x; + double y; + double width; + double height; + if (double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out x) + && double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out y) + && double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out width) + && double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out height)) + { + if (!tokenizer.HasNoMoreTokens ()) + { + throw new InvalidOperationException ("Invalid Rect format: " + source); + } + value = new Rect (x, y, width, height); + } + else + { + throw new FormatException (string.Format ("Invalid Rect format: {0}", source)); + } + } + return value; + } + + public override string ToString () + { + return ToString (null); + } + + public string ToString (IFormatProvider provider) + { + return ToString (null, provider); + } + + string IFormattable.ToString (string format, IFormatProvider provider) + { + return ToString (format, provider); + } + + private string ToString (string format, IFormatProvider provider) + { + if (IsEmpty) + return "Empty"; + + if (provider == null) + provider = CultureInfo.CurrentCulture; + + if (format == null) + format = string.Empty; + + var separator = NumericListTokenizer.GetSeparator (provider); + + var rectFormat = string.Format ( + "{{0:{0}}}{1}{{1:{0}}}{1}{{2:{0}}}{1}{{3:{0}}}", + format, separator); + return string.Format (provider, rectFormat, + _x, _y, _width, _height); + } + + public static Rect Empty { + get { + Rect r = new Rect (); + r._x = r._y = Double.PositiveInfinity; + r._width = r._height = Double.NegativeInfinity; + return r; + } + } + + public bool IsEmpty { + get { + return (_x == Double.PositiveInfinity && + _y == Double.PositiveInfinity && + _width == Double.NegativeInfinity && + _height == Double.NegativeInfinity); + } + } + + public Point Location { + get { + return new Point (_x, _y); + } + set { + if (IsEmpty) + throw new InvalidOperationException ("Cannot modify this property on the Empty Rect."); + + _x = value.X; + _y = value.Y; + } + } + + public Size Size { + get { + if (IsEmpty) + return Size.Empty; + return new Size (_width, _height); + } + set { + if (IsEmpty) + throw new InvalidOperationException ("Cannot modify this property on the Empty Rect."); + + _width = value.Width; + _height = value.Height; + } + } + + public double X { + get { return _x; } + set { + if (IsEmpty) + throw new InvalidOperationException ("Cannot modify this property on the Empty Rect."); + + _x = value; + } + } + + public double Y { + get { return _y; } + set { + if (IsEmpty) + throw new InvalidOperationException ("Cannot modify this property on the Empty Rect."); + + _y = value; + } + } + + public double Width { + get { return _width; } + set { + if (IsEmpty) + throw new InvalidOperationException ("Cannot modify this property on the Empty Rect."); + + if (value < 0) + throw new ArgumentException ("width must be non-negative."); + + _width = value; + } + } + + public double Height { + get { return _height; } + set { + if (IsEmpty) + throw new InvalidOperationException ("Cannot modify this property on the Empty Rect."); + + if (value < 0) + throw new ArgumentException ("height must be non-negative."); + + _height = value; + } + } + + public double Left { + get { return _x; } + } + + public double Top { + get { return _y; } + } + + public double Right { + get { return _x + _width; } + } + + public double Bottom { + get { return _y + _height; } + } + + public Point TopLeft { + get { return new Point (Left, Top); } + } + + public Point TopRight { + get { return new Point (Right, Top); } + } + + public Point BottomLeft { + get { return new Point (Left, Bottom); } + } + + public Point BottomRight { + get { return new Point (Right, Bottom); } + } + + double _x; + double _y; + double _width; + double _height; + } +} diff --git a/src/FPF/WindowsBase/System.Windows/RectConverter.cs b/src/FPF/WindowsBase/System.Windows/RectConverter.cs new file mode 100644 index 0000000..07fe262 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/RectConverter.cs @@ -0,0 +1,57 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok <toshok@novell.com> +// + +using System; +using System.ComponentModel; +using System.Globalization; + +namespace System.Windows { + + public sealed class RectConverter : TypeConverter + { + public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof (string); + } + + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + return destinationType == typeof (string); + } + + public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) + { + if (!(value is string)) + throw new NotSupportedException ("RectConverter only supports converting from strings"); + + return Rect.Parse ((string)value); + } + + public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + return ((Rect)value).ToString (culture); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/Size.cs b/src/FPF/WindowsBase/System.Windows/Size.cs new file mode 100644 index 0000000..c1095ab --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/Size.cs @@ -0,0 +1,192 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@novell.com) +// + +using System; +using System.ComponentModel; +using System.Globalization; +using System.Windows.Converters; +using System.Windows.Markup; + +namespace System.Windows { + + [Serializable] + [ValueSerializer (typeof (SizeValueSerializer))] + [TypeConverter (typeof (SizeConverter))] + public struct Size : IFormattable + { + public Size (double width, double height) + { + if (width < 0 || height < 0) + throw new ArgumentException ("Width and Height must be non-negative."); + + this._width = width; + this._height = height; + } + + public bool Equals (Size value) + { + return _width == value.Width && _height == value.Height; + } + + public override bool Equals (object o) + { + if (!(o is Size)) + return false; + + return Equals ((Size)o); + } + + public static bool Equals (Size size1, Size size2) + { + return size1.Equals (size2); + } + + public override int GetHashCode () + { + unchecked + { + return (_width.GetHashCode () * 397) ^ _height.GetHashCode (); + } + } + + public static Size Parse (string source) + { + if (source == null) + throw new ArgumentNullException ("source"); + + if (source.Trim () == "Empty") + { + return Empty; + } + var tokenizer = new NumericListTokenizer (source, CultureInfo.InvariantCulture); + double width; + double height; + if (!double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out width) || + !double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out height)) + { + throw new FormatException (string.Format ("Invalid Size format: {0}", source)); + } + if (!tokenizer.HasNoMoreTokens ()) + { + throw new InvalidOperationException ("Invalid Size format: " + source); + } + return new Size(width, height); + } + + public override string ToString () + { + return ConvertToString (null, null); + } + + public string ToString (IFormatProvider provider) + { + return ConvertToString (null, provider); + } + + string IFormattable.ToString (string format, IFormatProvider provider) + { + return ConvertToString (format, provider); + } + + private string ConvertToString (string format, IFormatProvider provider) + { + if (IsEmpty) + return "Empty"; + + if (provider == null) + provider = CultureInfo.CurrentCulture; + if (format == null) + format = string.Empty; + var separator = NumericListTokenizer.GetSeparator (provider); + var vectorFormat = string.Format ("{{0:{0}}}{1}{{1:{0}}}", format, separator); + return string.Format (provider, vectorFormat, _width, _height); + } + + public bool IsEmpty { + get { + return (_width == Double.NegativeInfinity && + _height == Double.NegativeInfinity); + } + } + + public double Height { + get { return _height; } + set { + if (IsEmpty) + throw new InvalidOperationException ("Cannot modify this property on the Empty Size."); + + if (value < 0) + throw new ArgumentException ("height must be non-negative."); + + _height = value; + } + } + + public double Width { + get { return _width; } + set { + if (IsEmpty) + throw new InvalidOperationException ("Cannot modify this property on the Empty Size."); + + if (value < 0) + throw new ArgumentException ("width must be non-negative."); + + _width = value; + } + } + + public static Size Empty { + get { + Size s = new Size (); + s._width = s._height = Double.NegativeInfinity; + return s; + } + } + + /* operators */ + public static explicit operator Point (Size size) + { + return new Point (size.Width, size.Height); + } + + public static explicit operator Vector (Size size) + { + return new Vector (size.Width, size.Height); + } + + public static bool operator ==(Size size1, Size size2) + { + return size1.Equals (size2); + } + + public static bool operator !=(Size size1, Size size2) + { + return !size1.Equals (size2); + } + + double _width; + double _height; + } +} diff --git a/src/FPF/WindowsBase/System.Windows/SizeConverter.cs b/src/FPF/WindowsBase/System.Windows/SizeConverter.cs new file mode 100644 index 0000000..59a2c0d --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/SizeConverter.cs @@ -0,0 +1,57 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok <toshok@novell.com> +// + +using System; +using System.ComponentModel; +using System.Globalization; + +namespace System.Windows { + + public sealed class SizeConverter : TypeConverter + { + public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof (string); + } + + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + return destinationType == typeof (string); + } + + public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) + { + if (!(value is string)) + throw new NotSupportedException ("SizeConverter only supports converting from strings"); + + return Size.Parse ((string)value); + } + + public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + return ((Size)value).ToString (culture); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/SplashScreen.cs b/src/FPF/WindowsBase/System.Windows/SplashScreen.cs new file mode 100644 index 0000000..16b2ecc --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/SplashScreen.cs @@ -0,0 +1,55 @@ +// 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.Reflection; +using System.Security; + +namespace System.Windows { + public class SplashScreen { + + [SecurityCritical] + public SplashScreen (Assembly resourceAssembly, string resourceName) + { + throw new NotImplementedException (); + } + + public SplashScreen (string resourceName) + { + throw new NotImplementedException (); + } + + [SecurityCritical] + public void Show (bool autoClose) + { + throw new NotImplementedException (); + } + + [SecurityCritical] + public void Close (TimeSpan fadeoutDuration) + { + throw new NotImplementedException (); + } + } +}
\ No newline at end of file diff --git a/src/FPF/WindowsBase/System.Windows/ValidateValueCallback.cs b/src/FPF/WindowsBase/System.Windows/ValidateValueCallback.cs new file mode 100644 index 0000000..30be3df --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/ValidateValueCallback.cs @@ -0,0 +1,29 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@ximian.com) +// + +namespace System.Windows { + + public delegate bool ValidateValueCallback (object value); +} diff --git a/src/FPF/WindowsBase/System.Windows/Vector.cs b/src/FPF/WindowsBase/System.Windows/Vector.cs new file mode 100644 index 0000000..88b2305 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/Vector.cs @@ -0,0 +1,284 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok (toshok@novell.com) +// + +using System.ComponentModel; +using System.Globalization; +using System.Windows.Converters; +using System.Windows.Markup; +using System.Windows.Media; + +namespace System.Windows { + + [Serializable] + [ValueSerializer (typeof (VectorValueSerializer))] + [TypeConverter (typeof (VectorConverter))] + public struct Vector : IFormattable + { + public Vector (double x, double y) + { + this._x = x; + this._y = y; + } + + public bool Equals (Vector value) + { + return _x == value.X && _y == value.Y; + } + + public override bool Equals (object o) + { + if (!(o is Vector)) + return false; + + return Equals ((Vector)o); + } + + public override int GetHashCode () + { + unchecked + { + return (_x.GetHashCode () * 397) ^ _y.GetHashCode (); + } + } + + public static bool Equals (Vector vector1, Vector vector2) + { + return vector1.Equals (vector2); + } + + public static Point Add (Vector vector, Point point) + { + return new Point (vector.X + point.X, vector.Y + point.Y); + } + + public static Vector Add (Vector vector1, Vector vector2) + { + return new Vector (vector1.X + vector2.X, + vector1.Y + vector2.Y); + } + + public static double AngleBetween (Vector vector1, Vector vector2) + { + double cos_theta = (vector1.X * vector2.X + vector1.Y * vector2.Y) / (vector1.Length * vector2.Length); + + return Math.Acos (cos_theta) / Math.PI * 180; + } + + public static double CrossProduct (Vector vector1, Vector vector2) + { + // ... what operation is this exactly? + return vector1.X * vector2.Y - vector1.Y * vector2.X; + } + + public static double Determinant (Vector vector1, Vector vector2) + { + // same as CrossProduct, it appears. + return vector1.X * vector2.Y - vector1.Y * vector2.X; + } + + public static Vector Divide (Vector vector, double scalar) + { + return new Vector (vector.X / scalar, vector.Y / scalar); + } + + public static double Multiply (Vector vector1, Vector vector2) + { + return vector1.X * vector2.X + vector1.Y * vector2.Y; + } + + public static Vector Multiply (Vector vector, Matrix matrix) + { + return new Vector (vector.X * matrix.M11 + vector.Y * matrix.M21, + vector.X * matrix.M12 + vector.Y * matrix.M22); + } + + public static Vector Multiply (double scalar, Vector vector) + { + return new Vector (scalar * vector.X, scalar * vector.Y); + } + + public static Vector Multiply (Vector vector, double scalar) + { + return new Vector (scalar * vector.X, scalar * vector.Y); + } + + public void Negate () + { + _x = -_x; + _y = -_y; + } + + public void Normalize () + { + double ls = LengthSquared; + if (ls == 1) + return; + + double l = Math.Sqrt (ls); + _x /= l; + _y /= l; + } + + public static Vector Subtract (Vector vector1, Vector vector2) + { + return new Vector (vector1.X - vector2.X, vector1.Y - vector2.Y); + } + + public static Vector Parse (string source) + { + if (source == null) + throw new ArgumentNullException ("source"); + var tokenizer = new NumericListTokenizer (source, CultureInfo.InvariantCulture); + double x; + double y; + if (!double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out x) || + !double.TryParse (tokenizer.GetNextToken (), NumberStyles.Float, CultureInfo.InvariantCulture, out y)) + { + throw new FormatException (string.Format ("Invalid Vector format: {0}", source)); + } + if (!tokenizer.HasNoMoreTokens ()) + { + throw new InvalidOperationException("Invalid Vector format: " + source); + } + return new Vector(x, y); + } + + public override string ToString () + { + return ToString(null); + } + + public string ToString (IFormatProvider provider) + { + return ToString (null, provider); + } + + string IFormattable.ToString (string format, IFormatProvider provider) + { + return ToString (format, provider); + } + + private string ToString(string format,IFormatProvider formatProvider) + { + if (formatProvider == null) + formatProvider = CultureInfo.CurrentCulture; + if (format == null) + format = string.Empty; + var separator = NumericListTokenizer.GetSeparator (formatProvider); + var vectorFormat = string.Format ("{{0:{0}}}{1}{{1:{0}}}", format, separator); + return string.Format (formatProvider, vectorFormat, _x, _y); + } + + public double Length { + get { return Math.Sqrt (LengthSquared); } + } + + public double LengthSquared { + get { return _x * _x + _y * _y; } + } + + public double X { + get { return _x; } + set { _x = value; } + } + + public double Y { + get { return _y; } + set { _y = value; } + } + + /* operators */ + public static explicit operator Point (Vector vector) + { + return new Point (vector.X, vector.Y); + } + + public static explicit operator Size (Vector vector) + { + return new Size (vector.X, vector.Y); + } + + public static Vector operator - (Vector vector1, Vector vector2) + { + return Subtract (vector1, vector2); + } + + public static Vector operator - (Vector vector) + { + Vector result = vector; + result.Negate (); + return result; + } + + public static bool operator != (Vector vector1, Vector vector2) + { + return !Equals (vector1, vector2); + } + + public static bool operator == (Vector vector1, Vector vector2) + { + return Equals (vector1, vector2); + } + + public static double operator * (Vector vector1, Vector vector2) + { + return Multiply (vector1, vector2); + } + + public static Vector operator * (Vector vector, Matrix matrix) + { + return Multiply (vector, matrix); + } + + public static Vector operator * (double scalar, Vector vector) + { + return Multiply (scalar, vector); + } + + public static Vector operator * (Vector vector, double scalar) + { + return Multiply (vector, scalar); + } + + public static Vector operator / (Vector vector, double scalar) + { + return Divide (vector, scalar); + } + + public static Point operator + (Vector vector, Point point) + { + return Add (vector, point); + } + + public static Vector operator + (Vector vector1, Vector vector2) + { + return Add (vector1, vector2); + } + + double _x; + double _y; + } + +} diff --git a/src/FPF/WindowsBase/System.Windows/VectorConverter.cs b/src/FPF/WindowsBase/System.Windows/VectorConverter.cs new file mode 100644 index 0000000..69823c1 --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/VectorConverter.cs @@ -0,0 +1,57 @@ +// 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) 2007 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Chris Toshok <toshok@novell.com> +// + +using System; +using System.ComponentModel; +using System.Globalization; + +namespace System.Windows { + + public sealed class VectorConverter : TypeConverter + { + public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof (string); + } + + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + return destinationType == typeof (string); + } + + public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) + { + if (!(value is string)) + throw new NotSupportedException ("VectorConverter only supports converting from strings"); + + return Vector.Parse ((string)value); + } + + public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + return ((Vector)value).ToString (culture); + } + } +} diff --git a/src/FPF/WindowsBase/System.Windows/WeakEventManager.cs b/src/FPF/WindowsBase/System.Windows/WeakEventManager.cs new file mode 100644 index 0000000..ff5c29c --- /dev/null +++ b/src/FPF/WindowsBase/System.Windows/WeakEventManager.cs @@ -0,0 +1,178 @@ +// +// WeakEventManager.cs +// +// Author: +// Chris Toshok (toshok@ximian.com) +// +// (C) 2007 Novell, Inc. +// +// 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.Windows.Threading; + +namespace System.Windows { + + public abstract class WeakEventManager : DispatcherObject + { + Hashtable sourceData; + + protected WeakEventManager () + { + sourceData = new Hashtable (); + } + + protected IDisposable ReadLock { + get { throw new NotImplementedException (); } + } + + protected IDisposable WriteLock { + get { throw new NotImplementedException (); } + } + + protected object this [object source] { + get { return sourceData[source]; } + set { sourceData[source] = value; } + } + + protected void DeliverEvent (object sender, EventArgs args) + { + DeliverEventToList (sender, args, (ListenerList)this[sender]); + } + + protected void DeliverEventToList (object sender, EventArgs args, ListenerList list) + { + for (int i = 0; i < list.Count; i ++) { + IWeakEventListener listener = list[i]; + listener.ReceiveWeakEvent (GetType(), sender, args); + } + } + + protected void ProtectedAddListener (object source, IWeakEventListener listener) + { + ListenerList list = sourceData[source] as ListenerList; + if (list != null) + list.Add (listener); + } + + protected void ProtectedRemoveListener (object source, IWeakEventListener listener) + { + ListenerList list = sourceData[source] as ListenerList; + if (list != null) + list.Remove (listener); + } + + protected virtual bool Purge (object source, object data, bool purgeAll) + { + throw new NotImplementedException (); + } + + protected void Remove (object source) + { + throw new NotImplementedException (); + } + + protected void ScheduleCleanup () + { + throw new NotImplementedException (); + } + + protected abstract void StartListening (object source); + protected abstract void StopListening (object source); + + + protected static WeakEventManager GetCurrentManager (Type managerType) + { + throw new NotImplementedException (); + } + + protected static void SetCurrentManager (Type managerType, WeakEventManager manager) + { + throw new NotImplementedException (); + } + + + protected class ListenerList + { + public ListenerList () + { + throw new NotImplementedException (); + } + + public ListenerList (int capacity) + { + throw new NotImplementedException (); + } + + public int Count { + get { throw new NotImplementedException (); } + } + + public static ListenerList Empty { + get { throw new NotImplementedException (); } + } + + public bool IsEmpty { + get { throw new NotImplementedException (); } + } + + public IWeakEventListener this[int index] { + get { throw new NotImplementedException (); } + } + + public void Add (IWeakEventListener listener) + { + throw new NotImplementedException (); + } + + public bool BeginUse () + { + throw new NotImplementedException (); + } + + public WeakEventManager.ListenerList Clone () + { + throw new NotImplementedException (); + } + + public void EndUse () + { + throw new NotImplementedException (); + } + + public static bool PrepareForWriting (ref WeakEventManager.ListenerList list) + { + throw new NotImplementedException (); + } + + public bool Purge () + { + throw new NotImplementedException (); + } + + public void Remove (IWeakEventListener listener) + { + throw new NotImplementedException (); + } + } + } + +} diff --git a/src/FPF/WindowsBase/WindowsBase.csproj b/src/FPF/WindowsBase/WindowsBase.csproj new file mode 100644 index 0000000..dcd2c2d --- /dev/null +++ b/src/FPF/WindowsBase/WindowsBase.csproj @@ -0,0 +1,14 @@ +<Project Sdk="Xamarin.Mac.Sdk"> + <PropertyGroup> + <NoWarn>1699,67,618</NoWarn> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants> + <GenerateAssemblyInfo>false</GenerateAssemblyInfo> + <PublicSign>false</PublicSign> + <TargetFramework>$(TargetFramework)</TargetFramework> + </PropertyGroup> + <ItemGroup> + <Reference Include="System.Xml" /> + <Reference Include="System.Xaml" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/src/FPF/winfx3.pub b/src/FPF/winfx3.pub Binary files differnew file mode 100644 index 0000000..695f1b3 --- /dev/null +++ b/src/FPF/winfx3.pub |