From f81023f3b38b7fd4c0f0b29f8e0b56f958c29623 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Sat, 9 May 2020 15:07:52 +0200 Subject: [PATCH] source tree organization --- Crow/Crow.csproj | 7 +-- Crow/src/{ => 2d}/Measure.cs | 0 Crow/src/{ => 2d}/Point.cs | 0 Crow/src/{ => 2d}/PointD.cs | 0 Crow/src/{ => 2d}/Rectangle.cs | 0 Crow/src/{ => 2d}/RectangleD.cs | 0 Crow/src/{ => 2d}/Size.cs | 0 Crow/src/{ => 2d}/SizeD.cs | 0 Crow/src/{ => EventArgs}/DragDropEventArgs.cs | 0 .../src/{ => EventArgs}/LayoutingEventArgs.cs | 0 Crow/src/EventArgs/ListChangedEventArg.cs | 17 +++++++ .../MouseCursorChangedEventArgs.cs | 0 .../src/{ => EventArgs}/ScrollingEventArgs.cs | 0 .../SelectionChangeEventArgs.cs | 0 .../{ => EventArgs}/TextChangeEventArgs.cs | 0 .../{ => EventArgs}/ValueChangeEventArgs.cs | 0 Crow/src/{ => Fill}/Gradient.cs | 0 Crow/src/IListChanged.cs | 48 ------------------- Crow/src/{ => IML}/IMLAttributes.cs | 0 Crow/src/{ => IML}/Instantiator.cs | 0 Crow/src/IObservableList.cs | 19 ++++++++ Crow/src/IValueChange.cs | 47 ++++++++++++++++++ Crow/src/ReflexionExtensions.cs | 26 +--------- Crow/src/Widgets/IValueChange.cs | 36 -------------- Crow/src/{ => styling}/Style.cs | 0 Crow/src/{ => styling}/StyleReader.cs | 0 26 files changed, 89 insertions(+), 111 deletions(-) rename Crow/src/{ => 2d}/Measure.cs (100%) rename Crow/src/{ => 2d}/Point.cs (100%) rename Crow/src/{ => 2d}/PointD.cs (100%) rename Crow/src/{ => 2d}/Rectangle.cs (100%) rename Crow/src/{ => 2d}/RectangleD.cs (100%) rename Crow/src/{ => 2d}/Size.cs (100%) rename Crow/src/{ => 2d}/SizeD.cs (100%) rename Crow/src/{ => EventArgs}/DragDropEventArgs.cs (100%) rename Crow/src/{ => EventArgs}/LayoutingEventArgs.cs (100%) create mode 100644 Crow/src/EventArgs/ListChangedEventArg.cs rename Crow/src/{ => EventArgs}/MouseCursorChangedEventArgs.cs (100%) rename Crow/src/{ => EventArgs}/ScrollingEventArgs.cs (100%) rename Crow/src/{ => EventArgs}/SelectionChangeEventArgs.cs (100%) rename Crow/src/{ => EventArgs}/TextChangeEventArgs.cs (100%) rename Crow/src/{ => EventArgs}/ValueChangeEventArgs.cs (100%) rename Crow/src/{ => Fill}/Gradient.cs (100%) delete mode 100644 Crow/src/IListChanged.cs rename Crow/src/{ => IML}/IMLAttributes.cs (100%) rename Crow/src/{ => IML}/Instantiator.cs (100%) create mode 100644 Crow/src/IObservableList.cs create mode 100644 Crow/src/IValueChange.cs delete mode 100644 Crow/src/Widgets/IValueChange.cs rename Crow/src/{ => styling}/Style.cs (100%) rename Crow/src/{ => styling}/StyleReader.cs (100%) diff --git a/Crow/Crow.csproj b/Crow/Crow.csproj index 5f29d798..0094690c 100644 --- a/Crow/Crow.csproj +++ b/Crow/Crow.csproj @@ -4,13 +4,14 @@ netstandard2.0 $(CrowVersion) - 0.8.0 + $(CrowVersion) + $(CrowPackageVersion) + C# Rapid Open Widget Toolkit C.R.O.W. is a widget toolkit and rendering engine developed in C# with templates, styles, compositing, and bindings. MIT Jean-Philippe Bruyère https://github.com/jpbruyere/Crow - $(CrowPackageVersion) GUI Widget toolkit Interface C# .Net Mono False https://github.com/jpbruyere/Crow/wiki @@ -38,7 +39,7 @@ - + $(DefineConstants);STB_SHARP diff --git a/Crow/src/Measure.cs b/Crow/src/2d/Measure.cs similarity index 100% rename from Crow/src/Measure.cs rename to Crow/src/2d/Measure.cs diff --git a/Crow/src/Point.cs b/Crow/src/2d/Point.cs similarity index 100% rename from Crow/src/Point.cs rename to Crow/src/2d/Point.cs diff --git a/Crow/src/PointD.cs b/Crow/src/2d/PointD.cs similarity index 100% rename from Crow/src/PointD.cs rename to Crow/src/2d/PointD.cs diff --git a/Crow/src/Rectangle.cs b/Crow/src/2d/Rectangle.cs similarity index 100% rename from Crow/src/Rectangle.cs rename to Crow/src/2d/Rectangle.cs diff --git a/Crow/src/RectangleD.cs b/Crow/src/2d/RectangleD.cs similarity index 100% rename from Crow/src/RectangleD.cs rename to Crow/src/2d/RectangleD.cs diff --git a/Crow/src/Size.cs b/Crow/src/2d/Size.cs similarity index 100% rename from Crow/src/Size.cs rename to Crow/src/2d/Size.cs diff --git a/Crow/src/SizeD.cs b/Crow/src/2d/SizeD.cs similarity index 100% rename from Crow/src/SizeD.cs rename to Crow/src/2d/SizeD.cs diff --git a/Crow/src/DragDropEventArgs.cs b/Crow/src/EventArgs/DragDropEventArgs.cs similarity index 100% rename from Crow/src/DragDropEventArgs.cs rename to Crow/src/EventArgs/DragDropEventArgs.cs diff --git a/Crow/src/LayoutingEventArgs.cs b/Crow/src/EventArgs/LayoutingEventArgs.cs similarity index 100% rename from Crow/src/LayoutingEventArgs.cs rename to Crow/src/EventArgs/LayoutingEventArgs.cs diff --git a/Crow/src/EventArgs/ListChangedEventArg.cs b/Crow/src/EventArgs/ListChangedEventArg.cs new file mode 100644 index 00000000..3fc509e4 --- /dev/null +++ b/Crow/src/EventArgs/ListChangedEventArg.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2020 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) +using System; +namespace Crow +{ + public class ListChangedEventArg : EventArgs + { + public int Index; + public object Element; + public ListChangedEventArg (int index, object element) + { + Index = index; + Element = element; + } + } +} diff --git a/Crow/src/MouseCursorChangedEventArgs.cs b/Crow/src/EventArgs/MouseCursorChangedEventArgs.cs similarity index 100% rename from Crow/src/MouseCursorChangedEventArgs.cs rename to Crow/src/EventArgs/MouseCursorChangedEventArgs.cs diff --git a/Crow/src/ScrollingEventArgs.cs b/Crow/src/EventArgs/ScrollingEventArgs.cs similarity index 100% rename from Crow/src/ScrollingEventArgs.cs rename to Crow/src/EventArgs/ScrollingEventArgs.cs diff --git a/Crow/src/SelectionChangeEventArgs.cs b/Crow/src/EventArgs/SelectionChangeEventArgs.cs similarity index 100% rename from Crow/src/SelectionChangeEventArgs.cs rename to Crow/src/EventArgs/SelectionChangeEventArgs.cs diff --git a/Crow/src/TextChangeEventArgs.cs b/Crow/src/EventArgs/TextChangeEventArgs.cs similarity index 100% rename from Crow/src/TextChangeEventArgs.cs rename to Crow/src/EventArgs/TextChangeEventArgs.cs diff --git a/Crow/src/ValueChangeEventArgs.cs b/Crow/src/EventArgs/ValueChangeEventArgs.cs similarity index 100% rename from Crow/src/ValueChangeEventArgs.cs rename to Crow/src/EventArgs/ValueChangeEventArgs.cs diff --git a/Crow/src/Gradient.cs b/Crow/src/Fill/Gradient.cs similarity index 100% rename from Crow/src/Gradient.cs rename to Crow/src/Fill/Gradient.cs diff --git a/Crow/src/IListChanged.cs b/Crow/src/IListChanged.cs deleted file mode 100644 index fd6e60a7..00000000 --- a/Crow/src/IListChanged.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// IListChanged.cs -// -// Author: -// Jean-Philippe Bruyère -// -// Copyright (c) 2013-2017 Jean-Philippe Bruyère -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; - -namespace Crow -{ - public class ListChangedEventArg : EventArgs { - public int Index; - public object Element; - public ListChangedEventArg (int index, object element) { - Index = index; - Element = element; - } - } - public interface IObservableList { - event EventHandler ListAdd; - event EventHandler ListRemove; - event EventHandler ListEdit; - - void Insert (); - void Remove (); - void RaiseEdit (); - } -} - diff --git a/Crow/src/IMLAttributes.cs b/Crow/src/IML/IMLAttributes.cs similarity index 100% rename from Crow/src/IMLAttributes.cs rename to Crow/src/IML/IMLAttributes.cs diff --git a/Crow/src/Instantiator.cs b/Crow/src/IML/Instantiator.cs similarity index 100% rename from Crow/src/Instantiator.cs rename to Crow/src/IML/Instantiator.cs diff --git a/Crow/src/IObservableList.cs b/Crow/src/IObservableList.cs new file mode 100644 index 00000000..311a21a3 --- /dev/null +++ b/Crow/src/IObservableList.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2013-2020 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; + +namespace Crow +{ + public interface IObservableList { + event EventHandler ListAdd; + event EventHandler ListRemove; + event EventHandler ListEdit; + + void Insert (); + void Remove (); + void RaiseEdit (); + } +} + diff --git a/Crow/src/IValueChange.cs b/Crow/src/IValueChange.cs new file mode 100644 index 00000000..011f7e80 --- /dev/null +++ b/Crow/src/IValueChange.cs @@ -0,0 +1,47 @@ +// Copyright (c) 20132020 Jean-Philippe Bruyère +// +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) + +using System; +using System.Collections.Generic; + +namespace Crow +{ + /// + /// implement `IValueChange` interface in object you want to bind to the interface. + /// For each property updated in code, raise a value change in the container class + /// to inform Crow binding system that the value has changed. + /// + public interface IValueChange + { + event EventHandler ValueChanged; + } + /// + /// Container for net primitive value type implementing IValueChange + /// + public class ValueContainer : IValueChange, IEquatable//, IConvertible + { + public event EventHandler ValueChanged; + T val; + public T Value { + get => val; + set { + if (EqualityComparer.Default.Equals (value, val)) + return; + val = value; + ValueChanged?.Invoke (this, new Crow.ValueChangeEventArgs ("Value", val)); + } + } + + public static implicit operator ValueContainer(T v) => new ValueContainer (v); + public static implicit operator T (ValueContainer v) => v.Value; + + public ValueContainer (T _val) { val = _val; } + + public bool Equals (T other) => val.Equals (other); + public override bool Equals (object obj) => obj is ValueContainer v && Equals (v); + public override int GetHashCode () => val.GetHashCode (); + public override string ToString () => val.ToString (); + } +} + diff --git a/Crow/src/ReflexionExtensions.cs b/Crow/src/ReflexionExtensions.cs index 8c0b4f27..25e2334b 100644 --- a/Crow/src/ReflexionExtensions.cs +++ b/Crow/src/ReflexionExtensions.cs @@ -1,28 +1,6 @@ -// -// ReflexionExtensions.cs +// Copyright (c) 2013-2020 Jean-Philippe Bruyère // -// Author: -// Jean-Philippe Bruyère -// -// Copyright (c) 2013-2017 Jean-Philippe Bruyère -// -// 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. +// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; using System.Reflection; diff --git a/Crow/src/Widgets/IValueChange.cs b/Crow/src/Widgets/IValueChange.cs deleted file mode 100644 index 7e18e5e5..00000000 --- a/Crow/src/Widgets/IValueChange.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// IValueChange.cs -// -// Author: -// Jean-Philippe Bruyère -// -// Copyright (c) 2013-2017 Jean-Philippe Bruyère -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; - -namespace Crow -{ - public interface IValueChange - { - event EventHandler ValueChanged; - } -} - diff --git a/Crow/src/Style.cs b/Crow/src/styling/Style.cs similarity index 100% rename from Crow/src/Style.cs rename to Crow/src/styling/Style.cs diff --git a/Crow/src/StyleReader.cs b/Crow/src/styling/StyleReader.cs similarity index 100% rename from Crow/src/StyleReader.cs rename to Crow/src/styling/StyleReader.cs -- 2.47.3